Skip to content

[5.5] Allow a custom manifest loader to provide custom environment variables when compiling the manifest #3667

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

Conversation

abertelrud
Copy link
Contributor

Extend the ManifestLoaderProtocol to allow a custom manifest loader to provide custom environment variables when compiling the manifest.

Motivation:

Clients of libSwiftPM can already provide a set of custom flags to pass to the Swift compiler when compiling and linking the manifest. This extends this support to allow custom environment entries as well. There's no immediate use for this in SwiftPM itself, but it could be used in the future, and some clients need this.

Modifications:

  • add a new property to ManifestLoadersProtocol that contains a string-to-string mapping
  • use it when compiling manifests and plugin scripts
  • add a unit tests that uses this functionality for a toy purpose (for testing)

Result:

Clients of libSwiftPM can specify environment entries. Note that this does not affect the environment that is passed when running the compiled manifest.

@abertelrud abertelrud self-assigned this Aug 15, 2021
@abertelrud abertelrud changed the base branch from main to release/5.5 August 15, 2021 23:57
@abertelrud abertelrud added the 5.5 label Aug 15, 2021
@abertelrud abertelrud marked this pull request as draft August 15, 2021 23:57
@abertelrud
Copy link
Contributor Author

@swift-ci please test

…st and plugin compilation

It defaults to `ProcessEnv.vars` so that there is no change in semantics unless the client code customizes the environment.
@abertelrud abertelrud force-pushed the eng/allow-manifest-resources-to-customize-compiler-environment-5.5 branch from 3835e39 to 9d5783e Compare August 16, 2021 16:27
@abertelrud
Copy link
Contributor Author

@swift-ci please test

@abertelrud abertelrud marked this pull request as ready for review August 16, 2021 16:50
@elsh elsh merged commit 60d2fda into swiftlang:release/5.5 Aug 16, 2021
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.

4 participants