Skip to content

Bump swift-subprocess to 1.0 - #937

Open
rayman-zhao wants to merge 1 commit into
swiftlang:mainfrom
rayman-zhao:subprocess-1.0
Open

rayman-zhao wants to merge 1 commit into
swiftlang:mainfrom
rayman-zhao:subprocess-1.0

Conversation

@rayman-zhao

Copy link
Copy Markdown
Contributor

Supersedes #936 — resubmitted after removing accidentally committed local build artifacts; the actual changes are identical. (That PR could not be reopened because its branch was force-pushed after closing.)

Motivation

swift-java currently pins swift-subprocess to 0.4.0..<0.5.0, while Subprocess 1.0 has been released (shipping with Swift 6.4). The 0.4 pin makes it impossible to use swift-java in a package graph that also contains a package requiring swift-subprocess 1.0, since SwiftPM must pick a single version for the whole graph. Subprocess 1.0.0 also includes a PATH-resolution security fix for Executable.name(_:).

Changes

  • Package.swift: "0.4.0"..<"0.5.0" -> "1.0.0"..<"2.0.0" (the SubprocessFoundation trait is kept; it now provides .data(limit:))
  • JavaCallbacksBuildCommand.swift: FileDescriptorOutput.standardOutput/.standardError -> .currentStandardOutput/.currentStandardError (renamed in 0.5)
  • JavaDependencyResolver.swift, CompileJavaTool.swift: drop ?? "" fallbacks — StringOutput results are non-optional String since 1.0
  • StaticBuildConfigPluginExecutable.swift: replace the if let error = result.standardError optional binding with a plain non-optional check (required: the value is no longer optional)

Testing

Built on Windows (Swift 6.4.1, JDK 25): swift build --target swift-java, --target StaticBuildConfigPluginExecutable, and --target SwiftJavaToolLibTests all pass with swift-subprocess resolved at 1.0.2.

Update the swift-subprocess dependency from 0.4.x to 1.0 and adapt to
the API changes introduced along the way:

- FileDescriptorOutput.standardOutput/.standardError were renamed to
  .currentStandardOutput/.currentStandardError
- StringOutput's standardOutput/standardError are now non-optional
  String, dropping the '?? ""' fallbacks and the optional binding

Subprocess 1.0 ships with Swift 6.4 and includes a PATH-resolution
security fix for Executable.name(_:).
@rayman-zhao
rayman-zhao requested a review from ktoso as a code owner October 17, 2026 09:27
@rayman-zhao

Copy link
Copy Markdown
Contributor Author

The failing Test (Swift) (noble swift:6.1.3) job is a toolchain-floor conflict rather than a code issue:

error: Dependencies could not be resolved because 'swift-subprocess' >= 0.5.0
contains incompatible tools version (6.2.0) and root depends on 'swift-subprocess' 1.0.0..<2.0.0.

swift-subprocess 0.5+ declares swift-tools-version: 6.2, so it cannot be resolved by the 6.1.3 toolchain at all — which I suspect is exactly why this package is pinned to 0.4.x today. All other jobs (6.3, nightly, macOS, benchmarks, samples, soundness) pass.

So this bump inherently means dropping Swift 6.1 toolchain support, which is a project-policy call. Happy to go either way:

  • If you're ready to raise the minimum toolchain, I can extend this PR with the swift-tools-version bump and remove 6.1.3 from the CI matrix.
  • If 6.1 support needs to stay for now, closing/deferring this PR is completely fine. (Context for the motivation: unblocking package graphs that need swift-java alongside a package depending on swift-subprocess 1.0, plus picking up the Executable.name(_:) PATH-resolution security fix.)

@ktoso

ktoso commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator

Hm yeah I'll have to check with adopters. We might need to be slow to drop 6.1 even though we're not officially a 1.0...

Thank you for the pr in any case.
I'll follow up soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants