-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·28 lines (22 loc) · 761 Bytes
/
run.sh
File metadata and controls
executable file
·28 lines (22 loc) · 761 Bytes
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
#!/bin/bash
PASSES=2
JAVA_MAJOR_VERSION=$(java -version 2>&1 | sed -E -n 's/.* version "([^.-]*).*"/\1/p' | cut -d' ' -f1)
if [[ "$JAVA_MAJOR_VERSION" -lt 24 ]]; then
echo "Java version 24 required"
exit 1
fi
java TestJarGenerator.java out/test.jar
java Optimizer.java out/test.jar out/optimized.jar $PASSES
echo -n "test.jar output : "
java -jar out/test.jar arg1 arg2
echo -n "optimized.jar output: "
java -jar out/optimized.jar arg1 arg2
original_size=$(stat -c %s out/test.jar)
optimized_size=$(stat -c %s out/optimized.jar)
diff=$((original_size - optimized_size))
if (( original_size > optimized_size )) ; then
echo "optimized.jar is $diff bytes smaller"
else
echo "expected the optimized jar to be smaller; diff is $diff"
exit 2
fi