chore: Project structure

This commit is contained in:
Tibo De Peuter 2025-03-27 10:46:40 +01:00
parent 948de3de02
commit 4054ed5fce
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
9 changed files with 511 additions and 2 deletions

41
src/gpl Executable file
View file

@ -0,0 +1,41 @@
#!/usr/bin/env bash
# TODO Build the jar if it does not exist
# TODO Check if Java is installed.
# Determine the operating system
OS="$(uname)"
# Set the path to the JAR file
JAR_PATH='build/libs/2025LogProg-project-GhentProlog-0.1-SNAPSHOT.jar'
# Check if Java is installed
if ! command -v java &> /dev/null; then
printf 'Error: Java is not installed. Please install Java to run this program.\n'
printf ' Visit https://www.java.com/en/download/ for more information.\n'
exit 1
fi
# Check if the JAR file exists
if [ ! -f "${JAR_PATH}" ]; then
printf 'Info: JAR file not found at "%s"\n' "${JAR_PATH}"
printf 'Info: Building the project...\n'
./gradlew build
if [ "${?}" -ne 0 ]; then
printf 'Error: Build failed\n'
exit 1
fi
fi
# Run the Java command based on the operating system
if [[ "${OS}" == 'Linux' || "${OS}" == 'Darwin' ]]; then
# Unix-based systems (Linux, macOS)
java -jar "${JAR_PATH}" "$@"
elif [[ "${OS}" == *"NT"* ]]; then
# Windows
java -jar "${JAR_PATH}" "$@"
else
printf 'Error: Unsupported operating system: "%s"\n' "${OS}"
exit 1
fi