Is it reproducible with SwiftPM command-line tools: swift build, swift test, swift package etc?
Description
When specifying a condition for a dependency of a target, it will not appear in the target.dependencies, evne if the condition is fulfilled.
Take for example the following example, where we want to use OkHttp only on Android:
.product(
name: "OkHttp",
package: "swift-openapi-okhttp",
condition: .when(platforms: [.android])
),
Inside the swift-java JExtract build plugin we are traversing the dependencies of the target, to find any related config files. OkHttp does not appear in target.dependencies when using condition:. This is even though we are building for Android with the Swift Android SDK.
This therefore means the JExtract build plugin is not able to find any config files related to OkHttp, and we are forced to include that dependency on all platforms, or do some ugly #if !canImport(Darwin) hack.
Removing
condition: .when(platforms: [.android])
makes OkHttp appear in the dependency list.
Expected behavior
I would expect the conditional dependency to appear in the list, especially when the condition is fulfilled.
Actual behavior
No response
Steps to reproduce
No response
Swift Package Manager version/commit hash
6.3
Swift & OS version (output of swift --version ; uname -a)
No response
Is it reproducible with SwiftPM command-line tools:
swift build,swift test,swift packageetc?swift build,swift test,swift packageetc.Description
When specifying a
conditionfor a dependency of a target, it will not appear in thetarget.dependencies, evne if the condition is fulfilled.Take for example the following example, where we want to use
OkHttponly on Android:Inside the
swift-javaJExtract build plugin we are traversing the dependencies of the target, to find any related config files.OkHttpdoes not appear intarget.dependencieswhen usingcondition:. This is even though we are building for Android with the Swift Android SDK.This therefore means the JExtract build plugin is not able to find any config files related to OkHttp, and we are forced to include that dependency on all platforms, or do some ugly
#if !canImport(Darwin)hack.Removing
makes
OkHttpappear in the dependency list.Expected behavior
I would expect the conditional dependency to appear in the list, especially when the condition is fulfilled.
Actual behavior
No response
Steps to reproduce
No response
Swift Package Manager version/commit hash
6.3
Swift & OS version (output of
swift --version ; uname -a)No response