-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuildAndroid.java
31 lines (26 loc) · 1011 Bytes
/
BuildAndroid.java
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
import java.io.*;
import java.net.*;
import java.nio.file.*;
import java.util.zip.*;
public class BuildAndroid {
public static void main(String[] a) throws Exception {
// extract web assets
String baseDir = "src/main/resources";
new File(baseDir).mkdirs();
runCommand("unzip -o lib/Peergos.jar webroot/* -d " + baseDir);
runCommand("unzip -o lib/Peergos.jar org/sqlite/native/Linux-Android/aarch64/libsqlitejdbc.so -d " + baseDir);
// run native-image
runCommand("mvn " +
"-Pandroid " +
"gluonfx:build " +
"gluonfx:package"
);
}
public static int runCommand(String command) throws Exception {
System.out.println(command);
ProcessBuilder pb = new ProcessBuilder(command.split(" "));
pb.redirectError(ProcessBuilder.Redirect.INHERIT);
pb.redirectOutput(ProcessBuilder.Redirect.INHERIT);
return pb.start().waitFor();
}
}