Skip to content

Commit ef23124

Browse files
authored
Merge pull request #77411 from gottesmm/pr-d60d3f6bf1fa250c270076ecf0e85a740c03e7ab
[swift_snapshot_tool] Add support for SWIFT_LIBRARY_PATH so scripts has access to the .dylib path so they can run tests.
2 parents 6275a7c + cc9711e commit ef23124

File tree

4 files changed

+25
-7
lines changed

4 files changed

+25
-7
lines changed

utils/swift_snapshot_tool/Sources/swift_snapshot_tool/bisect_toolchains.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ struct BisectToolchains: AsyncParsableCommand {
66
commandName: "bisect",
77
discussion: """
88
Bisects on exit status of attached script. Passes in name of swift as the
9-
environment variabless SWIFTC and SWIFT_FRONTEND
9+
environment variables \(environmentVariables).
1010
""")
1111

1212
@Flag var platform: Platform = .osx
@@ -22,8 +22,9 @@ struct BisectToolchains: AsyncParsableCommand {
2222

2323
@Option(
2424
help: """
25-
The script that should be run. The environment variable
26-
SWIFT_EXEC is used by the script to know where swift-frontend is
25+
The script that should be run. It runs a specific swift compilation and
26+
optionally program using the passed in environment variables
27+
\(environmentVariables)
2728
""")
2829
var script: String
2930

utils/swift_snapshot_tool/Sources/swift_snapshot_tool/download_toolchain.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,13 @@ func downloadToolchainAndRunTest(
144144

145145
let swiftcPath = "\(toolchainDir)/usr/bin/swiftc"
146146
let swiftFrontendPath = "\(toolchainDir)/usr/bin/swift-frontend"
147+
// Just for now just support macosx.
148+
let platform = "macosx"
149+
let swiftLibraryPath = "\(toolchainDir)/usr/lib/swift/\(platform)"
147150
log(shell("\(swiftcPath) --version").stdout)
148151
let exitCode = shell(
149-
"\(script)", environment: ["SWIFTC": swiftcPath, "SWIFT_FRONTEND": swiftFrontendPath],
152+
"\(script)", environment: ["SWIFTC": swiftcPath, "SWIFT_FRONTEND": swiftFrontendPath,
153+
"SWIFT_LIBRARY_PATH": swiftLibraryPath],
150154
mustSucceed: false,
151155
verbose: verbose,
152156
extraArgs: extraArgs
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//===--- misc_global_strings.swift ----------------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2024 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
let environmentVariables = "SWIFTC, SWIFT_FRONTEND, and SWIFT_LIBRARY_PATH"

utils/swift_snapshot_tool/Sources/swift_snapshot_tool/run_toolchain.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ struct RunToolchains: AsyncParsableCommand {
66
static let configuration = CommandConfiguration(
77
commandName: "run",
88
discussion: """
9-
Run a toolchain like bisect would. Passes in name of swift as the
10-
environment variabless SWIFTC and SWIFT_FRONTEND
11-
""")
9+
Run a toolchain like bisect would. Passed the environment variables:
10+
\(environmentVariables)
11+
""")
1212

1313
@Flag var platform: Platform = .osx
1414

0 commit comments

Comments
 (0)