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:

/www/js/app/
/www/js/vendor/
/www/html/some_page.html

      

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

+3


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;
fi
cd $DSTROOT
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):

*.svg
README

      



Now add a new RunScript build target and type

"$PROJECT_DIR/$PROJECT_NAME/remove_files.sh"

      

in the box where the script code is usually placed.

+3


source







All Articles