Skip to content

Add setting for environment variables to send to Swift #305

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 5 commits into from
May 15, 2022

Conversation

adam-fowler
Copy link
Contributor

Something like this @stevapple?

Otherwise we can send `{}` to `execFile` which messes with stuff.
Copy link
Contributor

@stevapple stevapple left a comment

Choose a reason for hiding this comment

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

LGTM otherwise

@@ -77,6 +77,12 @@ const configuration = {
get buildArguments(): string[] {
return vscode.workspace.getConfiguration("swift").get<string[]>("buildArguments", []);
},
/** Environment variables to set when building */
get swiftEnvironmentVariables(): { [key: string]: string } {
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we can extract Object.keys(swiftEnvironmentVariables).length > 0 in to a new computed property?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure this is totally necessary, I do the same in execFile to make it more obvious why we are setting runtimePath env.

@stevapple
Copy link
Contributor

I think this could close #266 and I'll continue the remaining work based on #294

when adding environment vars for swiftExec or execFile we either combine with vars passed in or the current process vars
@adam-fowler adam-fowler requested a review from 0xTim May 13, 2022 14:45
Copy link
Member

@0xTim 0xTim left a comment

Choose a reason for hiding this comment

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

One minor spelling, otherwise LGTM

options.env = { ...options.env, ...runtimeEnv };
}
}
// it options contain environment keys add them to process environment keys
Copy link
Member

Choose a reason for hiding this comment

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

Not spelling

Suggested change
// it options contain environment keys add them to process environment keys
// if options contain environment keys add them to process environment keys

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This code got deleted so no need to fix comment. It is now setup the same as in execFileStreamOutput

@adam-fowler adam-fowler merged commit 9d2b1f6 into swiftlang:main May 15, 2022
@adam-fowler adam-fowler deleted the swift-env-vars branch May 15, 2022 08:35
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.

3 participants