Updated Branches: refs/heads/master b5454942c -> ce766c613
[CB-4469] move copy resource script out of project file Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/ce766c61 Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/ce766c61 Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/ce766c61 Branch: refs/heads/master Commit: ce766c6139e288ce0b4592fb915890018681b8b9 Parents: b545494 Author: David Kemp <[email protected]> Authored: Tue Jul 30 20:07:35 2013 -0400 Committer: Max Woghiren <[email protected]> Committed: Wed Aug 7 12:10:44 2013 -0400 ---------------------------------------------------------------------- .../__TESTING__.xcodeproj/project.pbxproj | 2 +- bin/templates/project/copy_www.sh | 79 ++++++++++++++++++++ 2 files changed, 80 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce766c61/bin/templates/project/__TESTING__.xcodeproj/project.pbxproj ---------------------------------------------------------------------- diff --git a/bin/templates/project/__TESTING__.xcodeproj/project.pbxproj b/bin/templates/project/__TESTING__.xcodeproj/project.pbxproj index 0001f60..d0f522c 100755 --- a/bin/templates/project/__TESTING__.xcodeproj/project.pbxproj +++ b/bin/templates/project/__TESTING__.xcodeproj/project.pbxproj @@ -356,7 +356,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "SRC_DIR=\"www/\"\nDST_DIR=\"$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/www\"\nCOPY_HIDDEN=\nORIG_IFS=$IFS\nIFS=$(echo -en \"\\n\\b\")\n\nif [[ ! -e \"$SRC_DIR\" ]]; then\n echo \"Path does not exist: $SRC_DIR\"\n exit 1\nfi\n\nif [[ -n $COPY_HIDDEN ]]; then\n alias do_find='find \"$SRC_DIR\"'\nelse\n alias do_find='find -L \"$SRC_DIR\" -name \".*\" -prune -o'\nfi\n\ntime (\n# Code signing files must be removed or else there are\n# resource signing errors.\nrm -rf \"$DST_DIR\" \\\n \"$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/_CodeSignature\" \\\n \"$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/PkgInfo\" \\\n \"$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/embedded.mobileprovision\"\n\n# Directories\nfor p in $(do_find -type d -print); do\n subpath=\"${p#$SRC_DIR}\"\n mkdir \"$DST_DIR$subpath\" || exit 1\ndone\n\n# Symlinks\nfor p in $(do_find -type l -print); do\n subpath=\"${p#$SRC_DIR}\"\n source=$(readlink $SRC_DIR$subpath)\n sourcetype=$(stat -f \"%HT%SY\" $source)\n if [ \"$sourcetype\" = \"Directory\" ]; then\n mkdir \"$DST_DIR$subpath\" || exit 2\n else\n rsync -a \"$source\" \"$DST_DIR$subpath\" || exit 3\n fi\ndone\n\n# Files\nfor p in $(do_find -type f -print); do\n subpath=\"${p#$SRC_DIR}\"\n if ! ln \"$SRC_DIR$subpath\" \"$DST_DIR$subpath\" 2>/dev/null; then\n rsync -a \"$SRC_DIR$subpath\" \"$DST_DIR$subpath\" || exit 4\n fi\ndone\n\n)\nIFS=$ORIG_IFS"; + shellScript = ./copy_www.sh; }; /* End PBXShellScriptBuildPhase section */ http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/ce766c61/bin/templates/project/copy_www.sh ---------------------------------------------------------------------- diff --git a/bin/templates/project/copy_www.sh b/bin/templates/project/copy_www.sh new file mode 100644 index 0000000..1fe36d8 --- /dev/null +++ b/bin/templates/project/copy_www.sh @@ -0,0 +1,79 @@ +#!/bin/sh +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# +# This script copies the www directory into the Xcode project. +# +# This script should not be called directly. +# It is called as a build step from Xcode. + +SRC_DIR="www/" +DST_DIR="$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/www" +COPY_HIDDEN= +ORIG_IFS=$IFS +IFS=$(echo -en "\n\b") + +if [[ ! -e "$SRC_DIR" ]]; then + echo "Path does not exist: $SRC_DIR" + exit 1 +fi + +if [[ -n $COPY_HIDDEN ]]; then + alias do_find='find "$SRC_DIR"' +else + alias do_find='find -L "$SRC_DIR" -name ".*" -prune -o' +fi + +time ( +# Code signing files must be removed or else there are +# resource signing errors. +rm -rf "$DST_DIR" \ + "$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/_CodeSignature" \ + "$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/PkgInfo" \ + "$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/embedded.mobileprovision" + +# Directories +for p in $(do_find -type d -print); do + subpath="${p#$SRC_DIR}" + mkdir "$DST_DIR$subpath" || exit 1 +done + +# Symlinks +for p in $(do_find -type l -print); do + subpath="${p#$SRC_DIR}" + source=$(readlink $SRC_DIR$subpath) + sourcetype=$(stat -f "%HT%SY" $source) + if [ "$sourcetype" = "Directory" ]; then + mkdir "$DST_DIR$subpath" || exit 2 + else + rsync -a "$source" "$DST_DIR$subpath" || exit 3 + fi +done + +# Files +for p in $(do_find -type f -print); do + subpath="${p#$SRC_DIR}" + if ! ln "$SRC_DIR$subpath" "$DST_DIR$subpath" 2>/dev/null; then + rsync -a "$SRC_DIR$subpath" "$DST_DIR$subpath" || exit 4 + fi +done + +) +IFS=$ORIG_IFS +
