In my mission to figure out how to restrict an SPM dependency for Apple Silicon platforms, I was poking around the
PackageDescription definition and noticed that if
configuration were allowed in
TargetDependencyCondition.when, we'd have an available workaround, given that we currently only need to strip Apple Silicon-incompatible dependencies on the
SE-0273 includes it in a
target definition very clearly, but it was not implemented this way.
So why does
TargetDependencyCondition.when not offer a
configuration option? I can see why this would not typically make sense, but would love to understand more about why it is explicitly not included in this
Condition struct given that it was in the proposal.
If it were allowed, this seems like it would offer a pretty easy way to differentiate local dependencies vs. dependencies that are only needed when the application is built for production, which could even help optimize some larger projects as well.
The signature for
public static func when(platforms: [PackageDescription.Platform]? = nil) -> PackageDescription.TargetDependencyCondition
while the signature for
public static func when(platforms: [PackageDescription.Platform]? = nil, configuration: PackageDescription.BuildConfiguration? = nil) -> PackageDescription.BuildSettingCondition