improve gnu scripts

This commit is contained in:
Eugenio Romano
2019-03-20 00:35:15 +00:00
parent e392d3e602
commit 561dd15b04
3 changed files with 17 additions and 2 deletions

View File

@@ -53,7 +53,7 @@ jobs:
- ./scripts/lint.sh || exit 1 - ./scripts/lint.sh || exit 1
- rm -rf tmp && mkdir tmp - rm -rf tmp && mkdir tmp
- git merge-base origin/$TRAVIS_BRANCH HEAD > ./tmp/devhead.txt - git merge-base origin/$TRAVIS_BRANCH HEAD > ./tmp/devhead.txt
- (./scripts/smart-build.sh -b $TRAVIS_BRANCH || exit 1;); - (./scripts/smart-build.sh -b $TRAVIS_BRANCH -gnu || exit 1;);
- npm run build:dist || exit 1 - npm run build:dist || exit 1
- ./scripts/license-list-generator.sh - ./scripts/license-list-generator.sh
- stage: Unit test - stage: Unit test

View File

@@ -48,6 +48,7 @@ git merge-base origin/$BRANCH_NAME HEAD > ./$DIRECTORY/devhead.txt
fi fi
HEAD_SHA_BRANCH="$(cat ./$DIRECTORY/devhead.txt)" HEAD_SHA_BRANCH="$(cat ./$DIRECTORY/devhead.txt)"
echo ""
echo "Branch name $BRANCH_NAME HEAD sha " $HEAD_SHA_BRANCH echo "Branch name $BRANCH_NAME HEAD sha " $HEAD_SHA_BRANCH
# tmp folder doesn't exist. # tmp folder doesn't exist.

View File

@@ -1,20 +1,28 @@
#!/usr/bin/env bash #!/usr/bin/env bash
eval BRANCH_NAME="" eval BRANCH_NAME=""
eval GNU=false
show_help() { show_help() {
echo "Usage: smart-build.sh" echo "Usage: smart-build.sh"
echo "" echo ""
echo "-b branch name" echo "-b branch name"
echo "-gnu for gnu"
} }
branch_name(){ branch_name(){
BRANCH_NAME=$1 BRANCH_NAME=$1
} }
gnu_mode() {
echo "====== GNU MODE ====="
GNU=true
}
while [[ $1 == -* ]]; do while [[ $1 == -* ]]; do
case "$1" in case "$1" in
-b) branch_name $2; shift 2;; -b) branch_name $2; shift 2;;
-gnu) gnu_mode; shift;;
-*) echo "invalid option: $1" 1>&2; show_help; exit 0;; -*) echo "invalid option: $1" 1>&2; show_help; exit 0;;
esac esac
done done
@@ -25,8 +33,14 @@ then
exit 0 exit 0
fi fi
if $GNU; then
gnu='-gnu'
else
gnu=''
fi
#reset the tmp folder #reset the tmp folder
affected="$(./scripts/affected-libs.sh -gnu -b "$BRANCH_NAME")" affected="$(./scripts/affected-libs.sh ${gnu[@]} -b "$BRANCH_NAME")"
echo $affected echo $affected
libs=(`echo $affected | sed 's/^$/\n/g'`) libs=(`echo $affected | sed 's/^$/\n/g'`)