swiftlang / swiftlang/swift-java
Building a package for Apple platform shouldn't use JExtractSwiftPlugin plugin and swift-java dependency at all
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 1.2k
- Forks
- 123
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 16
Description
As per discussion with @ktoso on Slack:
When using a shared Swift package between Android and iOS, macOS etc…, we can't have the JExtractSwiftPlugin be used, and we don't want the swift-java dependency at all even.
The current workaround is to use an ENV variable inside the Package.swift manifest which only adds the dependency and plugin to the target if built for Android (The environment variable needs to be set in the gradle script in that case)
import Foundation.NSProcessInfo
let isSwiftJavaBuild = ProcessInfo.processInfo.environment["SWIFT_JAVA_BUILD"] != nil
if isSwiftJavaBuild {
package.targets.first?.dependencies.append(.product(name: "SwiftJava", package: "swift-java"))
package.targets.first?.plugins?.append(.plugin(name: "JExtractSwiftPlugin", package: "swift-java"))
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Package.swift manifest and the Gradle script described in the issue. Review how the Swift package is configured for Apple and Android builds, then verify that Apple builds do not add the SwiftJava dependency or JExtractSwiftPlugin while Android builds retain the required integration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100