cmd/build: -overlay build flag support
Overlay allows for changes to stdlib and runtime.
diff --git a/cmd/gomobile/build.go b/cmd/gomobile/build.go
index 957da94..c733e2c 100644
--- a/cmd/gomobile/build.go
+++ b/cmd/gomobile/build.go
@@ -71,8 +71,9 @@
The -v flag provides verbose output, including the list of packages built.
-The build flags -a, -i, -n, -x, -gcflags, -ldflags, -tags, -trimpath, and -work are
-shared with the build command. For documentation, see 'go help build'.
+The build flags -a, -i, -n, -x, -gcflags, -ldflags, -tags, -trimpath, -work,
+and -overlay are shared with the build command. For documentation, see
+'go help build'.
`,
}
@@ -248,6 +249,7 @@
buildIOSVersion string // -iosversion
buildAndroidAPI int // -androidapi
buildTags stringsFlag // -tags
+ buildOverlay string // -overlay
)
func addBuildFlags(cmd *command) {
@@ -258,6 +260,7 @@
cmd.flag.StringVar(&buildBundleID, "bundleid", "", "")
cmd.flag.StringVar(&buildIOSVersion, "iosversion", "13.0", "")
cmd.flag.IntVar(&buildAndroidAPI, "androidapi", minAndroidAPI, "")
+ cmd.flag.StringVar(&buildOverlay, "overlay", "", "")
cmd.flag.BoolVar(&buildA, "a", false, "")
cmd.flag.BoolVar(&buildI, "i", false, "")
@@ -327,6 +330,9 @@
if buildLdflags != "" {
cmd.Args = append(cmd.Args, "-ldflags", buildLdflags)
}
+ if buildOverlay != "" {
+ cmd.Args = append(cmd.Args, "-overlay", buildOverlay)
+ }
if buildTrimpath {
cmd.Args = append(cmd.Args, "-trimpath")
}
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
I spotted some possible problems with your PR:
1. The first word in the commit title after the package should be a lowercase English word (usually a verb).
2. You usually need to reference a bug number for all but trivial or cosmetic fixes. For the mobile repo, the format is usually 'Fixes golang/go#12345' or 'Updates golang/go#12345' at the end of the commit message. Should you have a bug reference?
Please address any problems by updating the GitHub PR.
When complete, mark this comment as 'Done' and click the [blue 'Reply' button](https://go.dev/wiki/GerritBot#i-left-a-reply-to-a-comment-in-gerrit-but-no-one-but-me-can-see-it) above. These findings are based on heuristics; if a finding does not apply, briefly reply here saying so.
To update the commit title or commit message body shown here in Gerrit, you must edit the GitHub PR title and PR description (the first comment) in the GitHub web interface using the 'Edit' button or 'Edit' menu entry there. Note: pushing a new commit to the PR will not automatically update the commit message used by Gerrit.
For more details, see:
(In general for Gerrit code reviews, the change author is expected to [log in to Gerrit](https://go-review.googlesource.com/login/) with a Gmail or other Google account and then close out each piece of feedback by marking it as 'Done' if implemented as suggested or otherwise reply to each review comment. See the [Review](https://go.dev/doc/contribute#review) section of the Contributing Guide for details.)
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Congratulations on opening your first change. Thank you for your contribution!
Next steps:
A maintainer will review your change and provide feedback. See
https://go.dev/doc/contribute#review for more info and tips to get your
patch through code review.
Most changes in the Go project go through a few rounds of revision. This can be
surprising to people new to the project. The careful, iterative review process
is our way of helping mentor contributors and ensuring that their contributions
have a lasting impact.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
The -overlay flag comes in handy when trying to change the behaviour of the Go runtime on platforms like Android.
For instance: Applying patches to change behaviour of Timers, like done by WireGuard https://github.com/WireGuard/wireguard-android/blob/09b75c2bd37f749e2a8c85876394854113c74be7/tunnel/tools/libwg-go/goruntime-boottime-over-monotonic.diff
(the diff could be patching stdlib/runtime at build time with https://github.com/felixge/go-patch-overlay, if gomobile supported -overlay)
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
and -overlay are shared with the build command. For documentation, seeLet's keep the alphabetical order like `-a, -i, -n, -x, -gcflags, -ldflags, -overlay, -tags, -trimpath, and -work`.
Also, Update bind.go too.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |