Last active
January 27, 2022 12:18
-
-
Save bionade24/eaae0312f795a23b012ca2a56f4b85c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
shopt -s dotglob | |
TMP_PATH="/tmp/SchiffeVersenken_temp" | |
CALLDIR="$(pwd)" | |
build_project() { | |
javac -sourcepath "${TMP_PATH}/src/" ${TMP_PATH}/src/de/uniluebeck/itm/schiffeversenken/**/*.java -d "${TMP_PATH}/bin" || return 1 | |
javadoc -quiet -sourcepath "${TMP_PATH}/src/" -d "${TMP_PATH}/doc" -subpackages de.uniluebeck.itm.schiffeversenken || return 1 | |
sed -i "s!<name>SchiffeVorgabe</name>!<name>$1</name>!g" "${TMP_PATH}/.project" || return 1 | |
cd "$TMP_PATH" && zip -r "${CALLDIR}/${1}.zip" ./* --exclude ".git" "workspace" "pom.xml" || return 1; cd -; | |
} | |
if [ -z "$1" ]; then | |
echo "ERROR: Es muss ein gewünschter Name als Argument mitgegeben werden! | |
z.B. $0 127-SchiffeVersenkenA1.1" | |
exit 1 | |
fi | |
if ! grep -q 'exports de.uniluebeck.itm.schiffeversenken.main;' ./src/module-info.java; then | |
echo "ERROR: Dieses Skript muss im SchiffeVersenken Projektordner ausgeführt werden." | |
exit 1 | |
fi | |
cp -r "$CALLDIR" "$TMP_PATH" || exit 1 | |
build_project "$@" && echo "${1}.zip is now in the dir from which you called." || echo "Building & zipping the project failed." | |
rm -rf "$TMP_PATH" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment