platform: Upgrade NDK to the latest LTS version

This commit is contained in:
世界
2024-02-26 22:49:48 +08:00
parent 02b7041de6
commit 7359fdf195
3 changed files with 18 additions and 15 deletions

View File

@@ -84,8 +84,8 @@ builds:
goarch: arm goarch: arm
goarm: 7 goarm: 7
env: env:
- CC=armv7a-linux-androideabi19-clang - CC=armv7a-linux-androideabi21-clang
- CXX=armv7a-linux-androideabi19-clang++ - CXX=armv7a-linux-androideabi21-clang++
- goos: android - goos: android
goarch: arm64 goarch: arm64
env: env:
@@ -94,8 +94,8 @@ builds:
- goos: android - goos: android
goarch: 386 goarch: 386
env: env:
- CC=i686-linux-android19-clang - CC=i686-linux-android21-clang
- CXX=i686-linux-android19-clang++ - CXX=i686-linux-android21-clang++
- goos: android - goos: android
goarch: amd64 goarch: amd64
goamd64: v1 goamd64: v1

View File

@@ -30,7 +30,7 @@ func FindSDK() {
} }
for _, path := range searchPath { for _, path := range searchPath {
path = os.ExpandEnv(path) path = os.ExpandEnv(path)
if rw.FileExists(path + "/licenses/android-sdk-license") { if rw.FileExists(filepath.Join(path, "licenses", "android-sdk-license")) {
androidSDKPath = path androidSDKPath = path
break break
} }
@@ -58,11 +58,13 @@ func FindSDK() {
} }
func findNDK() bool { func findNDK() bool {
if rw.FileExists(androidSDKPath + "/ndk/25.1.8937393") { const fixedVersion = "26.2.11394342"
androidNDKPath = androidSDKPath + "/ndk/25.1.8937393" const versionFile = "source.properties"
if fixedPath := filepath.Join(androidSDKPath, "ndk", fixedVersion); rw.FileExists(filepath.Join(fixedPath, versionFile)) {
androidNDKPath = fixedPath
return true return true
} }
ndkVersions, err := os.ReadDir(androidSDKPath + "/ndk") ndkVersions, err := os.ReadDir(filepath.Join(androidSDKPath, "ndk"))
if err != nil { if err != nil {
return false return false
} }
@@ -83,8 +85,10 @@ func findNDK() bool {
return true return true
}) })
for _, versionName := range versionNames { for _, versionName := range versionNames {
if rw.FileExists(androidSDKPath + "/ndk/" + versionName) { currentNDKPath := filepath.Join(androidSDKPath, "ndk", versionName)
androidNDKPath = 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 return true
} }
} }
@@ -95,13 +99,12 @@ var GoBinPath string
func FindMobile() { func FindMobile() {
goBin := filepath.Join(build.Default.GOPATH, "bin") goBin := filepath.Join(build.Default.GOPATH, "bin")
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
if !rw.FileExists(goBin + "/" + "gobind.exe") { if !rw.FileExists(filepath.Join(goBin, "gobind.exe")) {
log.Fatal("missing gomobile.exe installation") log.Fatal("missing gomobile installation")
} }
} else { } else {
if !rw.FileExists(goBin + "/" + "gobind") { if !rw.FileExists(filepath.Join(goBin, "gobind")) {
log.Fatal("missing gomobile installation") log.Fatal("missing gomobile installation")
} }
} }