Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add Bundle Items for specific Scheme?

I would like to add some bundle items just for a specific scheme. I could create a run-script, but there i am unable to read out the current scheme.

Is there another chance to add some bundle files only for a specific scheme in Xcode 9.x?

like image 545
derdida Avatar asked Nov 02 '17 14:11

derdida


3 Answers

In script you can get your current build configuration.

You can duplicate your current build configuration, this will save all your settings for that config. After that rename your new config and refer to it in your scheme you would like to add bundle items to (there is no need to use separate scheme, you can say that, for example, you want to add that resources only for running. In that case just set your new config to Run build configuration of your existing scheme).

After you have all set up you can check on specific config in your run-script like this:

if [ "${CONFIGURATION}" = "BetaDebug" ] || [ "${CONFIGURATION}" = "BetaRelease" ] ; then
// Do something specific for that config
elif [ "${CONFIGURATION}" = "ProductionDebug" ] || [ "${CONFIGURATION}" = "ProductionRelease" ] ; then
// Do something specific for that config
fi

where "${CONFIGURATION}" is config name.

like image 103
LowKostKustomz Avatar answered Oct 24 '22 07:10

LowKostKustomz


Run the script like this after Copy Bundle Resources phase:

if [ "${CONFIGURATION}" = "Release" ]; then
cp -r ${PROJECT_DIR}/Settings/production/Settings.bundle "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app"
fi
like image 5
Andy Jazz Avatar answered Oct 24 '22 08:10

Andy Jazz


Unfortunately you can't add a file just for a specific scheme using Xcode 9, but You can create a new target duplicating the other one, and you can configure your particular scheme to build that special target. In this way you can add files just to the special target (and indirectly to the special scheme) For target duplication it's very easy to do. You can take a look at this answer

Here you can find a tutorial on how to use targets to manage development builds Vs production builds.

Hope this answer your question.

like image 2
Giuseppe Lanza Avatar answered Oct 24 '22 06:10

Giuseppe Lanza