Hello. I think I should explain my situation first.
Now I have a huge one xcodeproj, and i want to split it. so, I'm trying to make local packages. and combine them into the one project.
like, my.xcodeproj = [PackageA.swift, PackageB.swift, PackageC.swift...]
and some packages need conditions like, "is it DEBUG?" or "is it RELEASE?" until now. In fact, I have more build configurations so this contexts can be added. like "is it ad-hoc?" "is it QA?"
before making local packages, I made some custom configurations and flags. furthermore I made schemes like "app-ad-hoc", "app-dev", "app-qa". and I archive and distribute matching target one by one. below json is my abstraction.
{
"app-ad-hoc" : {
"add-hoc-configuration": ["DEBUG", "add-hoc"]
},
"app-ad-hoc-qa" : {
"add-hoc-qa-configuration": ["DEBUG", "add-hoc", "QA"]
},
"app-dev": {
"dev-configuration": ["DEBUG, "DEV"]
},
...
"app-release": {
"release-configuration": ["RELEASE"]
}
}
so, with swift packages, I want to solve this problem as swift's compiler control statements too. like,
// PacakageA
#if DEBUG
something.isDebuggable = true
#elseif QA
something.isQA = true
#endif
If i change this flow, like inject some flags with swift, I have to codes in local packages too. I don't want to do that.
so I've tried to make custom flags in Package.swift
. like,
.target(
name: "Package",
swiftSettings: [
.define("DEBUG", .when(configuration: .debug)),
.define("RELEASE", .when(configuration: .release))
]
),
but there are only two option .debug
and .release
in PackageDescription.BuildConfiguration
and also, my custom configurations are all belong to .release
. so I can't understand how PackageDescription.BuildConfiguration
really match to project's configuration.
Maybe you think It's not appropriate idea for swift packages. like, 'package should be independent'
I want to solve this problem, but I also really expect other ideas.
Thank you for reading. I need your help