Skip to content

Commit

Permalink
Merge branch 'main' into add-deeplink
Browse files Browse the repository at this point in the history
  • Loading branch information
inkeliz authored Dec 8, 2023
2 parents ff83b0a + abc34cf commit 057471f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 33 deletions.
2 changes: 1 addition & 1 deletion gogio/androidbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func compileAndroid(tmpDir string, tools *androidTools, bi *buildInfo) (err erro
return err
})
}
appDir, err := runCmd(exec.Command("go", "list", "-f", "{{.Dir}}", "gioui.org/app/"))
appDir, err := runCmd(exec.Command("go", "list", "-tags", bi.tags, "-f", "{{.Dir}}", "gioui.org/app/"))
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions gogio/build_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ type packageMetadata struct {
}

func getPkgMetadata(pkgPath string) (*packageMetadata, error) {
pkgImportPath, err := runCmd(exec.Command("go", "list", "-f", "{{.ImportPath}}", pkgPath))
pkgImportPath, err := runCmd(exec.Command("go", "list", "-tags", *extraTags, "-f", "{{.ImportPath}}", pkgPath))
if err != nil {
return nil, err
}
pkgDir, err := runCmd(exec.Command("go", "list", "-f", "{{.Dir}}", pkgPath))
pkgDir, err := runCmd(exec.Command("go", "list", "-tags", *extraTags, "-f", "{{.Dir}}", pkgPath))
if err != nil {
return nil, err
}
Expand Down
32 changes: 2 additions & 30 deletions gogio/iosbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,16 +490,6 @@ func archiveIOS(tmpDir, target, frameworkRoot string, bi *buildInfo) error {
lipo := exec.Command("xcrun", "lipo", "-o", exe, "-create")
var builds errgroup.Group
tags := bi.tags
goos := "ios"
supportsIOS, err := supportsGOOS("ios")
if err != nil {
return err
}
if !supportsIOS {
// Go 1.15 and earlier target iOS with GOOS=darwin, tags=ios.
goos = "darwin"
tags = "ios " + tags
}
for _, a := range bi.archs {
clang, cflags, err := iosCompilerFor(target, a, bi.minsdk)
if err != nil {
Expand All @@ -519,7 +509,7 @@ func archiveIOS(tmpDir, target, frameworkRoot string, bi *buildInfo) error {
cflagsLine := strings.Join(cflags, " ")
cmd.Env = append(
os.Environ(),
"GOOS="+goos,
"GOOS=ios",
"GOARCH="+a,
"CGO_ENABLED=1",
"CC="+clang,
Expand All @@ -537,7 +527,7 @@ func archiveIOS(tmpDir, target, frameworkRoot string, bi *buildInfo) error {
if _, err := runCmd(lipo); err != nil {
return err
}
appDir, err := runCmd(exec.Command("go", "list", "-f", "{{.Dir}}", "gioui.org/app/"))
appDir, err := runCmd(exec.Command("go", "list", "-tags", tags, "-f", "{{.Dir}}", "gioui.org/app/"))
if err != nil {
return err
}
Expand All @@ -555,24 +545,6 @@ func archiveIOS(tmpDir, target, frameworkRoot string, bi *buildInfo) error {
return ioutil.WriteFile(moduleFile, []byte(module), 0644)
}

func supportsGOOS(wantGoos string) (bool, error) {
geese, err := runCmd(exec.Command("go", "tool", "dist", "list"))
if err != nil {
return false, err
}
for _, pair := range strings.Split(geese, "\n") {
s := strings.SplitN(pair, "/", 2)
if len(s) != 2 {
return false, fmt.Errorf("go tool dist list: invalid GOOS/GOARCH pair: %s", pair)
}
goos := s[0]
if goos == wantGoos {
return true, nil
}
}
return false, nil
}

func iosCompilerFor(target, arch string, minsdk int) (string, []string, error) {
var (
platformSDK string
Expand Down

0 comments on commit 057471f

Please sign in to comment.