Skip to content

Instantly share code, notes, and snippets.

@Maarc
Last active March 27, 2017 11:20
Show Gist options
  • Save Maarc/13831ccfb186640c487de22717a1c050 to your computer and use it in GitHub Desktop.
Save Maarc/13831ccfb186640c487de22717a1c050 to your computer and use it in GitHub Desktop.
Script for building the Red Hat Application Migration Toolkit (RHAMT)
#!/bin/bash
# Current directory
DIR_CURRENT=$(pwd)
# Directory with the source code
DIR_GIT_CODE='code'
# Maven build parameters
MVN_ARGS='-T 4 -U clean eclipse:clean eclipse:eclipse install'
# Clone the ${1} GitHub repostory.
github_clone()
{
echo ">>> Checkout '${1}'"
cd ${DIR_CURRENT}/${DIR_GIT_CODE}
git clone "[email protected]:${1}.git"
}
# Builds the maven project in ${1} skipping the tests.
mvnt()
{
echo ">>> Build '$1' (without executing tests)"
mvn -f ${DIR_CURRENT}/${DIR_GIT_CODE}/$1 ${MVN_ARGS} -Dmaven.test.skip=true -DskipTests || { echo "Issue while executing 'mvnt' in $1"; kill -INT $$; }
}
# Builds the maven project in ${1} without skipping the tests.
mvna()
{
echo ">>> Build '$1'"
mvn -f ${DIR_CURRENT}/${DIR_GIT_CODE}/$1 ${MVN_ARGS} || { echo "Issue while executing 'mvna' in $1"; kill -INT $$; }
}
main()
{
mkdir -p ${DIR_GIT_CODE}
# Checkout source code from GitHub
github_clone "windup/windup"
github_clone "windup/windup-rulesets"
github_clone "windup/windup-distribution"
# Correct an issue with test dependencies in decompiler/api
mvnt "windup/bom"
mvna "windup/utils"
mvna "windup -pl decompiler -am"
mvna "windup/decompiler/api"
mvnt "windup"
mvnt "windup-rulesets"
mvnt "windup-distribution"
# Create a symlink to the built distribution
DIST=$(find . -type f -name "windup-distribution-*.zip" -exec echo {} \;)
echo ">>> RHAMT built successfully in ${DIST}"
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment