mirror of
https://github.com/2dust/v2rayNG.git
synced 2025-12-18 23:05:47 +08:00
Sagernet (#4194)
* switch to sagernet/gomobile * arguments for rb * match ndk version * with more options * nttld/setup-ndk#518
This commit is contained in:
46
.github/workflows/build.yml
vendored
46
.github/workflows/build.yml
vendored
@@ -36,13 +36,39 @@ jobs:
|
||||
path: ${{ github.workspace }}/build/AndroidLibV2rayLite/libs
|
||||
key: libtun2socks-${{ runner.os }}-${{ hashFiles('build/AndroidLibV2rayLite/.git/refs/heads/master') }}-${{ hashFiles('build/AndroidLibV2rayLite/.git/modules/badvpn/HEAD') }}-${{ hashFiles('build/AndroidLibV2rayLite/.git/modules/libancillary/HEAD') }}
|
||||
|
||||
- name: Fetch AndroidLibXrayLite
|
||||
run: |
|
||||
cd ${{ github.workspace }}/build
|
||||
git clone --depth=1 -b main https://github.com/2dust/AndroidLibXrayLite.git
|
||||
|
||||
- name: Restore cached libv2ray
|
||||
id: cache-libv2ray-restore
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ${{ github.workspace }}/build/AndroidLibXrayLite/
|
||||
key: libv2ray-${{ runner.os }}-${{ hashFiles('build/AndroidLibXrayLite/.git/refs/heads/main') }}
|
||||
|
||||
- name: Setup Android NDK
|
||||
if: steps.cache-libtun2socks-restore.outputs.cache-hit != 'true'
|
||||
if: steps.cache-libtun2socks-restore.outputs.cache-hit != 'true' || steps.cache-libv2ray-restore.outputs.cache-hit != 'true'
|
||||
uses: nttld/setup-ndk@v1
|
||||
id: setup-ndk
|
||||
# Same version as https://gitlab.com/fdroid/fdroiddata/metadata/com.v2ray.ang.yml
|
||||
with:
|
||||
ndk-version: r27
|
||||
add-to-path: true
|
||||
link-to-sdk: true
|
||||
local-cache: true
|
||||
|
||||
- name: Restore Android Symlinks
|
||||
if: steps.cache-libtun2socks-restore.outputs.cache-hit != 'true' || steps.cache-libv2ray-restore.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
directory="${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin"
|
||||
find "$directory" -type l | while read link; do
|
||||
current_target=$(readlink "$link")
|
||||
new_target="$directory/$(basename "$current_target")"
|
||||
ln -sf "$new_target" "$link"
|
||||
echo "Changed $(basename "$link") from $current_target to $new_target"
|
||||
done
|
||||
|
||||
- name: Build libtun2socks
|
||||
if: steps.cache-libtun2socks-restore.outputs.cache-hit != 'true'
|
||||
@@ -65,18 +91,6 @@ jobs:
|
||||
run: |
|
||||
cp -r ${{ github.workspace }}/build/AndroidLibV2rayLite/libs/* ${{ github.workspace }}/V2rayNG/app/libs/
|
||||
|
||||
- name: Fetch AndroidLibXrayLite
|
||||
run: |
|
||||
cd ${{ github.workspace }}/build
|
||||
git clone --depth=1 -b main https://github.com/2dust/AndroidLibXrayLite.git
|
||||
|
||||
- name: Restore cached libv2ray
|
||||
id: cache-libv2ray-restore
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ${{ github.workspace }}/build/AndroidLibXrayLite/
|
||||
key: libv2ray-${{ runner.os }}-${{ hashFiles('build/AndroidLibXrayLite/.git/refs/heads/main') }}
|
||||
|
||||
- name: Setup Golang
|
||||
if: steps.cache-libv2ray-restore.outputs.cache-hit != 'true'
|
||||
uses: actions/setup-go@v5
|
||||
@@ -94,7 +108,7 @@ jobs:
|
||||
- name: Install gomobile
|
||||
if: steps.cache-libv2ray-restore.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
go install golang.org/x/mobile/cmd/gomobile@v0.0.0-20240806205939-81131f6468ab
|
||||
CGO_ENABLED=0 go install -trimpath -ldflags="-w -s" github.com/sagernet/gomobile/cmd/gomobile@v0.1.4
|
||||
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Build libv2ray
|
||||
@@ -103,7 +117,9 @@ jobs:
|
||||
cd ${{ github.workspace }}/build/AndroidLibXrayLite
|
||||
gomobile init
|
||||
go mod tidy -v
|
||||
gomobile bind -v -androidapi 21 -ldflags='-s -w' ./
|
||||
gomobile bind -trimpath -buildvcs=false -v -androidapi 21 -ldflags='-s -w -buildid=' ./
|
||||
env:
|
||||
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
|
||||
|
||||
- name: Save libv2ray
|
||||
if: steps.cache-libv2ray-restore.outputs.cache-hit != 'true'
|
||||
|
||||
Reference in New Issue
Block a user