Skip to content

Commit 4d7d337

Browse files
committed
Preserve compatibility with older versions.
1 parent 58e0a23 commit 4d7d337

9 files changed

+65
-42
lines changed

Package.resolved

Lines changed: 14 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,57 @@
44
import PackageDescription
55

66
let dependencies: [Package.Dependency]
7+
let versionedTargets: [Target]
8+
let versionedDependencies: [Target.Dependency]
9+
710
#if swift(>=5.9)
811
dependencies = [
912
.package(url: "https://github.com/apple/swift-argument-parser.git", .exact("1.2.3")),
1013
.package(name: "SwiftPM", url: "https://github.com/apple/swift-package-manager.git", .branch("release/5.9")),
1114
.package(url: "https://github.com/apple/swift-tools-support-core.git", .branch("release/5.9")),
1215
]
16+
versionedTargets = [
17+
.target(
18+
name: "Xcodeproj",
19+
dependencies: [
20+
.product(name: "SwiftPM-auto", package: "SwiftPM"),
21+
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),
22+
]
23+
)
24+
]
25+
versionedDependencies = ["Xcodeproj"]
1326
#elseif swift(>=5.7)
1427
dependencies = [
1528
.package(url: "https://github.com/apple/swift-argument-parser.git", .exact("1.0.3")),
1629
.package(name: "SwiftPM", url: "https://github.com/apple/swift-package-manager.git", .branch("release/5.7")),
1730
.package(url: "https://github.com/apple/swift-tools-support-core.git", .branch("release/5.7")),
1831
]
32+
versionedTargets = []
33+
versionedDependencies = []
1934
#elseif swift(>=5.6)
2035
dependencies = [
2136
.package(url: "https://github.com/apple/swift-argument-parser.git", .exact("1.0.3")),
2237
.package(name: "SwiftPM", url: "https://github.com/apple/swift-package-manager.git", .branch("release/5.6")),
2338
.package(url: "https://github.com/apple/swift-tools-support-core.git", .exact("0.2.5"))
2439
]
40+
versionedTargets = []
41+
versionedDependencies = []
2542
#elseif swift(>=5.5)
2643
dependencies = [
2744
.package(url: "https://github.com/apple/swift-argument-parser.git", .exact("0.4.4")),
2845
.package(name: "SwiftPM", url: "https://github.com/apple/swift-package-manager.git", .branch("release/5.5")),
2946
.package(url: "https://github.com/apple/swift-tools-support-core.git", .exact("0.2.3"))
3047
]
48+
versionedTargets = []
49+
versionedDependencies = []
3150
#else
3251
dependencies = [
3352
.package(url: "https://github.com/apple/swift-argument-parser.git", .exact("0.3.2")),
3453
.package(name: "SwiftPM", url: "https://github.com/apple/swift-package-manager.git", .revision("swift-5.3.3-RELEASE")),
3554
.package(url: "https://github.com/apple/swift-tools-support-core.git", .exact("0.1.12"))
3655
]
56+
versionedTargets = []
57+
versionedDependencies = []
3758
#endif
3859

3960
let platforms: [SupportedPlatform]
@@ -59,16 +80,8 @@ let package = Package(
5980

6081
dependencies: dependencies,
6182

62-
targets: [
63-
.target(
64-
name: "Xcodeproj",
65-
dependencies: [
66-
.product(name: "SwiftPM-auto", package: "SwiftPM"),
67-
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),
68-
]
69-
),
70-
.target(name: "CreateXCFramework", dependencies: [
71-
"Xcodeproj",
83+
targets: versionedTargets + [
84+
.target(name: "CreateXCFramework", dependencies: versionedDependencies + [
7285
.product(name: "ArgumentParser", package: "swift-argument-parser"),
7386
.product(name: "SwiftPM-auto", package: "SwiftPM"),
7487
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),

Sources/Xcodeproj/PropertyList.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
#if swift(>=5.9)
14+
1315
/// A enum representing data types for legacy PropertyList type.
1416
/// Note that the `identifier` enum is not strictly necessary,
1517
/// but useful to semantically distinguish the strings that
@@ -148,3 +150,5 @@ extension PropertyList {
148150
}
149151
}
150152
}
153+
154+
#endif

Sources/Xcodeproj/SchemesGenerator.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
#if swift(>=5.9)
14+
1315
import TSCBasic
1416
import PackageGraph
1517
import PackageModel
@@ -309,3 +311,5 @@ func legacySchemeGenerator(container: String, graph: PackageGraph, codeCoverageE
309311
</Scheme>
310312
""")
311313
}
314+
315+
#endif

Sources/Xcodeproj/Target+PBXProj.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
#if swift(>=5.9)
14+
1315
/*
1416
In an effort to provide:
1517

@@ -88,3 +90,5 @@ extension ResolvedTarget {
8890
}
8991
}
9092
}
93+
94+
#endif

Sources/Xcodeproj/XcodeProjectModel.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
#if swift(>=5.9)
14+
1315
/*
1416
A very simple rendition of the Xcode project model. There is only sufficient
1517
functionality to allow creation of Xcode projects in a somewhat readable way,
@@ -517,3 +519,5 @@ public func += (lhs: inout [String]?, rhs: [String]) {
517519
lhs = lhs! + rhs
518520
}
519521
}
522+
523+
#endif

Sources/Xcodeproj/XcodeProjectModelSerialization.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
#if swift(>=5.9)
14+
1315
/*
1416
An extemely simple rendition of the Xcode project model into a plist. There
1517
is only enough functionality to allow serialization of Xcode projects.
@@ -643,3 +645,5 @@ extension PropertyList {
643645
}
644646
}
645647
}
648+
649+
#endif

Sources/Xcodeproj/generate.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
#if swift(>=5.9)
14+
1315
import Basics
1416
import PackageGraph
1517
import PackageModel
@@ -335,3 +337,5 @@ public enum XcodeProject {
335337
}) ?? []
336338
}
337339
}
340+
341+
#endif

Sources/Xcodeproj/pbxproj.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
#if swift(>=5.9)
14+
1315
import Basics
1416
import TSCBasic
1517
import PackageGraph
@@ -896,3 +898,5 @@ func appendSetting(
896898
throw InternalError("Unhandled decl \(decl)")
897899
}
898900
}
901+
902+
#endif

0 commit comments

Comments
 (0)