Skip to content

armgit / xtool

Public Imported from GitHub
0

Cross-platform Xcode replacement. Build and deploy iOS apps with SwiftPM on Linux, Windows, macOS.

Enable static linking on Linux

Kabir Oberaia582303bcfad
diff --git a/Supersign/Package.swift b/Supersign/Package.swift
index 1f2c9c7..f8e4252 100644
--- a/Supersign/Package.swift
+++ b/Supersign/Package.swift
@@ -8,6 +8,16 @@ let cSettings: [CSetting] = [
.headerSearchPath("../../vendored/include", .when(platforms: [.macOS, .iOS])),
]
+extension Product.Library.LibraryType {
+ static var smart: Self {
+ #if os(Linux)
+ return .static
+ #else
+ return .dynamic
+ #endif
+ }
+}
+
let package = Package(
name: "Supersign",
platforms: [
@@ -17,7 +27,7 @@ let package = Package(
products: [
.library(
name: "Supersign",
- type: .dynamic,
+ type: .smart,
targets: ["Supersign"]
),
],
diff --git a/SupersignCLISupport/Sources/SupersignCLI/main.swift b/SupersignCLISupport/Sources/SupersignCLI/main.swift
index 093147e..3444031 100644
--- a/SupersignCLISupport/Sources/SupersignCLI/main.swift
+++ b/SupersignCLISupport/Sources/SupersignCLI/main.swift
@@ -2,13 +2,13 @@ import Foundation
import Supersign
import SupersignCLISupport
-let moduleBundle: Bundle
-#if swift(>=5.5) || os(macOS)
+let moduleBundle: Bundle?
+#if os(macOS)
moduleBundle = Bundle.module
#else
-moduleBundle = Bundle(url: Bundle.main.url(forResource: "SupersignCLISupport_SupersignCLI", withExtension: "resources")!)!
+moduleBundle = Bundle.main.url(forResource: "SupersignCLISupport_SupersignCLI", withExtension: "resources").flatMap(Bundle.init(url:))
#endif
-let app = moduleBundle.url(forResource: "Supercharge", withExtension: "ipa")!
+let app = moduleBundle?.url(forResource: "Supercharge", withExtension: "ipa")!
#warning("Improve persistence on Windows/Linux")
diff --git a/SupersignCLISupport/Sources/SupersignCLISupport/SuperchargeCommand.swift b/SupersignCLISupport/Sources/SupersignCLISupport/SuperchargeCommand.swift
index b1150a9..937c1ea 100644
--- a/SupersignCLISupport/Sources/SupersignCLISupport/SuperchargeCommand.swift
+++ b/SupersignCLISupport/Sources/SupersignCLISupport/SuperchargeCommand.swift
@@ -12,6 +12,10 @@ struct InstallSuperchargeCommand: ParsableCommand {
@Option(name: .shortAndLong) var account: String?
func run() throws {
+ guard let app = SupersignCLI.config.superchargeApp else {
+ throw Console.Error("This copy of Supersign is not configured to install Supercharge.")
+ }
+
let username: String
let credentials: IntegratedInstaller.Credentials
@@ -66,7 +70,7 @@ struct InstallSuperchargeCommand: ParsableCommand {
storage: SupersignCLI.config.storage,
delegate: installDelegate
)
- installer.install(app: SupersignCLI.config.superchargeApp)
+ installer.install(app: app)
semaphore.wait()
_ = installer
}
diff --git a/SupersignCLISupport/Sources/SupersignCLISupport/SupersignCommand.swift b/SupersignCLISupport/Sources/SupersignCLISupport/SupersignCommand.swift
index 207d2a0..3fbf696 100644
--- a/SupersignCLISupport/Sources/SupersignCLISupport/SupersignCommand.swift
+++ b/SupersignCLISupport/Sources/SupersignCLISupport/SupersignCommand.swift
@@ -4,11 +4,11 @@ import ArgumentParser
public enum SupersignCLI {
public struct Configuration {
- public let superchargeApp: URL
+ public let superchargeApp: URL?
public let storage: KeyValueStorage
public init(
- superchargeApp: URL,
+ superchargeApp: URL?,
storage: KeyValueStorage
) {
self.superchargeApp = superchargeApp