Update build scripts

This commit is contained in:
世界 2021-02-25 12:58:04 +08:00
parent b700ee2967
commit bca990b9e7
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
13 changed files with 275 additions and 115 deletions

View File

@ -4,6 +4,7 @@ on:
push:
branches:
- main
- dev
paths-ignore:
- '**.md'
- '.github/**'
@ -13,44 +14,213 @@ on:
- dev
jobs:
native:
name: Native Build
ffmpeg:
name: Native Build ( FFmpeg )
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Android SDK Tools
uses: android-actions/setup-android@v2
- name: Native Cache
uses: actions/cache@main
- name: Fetch Status
run: git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status
- name: FFmpeg Cache
id: cache
uses: actions/cache@v2
with:
path: |
TMessagesProj/libs
TMessagesProj/src/main/libs
key: ${{ hashFiles('TMessagesProj/jni/**', 'ss-rust/src/main/rust/**') }}
- name: Check Cache
run: |
[ -f "TMessagesProj/libs/libv2ray.aar" ] && echo "Cache found." || echo "CONTINUE=true" >> $GITHUB_ENV
TMessagesProj/jni/ffmpeg/build
key: ${{ hashFiles('ffmpeg_status') }}
- name: Setup Android SDK Tools
uses: android-actions/setup-android@v2
if: steps.cache.outputs.cache-hit != 'true'
- name: Install NDK
if: env.CONTINUE
if: steps.cache.outputs.cache-hit != 'true'
run: |
echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.3.6528147" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.3.6528147" >> local.properties
- uses: actions/setup-go@v2
if: env.CONTINUE
- name: Native Build
if: steps.cache.outputs.cache-hit != 'true'
run: |
./run init libs ffmpeg
boringssl:
name: Native Build ( BoringSSL )
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Status
run: git submodule status TMessagesProj/jni/boringssl > boringssl_status
- name: BoringSSL Cache
id: cache
uses: actions/cache@v2
with:
path: |
TMessagesProj/jni/boringssl/build
key: ${{ hashFiles('boringssl_status') }}
- name: Setup Android SDK Tools
uses: android-actions/setup-android@v2
if: steps.cache.outputs.cache-hit != 'true'
- name: Install NDK
if: steps.cache.outputs.cache-hit != 'true'
run: |
echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.3.6528147" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.3.6528147" >> local.properties
- name: Native Build
if: steps.cache.outputs.cache-hit != 'true'
run: |
./run init action boringssl
./run init libs boringssl
native:
name: Native Build ( Telegram )
runs-on: ubuntu-latest
needs:
- ffmpeg
- boringssl
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Status
run: |
git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status
git submodule status TMessagesProj/jni/boringssl > boringssl_status
- name: Native Cache
id: cache
uses: actions/cache@v2
with:
path: |
TMessagesProj/src/main/libs
key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}
- name: Checkout Library
if: steps.cache.outputs.cache-hit != 'true'
run: |
git submodule update --init 'TMessagesProj/jni/*'
- name: FFmpeg Cache
uses: actions/cache@v2
if: steps.cache.outputs.cache-hit != 'true'
with:
path: |
TMessagesProj/jni/ffmpeg/build
key: ${{ hashFiles('ffmpeg_status') }}
- name: BoringSSL Cache
uses: actions/cache@v2
if: steps.cache.outputs.cache-hit != 'true'
with:
path: |
TMessagesProj/jni/boringssl/build
key: ${{ hashFiles('boringssl_status') }}
- name: Setup Android SDK Tools
uses: android-actions/setup-android@v2
if: steps.cache.outputs.cache-hit != 'true'
- name: Install NDK
if: steps.cache.outputs.cache-hit != 'true'
run: |
echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.3.6528147" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.3.6528147" >> local.properties
- name: Fix BoringSSL
run: |
cd TMessagesProj/jni
./patch_boringssl.sh
- name: Native Build
if: steps.cache.outputs.cache-hit != 'true'
run: |
./run libs native
v2ray:
name: Native Build (V2ray)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: V2ray Cache
id: cache
uses: actions/cache@v2
with:
path: |
TMessagesProj/libs/libv2ray.aar
key: ${{ hashFiles('bin/libs/v2ray.sh') }}
- name: Setup Android SDK Tools
uses: android-actions/setup-android@v2
if: steps.cache.outputs.cache-hit != 'true'
- name: Install NDK
if: steps.cache.outputs.cache-hit != 'true'
run: |
echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.3.6528147" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.3.6528147" >> local.properties
- name: Install Golang
uses: actions/setup-go@v2
if: steps.cache.outputs.cache-hit != 'true'
with:
go-version: ^1.15
- name: Native Build
if: env.CONTINUE
if: steps.cache.outputs.cache-hit != 'true'
run: ./run libs v2ray
shadowsocks:
name: Native Build (Shadowsocks)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Status
run: git submodule status ss-rust/src/main/rust/shadowsocks-rust > shadowsocks_status
- name: Shadowsocks Cache
id: cache
uses: actions/cache@v2
with:
path: |
TMessagesProj/libs/ss-rust-release.aar
key: ${{ hashFiles('shadowsocks_status') }}
- name: Setup Android SDK Tools
uses: android-actions/setup-android@v2
if: steps.cache.outputs.cache-hit != 'true'
- name: Install NDK
if: steps.cache.outputs.cache-hit != 'true'
run: |
./run init action
./run init libs
./run libs update
echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.3.6528147" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.3.6528147" >> local.properties
- name: Install Rust
if: steps.cache.outputs.cache-hit != 'true'
run: ./run init action shadowsocks
- name: Native Build
if: steps.cache.outputs.cache-hit != 'true'
run: ./run libs shadowsocks
shadowsocksr:
name: Native Build (ShadowsocksR)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Fetch Status
run: git submodule status 'ssr-libev/*' > shadowsocksr_status
- name: ShadowsocksR Cache
id: cache
uses: actions/cache@v2
with:
path: |
TMessagesProj/libs/ssr-libev-release.aar
key: ${{ hashFiles('shadowsocksr_status') }}
- name: Setup Android SDK Tools
uses: android-actions/setup-android@v2
if: steps.cache.outputs.cache-hit != 'true'
- name: Install NDK
if: steps.cache.outputs.cache-hit != 'true'
run: |
echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.3.6528147" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.3.6528147" >> local.properties
- name: Native Build
if: steps.cache.outputs.cache-hit != 'true'
run: ./run libs ssr
debug:
name: Debug Build
runs-on: ubuntu-latest
needs: native
needs:
- native
- v2ray
- shadowsocks
- shadowsocksr
strategy:
matrix:
flavor:
@ -67,19 +237,43 @@ jobs:
uses: actions/checkout@v2
- name: Setup Android SDK Tools
uses: android-actions/setup-android@v2
- name: Fetch Status
run: |
git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status
git submodule status TMessagesProj/jni/boringssl > boringssl_status
git submodule status ss-rust/src/main/rust/shadowsocks-rust > shadowsocks_status
git submodule status 'ssr-libev/*' > shadowsocksr_status
- name: Native Cache
uses: actions/cache@main
id: cache
uses: actions/cache@v2
with:
path: |
TMessagesProj/libs
TMessagesProj/src/main/libs
key: ${{ hashFiles('TMessagesProj/jni/**', 'ss-rust/src/main/rust/**') }}
key: ${{ hashFiles('TMessagesProj/jni/**', 'ffmpeg_status', 'boringssl_status') }}
- name: V2ray Cache
uses: actions/cache@v2
with:
path: |
TMessagesProj/libs/libv2ray.aar
key: ${{ hashFiles('bin/libs/v2ray.sh') }}
- name: Shadowsocks Cache
uses: actions/cache@v2
with:
path: |
TMessagesProj/libs/ss-rust-release.aar
key: ${{ hashFiles('shadowsocks_status') }}
- name: ShadowsocksR Cache
uses: actions/cache@v2
with:
path: |
TMessagesProj/libs/ssr-libev-release.aar
key: ${{ hashFiles('shadowsocksr_status') }}
- name: Fix Gradle Memoery
run: |
sed -i -e "s/16384/6144/g" gradle.properties
echo "ndk.dir=${ANDROID_HOME}/ndk-bundle" > local.properties
- name: Gradle cache
uses: actions/cache@main
uses: actions/cache@v2
with:
path: ~/.gradle
key: gradle-${{ hashFiles('**/*.gradle') }}

View File

@ -1,41 +0,0 @@
name: Native build
on:
push:
branches:
- dev
paths:
- 'TMessagesProj/jni/**'
- 'ss-rust/src/main/rust/**'
jobs:
native:
name: Native Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Android SDK Tools
uses: android-actions/setup-android@v2
- name: Install NDK
run: |
echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.3.6528147" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.3.6528147" >> local.properties
- uses: actions/setup-go@v2
with:
go-version: ^1.15
- name: Native Cache
uses: actions/cache@main
with:
path: |
TMessagesProj/libs
TMessagesProj/src/main/libs
key: ${{ hashFiles('TMessagesProj/jni/**', 'ss-rust/src/main/rust/**') }}
- name: Fix Gradle Memoery
run: sed -i -e "s/16384/6144/g" gradle.properties
- name: Native Build
run: |
test -f TMessagesProj/libs/libv2ray.aar && exit 0
./run init action
./run init libs
./run libs update

View File

@ -59,7 +59,7 @@ repositories {
dependencies {
implementation "androidx.browser:browser:1.3.0"
implementation 'androidx.core:core-ktx:1.5.0-beta01'
implementation 'androidx.core:core-ktx:1.5.0-beta02'
implementation 'androidx.palette:palette-ktx:1.0.0'
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.3.2'
@ -93,7 +93,8 @@ dependencies {
implementation project(":openpgp-api")
compileOnly files('libs/libv2ray.aar')
compileOnly fileTree("libs")
compileOnly "com.google.firebase:firebase-messaging:$fcmVersion"
compileOnly "com.google.firebase:firebase-crashlytics:$crashlyticsVersion"
compileOnly "com.google.android.play:core:$playCoreVersion"
@ -336,7 +337,7 @@ android {
sourceSets.all { set ->
if (set.name.startsWith("full")) {
set.dependencies {
implementation files('libs/libv2ray.aar', 'libs/ss-rust-release.aar', 'libs/ssr-libev-release.aar')
implementation fileTree("libs")
}
}
if (set.name.matches("(mini|full).*")) {

3
bin/init/action/boringssl.sh Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
sudo apt-get install bison gcc make curl ninja-build -y

View File

@ -1,10 +1,8 @@
#!/bin/bash
sudo apt-get install bison gcc make curl ninja-build -y
#!/usr/bin/env bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain none -y
echo "source \$HOME/.cargo/env" >>$HOME/.bashrc && source $HOME/.cargo/env
git submodule update --init --recursive
git submodule update --init ss-rust/src/main/rust/shadowsocks-rust
cd ss-rust/src/main/rust/shadowsocks-rust
rustup target install armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android

View File

@ -2,24 +2,5 @@
source "bin/init/env.sh"
export NINJA_PATH="$(command -v ninja)"
export PATH=$(echo "$ANDROID_HOME"/cmake/*/bin):$PATH
cd TMessagesProj/jni || exit 1
git submodule update --init --recursive
cd ffmpeg
git reset --hard
git clean -fdx
cd ..
./build_ffmpeg_clang.sh || exit 1
./patch_ffmpeg.sh || exit 1
cd boringssl
git reset --hard
git clean -fdx
cd ..
./patch_boringssl.sh || exit 1
./build_boringssl.sh
bin/init/libs/ffmpeg.sh
bin/init/libs/boringssl.sh

17
bin/init/libs/boringssl.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
source "bin/init/env.sh"
export NINJA_PATH="$(command -v ninja)"
export PATH=$(echo "$ANDROID_HOME"/cmake/*/bin):$PATH
cd TMessagesProj/jni || exit 1
git submodule update --init boringssl
cd boringssl
git reset --hard
git clean -fdx
cd ..
./patch_boringssl.sh || exit 1
./build_boringssl.sh

14
bin/init/libs/ffmpeg.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
source "bin/init/env.sh"
cd TMessagesProj/jni || exit 1
git submodule update --init ffmpeg
cd ffmpeg
git reset --hard
git clean -fdx
cd ..
./build_ffmpeg_clang.sh || exit 1
./patch_ffmpeg.sh || exit 1

7
bin/libs/shadowsocks.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
source "bin/init/env.sh"
git submodule update --init ss-rust/src/main/rust/shadowsocks-rust
./gradlew ss-rust:assembleRelease || exit 1
cp ss-rust/build/outputs/aar/* TMessagesProj/libs

View File

@ -1,6 +0,0 @@
#!/bin/bash
source "bin/init/env.sh"
./gradlew ss-rust:assembleRelease || exit 1
cp ss-rust/build/outputs/aar/* TMessagesProj/libs

View File

@ -2,5 +2,6 @@
source "bin/init/env.sh"
git submodule update --init 'ssr-libev/src/main/jni/*'
./gradlew ssr-libev:assembleRelease || exit 1
cp ssr-libev/build/outputs/aar/* TMessagesProj/libs
cp ssr-libev/build/outputs/aar/* TMessagesProj/libs

View File

@ -1,6 +1,6 @@
#!/bin/bash
bin/libs/v2ray.sh || exit 1
bin/libs/ss.sh || exit 1
bin/libs/shadowsocks.sh || exit 1
bin/libs/ssr.sh || exit 1
bin/libs/native.sh || exit 1

View File

@ -1,19 +1,9 @@
#!/bin/bash
V2RAY_CORE_VERSION="4.34.0"
// v4.34.0
V2RAY_CORE_VERSION="a6efb4d60b86789a68ed8ac8d52cfcec2d80229a"
source "bin/init/env.sh"
#v2rayCore="$(go env GOPATH)/src/v2ray.com/core"
#
#if [ ! -f "$v2rayCore/go.mod" ]; then
# git clone https://github.com/v2fly/v2ray-core.git "$v2rayCore" -b "v$V2RAY_CORE_VERSION" --depth 1
#fi
#
#cd "$v2rayCore"
#git fetch origin "v$V2RAY_CORE_VERSION"
#git checkout -b master
#git reset "v$V2RAY_CORE_VERSION" --hard
export GO111MOUDLE=on
export PATH="$PATH:$(go env GOPATH)/bin"
@ -21,8 +11,9 @@ cd "$PROJECT/build"
[ -d "v2ray" ] || git clone https://github.com/2dust/AndroidLibV2rayLite v2ray
cd v2ray
git reset --hard && git clean -fdx
sed -i -e "s|go 1.14|go 1.15|g" go.mod
go mod download -x
sed -i -e "s|go 1.14|go 1.16|g" go.mod
sed -i -e "s|core master|core $V2RAY_CORE_VERSION|g" go.mod
go mod download -x || exit 1
go get -v golang.org/x/mobile/cmd/...
gomobile init
gomobile bind -v -ldflags='-s -w' . || exit 1