Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Configure environment variables
run: |
echo "SWIFT_SDK_ID=${{ steps.setup-swiftwasm.outputs.swift-sdk-id }}" >> $GITHUB_ENV
echo "SWIFT_PATH=$(dirname $(which swiftc))" >> $GITHUB_ENV
echo "SWIFT_BIN_PATH=$(dirname $(which swiftc))" >> $GITHUB_ENV
- run: make bootstrap
- run: make unittest
# Skip unit tests with uwasi because its proc_exit throws
Expand Down
2 changes: 1 addition & 1 deletion Plugins/PackageToJS/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ swift test --package-path ./Plugins/PackageToJS
Please define the following environment variables when you want to run E2E tests:

- `SWIFT_SDK_ID`: Specifies the Swift SDK identifier to use
- `SWIFT_PATH`: Specifies the `bin` path to the Swift toolchain to use
- `SWIFT_BIN_PATH`: Specifies the `bin` path to the Swift toolchain to use

18 changes: 9 additions & 9 deletions Plugins/PackageToJS/Tests/ExampleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ extension Trait where Self == ConditionTrait {
static var requireSwiftSDK: ConditionTrait {
.enabled(
if: ProcessInfo.processInfo.environment["SWIFT_SDK_ID"] != nil
&& ProcessInfo.processInfo.environment["SWIFT_PATH"] != nil,
"Requires SWIFT_SDK_ID and SWIFT_PATH environment variables"
&& ProcessInfo.processInfo.environment["SWIFT_BIN_PATH"] != nil,
"Requires SWIFT_SDK_ID and SWIFT_BIN_PATH environment variables"
)
}

static func requireSwiftSDK(triple: String) -> ConditionTrait {
.enabled(
if: {
guard let swiftSDKID = ProcessInfo.processInfo.environment["SWIFT_SDK_ID"],
ProcessInfo.processInfo.environment["SWIFT_PATH"] != nil
ProcessInfo.processInfo.environment["SWIFT_BIN_PATH"] != nil
else {
return false
}
Expand All @@ -32,22 +32,22 @@ extension Trait where Self == ConditionTrait {
}
return sanityCheckCompatibility(triple: triple)
}(),
"Requires SWIFT_SDK_ID and SWIFT_PATH environment variables"
"Requires SWIFT_SDK_ID and SWIFT_BIN_PATH environment variables"
)
}

static func requireEmbeddedSwiftInToolchain(triple: String) -> ConditionTrait {
// Check if $SWIFT_PATH/../lib/swift/embedded/wasm32-unknown-none-wasm/ exists
// Check if $SWIFT_BIN_PATH/../lib/swift/embedded/wasm32-unknown-none-wasm/ exists
return .enabled(
if: {
guard let swiftPath = ProcessInfo.processInfo.environment["SWIFT_PATH"] else {
guard let swiftPath = ProcessInfo.processInfo.environment["SWIFT_BIN_PATH"] else {
return false
}
let embeddedPath = URL(fileURLWithPath: swiftPath).deletingLastPathComponent()
.appending(path: "lib/swift/embedded/\(triple)")
return FileManager.default.fileExists(atPath: embeddedPath.path)
}(),
"Requires embedded Swift SDK under $SWIFT_PATH/../lib/swift/embedded"
"Requires embedded Swift SDK under $SWIFT_BIN_PATH/../lib/swift/embedded"
)
}

Expand Down Expand Up @@ -75,7 +75,7 @@ extension Trait where Self == ConditionTrait {
return false
}
}
guard let swiftPath = ProcessInfo.processInfo.environment["SWIFT_PATH"],
guard let swiftPath = ProcessInfo.processInfo.environment["SWIFT_BIN_PATH"],
let swiftSDKID = ProcessInfo.processInfo.environment["SWIFT_SDK_ID"]
else {
return false
Expand All @@ -102,7 +102,7 @@ extension Trait where Self == ConditionTrait {
}

static func getSwiftPath() -> String? {
ProcessInfo.processInfo.environment["SWIFT_PATH"]
ProcessInfo.processInfo.environment["SWIFT_BIN_PATH"]
}

static func getEmbeddedSwiftSDKID() -> String? {
Expand Down