summaryrefslogtreecommitdiff
path: root/scripts/patch_gson.sh
blob: 3825683305309a022227d8b7cf4b95d0f476f9a4 (plain)
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
#!/bin/bash
# Patch Gson with module-info.java
# When Gson releases a new version, we will no longer need to do this 
# https://github.com/google/gson/issues/1315

set -e

# Check JAVA_HOME points to java 11
./scripts/check_java_home.sh

# Download Gson jar
cd modules
curl https://repo1.maven.org/maven2/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar > gson.jar

# Unpack jar into modules/classes
mkdir classes
cd classes
$JAVA_HOME/bin/jar xf ../gson.jar
cd ..

# Compile module-info.java to module-info.class
$JAVA_HOME/bin/javac -p com.google.gson -d classes module-info.java

# Update gson.jar with module-info.class
$JAVA_HOME/bin/jar uf gson.jar -C classes module-info.class

# Clean up
rm -rf classes
cd ..