-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·75 lines (64 loc) · 2.62 KB
/
build.sh
File metadata and controls
executable file
·75 lines (64 loc) · 2.62 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
os=$(uname -s)
if [ "$os" == "Darwin" ]; then
echo Nothing to do with macOS
exit 0
fi
build_tools=~/build-tools
if [ "$os" = "Linux" ]; then
if command -v apt-get >/dev/null 2>&1 || [ -f /etc/debian_version ]; then
echo "Detected Debian/Ubuntu - using apt"
sudo apt-get update
sudo apt-get install -y openjdk-8-jdk wget unzip zip git curl ca-certificates
elif command -v yum >/dev/null 2>&1; then
echo "Detected RHEL/CentOS - using yum"
yum clean all
yum install java-1.8.0-openjdk-devel wget unzip zip git curl ca-certificates -y
else
echo "Unsupported Linux distribution" >&2
exit 1
fi
fi
if command -v javac >/dev/null 2>&1; then
export JAVA_HOME="$(dirname "$(dirname "$(readlink -f "$(command -v javac)")")")"
export PATH="${JAVA_HOME}/bin:${PATH}"
fi
if [ ! -d "${build_tools}" ]; then mkdir ${build_tools}; fi;
cd ${build_tools} || exit
if [ ! -d "${build_tools}/android-studio/bin" ]; then
wget https://r1---sn-ni5een7z.gvt1.com/edgedl/android/studio/ide-zips/2020.3.1.25/android-studio-2020.3.1.25-linux.tar.gz
tar zvxf android-studio-2020.3.1.25-linux.tar.gz
rm -f android-studio-2020.3.1.25-linux.tar.gz
else
echo "build-tool $(ls | grep android-studio | head -1) exist"
fi
export PATH=${PATH}:${build_tools}/android-studio/bin
if [ ! -d "${build_tools}/cmdline-tools/bin" ]; then
wget https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip
unzip commandlinetools-linux-7583922_latest.zip
rm -f commandlinetools-linux-7583922_latest.zip
else
echo "build-tool $(ls | grep cmdline-tools | head -1) exist"
fi
export PATH=${PATH}:${build_tools}/cmdline-tools/bin
if [ ! -d "${build_tools}/sdk_root/platform-tools" ]; then
sdkmanager "ndk-bundle" --channel=3 --channel=1 "cmake;3.18.1" 'ndk;23.0.7599858' "platform-tools" "build-tools;30.0.3" "platforms;android-31" "cmake;3.18.1" --sdk_root=`pwd`/sdk_root
export ANDROID_NDK_HOME=$(pwd)/sdk_root/ndk-bundle
else
echo "build-tool $(ls | grep sdk_root | head -1) exist"
fi
export PATH=${PATH}:${build_tools}/sdk_root/platform-tools
export ANDROID_SDK_ROOT=${build_tools}/sdk_root
if [ ! -d "${build_tools}/gradle-7.0.2/bin" ]; then
wget https://services.gradle.org/distributions/gradle-7.0.2-bin.zip
unzip gradle-7.0.2-bin.zip
rm -f gradle-7.0.2-bin.zip
else
echo "build-tool $(ls | grep gradle | head -1) exist"
fi
export PATH=${PATH}:${build_tools}/gradle-7.0.2/bin
cd - || exit
cd app/src/main/cpp/scadup || exit
git submodule update --init --recursive
cd - || exit
gradle clean assembleDebug --no-daemon --stacktrace