chore: Project structure
This commit is contained in:
parent
948de3de02
commit
4054ed5fce
9 changed files with 511 additions and 2 deletions
9
src/Main.kt
Normal file
9
src/Main.kt
Normal file
|
@ -0,0 +1,9 @@
|
|||
fun main() {
|
||||
for (i in 1..10) {
|
||||
println("Hello, Kotlin Command Line Utility!")
|
||||
}
|
||||
}
|
||||
|
||||
fun testMe(): String {
|
||||
return "Hello, Kotlin Command Line Utility!"
|
||||
}
|
41
src/gpl
Executable file
41
src/gpl
Executable 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
|
||||
|
25
src/gpl.bat
Normal file
25
src/gpl.bat
Normal file
|
@ -0,0 +1,25 @@
|
|||
@echo off
|
||||
|
||||
REM Set the path to the JAR file
|
||||
set JAR_PATH=build\libs\MyKotlinProject-1.0-SNAPSHOT.jar
|
||||
|
||||
REM Function to check if Java is installed
|
||||
where java >nul 2>nul
|
||||
if %errorlevel% neq 0 (
|
||||
echo Error: Java is not installed. Please install Java to run this program.
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Check if the JAR file exists
|
||||
if not exist "%JAR_PATH%" (
|
||||
echo JAR file not found at %JAR_PATH%.
|
||||
echo Building the project...
|
||||
gradlew build
|
||||
if %errorlevel% neq 0 (
|
||||
echo Error: Build failed.
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
REM Run the Java command
|
||||
java -jar %JAR_PATH% %*
|
Reference in a new issue