Repository navigation
Expand file tree
/
Copy pathPackage.swift
More file actions
52 lines (47 loc) · 1.69 KB
/
Copy pathPackage.swift
File metadata and controls
52 lines (47 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// swift-tools-version: 5.9
import Foundation
import PackageDescription
// Keep this in sync with the Cargo workspace version via
// scripts/sync-sdk-versions.sh. Release preparation replaces the checksum
// after building the versioned XCFramework; see RELEASE.md.
let secretSpecBinaryVersion = "0.19.1"
let secretSpecBinaryChecksum = "50b6a9007990d22c24b0659bf7ae195cb1b624c328ae694c4218703508d90bf9"
let localBinaryPath = "secretspec-swift/Artifacts/CSecretSpec.xcframework"
let packageRoot = URL(fileURLWithPath: #filePath).deletingLastPathComponent()
let hasLocalBinary = FileManager.default.fileExists(
atPath: packageRoot.appendingPathComponent(localBinaryPath).path
)
let ffiTarget: Target = hasLocalBinary
? .binaryTarget(name: "CSecretSpec", path: localBinaryPath)
: .binaryTarget(
name: "CSecretSpec",
url: "https://github.com/cachix/secretspec/releases/download/v\(secretSpecBinaryVersion)/CSecretSpec.xcframework.zip",
checksum: secretSpecBinaryChecksum
)
let package = Package(
name: "SecretSpec",
platforms: [
.macOS(.v12),
],
products: [
.library(name: "SecretSpec", targets: ["SecretSpec"]),
],
targets: [
ffiTarget,
.target(
name: "SecretSpec",
dependencies: ["CSecretSpec"],
path: "secretspec-swift/Sources/SecretSpec"
),
.executableTarget(
name: "SecretSpecExamples",
dependencies: ["SecretSpec"],
path: "secretspec-swift/Examples"
),
.testTarget(
name: "SecretSpecTests",
dependencies: ["SecretSpec"],
path: "secretspec-swift/Tests/SecretSpecTests"
),
]
)