Copy files to bundle depending on active configuration

xcode configuration file
xcode environment variables configuration
how to create config file in swift
configuration file ios
xcconfig framework_search_paths
cisco pkg vs bin
xcodebuild configuration
multiple xcconfig files

is it possible to control which files are copied to the bundle depending on the active configuration? I don't want to add another target for this, so this not an option.

The real life example is a splash video which is in fact 8mb in size and is long. Every start of the app shows this video which is annoying. I don't want to break too much code so the solution is a very short splash video, which is the candidate to be copied to the bundle when the debug configuration is active.

Yes, I could make the debug video very small so it doesn't hurt if it is shipped with the release but for the sake of learning new things I need a way to control which file is copied depending on the configuration. I suppose a Run Script would do this, but maybe there is a simple solution which I don't see.

Thanks in advance!

I didn't find any better solution than using a Run Script. Best reference is Copy file to the App Resources directory if debug configuration is selected.

I solved my problem with this run script:

RESOURCE_PATH=$SRCROOT/ResourcesCopiedByRunScript

FILENAME_IN_BUNDLE=splashVideo.mp4

BUILD_APP_DIR=${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}

if [ "$CONFIGURATION" == "Debug" ]; then
    cp "$RESOURCE_PATH/shortDebugSplashVideo.mp4" "$BUILD_APP_DIR/$FILENAME_IN_BUNDLE"
else
    cp "$RESOURCE_PATH/productionSplashVideo.mp4" "$BUILD_APP_DIR/$FILENAME_IN_BUNDLE"
fi

xcode, is it possible to control which files are copied to the bundle depending on the active configuration? I don't want to add another target for this, so this not an option. No, you cannot copy files directly between the two ASA's. You need to first move the file from one ASA to another location and next from that location to the other ASA. But, not directly between the ASA's. For ASDM access of secondary, you can configure port redirection on primary ASA.

If you can give the two different files the same name, you can put them in the build products folders for the appropriate configuration. Then add one of them to the project, and make it a reference relative to the build product.

If you want to have the files live elsewhere, you can put symbolic links in the build products folders. But I'm not sure if it would work if the files have different names but the symlinks have the same name.

I've done this trick on Mac projects, I'm assuming it would work for iOS too.

Edit: Here's an example of something I've done: I want the debug build of my app to link against the debug build of a certain library, and I want the release build of the app to link against the release build of the library. So I put the debug library (or a symlink to it) into the Debug subfolder of the app build folder, and I put the release library into the Release subfolder of the app build folder. Then, when I add the library to the project, I specify that the reference is "relative to build product".

Professional Xcode 3, Copy Bundle Resources copies any input file into the Resources folder of the productrelative references are based on the active build configuration and target​  This post contains and describes a script for copying per-user configuration and data files to every user's profile on a system as well as why this is needed, how to use the script, and how to implement the script in the context of System Center Configuration Manager (ConfigMgr).

The best way to do it using Exclude Source File Names under Build Settings as it shown in the image.

Beginning Xcode, If you have two build configurations, Debug and Release, every target will produce of the standard folders inside a bundle, assuming the target produces a bundle. relative references are based on the active build configuration and target? applicable to product file references used as input files to a Copy Files phase. The second time I do this, it will overwrite the file: R1#copy running-config my-config.cfg Destination filename [my-config.cfg]? %Warning:There is a file already existing with this name Do you want to over write? [confirm] 1072 bytes copied in 0.648 secs (1654 bytes/sec) Copy to running-config. Copying something to the running configuration

You can replace one file to another using run script before compile step

RESOURCE_PATH=$SRCROOT/SampleProject/SupportingFiles/

LICENSE=license.txt
LICENSE_PROD=license_prod.txt

if [ "$CONFIGURATION" == "Release" ]; then
cp $RESOURCE_PATH/$LICENSE_PROD $RESOURCE_PATH/$LICENSE
fi

Cisco IOS File System, Configuration Files, and Bundle Files , This appendix describes how to manipulate the Catalyst 3850 switch flash file system, how to copy configuration files, and how to install and copy  Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset. webpack is a module bundler. Sponsor webpack and get apparel from the official shop !

Xcode Build Configuration Files, This week, we'll show you how you can use text-based xcconfig files to Xcode build configuration files, more commonly known by their xcconfig file setting to speed up local builds by only compiling for the active architecture: any targets and don't appear in any “Copy Bundle Resources” build phases. is it possible to control which files are copied to the bundle depending on the active configuration? I don't want to add another target for this, so this not an option. The real life example is a splash video which is in fact 8mb in size and is long. Every start of the app shows this video which is annoying.

How to Setup Configurations and Schemes in XCode, The reason for creating 1 Debug and 1 Release configuration is: such as a bundle version, that can be used within the Info.plist file to change to tailor the source code based on the current environment that is being built. The replacement file must be a complete configuration generated by a Cisco IOS device (for example, a configuration generated by the copy running-config destination-url command). Note If you generate the replacement configuration file externally, it must comply with the format of files generated by Cisco IOS devices.

Download Firebase config file or object, You can download the Firebase config file or Firebase config object for each of your In the Your apps card, select the bundle ID of the app for which you need a config file. Copy the config object snippet, then add it to your app's HTML. 4. Create a batch file called filecopy.bat with the below two lines and place it in the parent directory created in step 1. This batch file will create a folder specified on the command-line (if it doesn’t already exist) and copy the files from the Files2Copy folder into it. if not exist "%~1" md "%~1" copy /y "%~dp0Files2Copy\*.*" "%~1" 5.

Comments
  • A good question, and if I am asked, I would say no. I am just doing this for a customer and I'd like to protect my sanity from this video so there is no real choice :)
  • I understand your point, and it's nice question to find out. This should reduce the build time a lot after cleaning up the target too.
  • Does this then put the file in the "Copy Bundle Resources" place under Build Phases? I'm trying it out and not seeing my test file show up there.
  • It's been a while since I answered myself, but I assume it is not placing the file in that particular list. It will copy the file directly to the bundle. Best explored with the simulator.
  • Right. I noticed the the files are indeed included in the bundle but do not show up in the "Copy Bundle Resources" place under Build Phases. Thanks for the solution though!
  • My paths contained spaces, which made cp choke. Edited the code with a fix.
  • I'm a bit uncertain how to do what you suggested. Can you give some kind of example?
  • What happens when you clean your build?
  • @Justin: Good point, that wipes out the symlinks... actually, I have a script build phase that creates the symlinks.
  • No need of scripts, build phase, Xcode default option.