e-sites / Natrium

A pre-build (Swift) script to alter your Xcode project at pre-build-time per environment, build configuration and target.
https://www.e-sites.nl
MIT License
146 stars 15 forks source link

Natrium should remove all xcconfig files before generate #20

Closed dangthaison91 closed 5 years ago

dangthaison91 commented 5 years ago

When using Natrium, many times it implicitly failed at local but build still success cause xcconfig files already generated before. This often takes time to check why CI build failed and notice to check Natrium's log.

I'm not sure if once Natrium fails can it make Pre-Action fail the following Build will be failed? If not we can remove all xcconfig files before generating a new one.

basvankuijck commented 5 years ago

Pre-actions unfortunately cannot stop or fail the build itself.

What might improve your CI builds is to call natrium from your build pipeline itself.

For example (in .travis.yml):

language: objective-c
osx_image: xcode10

script:
  - ./natrium -c Release -e Production -t App -p $TRAVIS_BUILD_DIR
  - xcodebuild ... etc
mpsnp commented 5 years ago

Even during development, it's nice to see if last generation was successful. What about creation of extra build step, which will check if there was an error during generation? And build step can fail build as expected.

basvankuijck commented 5 years ago

If a fatalError occurs the Logger will write an #error to Natrium.swift, which will be picked up by xcode's build system at build time (after the pre-action)