I'm trying to select between the development and distribution provisioning profiles for my iOS application built with Bazel.
Right now I'm hacking this with a config_setting based on the compilation mode:
config_setting(
name = "isFastBuild",
values = {"compilation_mode": "fastbuild"}
)
config_setting(
name = "isDebugBuild",
values = {"compilation_mode": "dbg"}
)
config_setting(
name = "isOptimizedBuild",
values = {"compilation_mode": "opt"}
)
...
provisioning_profile = select({
":isFastBuild": ":DevelopmentProfile",
":isDebugBuild": ":DevelopmentProfile",
":isOptimizedBuild": ":DistributionProfile",
}),
But ideally I could just pass an environment variable that would make this more explicit since the compilation mode doesn't really imply whether it's a release build or not.
Is there a way I can use an environment variable (or some other feature) to accomplish this more explicitly?
There are a number of things you can do:
constraint_setting
with appropriate constraint_values
for each of your profiles. Then make a platform for each release profile that sets the appropriate constraint value, and use the correct platform with --platforms
when you want to build.build_setting
instead of constraint_setting
. Making it a flag will enable you to set it's value on the command line. You can use build settings in select()
statements by wrapping it in a config_setting
.