diff --git a/cmd/gomobile/bind_iosapp.go b/cmd/gomobile/bind_iosapp.go index 7980f6d..e2702f0 100644 --- a/cmd/gomobile/bind_iosapp.go +++ b/cmd/gomobile/bind_iosapp.go @@ -44,7 +44,6 @@ func goIOSBind(pkg *build.Package) error { cmd := exec.Command("xcrun", "lipo", "-create") - // TODO(crawshaw): Build in parallel. for _, env := range [][]string{darwinArmEnv, darwinArm64Env, darwinAmd64Env} { arch := archClang(getenv(env, "GOARCH")) path, err := goIOSBindArchive(name, mainFile, env) diff --git a/cmd/gomobile/build.go b/cmd/gomobile/build.go index 3bed775..a973f99 100644 --- a/cmd/gomobile/build.go +++ b/cmd/gomobile/build.go @@ -203,9 +203,12 @@ func init() { } func goBuild(src string, env []string, args ...string) error { + // The -p flag is to speed up darwin/arm builds. + // Remove when golang.org/issue/10477 is resolved. cmd := exec.Command( "go", "build", + fmt.Sprintf("-p=%d", runtime.NumCPU()), "-pkgdir="+pkgdir(env), "-tags="+strconv.Quote(strings.Join(ctx.BuildTags, ",")), ) diff --git a/cmd/gomobile/init.go b/cmd/gomobile/init.go index 8d7af18..069cb23 100644 --- a/cmd/gomobile/init.go +++ b/cmd/gomobile/init.go @@ -168,7 +168,9 @@ func installStd(env []string, args ...string) error { fmt.Fprintf(os.Stderr, "\n# Building standard library for %s/%s.\n", tOS, tArch) } - cmd := exec.Command("go", "install", "-pkgdir="+pkgdir(env)) + // The -p flag is to speed up darwin/arm builds. + // Remove when golang.org/issue/10477 is resolved. + cmd := exec.Command("go", "install", fmt.Sprintf("-p=%d", runtime.NumCPU()), "-pkgdir="+pkgdir(env)) cmd.Args = append(cmd.Args, args...) if buildV { cmd.Args = append(cmd.Args, "-v")