Merge branch 'master' into 'master'
[bitmask_android.git] / build_deps.sh
1 #!/bin/bash
2
3 function quit {
4     echo "Task failed. $1."
5     exit 1
6 }
7
8
9 DIR_OVPNASSETS=./ics-openvpn/main/build/ovpnassets
10 DIR_OVPNLIBS=./ics-openvpn/main/build/intermediates/cmake/noovpn3/release/obj
11 DIR_GOLIBS=./go/lib/
12 FILE_X86=./go/out/x86/piedispatcherlib
13 FILE_ARM=./go/out/armeabi-v7a/piedispatcherlib
14
15 # init
16 # look for empty dir
17
18 if [[ $(ls -A ${DIR_OVPNASSETS}) && $(ls -A ${DIR_OVPNLIBS}) ]]
19 then
20     echo "Dirty build: skipped externalNativeBuild - reusing existing libs"
21 else
22     echo "Clean build: starting externalNativeBuild and GO dependency builds"
23     cd ./ics-openvpn || quit "Directory ics-opevpn not found"
24     ./gradlew clean main:externalNativeBuildCleanNoovpn3Release main:externalNativeBuildNoovpn3Release --debug --stacktrace || quit "Build ics-openvpn native libraries failed"
25     cd ..
26 fi
27
28 if [[ $(ls -A ${DIR_GOLIBS}) ]]
29 then
30     echo "Dirty build: Reusing go libraries"
31 else
32     echo "Clean build: compiling Go libraries"
33     cd ./go || quit "Directory go not found"
34     ./install_go.sh || quit "install_go.sh failed"
35     ./android_build_shapeshifter.sh createLibrary || quit "android_build_shapeshifter_dispatcher.sh failed"
36     cd ..
37 fi