Skip to content

Commit 7d1246e

Browse files
committed
build: remove package-benchmark from the dependencies
This package is not very Windows friendly. A partial port was attempted but revealed further Unixisms that will be difficult to port. There are alternative packages for benchmarking, e.g. google/swift-benchmark which may be a better choice.
1 parent 79237aa commit 7d1246e

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

Package.swift

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ let javaIncludePath = "\(javaHome)/include"
4040
#error("Currently only macOS and Linux platforms are supported, this may change in the future.")
4141
#endif
4242

43+
func sjEnableBenchmarking() -> Bool {
44+
if let value = ProcessInfo.processInfo.environment["SWIFT_JAVA_ENABLE_BENCHMARKING"] {
45+
switch value {
46+
case "TRUE", "YES", "1": return true
47+
case "FALSE", "NO", "0": return false
48+
default: break
49+
}
50+
}
51+
fatalError("Please set 'SWIFT_JAVA_ENABLE_BENCHMARKING' to 'TRUE' or 'FALSE'")
52+
}
53+
4354
let package = Package(
4455
name: "JavaKit",
4556
platforms: [
@@ -139,8 +150,10 @@ let package = Package(
139150
dependencies: [
140151
.package(url: "https://github.com/swiftlang/swift-syntax.git", branch: "main"),
141152
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.5.0"),
142-
.package(url: "https://github.com/ordo-one/package-benchmark", .upToNextMajor(from: "1.4.0")),
143-
],
153+
] + (sjEnableBenchmarking() ? [
154+
.package(url: "https://github.com/ordo-one/package-benchmark",
155+
.upToNextMajor(from: "1.4.0")),
156+
] : []),
144157
targets: [
145158
.macro(
146159
name: "JavaKitMacros",

0 commit comments

Comments
 (0)