Skip to content

Commit

Permalink
feat: pass user args to mvn in build-coatjava.sh (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
c-dilks authored Jan 23, 2024
1 parent ca5a83c commit 750a0bb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
java-version: 11
distribution: zulu
- name: build
run: ./build-coatjava.sh --spotbugs --unittests --quiet
run: ./build-coatjava.sh --spotbugs --unittests --quiet -T4
- name: tar # tarball to preserve permissions
run: tar czvf coatjava.tar.gz coatjava
- uses: actions/upload-artifact@v3
Expand Down
36 changes: 16 additions & 20 deletions build-coatjava.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,28 @@ set -e
set -u
set -o pipefail

usage='build-coatjava.sh [-h] [--quiet] [--spotbugs] [--nomaps] [--unittests]'
usage='''build-coatjava.sh [-h] [--help] [--quiet] [--spotbugs] [--nomaps] [--unittests]
- all other arguments will be passed to `mvn`, e.g., -T4 will build with 4 parallel threads'''

quiet="no"
runSpotBugs="no"
downloadMaps="yes"
runUnitTests="no"
mvnArgs=()
for xx in $@
do
if [ "$xx" == "--spotbugs" ]
then
runSpotBugs="yes"
elif [ "$xx" == "-n" ]
then
runSpotBugs="no"
elif [ "$xx" == "--nomaps" ]
then
downloadMaps="no"
elif [ "$xx" == "--unittests" ]
then
runUnitTests="yes"
elif [ "$xx" == "--quiet" ]
then
quiet="yes"
else
echo "$usage"
exit 2
fi
case $xx in
--spotbugs) runSpotBugs="yes" ;;
-n) runSpotBugs="no" ;;
--nomaps) downloadMaps="no" ;;
--unittests) runUnitTests="yes" ;;
--quiet) quiet="yes" ;;
-h|--help)
echo "$usage"
exit 2
;;
*) mvnArgs+=($xx) ;;
esac
done

top="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"
Expand All @@ -42,6 +37,7 @@ then
wget='wget --progress=dot:mega'
mvn="mvn -q -B --settings $top/maven-settings.xml"
fi
mvn+=" ${mvnArgs[*]}"

command_exists () {
type "$1" &> /dev/null
Expand Down

0 comments on commit 750a0bb

Please sign in to comment.