I have a user defined build setting at the project level:

Which is fed into the Other Swift flags build setting also at the project level:

This causes the compiler to emit a warning when any function takes longer than 1000 ms to compile. The problem is that CI is much slower than our dev machines, so on our dev machines we would like it to be more like 300 ms, and on CI 2000+ ms, or maybe even just disabled. We run with warnings as errors, so if the CI which is shared machines goes slow this often causes the build to fail.
When running on CI there is a CI environment variable that is set, so I'd like to change the value of the LONG_SWIFT_COMPILE_LIMIT_MS build setting if CI is set or not. How can I do this? I tried adding:
if [ -z ${CI+x} ]; then
# Not running on CI
setenv LONG_SWIFT_COMPILE_LIMIT_MS 300
else
# Running on CI
setenv LONG_SWIFT_COMPILE_LIMIT_MS 2000
fi
as a prebuild script on the scheme, but that didn't work.
xcodebuildis invoked. Alternatively, you can passLONG_SWIFT_COMPILE_LIMIT_MS=2000as an argument toxcodebuild.CIis set beforexcodebuildis invoked. But using my bash script above, theLONG_SWIFT_COMPILE_LIMIT_MSvariable isn't found by Xcode when running it locally. Not sure how to run a script earlier then the scheme pre-build action.xcodebuildflags so addingLONG_SWIFT_COMPILE_LIMIT_MS=2000there works. Then the user definedLONG_SWIFT_COMPILE_LIMIT_MS=300in the project file is used only locally.