From 7359fdf1954363c772985a95f8a6b2726cea011f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 26 Feb 2024 22:49:48 +0800 Subject: [PATCH] platform: Upgrade NDK to the latest LTS version --- .goreleaser.yaml | 8 ++++---- clients/android | 2 +- cmd/internal/build_shared/sdk.go | 23 +++++++++++++---------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 7f9087f5..873e8a01 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -84,8 +84,8 @@ builds: goarch: arm goarm: 7 env: - - CC=armv7a-linux-androideabi19-clang - - CXX=armv7a-linux-androideabi19-clang++ + - CC=armv7a-linux-androideabi21-clang + - CXX=armv7a-linux-androideabi21-clang++ - goos: android goarch: arm64 env: @@ -94,8 +94,8 @@ builds: - goos: android goarch: 386 env: - - CC=i686-linux-android19-clang - - CXX=i686-linux-android19-clang++ + - CC=i686-linux-android21-clang + - CXX=i686-linux-android21-clang++ - goos: android goarch: amd64 goamd64: v1 diff --git a/clients/android b/clients/android index 66028176..c8db11f0 160000 --- a/clients/android +++ b/clients/android @@ -1 +1 @@ -Subproject commit 660281767171d26795018bad577f77e7e6bcdb91 +Subproject commit c8db11f06251e861a2733db596bf74e5497658cf diff --git a/cmd/internal/build_shared/sdk.go b/cmd/internal/build_shared/sdk.go index 0c447ba1..ce7f0c86 100644 --- a/cmd/internal/build_shared/sdk.go +++ b/cmd/internal/build_shared/sdk.go @@ -30,7 +30,7 @@ func FindSDK() { } for _, path := range searchPath { path = os.ExpandEnv(path) - if rw.FileExists(path + "/licenses/android-sdk-license") { + if rw.FileExists(filepath.Join(path, "licenses", "android-sdk-license")) { androidSDKPath = path break } @@ -58,11 +58,13 @@ func FindSDK() { } func findNDK() bool { - if rw.FileExists(androidSDKPath + "/ndk/25.1.8937393") { - androidNDKPath = androidSDKPath + "/ndk/25.1.8937393" + const fixedVersion = "26.2.11394342" + const versionFile = "source.properties" + if fixedPath := filepath.Join(androidSDKPath, "ndk", fixedVersion); rw.FileExists(filepath.Join(fixedPath, versionFile)) { + androidNDKPath = fixedPath return true } - ndkVersions, err := os.ReadDir(androidSDKPath + "/ndk") + ndkVersions, err := os.ReadDir(filepath.Join(androidSDKPath, "ndk")) if err != nil { return false } @@ -83,8 +85,10 @@ func findNDK() bool { return true }) for _, versionName := range versionNames { - if rw.FileExists(androidSDKPath + "/ndk/" + versionName) { - androidNDKPath = androidSDKPath + "/ndk/" + versionName + currentNDKPath := filepath.Join(androidSDKPath, "ndk", versionName) + if rw.FileExists(filepath.Join(androidSDKPath, versionFile)) { + androidNDKPath = currentNDKPath + log.Warn("reproducibility warning: using NDK version " + versionName + " instead of " + fixedVersion) return true } } @@ -95,13 +99,12 @@ var GoBinPath string func FindMobile() { goBin := filepath.Join(build.Default.GOPATH, "bin") - if runtime.GOOS == "windows" { - if !rw.FileExists(goBin + "/" + "gobind.exe") { - log.Fatal("missing gomobile.exe installation") + if !rw.FileExists(filepath.Join(goBin, "gobind.exe")) { + log.Fatal("missing gomobile installation") } } else { - if !rw.FileExists(goBin + "/" + "gobind") { + if !rw.FileExists(filepath.Join(goBin, "gobind")) { log.Fatal("missing gomobile installation") } }