Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project configuration #21

Open
ealeksandrov opened this issue Jul 14, 2017 · 7 comments
Open

Project configuration #21

ealeksandrov opened this issue Jul 14, 2017 · 7 comments

Comments

@ealeksandrov
Copy link

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
Copy link
Contributor

samdods commented Oct 18, 2017

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

@ealeksandrov
Copy link
Author

ealeksandrov commented Oct 20, 2017

@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
Copy link
Contributor

samdods commented Oct 20, 2017 via email

@ealeksandrov
Copy link
Author

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

@KaneCheshire
Copy link
Contributor

@samdods
Copy link
Contributor

samdods commented Jan 15, 2018

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

@ealeksandrov
Copy link
Author

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants