Просмотр исходного кода

travis: Install Android NDK explicitly, removed from gomobile (#3593)

The Android NDK was recently removed from gomobile, leading to our Android
builds failing. Starting from https://go-review.googlesource.com/#/c/35173/ ,
gomobile requires a locally installed NDK. This PR ensures that travis installs
that too before running the build steps.
Péter Szilágyi 8 лет назад
Родитель
Сommit
7814a8e131
2 измененных файлов с 10 добавлено и 2 удалено
  1. 2 1
      .travis.yml
  2. 8 1
      build/ci.go

+ 2 - 1
.travis.yml

@@ -65,10 +65,11 @@ matrix:
 
         # Build the Android archive and upload it to Maven Central and Azure
         - brew update
-        - brew install android-sdk maven gpg
+        - travis_wait 60 brew install android-sdk android-ndk maven gpg
         - alias gpg="gpg2"
 
         - export ANDROID_HOME=/usr/local/opt/android-sdk
+        - export ANDROID_NDK=/usr/local/opt/android-ndk
         - echo "y" | android update sdk --no-ui --filter `android list sdk | grep "SDK Platform Android" | grep -E 'API 15|API 19|API 24' | awk '{print $1}' | cut -d '-' -f 1 | tr '\n' ','`
 
         - go run build/ci.go aar -signer ANDROID_SIGNING_KEY -deploy https://oss.sonatype.org -upload gethstore/builds

+ 8 - 1
build/ci.go

@@ -700,9 +700,16 @@ func doAndroidArchive(cmdline []string) {
 	flag.CommandLine.Parse(cmdline)
 	env := build.Env()
 
+	// Sanity check that the SDK and NDK are installed and set
+	if os.Getenv("ANDROID_HOME") == "" {
+		log.Fatal("Please ensure ANDROID_HOME points to your Android SDK")
+	}
+	if os.Getenv("ANDROID_NDK") == "" {
+		log.Fatal("Please ensure ANDROID_NDK points to your Android NDK")
+	}
 	// Build the Android archive and Maven resources
 	build.MustRun(goTool("get", "golang.org/x/mobile/cmd/gomobile"))
-	build.MustRun(gomobileTool("init"))
+	build.MustRun(gomobileTool("init", "--ndk", os.Getenv("ANDROID_NDK")))
 	build.MustRun(gomobileTool("bind", "--target", "android", "--javapkg", "org.ethereum", "-v", "github.com/ethereum/go-ethereum/mobile"))
 
 	if *local {