Skip to content

Commit 150ba13

Browse files
authored
Merge pull request #20117 from gottesmm/pr-7f73c70f7905834a15de56e075391e6b6ccaf491
[benchmark] Fix the swiftpm based benchmark build.
2 parents ecf29e6 + 7d58b40 commit 150ba13

File tree

1 file changed

+46
-39
lines changed

1 file changed

+46
-39
lines changed

benchmark/Package.swift

Lines changed: 46 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:4.0
1+
// swift-tools-version:4.2
22

33
import PackageDescription
44
import Foundation
@@ -39,50 +39,57 @@ let multiSourceLibraries: [String] = {
3939
}
4040
}()
4141

42-
let p = Package(
43-
name: "swiftbench",
44-
products: [
45-
.library(name: "TestsUtils", type: .static, targets: ["TestsUtils"]),
46-
.library(name: "DriverUtils", type: .static, targets: ["DriverUtils"]),
47-
.library(name: "ObjectiveCTests", type: .static, targets: ["ObjectiveCTests"]),
48-
.executable(name: "SwiftBench", targets: ["SwiftBench"]),
49-
.library(name: "PrimsSplit", type: .static, targets: ["PrimsSplit"])
50-
] + singleSourceLibraries.map { .library(name: $0, type: .static, targets: [$0]) }
51-
+ multiSourceLibraries.map { .library(name: $0, type: .static, targets: [$0]) },
52-
targets: [
53-
.target(name: "TestsUtils",
54-
path: "utils",
55-
sources: ["TestsUtils.swift"]),
56-
.target(name: "DriverUtils",
57-
dependencies: [.target(name: "TestsUtils")],
58-
path: "utils",
59-
sources: ["DriverUtils.swift", "ArgParse.swift"]),
42+
var products: [Product] = []
43+
products.append(.library(name: "TestsUtils", type: .static, targets: ["TestsUtils"]))
44+
products.append(.library(name: "DriverUtils", type: .static, targets: ["DriverUtils"]))
45+
products.append(.library(name: "ObjectiveCTests", type: .static, targets: ["ObjectiveCTests"]))
46+
products.append(.executable(name: "SwiftBench", targets: ["SwiftBench"]))
47+
products.append(.library(name: "PrimsSplit", type: .static, targets: ["PrimsSplit"]))
48+
products += singleSourceLibraries.map { .library(name: $0, type: .static, targets: [$0]) }
49+
products += multiSourceLibraries.map { .library(name: $0, type: .static, targets: [$0]) }
50+
51+
var targets: [Target] = []
52+
targets.append(.target(name: "TestsUtils", path: "utils", sources: ["TestsUtils.swift"]))
53+
targets.append(.systemLibrary(name: "LibProc", path: "utils/LibProc"))
54+
targets.append(
55+
.target(name: "DriverUtils",
56+
dependencies: [.target(name: "TestsUtils"), "LibProc"],
57+
path: "utils",
58+
sources: ["DriverUtils.swift", "ArgParse.swift"]))
59+
targets.append(
6060
.target(name: "SwiftBench",
61-
dependencies: [
62-
.target(name: "TestsUtils"),
63-
.target(name: "ObjectiveCTests"),
64-
.target(name: "DriverUtils"),
65-
] + singleSourceLibraries.map { .target(name: $0) }
66-
+ multiSourceLibraries.map { .target(name: $0) },
67-
path: "utils",
68-
sources: ["main.swift"]),
69-
.target(name: "ObjectiveCTests",
70-
path: "utils/ObjectiveCTests",
71-
publicHeadersPath: "."),
72-
] + singleSourceLibraries.map { x in
61+
dependencies: [
62+
.target(name: "TestsUtils"),
63+
.target(name: "ObjectiveCTests"),
64+
.target(name: "DriverUtils"),
65+
] + singleSourceLibraries.map { .target(name: $0) }
66+
+ multiSourceLibraries.map { .target(name: $0) },
67+
path: "utils",
68+
sources: ["main.swift"]))
69+
targets.append(
70+
.target(name: "ObjectiveCTests",
71+
path: "utils/ObjectiveCTests",
72+
publicHeadersPath: "."))
73+
targets += singleSourceLibraries.map { x in
7374
return .target(name: x,
7475
dependencies: [
7576
.target(name: "TestsUtils"),
7677
.target(name: "ObjectiveCTests"),
7778
],
7879
path: "single-source",
7980
sources: ["\(x).swift"])
80-
} + multiSourceLibraries.map { x in
81-
return .target(name: x,
82-
dependencies: [
83-
.target(name: "TestsUtils")
84-
],
85-
path: "multi-source/\(x)")
86-
},
87-
swiftLanguageVersions: [4]
81+
}
82+
targets += multiSourceLibraries.map { x in
83+
return .target(name: x,
84+
dependencies: [
85+
.target(name: "TestsUtils")
86+
],
87+
path: "multi-source/\(x)")
88+
}
89+
90+
let p = Package(
91+
name: "swiftbench",
92+
products: products,
93+
targets: targets,
94+
swiftLanguageVersions: [.v4]
8895
)

0 commit comments

Comments
 (0)