Register options that takes files as argument to exclude these files for every build

This commit is contained in:
Antonin Décimo
2014-08-24 11:12:57 +02:00
parent fd4e0195a7
commit 967a483355
4 changed files with 26 additions and 7 deletions

View File

@@ -29,6 +29,11 @@ SCRIPT_ARGS="a; activity: apk-package-version: apk-maintainer-name: apk-package-
SCRIPT_ARGS="m; osx-icon: osx-maintainer-name: $SCRIPT_ARGS" SCRIPT_ARGS="m; osx-icon: osx-maintainer-name: $SCRIPT_ARGS"
## List the options that require a file/directory that should be excluded by zip.
EXCLUDE_OPTIONS=("win-icon" "osx-icon")
EXCLUDE_CONFIG=("INI__windows__icon" "INI__macosx__icon")
## Add a short summary of your platform script here ## Add a short summary of your platform script here
## SHORT_HELP=" -a Create an executable for a ## SHORT_HELP=" -a Create an executable for a
## --osname Create an executable for osname" ## --osname Create an executable for osname"
@@ -84,7 +89,7 @@ CONFIG=false
CONFIG_FILE=config.ini CONFIG_FILE=config.ini
PROJECT_FILES= PROJECT_FILES=
EXCLUDE_FILES=$(/bin/ls -A | grep "^[.]" | tr '\n' ' ') MAIN_EXCLUDE_FILES=
PROJECT_NAME="${PWD##/*/}" PROJECT_NAME="${PWD##/*/}"
PROJECT_DIR="$PWD" PROJECT_DIR="$PWD"
@@ -134,6 +139,10 @@ do
if [ -n "${INI__global__project_name}" ]; then if [ -n "${INI__global__project_name}" ]; then
PROJECT_NAME=${INI__global__project_name} PROJECT_NAME=${INI__global__project_name}
fi fi
for option in "${EXCLUDE_CONFIG[@]}"
do
MAIN_EXCLUDE_FILES="${!option} $MAIN_EXCLUDE_FILES"
done
fi fi
done done
unset OPTIND unset OPTIND
@@ -164,6 +173,12 @@ do
missing_operands=false missing_operands=false
rm -rf "$MAIN_CACHE_DIR" rm -rf "$MAIN_CACHE_DIR"
fi fi
for option in "${EXCLUDE_OPTIONS[@]}"
do
if [ "$OPTOPT" = "$option" ]; then
MAIN_EXCLUDE_FILES="$OPTARG $MAIN_EXCLUDE_FILES"
fi
done
done done
shift $((OPTIND-1)) shift $((OPTIND-1))
for file in "$@" for file in "$@"
@@ -184,6 +199,7 @@ init_module ()
GLOBAL_OPTOFS=$OPTOFS GLOBAL_OPTOFS=$OPTOFS
unset OPTIND unset OPTIND
unset OPTOFS unset OPTOFS
EXCLUDE_FILES=$MAIN_EXCLUDE_FILES
if [ -z "$MAIN_RELEASE_DIR" ]; then if [ -z "$MAIN_RELEASE_DIR" ]; then
MAIN_RELEASE_DIR=$(cd "$(dirname "$RELEASE_DIR")" && pwd)/$(basename "$RELEASE_DIR") MAIN_RELEASE_DIR=$(cd "$(dirname "$RELEASE_DIR")" && pwd)/$(basename "$RELEASE_DIR")
RELEASE_DIR="$MAIN_RELEASE_DIR"/$LOVE_VERSION RELEASE_DIR="$MAIN_RELEASE_DIR"/$LOVE_VERSION
@@ -201,9 +217,9 @@ create_love_file ()
cd "$PROJECT_DIR" cd "$PROJECT_DIR"
rm -rf "$RELEASE_DIR"/"$PROJECT_NAME".love 2> /dev/null rm -rf "$RELEASE_DIR"/"$PROJECT_NAME".love 2> /dev/null
if [ -z "$PROJECT_FILES" ]; then if [ -z "$PROJECT_FILES" ]; then
zip --filesync -$1 -r "$RELEASE_DIR"/"$PROJECT_NAME".love -x "$0" "${MAIN_RELEASE_DIR#$PWD/}/*" "$CONFIG_FILE" $EXCLUDE_FILES @ * zip --filesync -$1 -r "$RELEASE_DIR"/"$PROJECT_NAME".love -x "$0" "${MAIN_RELEASE_DIR#$PWD/}/*" "$CONFIG_FILE" $MAIN_EXCLUDE_FILES $EXCLUDE_FILES $(/bin/ls -A | grep "^[.]" | tr '\n' ' ') @ *
else else
zip --filesync -$1 -r "$RELEASE_DIR"/"$PROJECT_NAME".love -x "$0" "${MAIN_RELEASE_DIR#$PWD/}/*" "$CONFIG_FILE" $EXCLUDE_FILES @ $PROJECT_FILES zip --filesync -$1 -r "$RELEASE_DIR"/"$PROJECT_NAME".love -x "$0" "${MAIN_RELEASE_DIR#$PWD/}/*" "$CONFIG_FILE" $MAIN_EXCLUDE_FILES $EXCLUDE_FILES $(/bin/ls -A | grep "^[.]" | tr '\n' ' ') @ $PROJECT_FILES
fi fi
cd "$RELEASE_DIR" cd "$RELEASE_DIR"
LOVE_FILE="$PROJECT_NAME".love LOVE_FILE="$PROJECT_NAME".love

View File

@@ -25,7 +25,12 @@
# - a dot "." if it has an optional argument # - a dot "." if it has an optional argument
# - a colon ":" if it requires an argument # - a colon ":" if it requires an argument
# If you need options that might conflict by their names with already defined options, please prefix them. # If you need options that might conflict by their names with already defined options, please prefix them.
SCRIPT_ARGS="q; wer: ty. uiop $SCRIPT_ARGS" SCRIPT_ARGS="q; wer: ty. uiop $SCRIPT_ARGS"
# If some options require a file or a directory as argument,
# and this file should be excluded by zip, add the option.
EXCLUDE_OPTIONS=("wer")
EXCLUDE_CONFIG=("INI__q__wer")
## 2. Add a short summary of your module ## 2. Add a short summary of your module
SHORT_HELP=" -q Create an Example application" SHORT_HELP=" -q Create an Example application"
@@ -45,7 +50,7 @@ done
## $MAIN_CACHE_DIR - if you need to cache something independant from love version ## $MAIN_CACHE_DIR - if you need to cache something independant from love version
## $CACHE_DIR - if you need to cache something dependant from love version ## $CACHE_DIR - if you need to cache something dependant from love version
## $PROJECT_FILES - if empty, means * ## $PROJECT_FILES - if empty, means *
## $EXCLUDE_FILES - every hidden file (.*) is excluded ## $EXCLUDE_FILES - add files to be excluded by zip.
## $PROJECT_NAME ## $PROJECT_NAME
## $PROJECT_DIR ## $PROJECT_DIR
## $RELEASE_DIR ## $RELEASE_DIR

View File

@@ -22,7 +22,6 @@ do
MAINTAINER_NAME=$OPTARG MAINTAINER_NAME=$OPTARG
fi fi
done done
EXCLUDE_FILES="$EXCLUDE_FILES $PROJECT_ICNS"
PACKAGE_NAME=$(echo $PROJECT_NAME | sed -e 's/[^-a-zA-Z0-9_]/-/g') PACKAGE_NAME=$(echo $PROJECT_NAME | sed -e 's/[^-a-zA-Z0-9_]/-/g')

View File

@@ -19,7 +19,6 @@ do
PROJECT_ICO=$OPTARG PROJECT_ICO=$OPTARG
fi fi
done done
EXCLUDE_FILES="$EXCLUDE_FILES $PROJECT_ICO"
# Wine # Wine
FOUND_WINE=true FOUND_WINE=true