File tree Expand file tree Collapse file tree 9 files changed +43
-81
lines changed
Expand file tree Collapse file tree 9 files changed +43
-81
lines changed Original file line number Diff line number Diff line change 1212 - run : git submodule update --init --recursive
1313 - restore_cache :
1414 key : jars-{{ checksum "build.gradle" }}
15+ - restore_cache :
16+ key : go
1517 - run :
1618 name : Run Build and Tests
1719 command : ./gradlew assembleDebug check
20+ - save_cache :
21+ paths :
22+ - ~/go
23+ key : go
1824 - save_cache :
1925 paths :
2026 - ~/.gradle
Original file line number Diff line number Diff line change 1- [submodule "app/src/v2ray-plugin "]
2- path = app/src/v2ray-plugin
3- url = https://github.com/madeye /v2ray-plugin
1+ [submodule "app/src/main/go/ v2ray-plugin "]
2+ path = app/src/main/go/ v2ray-plugin
3+ url = https://github.com/shadowsocks /v2ray-plugin.git
Original file line number Diff line number Diff line change 33# no tests written yet
44/src /androidTest
55/src /test
6- /src /bin
7- /src /pkg
8- /src /src
9- /.deps
Original file line number Diff line number Diff line change @@ -41,15 +41,15 @@ android {
4141 universalApk true
4242 }
4343 }
44- sourceSets. main. jniLibs. srcDirs + = new File (projectDir, " src/bin " )
44+ sourceSets. main. jniLibs. srcDirs + = new File (projectDir, " build/go " )
4545}
4646
4747task goBuild (type : Exec ) {
4848 if (Os . isFamily(Os . FAMILY_WINDOWS )) {
4949 println " Warning: Building on Windows is not supported"
5050 } else {
51- executable " sh "
52- args " -c " , " src/make .bash " + minSdkVersion
51+ executable " /bin/bash "
52+ args " go-build .bash" , minSdkVersion
5353 environment " ANDROID_HOME" , android. sdkDirectory
5454 environment " ANDROID_NDK_HOME" , android. ndkDirectory
5555 }
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ [[ -z " ${ANDROID_NDK_HOME} " ]] && ANDROID_NDK_HOME=" ${ANDROID_HOME} /ndk-bundle"
4+ TOOLCHAIN=" $( find ${ANDROID_NDK_HOME} /toolchains/llvm/prebuilt/* -maxdepth 1 -type d -print -quit) /bin"
5+ ABIS=(armeabi-v7a arm64-v8a x86 x86_64)
6+ GO_ARCHS=(' arm GOARM=7' arm64 386 amd64)
7+ CLANG_ARCHS=(armv7a-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android)
8+ STRIP_ARCHS=(arm-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android)
9+
10+ MIN_API=" $1 "
11+ ROOT=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
12+ OUT_DIR=" $ROOT /build/go"
13+
14+ cd " $ROOT /src/main/go/v2ray-plugin"
15+ BIN=" libv2ray.so"
16+ for i in " ${! ABIS[@]} " ; do
17+ ABI=" ${ABIS[$i]} "
18+ [[ -f " ${OUT_DIR} /${ABI} /${BIN} " ]] && continue
19+ echo " Build ${BIN} ${ABI} "
20+ mkdir -p ${OUT_DIR} /${ABI} \
21+ && env \
22+ CGO_ENABLED=1 CC=" ${TOOLCHAIN} /${CLANG_ARCHS[$i]}${MIN_API} -clang" \
23+ GOOS=android GOARCH=${GO_ARCHS[$i]} \
24+ go build -v -ldflags=' -s -w' -o " ${OUT_DIR} /unstripped" \
25+ && " ${TOOLCHAIN} /${STRIP_ARCHS[$i]} -strip" " ${OUT_DIR} /unstripped" -o " ${OUT_DIR} /${ABI} /${BIN} " \
26+ || exit -1
27+ rm " ${OUT_DIR} /unstripped"
28+ done
29+
30+ cd " $ROOT "
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments