Skip to content

Add an Environment type to represent environment variables #298

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 1 commit into from
Mar 13, 2025
Merged

Conversation

jakepetroules
Copy link
Collaborator

This starts with a slightly modified version of the implementation from SwiftPM. This is not yet adopted anywhere, it's just adding the initial implementation.

Closes #186

@jakepetroules
Copy link
Collaborator Author

@swift-ci test

@@ -12,25 +12,157 @@

import Foundation

@TaskLocal fileprivate var processEnvironment = ProcessInfo.processInfo.environment
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ignore the "diffs" in this file. This PR is entirely additions; the original Environment.swift was renamed to EnvironmentHelpers.swift.

@jakepetroules jakepetroules enabled auto-merge (rebase) March 12, 2025 22:07
@jakepetroules
Copy link
Collaborator Author

@swift-ci test windows

@jakepetroules
Copy link
Collaborator Author

@swift-ci test

@jakepetroules jakepetroules added the windows Support for the Windows platform label Mar 12, 2025
@jakepetroules
Copy link
Collaborator Author

@swift-ci test windows

@dschaefer2
Copy link
Member

If you want to apply it somewhere, TouchTool could use some love.

            guard let commandShellPath = getEnvironmentVariable("ComSpec") else {

@jakepetroules
Copy link
Collaborator Author

@swift-ci test

1 similar comment
@jakepetroules
Copy link
Collaborator Author

@swift-ci test

This starts with a slightly modified version of the implementation from SwiftPM. This is not yet adopted anywhere, it's just adding the initial implementation.

Closes #186
@jakepetroules
Copy link
Collaborator Author

@swift-ci test

@jakepetroules
Copy link
Collaborator Author

If you want to apply it somewhere, TouchTool could use some love.

            guard let commandShellPath = getEnvironmentVariable("ComSpec") else {

Coming in a follow-on PR :)

@jakepetroules jakepetroules merged commit 7f75d72 into main Mar 13, 2025
3 checks passed
@jakepetroules jakepetroules deleted the env branch March 13, 2025 04:40
@weliveindetail
Copy link
Member

@jakepetroules I am afraid your last patch causes a compile failure on Windows:

C:\Users\swift-ci\jenkins\workspace\swift-main-windows-toolchain-arm64\swift-build\Sources\SWBUtil\Environment.swift:16:19: error: cannot find type 'EnvironmentKey' in scope
 14 | 
 15 | public struct Environment {
 16 |     var storage: [EnvironmentKey: String]
    |                   `- error: cannot find type 'EnvironmentKey' in scope
 17 | }
 18 | 

Attaching the full lo here: swift-main-windows-toolchain-arm64-1060.log

As a result the nightly builds fail and PR testing is stuck. I will prepare a revert. Please let me know if you have a better proposal.

jakepetroules added a commit that referenced this pull request Mar 20, 2025
jakepetroules added a commit that referenced this pull request Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
windows Support for the Windows platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an EnvironmentBlock type to represent environment variables
4 participants