Skip to content

Commit 1d3b1e5

Browse files
committed
feat: added glflags
1 parent 1ad2df2 commit 1d3b1e5

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed

cmd/gomobile/bind.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ classes.
6565
6666
The -v flag provides verbose output, including the list of packages built.
6767
68-
The build flags -a, -n, -x, -gcflags, -ldflags, -tags, -trimpath, and -work
68+
The build flags -a, -n, -x, -gcflags, -ldflags, -tags, -glflags, -trimpath, and -work
6969
are shared with the build command. For documentation, see 'go help build'.
7070
`,
7171
}
@@ -231,9 +231,10 @@ func getModuleVersions(targetPlatform string, targetArch string, src string) (*m
231231
cmd.Env = append(os.Environ(), "GOOS="+platformOS(targetPlatform), "GOARCH="+targetArch)
232232

233233
tags := append(buildTags[:], platformTags(targetPlatform)...)
234+
glflags := buildGoListFlags
234235

235236
// TODO(hyangah): probably we don't need to add all the dependencies.
236-
cmd.Args = append(cmd.Args, "-m", "-json", "-tags="+strings.Join(tags, ","), "all")
237+
cmd.Args = append(cmd.Args, glflags, "-m", "-json", "-tags="+strings.Join(tags, ","), "all")
237238
cmd.Dir = src
238239

239240
output, err := cmd.Output()

cmd/gomobile/build.go

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -233,27 +233,29 @@ func printcmd(format string, args ...interface{}) {
233233

234234
// "Build flags", used by multiple commands.
235235
var (
236-
buildA bool // -a
237-
buildI bool // -i
238-
buildN bool // -n
239-
buildV bool // -v
240-
buildX bool // -x
241-
buildO string // -o
242-
buildGcflags string // -gcflags
243-
buildLdflags string // -ldflags
244-
buildTarget string // -target
245-
buildTrimpath bool // -trimpath
246-
buildWork bool // -work
247-
buildBundleID string // -bundleid
248-
buildIOSVersion string // -iosversion
249-
buildAndroidAPI int // -androidapi
250-
buildTags stringsFlag // -tags
236+
buildA bool // -a
237+
buildI bool // -i
238+
buildN bool // -n
239+
buildV bool // -v
240+
buildX bool // -x
241+
buildO string // -o
242+
buildGcflags string // -gcflags
243+
buildLdflags string // -ldflags
244+
buildTarget string // -target
245+
buildTrimpath bool // -trimpath
246+
buildWork bool // -work
247+
buildBundleID string // -bundleid
248+
buildIOSVersion string // -iosversion
249+
buildAndroidAPI int // -androidapi
250+
buildTags stringsFlag // -tags
251+
buildGoListFlags string // -glflags
251252
)
252253

253254
func addBuildFlags(cmd *command) {
254255
cmd.flag.StringVar(&buildO, "o", "", "")
255256
cmd.flag.StringVar(&buildGcflags, "gcflags", "", "")
256257
cmd.flag.StringVar(&buildLdflags, "ldflags", "", "")
258+
cmd.flag.StringVar(&buildGoListFlags, "glflags", "", "")
257259
cmd.flag.StringVar(&buildTarget, "target", "android", "")
258260
cmd.flag.StringVar(&buildBundleID, "bundleid", "", "")
259261
cmd.flag.StringVar(&buildIOSVersion, "iosversion", "13.0", "")

0 commit comments

Comments
 (0)