Skip to content

Commit 9c3805a

Browse files
committed
Do not compile the dependencies in release mode by default
With Swift 6 it does not work anymore. See <swiftlang/swift#76605>.
1 parent 3917784 commit 9c3805a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Sources/swift-sh/Helpers/DepsPackage.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct DepsPackage {
6565
self.packageHash = Data(SHA256.hash(data: packageSwiftContent))
6666
}
6767

68-
func retrieveREPLInvocation(packageFolder: FilePath, disableSandboxForPackageResolution: Bool, fileManager fm: FileManager, logger: Logger) async throws -> [String] {
68+
func retrieveREPLInvocation(packageFolder: FilePath, buildDependenciesInReleaseMode: Bool, disableSandboxForPackageResolution: Bool, fileManager fm: FileManager, logger: Logger) async throws -> [String] {
6969
/* Let’s see if we need to update/create the Package.swift file. */
7070
let packageSwiftPath = packageFolder.appending("Package.swift")
7171
let packageSwiftURL = packageSwiftPath.url
@@ -99,7 +99,7 @@ struct DepsPackage {
9999
let slaveFd = FileDescriptor(rawValue: slaveRawFd)
100100
let masterFd = FileDescriptor(rawValue: masterRawFd)
101101
let pi = ProcessInvocation(
102-
"swift", args: ["run", "-c", "release", "--repl"] + (disableSandboxForPackageResolution ? ["--disable-sandbox"] : []),
102+
"swift", args: ["run", "--repl"] + (buildDependenciesInReleaseMode ? ["-c", "release"] : []) + (disableSandboxForPackageResolution ? ["--disable-sandbox"] : []),
103103
usePATH: true, workingDirectory: packageFolder.url,
104104
/* The environment below tricks swift somehow into allowing the REPL when stdout is not a tty.
105105
* We do one better and give it a pty directly and we know we’re good. */

Sources/swift-sh/OptionGroups/BuildAndRunOptions.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ final class BuildAndRunOptions : ParsableArguments {
1818
@Flag(name: .long, inversion: .prefixedNo)
1919
var skipPackageOnNoRemoteModules = true
2020

21+
@Flag(name: .long, inversion: .prefixedNo)
22+
var buildDependenciesInReleaseMode = false
23+
2124
@Flag(name: .long, inversion: .prefixedNo)
2225
var disableSandboxForPackageResolution = false
2326

@@ -79,6 +82,7 @@ final class BuildAndRunOptions : ParsableArguments {
7982
let packageFolderPath = try xdgDirs.ensureCacheDirPath(packageFolderRelativePath)
8083
let ret = try await depsPackage.retrieveREPLInvocation(
8184
packageFolder: packageFolderPath,
85+
buildDependenciesInReleaseMode: buildDependenciesInReleaseMode,
8286
disableSandboxForPackageResolution: disableSandboxForPackageResolution,
8387
fileManager: fm, logger: logger
8488
)

0 commit comments

Comments
 (0)