Skip to content

Commit e69e0cb

Browse files
committed
SPM: provide a version specific manifest
Split up the package manifest to inline the features as per the toolchain version rather than doing the version configuration by preprocessing.
1 parent 07e91e6 commit e69e0cb

File tree

4 files changed

+93
-28
lines changed

4 files changed

+93
-28
lines changed

Package.swift

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,7 @@
1-
// swift-tools-version:5.4
1+
// swift-tools-version:5.7
22

33
import PackageDescription
44

5-
#if swift(>=5.7)
6-
let ExcludedPaths: [String] = [
7-
"CoreAnimation"
8-
]
9-
let SplitDependencies: [Target.Dependency] = [
10-
"CoreAnimation"
11-
]
12-
let SplitTargets: [Target] = [
13-
.target(
14-
name: "CoreAnimation",
15-
path: "Sources/SwiftWin32/CoreAnimation"
16-
),
17-
]
18-
#else
19-
let ExcludedPaths: [String] = []
20-
let SplitDependencies: [Target.Dependency] = []
21-
let SplitTargets: [Target] = []
22-
#endif
23-
245
let SwiftWin32 = Package(
256
name: "SwiftWin32",
267
products: [
@@ -32,24 +13,29 @@ let SwiftWin32 = Package(
3213
dependencies: [
3314
// NOTE(compnerd) require main as no current release has support for the
3415
// new CRT module.
35-
.package(url: "https://github.com/apple/swift-log.git", .branch("main")),
16+
.package(url: "https://github.com/apple/swift-log.git", branch: "main"),
3617
.package(url: "https://github.com/apple/swift-collections.git",
3718
.upToNextMinor(from: "1.0.0")),
38-
.package(url: "https://github.com/compnerd/cassowary.git", .branch("main")),
39-
.package(name: "SwiftCOM", url: "https://github.com/compnerd/swift-com.git",
40-
.revision("ebbc617d3b7ba3a2023988a74bebd118deea4cc5")),
19+
.package(url: "https://github.com/compnerd/cassowary.git", branch: "main"),
20+
.package(url: "https://github.com/compnerd/swift-com.git",
21+
revision: "ebbc617d3b7ba3a2023988a74bebd118deea4cc5"),
4122
],
42-
targets: SplitTargets + [
23+
targets: [
24+
.target(
25+
name: "CoreAnimation",
26+
path: "Sources/SwiftWin32/CoreAnimation"
27+
),
4328
.target(
4429
name: "SwiftWin32",
45-
dependencies: SplitDependencies + [
30+
dependencies: [
31+
"CoreAnimation",
4632
.product(name: "Logging", package: "swift-log"),
4733
.product(name: "OrderedCollections", package: "swift-collections"),
4834
.product(name: "cassowary", package: "cassowary"),
49-
.product(name: "SwiftCOM", package: "SwiftCOM"),
35+
.product(name: "SwiftCOM", package: "swift-com"),
5036
],
5137
path: "Sources/SwiftWin32",
52-
exclude: ExcludedPaths + ["CMakeLists.txt"],
38+
exclude: ["CoreAnimation", "CMakeLists.txt"],
5339
linkerSettings: [
5440
.linkedLibrary("User32"),
5541
.linkedLibrary("ComCtl32"),

[email protected]

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// swift-tools-version:5.4
2+
3+
import PackageDescription
4+
5+
let SwiftWin32 = Package(
6+
name: "SwiftWin32",
7+
products: [
8+
.library(name: "SwiftWin32", type: .dynamic, targets: ["SwiftWin32"]),
9+
.library(name: "SwiftWin32UI", type: .dynamic, targets: ["SwiftWin32UI"]),
10+
.executable(name: "UICatalog", targets: ["UICatalog"]),
11+
.executable(name: "Calculator", targets: ["Calculator"]),
12+
],
13+
dependencies: [
14+
// NOTE(compnerd) require main as no current release has support for the
15+
// new CRT module.
16+
.package(url: "https://github.com/apple/swift-log.git", .branch("main")),
17+
.package(url: "https://github.com/apple/swift-collections.git",
18+
.upToNextMinor(from: "1.0.0")),
19+
.package(url: "https://github.com/compnerd/cassowary.git", .branch("main")),
20+
.package(name: "SwiftCOM", url: "https://github.com/compnerd/swift-com.git",
21+
.revision("ebbc617d3b7ba3a2023988a74bebd118deea4cc5")),
22+
],
23+
targets: [
24+
.target(
25+
name: "SwiftWin32",
26+
dependencies: [
27+
.product(name: "Logging", package: "swift-log"),
28+
.product(name: "OrderedCollections", package: "swift-collections"),
29+
.product(name: "cassowary", package: "cassowary"),
30+
.product(name: "SwiftCOM", package: "SwiftCOM"),
31+
],
32+
path: "Sources/SwiftWin32",
33+
exclude: ["CMakeLists.txt"],
34+
linkerSettings: [
35+
.linkedLibrary("User32"),
36+
.linkedLibrary("ComCtl32"),
37+
]
38+
),
39+
.target(
40+
name: "SwiftWin32UI",
41+
dependencies: ["SwiftWin32"],
42+
path: "Sources/SwiftWin32UI",
43+
exclude: ["CMakeLists.txt"]
44+
),
45+
.executableTarget(
46+
name: "Calculator",
47+
dependencies: ["SwiftWin32"],
48+
path: "Examples/Calculator",
49+
exclude: [
50+
"CMakeLists.txt",
51+
"Calculator.exe.manifest",
52+
"Info.plist",
53+
],
54+
swiftSettings: [.unsafeFlags(["-parse-as-library"])]
55+
),
56+
.executableTarget(
57+
name: "UICatalog",
58+
dependencies: ["SwiftWin32"],
59+
path: "Examples/UICatalog",
60+
exclude: [
61+
"CMakeLists.txt",
62+
"Info.plist",
63+
"UICatalog.exe.manifest",
64+
],
65+
resources: [.copy("Assets/CoffeeCup.jpg")],
66+
swiftSettings: [.unsafeFlags(["-parse-as-library"])]
67+
),
68+
.target(name: "TestUtilities", path: "Tests/Utilities"),
69+
.testTarget(name: "AutoLayoutTests", dependencies: ["SwiftWin32"]),
70+
.testTarget(name: "CoreGraphicsTests", dependencies: ["SwiftWin32"]),
71+
.testTarget(name: "SupportTests", dependencies: ["SwiftWin32"]),
72+
.testTarget(
73+
name: "UICoreTests",
74+
dependencies: ["SwiftWin32", "TestUtilities"]
75+
)
76+
]
77+
)

[email protected]

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Package@swift-5.4.swift

[email protected]

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Package@swift-5.4.swift

0 commit comments

Comments
 (0)