-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild-obm.sh
executable file
·58 lines (43 loc) · 1.47 KB
/
build-obm.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
# Check if openblocks-module-manifest exists
if ! test -f "openblocks-module-manifest.json"; then
echo "openblocks-module-manifest.json not found"
exit 1
fi
echo "Building jar ==================================="
# Build the module into a jar
./gradlew jar
echo "Checking if the necessary commands exists ======"
# Check if wget, java, and zip exists
commands=(wget java zip)
for command in "${commands[@]}"
do
:
# Check if $command exists
if ! command -v "$command" &> /dev/null
then
# Perform cnf to tell the user where to install this command
cnf "$command"
echo "$command command not found"
exit 1
fi
done
echo "Checking if d8 exists =========================="
# Check if d8.jar has already downloaded
if ! test -f "d8.jar"; then
# Nop, download it
echo "Downloading d8 using wget"
wget https://openblocks.tk/tools/d8.jar
fi
echo "Dex-ing the jar ================================"
# Dex the jar
java -jar d8.jar --release --classpath libs/openblocks-module-interface.jar libs/android-30.jar --min-api 21 --output out.jar build/libs/*.jar
echo "Zipping the files =============================="
# Zip em to release.zip
zip release.zip openblocks-module-manifest.json out.jar
# then rename it to obm, OpenBlocks Module, where it can be loaded into the app
mv release.zip release.obm
echo "Removing out.jar ==============================="
# Delete out.jar
rm out.jar
echo "===================== Done ====================="
echo "Saved as release.obm"