Skip to content

Commit

Permalink
chore: build infra change
Browse files Browse the repository at this point in the history
  • Loading branch information
nexplorer-3e committed Aug 18, 2023
1 parent d1dc63a commit ce9a556
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 11 deletions.
27 changes: 17 additions & 10 deletions .github/workflows/debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,14 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: |
sudo apt-get install yasm -y
./run init libs libvpx
./run init libs ffmpeg
./run init action boringssl
./run init libs boringssl
sudo apt-get install bison gcc make curl ninja-build -y
. buildenv.sh
cd TMessagesProj/jni
./build_libvpx_clang.sh
./build_ffmpeg_clang.sh
./patch_ffmpeg.sh
./patch_boringssl.sh
./build_boringssl.sh
native:
name: Native Build (Telegram)
runs-on: ubuntu-latest
Expand All @@ -81,6 +85,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Fetch Status
run: |
git submodule status TMessagesProj/jni/ffmpeg > ffmpeg_status
Expand All @@ -105,13 +111,15 @@ jobs:
TMessagesProj/jni/ffmpeg/build
TMessagesProj/jni/libvpx/build
key: ${{ hashFiles('ffmpeg_status', 'libvpx_status', 'TMessagesProj/jni/*ffmpeg*.sh', 'TMessagesProj/jni/*libvpx*.sh', 'TMessagesProj/jni/patches/ffmpeg/*') }}
fail-on-cache-miss: 'true'
- name: BoringSSL Cache
uses: actions/cache@v3
if: steps.cache.outputs.cache-hit != 'true'
with:
path: |
TMessagesProj/jni/boringssl/build
key: ${{ hashFiles('boringssl_status') }}
fail-on-cache-miss: 'true'
- name: Setup Android SDK Tools
uses: android-actions/setup-android@v2
if: steps.cache.outputs.cache-hit != 'true'
Expand All @@ -121,11 +129,6 @@ jobs:
echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;21.4.7075529" --sdk_root=${ANDROID_SDK_ROOT} &> /dev/null
echo "sdk.dir=${ANDROID_HOME}" > local.properties
echo "ndk.dir=${ANDROID_HOME}/ndk/21.4.7075529" >> local.properties
- name: Fix BoringSSL
if: steps.cache.outputs.cache-hit != 'true'
run: |
cd TMessagesProj/jni
./patch_boringssl.sh
- uses: actions/setup-java@v3
name: Setup Java
with:
Expand Down Expand Up @@ -173,7 +176,11 @@ jobs:
- name: Native Build
if: steps.cache.outputs.cache-hit != 'true'
run: |
./run libs v2ray
. buildenv.sh
cd v2ray
make all
make downloadGoMobile
make BuildMobile
build:
name: Gradle Build
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ buildscript {

static String detectNdkVersion() {

def version = "21.4.7075529"
def version = System.getenv("NDK_VER")

def androidHome = System.getenv("ANDROID_HOME")

Expand Down
25 changes: 25 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#/usr/bin/env bash

. buildenv.sh

cd TMessagesProj/jni
./build_libvpx_clang.sh
./build_ffmpeg_clang.sh
./patch_ffmpeg.sh
./patch_boringssl.sh
./build_boringssl.sh

cd $PROJECT/v2ray
if [ $(command -v go) ]; then
export PATH=$PATH:$(go env GOPATH)/bin
else
echo "Error: go is not installed."
echo "To build libv2ray install latest stable go version first."
exit 1
fi
make all
make downloadGoMobile
make BuildMobile
mv libv2ray.aar ../TMessagesProj/libs

./gradlew assembleFullRelease
33 changes: 33 additions & 0 deletions buildenv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

if [ -z "$NDK_VER" ]; then export NDK_VER="21.4.7075529"; fi

if [ -z "$ANDROID_HOME" ]; then
if [ -d "$HOME/Android/Sdk" ]; then
export ANDROID_HOME="$HOME/Android/Sdk"
elif [ -d "$HOME/.local/lib/android/sdk" ]; then
export ANDROID_HOME="$HOME/.local/lib/android/sdk"
fi
fi


_NDK="$ANDROID_HOME/ndk/$NDK_VER"
[ -f "$_NDK/source.properties" ] || _NDK="$ANDROID_NDK_HOME"
[ -f "$_NDK/source.properties" ] || _NDK="$NDK"
[ -f "$_NDK/source.properties" ] || _NDK="$ANDROID_HOME/ndk-bundle"

if [ ! -f "$_NDK/source.properties" ]; then
echo "Error: NDK not found."
exit 1
fi

export ANDROID_NDK_HOME=$_NDK
export NDK=$_NDK
export PROJECT=$(realpath .)

if [ $(command -v go) ]; then
export PATH=$PATH:$(go env GOPATH)/bin
else
echo "Warning: go is not installed."
echo "To build libv2ray install latest stable go version first."
fi

0 comments on commit ce9a556

Please sign in to comment.