-
Notifications
You must be signed in to change notification settings - Fork 2
/
build_release.py
36 lines (28 loc) · 1.05 KB
/
build_release.py
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
#!/usr/bin/env python3
import sys
import os
import shutil
if sys.version_info[0] < 3:
print("Python 3 is required to run the script and not Python "+str(sys.version_info[0]))
sys.exit(1)
def fatal_error(message):
sys.stderr.write(message+"\n")
sys.stderr.write("\n\nBUILD FAILED!!! LOOK AT MESSAGES ABOVE\n\n")
sys.exit(1)
def run_command(command):
if os.system(command):
fatal_error("Failed to execute '"+command+"'")
def check_cd(path):
if os.chdir(path):
fatal_error("Failed to cd into '"+path+"'")
project_home = os.path.dirname(os.path.realpath(__file__))
if os.path.isdir("build_release"):
shutil.rmtree("build_release")
os.makedirs("build_release")
check_cd("build_release")
run_command("cmake -DCMAKE_BUILD_TYPE=Release ..")
run_command("make -j8")
check_cd(os.path.join(project_home,"jni"))
run_command("./gradlew -Pnative_build_location=../build_release install")
# Have a command line argument for sending it to maven central
#run_command("./gradlew -Pnative_build_location=../build_release uploadArchives")