-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUILD.sh
executable file
·64 lines (49 loc) · 1.65 KB
/
BUILD.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env bash
# Trap SIGINT signal (Ctrl-C)
trap exit 1 SIGINT
# Cleanup
rm -r Build
mkdir Build
# Find all subdirectories containing gradlew script
for dir in */
do
# Navigate into the directory
cd "${dir}" || continue
# Check if gradlew script exists
if [ -f "gradlew" ]
then
# Strip trailing /
dir=${dir%*/}
# Detect java version
case $dir in
# 1.20)
# export PATH="/usr/lib/jvm/java-21-openjdk/bin/:$PATH"
# ;;
*)
export PATH="/usr/lib/jvm/java-17-openjdk/bin/:$PATH"
;;
esac
# Grant execute permission to gradlew script
chmod +x gradlew
# Clean and build using gradlew
./gradlew clean build
# Loop over loader directories for build directories
for loader in fabric forge neoforge quilt
do
# Navigate into the directory
cd "${loader}" || continue
# Get the built JAR file
jar_file=$(find build/libs -name "killeffects-${loader}-*.jar" -type f)
# Extract version number from the JAR file name
version=$(basename "$jar_file" | grep -oP "killeffects-${loader}-\K[0-9]+\.[0-9]+\.[0-9]+")
# Move the built JAR file to the specified directory
mv build/libs/killeffects-${loader}-"${version}".jar ../../Build/KillEffects-"${loader}-${dir,,}-${version}".jar
# Navigate back to the parent directory
cd ..
done
# Cleanup
rm -rf .gradle .idea .vscode build logs run
fi
# Navigate back to the parent directory
cd ..
done