1
1
import ArgumentParser
2
- import Foundation
3
2
import CryptoKit
3
+ import Foundation
4
4
import Sake
5
5
import SwiftShell
6
6
@@ -11,6 +11,7 @@ struct ReleaseCommands {
11
11
case x86
12
12
case arm
13
13
}
14
+
14
15
enum OS {
15
16
case macos
16
17
case linux
@@ -21,10 +22,10 @@ struct ReleaseCommands {
21
22
22
23
var triple : String {
23
24
switch ( arch, os) {
24
- case ( . x86, . macos) : " x86_64-apple-macosx "
25
- case ( . arm, . macos) : " arm64-apple-macosx "
26
- case ( . x86, . linux) : " x86_64-unknown-linux-gnu "
27
- case ( . arm, . linux) : " aarch64-unknown-linux-gnu "
25
+ case ( . x86, . macos) : " x86_64-apple-macosx "
26
+ case ( . arm, . macos) : " arm64-apple-macosx "
27
+ case ( . x86, . linux) : " x86_64-unknown-linux-gnu "
28
+ case ( . arm, . linux) : " aarch64-unknown-linux-gnu "
28
29
}
29
30
}
30
31
}
@@ -167,7 +168,8 @@ struct ReleaseCommands {
167
168
let buildFlags = [ " --disable-sandbox " , " --configuration " , " release " , " --triple " , target. triple]
168
169
if target. os == . linux {
169
170
let platform = target. arch == . arm ? " linux/arm64 " : " linux/amd64 "
170
- let dockerExec = " docker run --rm --volume \( context. projectRoot) :/workdir --workdir /workdir --platform \( platform) swift: \( Constants . swiftVersion) "
171
+ let dockerExec =
172
+ " docker run --rm --volume \( context. projectRoot) :/workdir --workdir /workdir --platform \( platform) swift: \( Constants . swiftVersion) "
171
173
let buildFlags = ( buildFlags + [ " --static-swift-stdlib " ] ) . joined ( separator: " " )
172
174
return (
173
175
" \( dockerExec) swift build \( buildFlags) " ,
@@ -178,10 +180,10 @@ struct ReleaseCommands {
178
180
} else {
179
181
let buildFlags = buildFlags. joined ( separator: " " )
180
182
return (
181
- " swift build \( buildFlags) " ,
182
- " swift package clean " ,
183
- " strip -rSTx " ,
184
- " zip -j "
183
+ " swift build \( buildFlags) " ,
184
+ " swift package clean " ,
185
+ " strip -rSTx " ,
186
+ " zip -j "
185
187
)
186
188
}
187
189
} ( )
@@ -198,7 +200,9 @@ struct ReleaseCommands {
198
200
try runAndPrint ( bash: " \( strip) \( executablePath) " )
199
201
200
202
let executableArchivePath = executableArchivePath ( target: target, version: version)
201
- try runAndPrint ( bash: " \( zip) \( executableArchivePath) \( executablePath. replacingOccurrences ( of: " /workdir " , with: context. projectRoot) ) " )
203
+ try runAndPrint (
204
+ bash: " \( zip) \( executableArchivePath) \( executablePath. replacingOccurrences ( of: " /workdir " , with: context. projectRoot) ) "
205
+ )
202
206
}
203
207
204
208
print ( " Release artifacts built successfully at ' \( Constants . buildArtifactsDirectory) ' " )
0 commit comments