Skip to content
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

Add target dependencies to the package manifest via Fix-Its #73745

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

DougGregor
Copy link
Member

@DougGregor DougGregor commented May 20, 2024

When a module name for a given import declaration cannot be resolved, consult the "available modules" file provided by the Swift package manager to determine whether a module by that name is available something in the package or any of its dependencies.

If so, add a note with a Fix-It to the "no such module" diagnostic that edits the package manifest to introduce the missing target dependencies, e.g.,

.product(name: "Testing", package: "swift-testing")

Accepting the Fix-It should update the package manifest appropriately, so that building again will succeed in finding the appropriate module.

To support this functionality, there are three new frontend parameters:

  • -package-manifest <path>: provides the path to the package manifest file containing the target being built
  • -package-target-name <name>: provides the name of the target being built within that package manifest file
  • -package-available-modules <path>: provides the path to a JSON file containing the set of modules that are known to the package, which includes both modules declared within that package as well as any modules provided by the products of imported packages.

The Swift Package Manager is responsible for providing these command-line parameters.

When a module name for a given import declaration cannot be resolved,
consult the "available modules" file provided by the Swift package
manager to determine whether a module by that name is available
something in the package or any of its dependencies.

If so, add a note with a Fix-It to the "no such module" diagnostic
that edits the package manifest to introduce the missing target
dependencies, e.g.,

    .product(name: "Testing", package: "swift-testing")

Accepting the Fix-It should update the package manifest appropriately,
so that building again will succeed in finding the appropriate module.

To support this functionality, there are three new frontend parameters:

* `-package-manifest <path>`: provides the path to the package
manifest file containing the target being built
* `-package-target-name <name>`: provides the name of the target being
built within that package manifest file
* `-package-available-modules <path>`: provides the path to a JSON
file containing the set of modules that are known to the package,
which includes both modules declared within that package as well as
any modules provided by the products of imported packages.

The Swift Package Manager is responsible for providing this
command-line parameters.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant