cmd/gomobile: fix a bug in handling -target=ios flag value
When -target=ios, GOOS must be 'darwin'. Fixes golang/go#13670 Change-Id: Ie20db14cf24d886e13d9fe2e70caa0308790ad87 Reviewed-on: https://go-review.googlesource.com/18042 Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
parent
c897050410
commit
4f51fe273b
@ -97,10 +97,10 @@ func runBind(cmd *command) error {
|
||||
return err
|
||||
}
|
||||
|
||||
switch buildTarget {
|
||||
switch targetOS {
|
||||
case "android":
|
||||
return goAndroidBind(pkgs, targetArchs)
|
||||
case "ios":
|
||||
case "darwin":
|
||||
// TODO: use targetArchs?
|
||||
return goIOSBind(pkgs)
|
||||
default:
|
||||
|
@ -106,7 +106,7 @@ func runBuild(cmd *command) (err error) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
case "ios":
|
||||
case "darwin":
|
||||
// TODO: use targetArchs?
|
||||
if runtime.GOOS != "darwin" {
|
||||
return fmt.Errorf("-target=ios requires darwin host")
|
||||
@ -357,8 +357,12 @@ func parseBuildTarget(buildTarget string) (os string, archs []string, _ error) {
|
||||
archs = append(archs, arch)
|
||||
}
|
||||
|
||||
if all {
|
||||
return os, supported, nil
|
||||
targetOS := os
|
||||
if os == "ios" {
|
||||
targetOS = "darwin"
|
||||
}
|
||||
return os, archs, nil
|
||||
if all {
|
||||
return targetOS, supported, nil
|
||||
}
|
||||
return targetOS, archs, nil
|
||||
}
|
||||
|
@ -117,10 +117,10 @@ func TestParseBuildTargetFlag(t *testing.T) {
|
||||
{"android,android/arm", false, "android", androidArchs},
|
||||
{"android/arm", false, "android", "arm"},
|
||||
|
||||
{"ios", false, "ios", iosArchs},
|
||||
{"ios,ios/arm", false, "ios", iosArchs},
|
||||
{"ios/arm", false, "ios", "arm"},
|
||||
{"ios/amd64", false, "ios", "amd64"},
|
||||
{"ios", false, "darwin", iosArchs},
|
||||
{"ios,ios/arm", false, "darwin", iosArchs},
|
||||
{"ios/arm", false, "darwin", "arm"},
|
||||
{"ios/amd64", false, "darwin", "amd64"},
|
||||
|
||||
{"", true, "", ""},
|
||||
{"linux", true, "", ""},
|
||||
|
Loading…
x
Reference in New Issue
Block a user