You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a Package.swift file declares multiple targets in which some targets are conditional dependencies of other targets, the compiler does not correctly honor this condition. As an example:
// swift-tools-version:5.3// The swift-tools-version declares the minimum version of Swift required to build this package.importPackageDescriptionletpackage = Package(
name: "SPM-Platform-Bug",
platforms: [
.iOS(.v12),
.macOS(.v10_15)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "SPM-Platform-Bug",
targets: ["SPM-Platform-Bug"]),
],
dependencies: [
.package(name: "Lasso", url: "git@github.com:ww-tech/lasso.git", .exact("1.0.1"))
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "SPM-Platform-Bug",
dependencies: [
.byName(name: "iOS-ONLY", condition: .when(platforms: [.iOS]))
],
path: "Sources/SPM-Platform-Bug"
),
.target(
name: "iOS-ONLY",
dependencies: [
.byName(name: "Lasso")
],
path: "Sources/iOS-ONLY"
)
]
)
In this example, you can see that I have a single third party dependency called "Lasso", which heavily relies on UIKit. That framework is listed as a dependency of my "iOS-ONLY" target, which is then an iOS only dependency of my "SPM-Platform-Bug" target. The "SPM-Platform-Bug" target is the only one being vended by my package. If you resolve this package and build with macOS as the target, it will still try to compile "iOS-ONLY" and its dependencies, even though that target should not be included for macOS. It should only build the "SPM-Platform-Bug" target and correctly ignore the other one since it is not a dependency of any target being included with my macOS framework.
This bug was reproduced on Xcode 12 beta 1
The text was updated successfully, but these errors were encountered:
Additional Detail from JIRA
md5: 1e01f86acfc324ac8f4fe34806f2ef17
Issue Description:
When a Package.swift file declares multiple targets in which some targets are conditional dependencies of other targets, the compiler does not correctly honor this condition. As an example:
In this example, you can see that I have a single third party dependency called "Lasso", which heavily relies on UIKit. That framework is listed as a dependency of my "iOS-ONLY" target, which is then an iOS only dependency of my "SPM-Platform-Bug" target. The "SPM-Platform-Bug" target is the only one being vended by my package. If you resolve this package and build with macOS as the target, it will still try to compile "iOS-ONLY" and its dependencies, even though that target should not be included for macOS. It should only build the "SPM-Platform-Bug" target and correctly ignore the other one since it is not a dependency of any target being included with my macOS framework.
This bug was reproduced on Xcode 12 beta 1
The text was updated successfully, but these errors were encountered: