theappbusiness / ConfigGenerator

Configuration file code generator for use in Xcode projects
MIT License
157 stars 19 forks source link

Project configuration #21

Open ealeksandrov opened 7 years ago

ealeksandrov commented 7 years ago

Finally, you need to create a build target for each of your enviroments. This can be done be selecting File -> New -> Target and selecting 'External Build System'

The best way to support multiple environments is to define a separate scheme for each one. Then add the relevant target as an external build step for each scheme ensuring that 'Parallelize Build' is disabled.

Why is this so complex? I found adding build pre-action in scheme settings working just fine:

screen shot 2017-07-14 at 15 11 17

Am I missing something?

samdods commented 6 years ago

@ealeksandrov have you verified whether this works when building from the command line?

ealeksandrov commented 6 years ago

@samdods yep, it generates different configs when using xcodebuild with different -scheme option. Important part here is to mark scheme as shared to save script in source control and reuse inside dev team and CI.

samdods commented 6 years ago

Thanks, I'll update the readme and the blogpost

On 20 Oct 2017, at 11:44, Evgeny Aleksandrov notifications@github.com wrote:

@samdods yep, it generates different configs when using xcodebuild with different -scheme option. Important part here is to mark scheme as shared to save script in source control.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

ealeksandrov commented 6 years ago

Cool! You can also mention configen availability on homebrew - #22.

KaneCheshire commented 6 years ago

Issue #21: Project configuration

samdods commented 6 years ago

@ealeksandrov, when using your configuration, I don't seem to get build errors when there's a problem.

ealeksandrov commented 6 years ago

@samdods output (stdout/stderr) from scheme scripts are not redirected into Xcode.

But function output can be checked and handled in same script like:

configen -p ${SRCROOT}/Configs/prod-config.plist -h ${SRCROOT}/Configs/AppEnvironment.map -n AppConfig -o ${SRCROOT}/Configs

if [ $? -ne 0 ]
then rm ${SRCROOT}/Configs/AppConfig.swift
fi

I can confirm it's working for me. If any error arises - AppConfig.swift will be removed to trigger compile-time error. Another good idea is to append/replace this file with error string, Xcode will stop on it and present to user. But it will require little more bash-magic. And maybe this should go into configen itself since it already generates this file? Not sure about your direction and vision here. Let me know how can I help!