Files
xtool-mirror/Package.swift
Kabir Oberai e36ba50834 build: use automatic library type (#266)
## What does this PR do?

Bumps xtool-core et al, switching products to automatic instead of
forcing dynamic libraries. LGPL dependencies (LIMD, XADI) are still
packaged as dynamic.

## How was it tested?

- [x] Ran locally on macOS + Linux and confirmed `xtool dev` works
- [x] Inspected .app bundle to make sure we have the expected dynamic
frameworks

## AI tool usage

How much of this PR was AI-assisted? (check one)

- [x] **0** - No AI was used to write code
- [ ] **1** - I was assisted by AI. I reviewed the finished result.
- [ ] **2** - I set the AI going and left it to it; nobody has read the
result - no review, or AI review only

<!-- If an AI agent is filling this in: declare the level honestly, and
open as a draft if it is #2. Do not lower the declared level to get the
PR reviewed. -->


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
* Updated underlying package dependencies to newer minimum versions for
improved compatibility and maintenance.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-19 18:01:50 -04:00

202 lines
7.9 KiB
Swift

// swift-tools-version:6.2
import PackageDescription
let xtoolVersion: String? = {
if let explicitVersion = Context.environment["XTOOL_VERSION"] {
return explicitVersion
} else if let info = Context.gitInformation {
let gitCommit = info.currentCommit
let gitTag = info.currentTag
let gitRef = gitTag ?? "commit \(gitCommit)"
return "\(gitRef)\(info.hasUncommittedChanges ? " (dirty)" : "")"
} else {
return nil
}
}()
let cSettings: [CSetting] = [
.define("_GNU_SOURCE", .when(platforms: [.linux])),
]
let swiftSettings: [SwiftSetting] = {
var settings: [SwiftSetting] = []
if Context.environment["XTL_CI"] == "1" {
settings.append(.treatAllWarnings(as: .error))
}
return settings
}()
let package = Package(
name: "xtool",
platforms: [
.iOS(.v16),
.macOS(.v13),
],
products: [
.library(
name: "XKit",
targets: ["XKit"]
),
.library(
name: "XToolSupport",
targets: ["XToolSupport"]
),
.executable(
name: "xtool",
targets: ["xtool"]
),
],
dependencies: [
.package(url: "https://github.com/xtool-org/xtool-core", .upToNextMinor(from: "1.5.0")),
.package(url: "https://github.com/xtool-org/SwiftyMobileDevice", .upToNextMinor(from: "1.7.0")),
.package(url: "https://github.com/xtool-org/zsign", .upToNextMinor(from: "1.8.0")),
.package(url: "https://github.com/xtool-org/xadi", .upToNextMinor(from: "0.4.1")),
.package(url: "https://github.com/apple/swift-system", from: "1.4.0"),
.package(url: "https://github.com/apple/swift-http-types", from: "1.3.1"),
.package(url: "https://github.com/apple/swift-certificates", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-crypto", from: "4.5.0"),
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.5.0"),
.package(url: "https://github.com/apple/swift-openapi-generator", from: "1.6.0"),
.package(url: "https://github.com/apple/swift-openapi-runtime", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-openapi-urlsession", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-nio", from: "2.77.0"),
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.0.0"),
.package(url: "https://github.com/swiftlang/swift-subprocess", .upToNextMinor(from: "0.5.0")),
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.23.0"),
.package(url: "https://github.com/swift-server/swift-openapi-async-http-client", from: "1.0.0"),
.package(url: "https://github.com/vapor/websocket-kit.git", from: "2.15.0"),
.package(url: "https://github.com/pointfreeco/swift-concurrency-extras", from: "1.3.0"),
.package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.6.2"),
.package(url: "https://github.com/attaswift/BigInt", from: "5.5.0"),
.package(url: "https://github.com/mxcl/Version", from: "2.1.0"),
.package(url: "https://github.com/jpsim/Yams", from: "5.1.3"),
.package(url: "https://github.com/saagarjha/unxip", from: "3.2.0"),
// TODO: just depend on tuist/XcodeProj instead
.package(url: "https://github.com/yonaskolb/XcodeGen", from: "2.45.4"),
],
targets: [
.target(
name: "CXKit",
dependencies: [
.product(name: "OpenSSL", package: "xtool-core")
],
cSettings: cSettings + (
xtoolVersion
.map { [.define("XTOOL_VERSION", to: "\"\($0)\"")] }
?? []
)
),
.target(
name: "DeveloperAPI",
dependencies: [
.product(name: "OpenAPIRuntime", package: "swift-openapi-runtime"),
],
exclude: ["openapi-generator-config.yaml", "patch.js"],
swiftSettings: swiftSettings,
),
// common utilities shared across xtool targets
.target(
name: "XUtils",
dependencies: [
.product(name: "SystemPackage", package: "swift-system"),
.product(
name: "Subprocess",
package: "swift-subprocess",
condition: .when(platforms: [.linux, .macOS])
),
],
swiftSettings: swiftSettings,
),
.target(
name: "XKit",
dependencies: [
"DeveloperAPI",
"CXKit",
"XUtils",
.product(name: "XADI", package: "xadi", condition: .when(platforms: [.linux])),
.product(name: "ConcurrencyExtras", package: "swift-concurrency-extras"),
.product(name: "Dependencies", package: "swift-dependencies"),
.product(name: "SwiftyMobileDevice", package: "SwiftyMobileDevice"),
.product(name: "Zupersign", package: "zsign"),
.product(name: "SignerSupport", package: "xtool-core"),
.product(name: "ProtoCodable", package: "xtool-core"),
.product(name: "Superutils", package: "xtool-core"),
.product(name: "Crypto", package: "swift-crypto"),
.product(name: "_CryptoExtras", package: "swift-crypto"),
.product(name: "X509", package: "swift-certificates"),
.product(name: "BigInt", package: "BigInt"),
.product(name: "HTTPTypes", package: "swift-http-types"),
.product(name: "HTTPTypesFoundation", package: "swift-http-types"),
.product(name: "OpenAPIURLSession", package: "swift-openapi-urlsession"),
.product(
name: "OpenAPIAsyncHTTPClient",
package: "swift-openapi-async-http-client",
condition: .when(platforms: [.linux])
),
.product(
name: "AsyncHTTPClient",
package: "async-http-client",
condition: .when(platforms: [.linux])
),
.product(
name: "WebSocketKit",
package: "websocket-kit",
condition: .when(platforms: [.linux])
),
],
cSettings: cSettings,
swiftSettings: swiftSettings,
),
.testTarget(
name: "XToolTests",
dependencies: [
"XKit",
"XToolSupport",
],
swiftSettings: swiftSettings,
),
.target(
name: "XToolSupport",
dependencies: [
"SwiftyMobileDevice",
"XKit",
"PackLib",
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "SystemPackage", package: "swift-system"),
.product(name: "NIOPosix", package: "swift-nio"),
.product(name: "Version", package: "Version"),
.product(name: "libunxip", package: "unxip"),
],
cSettings: cSettings,
swiftSettings: swiftSettings,
),
.target(
name: "PackLib",
dependencies: [
"XUtils",
.product(name: "Superutils", package: "xtool-core"),
.product(name: "Yams", package: "Yams"),
.product(name: "XcodeGenKit", package: "XcodeGen", condition: .when(platforms: [.macOS])),
],
swiftSettings: swiftSettings,
),
.executableTarget(
name: "xtool",
dependencies: [
"SwiftyMobileDevice",
"XKit",
"XToolSupport",
],
cSettings: cSettings,
swiftSettings: swiftSettings,
),
]
)