-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompile
More file actions
executable file
·50 lines (37 loc) · 1.05 KB
/
Copy pathcompile
File metadata and controls
executable file
·50 lines (37 loc) · 1.05 KB
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
#!/usr/bin/env bash
echo "Current working directory: $PWD"
JARNAME="ExplodingLaserShootingBees-1.0.2.jar"
JASM="jasm/jasm-cli-2.9.0-all.jar"
LIBS="jasm/libs"
BASECMD="java -jar ${JASM}"
SRCROOT="./src/main/asm/"
RESOURCESROOT="./src/main/resources"
TARGET="./build/jar"
# Cleanup build directory
if [ -d $TARGET ]; then
rm -r $TARGET
fi
# Compile all files
echo "Compiling class files"
find ./src/main/asm/ -type f -print0 |
while IFS= read -r -d '' SRCFILE; do
FILE=${SRCFILE:${#SRCROOT}}
CLASSFILE="${TARGET}/${FILE}"
CLASSFILE="${CLASSFILE:0:${#CLASSFILE}-5}.class"
echo "| compiling ${SRCFILE}..."
CMD="$BASECMD compile $SRCFILE -o=$CLASSFILE -lib=$LIBS -ic=false"
$CMD
done
# Copy over resources
echo ""
echo "Copying resources"
echo "| copying paper-plugin.yml"
cp "${RESOURCESROOT}/paper-plugin.yml" "${TARGET}/paper-plugin.yml"
echo "| copying LICENSE"
cp "${RESOURCESROOT}/LICENSE" "${TARGET}/LICENSE"
# Create a nice jar
echo ""
echo "Creating jar file."
cd $TARGET || exit
jar --create --file ../libs/$JARNAME .
echo "Done!"