Skip to content

fix package describe to handle binary targets #3810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 29, 2021

Conversation

tomerd
Copy link
Contributor

@tomerd tomerd commented Oct 19, 2021

motivation: package describe command fails for packages with binary targets

changes:

  • PackageBuilder requires remote artifacts to be set to compute the model, as such make it a required argument
  • do not call PackageBuilder directly from describe and format commands, instead use Workspace::loadRootPackage API for loading a root package
  • update Workspace::loadRootPackage to compute artifacts

rdar://82263304

@tomerd
Copy link
Contributor Author

tomerd commented Oct 19, 2021

@swift-ci please smoke test


// radar/82263304
// compute binary artifacts for the sake of constructing a project model
// note this does not actually download remote artifacts and as such does not have the artifact's correct path
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@neonichu @abertelrud I dont love this, but its a tradeoff between needing to load the entire graph / download the binary artifacts as this API goal is to provide a quicker view into the package

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we are okay with the approach we would need to make this DRYer with other other artifact computation code

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having a fake path is fine here.

I guess another option would be changing path into an enum with a case for an actual path and something like noYetDownloaded, but not sure if that is really worth the hassle.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, in theory it seems that an enum is the way to go here in the future. Or the binary artifact should have an optional path. Or there should be some kind of distinction between known binary artifacts vs actually present binary artifacts. But in any case, I don't think it should block fixing the real issue addressed by this PR, so it shouldn't hold this up.

@tomerd tomerd self-assigned this Oct 20, 2021
@tomerd tomerd added the ready Author believes the PR is ready to be merged & any feedback has been addressed label Oct 20, 2021
@tomerd tomerd changed the title fix pacakge describe to handle binary targets fix package describe to handle binary targets Oct 26, 2021

// radar/82263304
// compute binary artifacts for the sake of constructing a project model
// note this does not actually download remote artifacts and as such does not have the artifact's correct path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having a fake path is fine here.

I guess another option would be changing path into an enum with a case for an actual path and something like noYetDownloaded, but not sure if that is really worth the hassle.

@tomerd
Copy link
Contributor Author

tomerd commented Oct 27, 2021

@swift-ci please smoke test

throw StringError("invalid manifests at \(root.packages)")

let package = try tsc_await {
workspace.loadRootPackage(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Standardizing all the various tool actions on loading at least the root package first seems like a good thing, so this seems like great cleanup regardless.


// radar/82263304
// compute binary artifacts for the sake of constructing a project model
// note this does not actually download remote artifacts and as such does not have the artifact's correct path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, in theory it seems that an enum is the way to go here in the future. Or the binary artifact should have an optional path. Or there should be some kind of distinction between known binary artifacts vs actually present binary artifacts. But in any case, I don't think it should block fixing the real issue addressed by this PR, so it shouldn't hold this up.

motivation: package describe command fails for packages with binary targets

changes:
* PackageBuilder requires remote artifacts to be set to compute the model, as such make it a required argument
* do not call PackageBuilder directly from describe and format commands, instead use  Workspace::loadRootPackage API for loading a root package
* update Workspace::loadRootPackage to compute artifacts
@tomerd
Copy link
Contributor Author

tomerd commented Oct 28, 2021

@swift-ci please smoke test

@tomerd
Copy link
Contributor Author

tomerd commented Oct 29, 2021

@abertelrud @neonichu fd4e5ee

@tomerd
Copy link
Contributor Author

tomerd commented Oct 29, 2021

@swift-ci please smoke test

@ykhandelwal913
Copy link

How can i test this version locally? as currently with latest xcode 14beta 3, we are getting swift package manager version 5.7. How can i update the SPM version locally to validate ?

@ykhandelwal913
Copy link

@tomerd
How can i test this version locally? as currently with latest xcode 14beta 3, we are getting swift package manager version 5.7. How can i update the SPM version locally to validate ?

@tomerd
Copy link
Contributor Author

tomerd commented Jul 15, 2022

the version of swift that ships with beta 3 should include this fix. are you still seeing an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready Author believes the PR is ready to be merged & any feedback has been addressed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants