Skip to content

Commit

Permalink
Remove build-and-test script; enhance build script
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronbrethorst committed Sep 6, 2024
1 parent a0740e7 commit 0d2c44e
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 28 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "automatic"
}
22 changes: 0 additions & 22 deletions build-and-test.sh

This file was deleted.

72 changes: 66 additions & 6 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,69 @@
# limitations under the License.
#

mvn -U clean install \
-Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2 \
-DskipTests=true \
-Dmaven.javadoc.skip=true \
-Dvalidate.silent=true \
-Dlog4j.configuration=
#!/bin/bash

# Function to print help message
print_help() {
echo "Usage: $0 [OPTIONS]"
echo "Wrapper script for Maven build command with customizable options."
echo
echo "Options:"
echo " --help Display this help message"
echo " --clean Run the clean phase before building (optional)"
echo " --check-updates Force a check for updated releases and snapshots"
echo " --test Run tests (disabled by default)"
echo " --javadoc Generate JavaDoc (disabled by default)"
echo " --validate-silent VALUE Set the validate.silent option (default: true)"
echo " --log4j-config VALUE Set the log4j.configuration option (default: empty)"
echo
echo "Example:"
echo " $0 --clean --check-updates --test --javadoc --validate-silent false --log4j-config my-log4j.properties"
}

# Default values
clean=""
check_updates=""
run_tests="false"
generate_javadoc="false"
validate_silent="true"
log4j_config=""

# Parse command line arguments
while [[ "$#" -gt 0 ]]; do
case $1 in
--help) print_help; exit 0;;
--clean) clean="clean ";;
--check-updates) check_updates="-U ";;
--test) run_tests="true";;
--javadoc) generate_javadoc="true";;
--validate-silent) validate_silent="$2"; shift;;
--log4j-config) log4j_config="$2"; shift;;
*) echo "Unknown parameter: $1"; print_help; exit 1;;
esac
shift
done

# Construct the Maven command
cmd="mvn ${check_updates}${clean}install"

# Add options based on parsed arguments
if [ "$run_tests" = "false" ]; then
cmd="$cmd -DskipTests=true"
fi

if [ "$generate_javadoc" = "false" ]; then
cmd="$cmd -Dmaven.javadoc.skip=true"
fi

cmd="$cmd -Dvalidate.silent=$validate_silent"

if [ -n "$log4j_config" ]; then
cmd="$cmd -Dlog4j.configuration=$log4j_config"
else
cmd="$cmd -Dlog4j.configuration="
fi

# Execute the command
echo "Executing: $cmd"
eval $cmd

0 comments on commit 0d2c44e

Please sign in to comment.