Skip to content

Commit 916814c

Browse files
committed
Allow release builds in the plugin
Was suggested in #90 (comment), this adds support for `--release` and `--configuration release` to switch to release config.
1 parent e0cab18 commit 916814c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Plugins/launch-xcode/launch-xcode.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,20 @@ struct LaunchXcode: CommandPlugin {
2020
print("This command is only supported on macOS")
2121
return
2222
#else
23-
let buildResult = try packageManager.build(.all(includingTests: false), parameters: .init(echoLogs: true))
23+
var args = ArgumentExtractor(arguments)
24+
var configuration: PackageManager.BuildConfiguration = .debug
25+
// --release
26+
if args.extractFlag(named: "release") > 0 {
27+
configuration = .release
28+
} else {
29+
// --configuration release
30+
let configurationOptions = args.extractOption(named: "configuration")
31+
if configurationOptions.contains("release") {
32+
configuration = .release
33+
}
34+
}
35+
36+
let buildResult = try packageManager.build(.all(includingTests: false), parameters: .init(configuration: configuration, echoLogs: true))
2437
guard buildResult.succeeded else { return }
2538
guard let buildServiceURL = buildResult.builtArtifacts.map({ $0.url }).filter({ $0.lastPathComponent == "SWBBuildServiceBundle" }).first else {
2639
print("Failed to determine path to built SWBBuildServiceBundle")

0 commit comments

Comments
 (0)