Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

Commit

Permalink
fix: ndk pipeline setup
Browse files Browse the repository at this point in the history
  • Loading branch information
zaneschepke committed Feb 23, 2024
1 parent f0c28de commit 4e1b414
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 9 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@ jobs:
x86_64-linux-android \
i686-linux-android
- name: Setup Android SDK
uses: android-actions/setup-android@v3
uses: nttld/setup-ndk@v1
with:
ndk-version: r25c
- name: Add cargo-ndk
run: |
cargo install cargo-ndk
- name: Install Protoc
uses: arduino/setup-protoc@v3
# Here we need to decode keystore.jks from base64 string and place it
# in the folder specified in the release signing configuration
- name: Decode Keystore
Expand All @@ -70,7 +74,9 @@ jobs:

# Build and sign APK ("-x test" argument is used to skip tests)
- name: Build Release APK
run: ./gradlew :app:assembleRelease -x test
run: ./gradlew :app:assembleRelease -x test --stacktrace
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}

# get release apk path
# can be fdroid or general, general for now
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ jobs:
x86_64-linux-android \
i686-linux-android
- name: Setup Android SDK
uses: android-actions/setup-android@v3
uses: nttld/setup-ndk@v1
with:
ndk-version: r25c
- name: Add cargo-ndk
run: |
cargo install cargo-ndk
- name: Install Protoc
uses: arduino/setup-protoc@v3
# Here we need to decode keystore.jks from base64 string and place it
# in the folder specified in the release signing configuration
- name: Decode Keystore
Expand All @@ -70,7 +74,9 @@ jobs:

# Build and sign APK ("-x test" argument is used to skip tests)
- name: Build Release APK
run: ./gradlew :app:assembleRelease -x test
run: ./gradlew :app:assembleRelease -x test --stacktrace
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}

# get release apk path
# can be fdroid or general, general for now
Expand Down
4 changes: 4 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
What's new:
- Add vpn lib integration
- Splash screen
- Country list
11 changes: 8 additions & 3 deletions vpn-client/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import com.android.build.gradle.internal.tasks.factory.dependsOn
import java.util.Locale
import org.gradle.kotlin.dsl.support.listFilesOrdered

plugins {
alias(libs.plugins.android.library)
Expand All @@ -10,6 +10,10 @@ plugins {

android {

android {
ndkVersion = sdkDirectory.resolve("ndk").listFilesOrdered().last().name
}

project.tasks.preBuild.dependsOn(Constants.BUILD_LIB_TASK)

namespace = "${Constants.NAMESPACE}.${Constants.VPN_LIB_NAME}"
Expand Down Expand Up @@ -60,11 +64,12 @@ dependencies {


tasks.register<Exec>(Constants.BUILD_LIB_TASK) {
val ndkPath = android.ndkDirectory.path ?: error("No NDK install found")
val ndkPath = android.sdkDirectory.resolve("ndk").listFilesOrdered().last().path ?: System.getenv("ANDROID_NDK_HOME")
commandLine("echo", "NDK HOME: $ndkPath")
val script = "${projectDir.path}/src/main/scripts/build-libs.sh"
//TODO find a better way to limit builds
if(file("${projectDir.path}/src/main/jniLibs/arm64-v8a/libnym_vpn_lib.so").exists() &&
file("${projectDir.path}/src/main/jniLibs/arm64-v8a/libwg.so").exists()) {
commandLine("echo", "Libs already compiled")
} else commandLine("sh").args(script, ndkPath)
} else commandLine("bash").args(script, ndkPath)
}
5 changes: 3 additions & 2 deletions vpn-client/src/main/scripts/build-libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ echo "NDK_HOME: $1"
#fix to work with different OS
archDir=$(basename $1/toolchains/llvm/prebuilt/*/)
echo "archdir: ${archDir}"
export NDK_TOOLCHAIN_DIR="$1/toolchains/llvm/prebuilt/${archDir[0]}/bin"
sh $PWD/src/tools/nym-vpn-client/wireguard/libwg/build-android.sh
export ANDROID_NDK_HOME="$1"
export NDK_TOOLCHAIN_DIR="$1/toolchains/llvm/prebuilt/${archDir}/bin"
bash $PWD/src/tools/nym-vpn-client/wireguard/libwg/build-android.sh
echo "Building nym-vpn-lib dep"
(cd $PWD/src/tools/nym-vpn-client/nym-vpn-lib; cargo ndk -t armeabi-v7a -t arm64-v8a -t i686-linux-android -t x86_64-linux-android -o ../../../main/jniLibs build --release)
#mv wireguard
Expand Down

0 comments on commit 4e1b414

Please sign in to comment.