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
145 stars 15 forks source link

**target_specific** not inject Natrium variables #14

Closed dangthaison91 closed 5 years ago

dangthaison91 commented 5 years ago

Natrium variable defines in configuration will not affect to target_specific. As I don't misunderstand the log, it shows that natrium_variables will be parsed after target_specific

- Version: 6.1.1

.natrium.yml:

settings:
  class_name: BuildConfiguration

environments:
  - Dev
  - Staging
  - Production

natrium_variables:
  BundleID:
    Dev: com.domain.XXX.dev
    Staging: com.domain.XXX.staging
    Production: com.domain.XXX

xcconfig:
  PRODUCT_BUNDLE_IDENTIFIER: ""

target_specific:
  Target_XXX:
    xcconfig:
      PRODUCT_BUNDLE_IDENTIFIER: "#{BundleID}"

- Natrium log:


12/9/18, 9:09:18 PM - Running Natrium installer (v6.1.1)
12/9/18, 9:09:18 PM - 
12/9/18, 9:09:18 PM - Parsing //Volumes/.../.natrium.yml
12/9/18, 9:09:18 PM -   [environments]
12/9/18, 9:09:18 PM -      - Dev
12/9/18, 9:09:18 PM -      - Staging
12/9/18, 9:09:18 PM -      - Production
12/9/18, 9:09:18 PM -   [settings]
12/9/18, 9:09:18 PM -     class_name = BuildConfiguration
12/9/18, 9:09:18 PM -   [target_specific:Target_XXX]
12/9/18, 9:09:18 PM -     xcconfig
12/9/18, 9:09:18 PM -       PRODUCT_BUNDLE_IDENTIFIER = #{BundleID}
12/9/18, 9:09:18 PM -   [natrium_variables]
12/9/18, 9:09:18 PM -     BundleID =  com.domain.XXX.dev
12/9/18, 9:09:18 PM -   [files]
12/9/18, 9:09:18 PM -     Firebase/GoogleService-Info.plist = Firebase/GoogleService-Info-DEV.plist
12/9/18, 9:09:19 PM -   [xcconfig]
12/9/18, 9:09:19 PM -     PRODUCT_BUNDLE_IDENTIFIER:* = #{BundleID}
12/9/18, 9:09:19 PM - ✅  Natrium ▸ Success!
basvankuijck commented 5 years ago

Thanks for your contribution. Your pull request tackled one part of the problem.

Only when you define an empty xcconfig (or other key) in your yaml file, then a target_specific key would be set. This isn't necessary anymore in v6.1.2