Add "format" target
@@ -9,8 +9,8 @@ usage()
{
eval 1>&2
echo "Simple builder for Jib for jib-core, jib-plugins-common, jib-maven-plugin, and jib-gradle-plugin"
- echo "use: $0 [-qe] [clean | core | plugins | maven | gradle | all | it]"
- echo " 'all' is the same as 'core plugins gradle maven'"
+ echo "use: $0 [-qe] [clean | core | plugins | maven | gradle | it | format]"
+ echo " providing no target is the same as 'core plugins gradle maven'"
echo " -q quick mode: skip tests, formatting"
echo " -e show error information (mvn: -e, gradle: --stacktrace --info)"
exit 1
@@ -32,13 +32,13 @@ while getopts qe c; do
\?) usage;;
esac
done
-shift `expr $OPTIND - 1`
+shift $( expr $OPTIND - 1 )
if [ $# -eq 0 ]; then
set -- core plugins gradle maven
fi
-set -e # exit on error
+set -o errexit # exit on error
for target in "$@"; do
case "$target" in
clean)
@@ -90,5 +90,12 @@ for target in "$@"; do
doBuild jib-maven-plugin ./mvnw $mavenOptions -Pintegration-tests verify -U
doBuild jib-gradle-plugin ./gradlew $gradleOptions integrationTest
;;
+
+ format)
+ doBuild jib-core ./gradlew googleJavaFormat
+ doBuild jib-plugins-common ./gradlew googleJavaFormat
+ doBuild jib-gradle-plugin ./gradlew googleJavaFormat
+ doBuild jib-maven-plugin ./mvnw fmt:format
+ ;;
esac
done
