瀏覽代碼

build: add GOBIN to PATH for gomobile (#16344)

* build: add GOBIN to PATH for gomobile

* build: install gobind alongside gomobile
Felix Lange 7 年之前
父節點
當前提交
b1917ac9a3
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4 3
      build/ci.go

+ 4 - 3
build/ci.go

@@ -726,7 +726,7 @@ func doAndroidArchive(cmdline []string) {
 		log.Fatal("Please ensure ANDROID_NDK points to your Android NDK")
 		log.Fatal("Please ensure ANDROID_NDK points to your Android NDK")
 	}
 	}
 	// Build the Android archive and Maven resources
 	// Build the Android archive and Maven resources
-	build.MustRun(goTool("get", "golang.org/x/mobile/cmd/gomobile"))
+	build.MustRun(goTool("get", "golang.org/x/mobile/cmd/gomobile", "golang.org/x/mobile/cmd/gobind"))
 	build.MustRun(gomobileTool("init", "--ndk", os.Getenv("ANDROID_NDK")))
 	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"))
 	build.MustRun(gomobileTool("bind", "--target", "android", "--javapkg", "org.ethereum", "-v", "github.com/ethereum/go-ethereum/mobile"))
 
 
@@ -777,9 +777,10 @@ func gomobileTool(subcmd string, args ...string) *exec.Cmd {
 	cmd.Args = append(cmd.Args, args...)
 	cmd.Args = append(cmd.Args, args...)
 	cmd.Env = []string{
 	cmd.Env = []string{
 		"GOPATH=" + build.GOPATH(),
 		"GOPATH=" + build.GOPATH(),
+		"PATH=" + GOBIN + string(os.PathListSeparator) + os.Getenv("PATH"),
 	}
 	}
 	for _, e := range os.Environ() {
 	for _, e := range os.Environ() {
-		if strings.HasPrefix(e, "GOPATH=") {
+		if strings.HasPrefix(e, "GOPATH=") || strings.HasPrefix(e, "PATH=") {
 			continue
 			continue
 		}
 		}
 		cmd.Env = append(cmd.Env, e)
 		cmd.Env = append(cmd.Env, e)
@@ -846,7 +847,7 @@ func doXCodeFramework(cmdline []string) {
 	env := build.Env()
 	env := build.Env()
 
 
 	// Build the iOS XCode framework
 	// Build the iOS XCode framework
-	build.MustRun(goTool("get", "golang.org/x/mobile/cmd/gomobile"))
+	build.MustRun(goTool("get", "golang.org/x/mobile/cmd/gomobile", "golang.org/x/mobile/cmd/gobind"))
 	build.MustRun(gomobileTool("init"))
 	build.MustRun(gomobileTool("init"))
 	bind := gomobileTool("bind", "--target", "ios", "--tags", "ios", "-v", "github.com/ethereum/go-ethereum/mobile")
 	bind := gomobileTool("bind", "--target", "ios", "--tags", "ios", "-v", "github.com/ethereum/go-ethereum/mobile")