Exclude files and directories from XCode 4 PhoneGap Build

I know that I can revoke the "Target Membership" in the Utility scope in XCode 4 to prevent the file from being included in the Xcode assembly; however for PhoneGap / Cordova apps only the www / root directory actually lists this as an option. Directories inside www / cannot be inappropriate.

Another option that I'm vaguely familiar with is using EXCLUDED_SOURCE_FILE_NAMES

in build settings, although I'm not entirely sure if this can be used to exclude directories in addition to files.

What would be the best solution to remove (for example) the following directories / files from the assembly:



Obviously I would like to leave these files there for development (since I just run the build script to cat / minify them).


source to share

1 answer

At the root of your project, add the list of files:

#!/bin/bash -x
# ATTENTION: You must use the following to run as RunScript target in Xcode
# ${PROJECT_DIR}/$PROJECT_NAME/remove_files.sh
# Remove all unwanted files
if ! [ -d $DSTROOT ]; then
        echo "$DSTROOT is not a directory, probably is non-archive build. Exiting.";
        exit 0;
cat "$PROJECT_DIR/$PROJECT_NAME/exclude_files.txt" | while read file; do find . -name "$file" | xargs -n1 rm -Rf; done


Then create a file YourProject / exclude_files.txt and fill it with names to remove (wildcards can be used):



Now add a new RunScript build target and type



in the box where the script code is usually placed.



All Articles