Reputation: 24757
I am trying to get the current scheme name and set it as a value in my plist. I am running the following shells script:
/usr/libexec/PlistBuddy -c "Set :SchemeName \"$SCHEME_NAME\"" "$INFOPLIST_FILE"
The result is that the scheme name is an empty string. If i set some constant string it works perfectly. How can i get the current scheme name?
Upvotes: 3
Views: 4197
Reputation: 1828
It seems the scheme name isn't available in the build phase scripts.
You have $CONFIGURATION
environment variable, but that is just the build configuration (set in Edit scheme > Info), e.g. Debug
or Release
. But many schemes can have the same build configuration.
It might suit you to create a new build configuration just for a specific scheme, duplicated from an existing build configuration. I did this when I had a Staging scheme which needed specific tweaks in my custom build-phase script.
How to create a new build configuration...
+
button and pick a configuration to duplicate.Once you have that you can go edit your scheme and change its build configuration to the new one. Then your scripts will know it's using that scheme.
Upvotes: 0
Reputation: 11016
You can't.
From https://developer.apple.com/library/ios/featuredarticles/XcodeConcepts/Concept-Schemes.html:
An Xcode scheme defines a collection of targets to build, a configuration to use when building, and a collection of tests to execute.
So this is purely an Xcode interface feature, and it's not part of the build process.
If you want to know for which build configuration (eg. Debug
or Release
) you're compiling for though, you can use $CONFIGURATION
.
Upvotes: 7