@@ -213,7 +213,7 @@ struct BuildSwiftlyRelease: AsyncParsableCommand {
213
213
return nil
214
214
}
215
215
216
- func checkGitRepoStatus( _ : String ) async throws {
216
+ func checkGitRepoStatus( ) async throws {
217
217
guard !self . skip else {
218
218
return
219
219
}
@@ -241,12 +241,8 @@ struct BuildSwiftlyRelease: AsyncParsableCommand {
241
241
func buildLinuxRelease( ) async throws {
242
242
// TODO: turn these into checks that the system meets the criteria for being capable of using the toolchain + checking for packages, not tools
243
243
let curl = try await self . assertTool ( " curl " , message: " Please install curl with `yum install curl` " )
244
- let make = try await self . assertTool ( " make " , message: " Please install make with `yum install make` " )
245
- let git = try await self . assertTool ( " git " , message: " Please install git with `yum install git` " )
246
- let strip = try await self . assertTool ( " strip " , message: " Please install strip with `yum install binutils` " )
247
- let sha256sum = try await self . assertTool ( " sha256sum " , message: " Please install sha256sum with `yum install coreutils` " )
248
244
249
- try await self . checkGitRepoStatus ( git )
245
+ try await self . checkGitRepoStatus ( )
250
246
251
247
// Start with a fresh SwiftPM package
252
248
try await sys. swift ( ) . package ( ) . reset ( ) . run ( currentPlatform)
@@ -264,7 +260,7 @@ struct BuildSwiftlyRelease: AsyncParsableCommand {
264
260
265
261
try ? FileManager . default. removeItem ( atPath: libArchivePath)
266
262
try runProgram ( curl, " -L " , " -o " , " \( buildCheckoutsDir + " /libarchive- \( libArchiveVersion) .tar.gz " ) " , " --remote-name " , " --location " , " https://github.com/libarchive/libarchive/releases/download/v \( libArchiveVersion) /libarchive- \( libArchiveVersion) .tar.gz " )
267
- let libArchiveTarShaActual = try await runProgramOutput ( sha256sum, " \( buildCheckoutsDir) /libarchive- \( libArchiveVersion) .tar.gz " )
263
+ let libArchiveTarShaActual = try await sys . sha256sum ( files : FilePath ( " \( buildCheckoutsDir) /libarchive- \( libArchiveVersion) .tar.gz " ) ) . output ( currentPlatform )
268
264
guard let libArchiveTarShaActual, libArchiveTarShaActual. starts ( with: libArchiveTarSha) else {
269
265
let shaActual = libArchiveTarShaActual ?? " none "
270
266
throw Error ( message: " The libarchive tar.gz file sha256sum is \( shaActual) , but expected \( libArchiveTarSha) " )
@@ -330,9 +326,9 @@ struct BuildSwiftlyRelease: AsyncParsableCommand {
330
326
env: customEnv
331
327
)
332
328
333
- try runProgramEnv ( make, env: customEnv)
329
+ try await sys . make ( ) . run ( currentPlatform , env: customEnv)
334
330
335
- try runProgram ( make , " install " )
331
+ try await sys . make ( ) . install ( ) . run ( currentPlatform )
336
332
337
333
FileManager . default. changeCurrentDirectoryPath ( cwd)
338
334
@@ -341,7 +337,7 @@ struct BuildSwiftlyRelease: AsyncParsableCommand {
341
337
let releaseDir = cwd + " /.build/release "
342
338
343
339
// Strip the symbols from the binary to decrease its size
344
- try runProgram ( strip, releaseDir + " / swiftly" )
340
+ try await sys . strip ( names : FilePath ( releaseDir) / " swiftly " ) . run ( currentPlatform )
345
341
346
342
try await self . collectLicenses ( releaseDir)
347
343
@@ -374,18 +370,13 @@ struct BuildSwiftlyRelease: AsyncParsableCommand {
374
370
}
375
371
376
372
func buildMacOSRelease( cert: String ? , identifier: String ) async throws {
377
- // Check system requirements
378
- let git = try await self . assertTool ( " git " , message: " Please install git with either `xcode-select --install` or `brew install git` " )
379
-
380
- try await self . checkGitRepoStatus ( git)
381
-
382
- let strip = try await self . assertTool ( " strip " , message: " In order to strip binaries there needs to be the `strip` tool that is installed on macOS. " )
373
+ try await self . checkGitRepoStatus ( )
383
374
384
375
try await sys. swift ( ) . package ( ) . clean ( ) . run ( currentPlatform)
385
376
386
377
for arch in [ " x86_64 " , " arm64 " ] {
387
378
try await sys. swift ( ) . build ( . product( " swiftly " ) , . configuration( " release " ) , . arch( " \( arch) " ) ) . run ( currentPlatform)
388
- try runProgram ( strip, " .build/ \( arch) -apple-macosx/release/swiftly " )
379
+ try await sys . strip ( names : FilePath ( " .build " ) / " \( arch) -apple-macosx/release/swiftly " ) . run ( currentPlatform )
389
380
}
390
381
391
382
let swiftlyBinDir = fs. cwd / " .build/release/.swiftly/bin "
@@ -450,7 +441,7 @@ struct BuildSwiftlyRelease: AsyncParsableCommand {
450
441
if self . test {
451
442
for arch in [ " x86_64 " , " arm64 " ] {
452
443
try await sys. swift ( ) . build ( . product( " test-swiftly " ) , . configuration( " debug " ) , . arch( " \( arch) " ) ) . run ( currentPlatform)
453
- try runProgram ( strip, " .build/ \( arch) -apple-macosx/release/swiftly " )
444
+ try await sys . strip ( names : FilePath ( " .build " ) / " \( arch) -apple-macosx/release/swiftly " ) . run ( currentPlatform )
454
445
}
455
446
456
447
let testArchive = releaseDir. appendingPathComponent ( " test-swiftly-macos.tar.gz " )
0 commit comments