I'm encountering a rather annoying issue which is causing swift-java's StaticBuildConfigPluginExecutable target to be built when building unrelated SwiftPM targets that don't import anything from swift-java at all.
I believe this is a SwiftPM issue, but I figured I'd report it here first in case anyone else has encountered the issue and found a workaround.
I'll file a SwiftPM issue once I've got a more minimal reproducer.
Reproducing
Add swiftlang/swift-java to a package (without actually using it anywhere);
// swift-tools-version: 6.1
import PackageDescription
let package = Package(
name: "SwiftJavaUser",
platforms: [.macOS(.v10_15)],
dependencies: [
.package(
url: "https://github.com/swiftlang/swift-java",
.upToNextMinor(from: "0.4.0")
),
],
targets: [
.executableTarget(name: "Target"),
]
)
Build and run an executable target that has nothing to do with swift-java;
Observe that StaticBuildConfigPluginExecutable related targets (such as SwiftSyntax and Subprocess) appear in the build log, and that the target takes significantly longer to build than if you remove the unused swift-java dependency.
SwiftPM itself even states that the swift-java dependency is unused (which is a bit contradictory).
Here's a simple Swift package that reproduces the issue: SwiftJavaUser.zip
I'm encountering a rather annoying issue which is causing swift-java's StaticBuildConfigPluginExecutable target to be built when building unrelated SwiftPM targets that don't import anything from swift-java at all.
I believe this is a SwiftPM issue, but I figured I'd report it here first in case anyone else has encountered the issue and found a workaround.
I'll file a SwiftPM issue once I've got a more minimal reproducer.
Reproducing
Add swiftlang/swift-java to a package (without actually using it anywhere);
Build and run an executable target that has nothing to do with swift-java;
Observe that StaticBuildConfigPluginExecutable related targets (such as SwiftSyntax and Subprocess) appear in the build log, and that the target takes significantly longer to build than if you remove the unused swift-java dependency.
SwiftPM itself even states that the swift-java dependency is unused (which is a bit contradictory).
Here's a simple Swift package that reproduces the issue: SwiftJavaUser.zip