[mobile] mobile/cmd/gomobile: add proguard.txt to gomobile bind .aar files

121 views
Skip to first unread message

Elias Naur (Gerrit)

unread,
May 6, 2015, 6:31:37 PM5/6/15
to Ian Lance Taylor, golang-co...@googlegroups.com
Elias Naur uploaded a change:
https://go-review.googlesource.com/9802

mobile/cmd/gomobile: add proguard.txt to gomobile bind .aar files

The gomobile bind command outputs an .aar file ready to include in an
Android project. If the including project use the minifyEnabled gradle
option the field go.Seq.memptr will be removed since it is only referenced
from C code.

Instruct the minifier to keep all go.* java code by adding an appropriate
proguard.txt file to the .aar file.

Change-Id: Ia1e89a5d8f4b4f349f9c2cf4d0dba2628557fdf9
---
M cmd/gomobile/bind.go
1 file changed, 7 insertions(+), 1 deletion(-)



diff --git a/cmd/gomobile/bind.go b/cmd/gomobile/bind.go
index 8804e38..0a2a9a4 100644
--- a/cmd/gomobile/bind.go
+++ b/cmd/gomobile/bind.go
@@ -311,7 +311,7 @@
// R.txt (mandatory)
// res/ (mandatory)
// libs/*.jar (optional, not relevant)
-// proguard.txt (optional, not relevant)
+// proguard.txt (optional)
// lint.jar (optional, not relevant)
// aidl (optional, not relevant)
//
@@ -345,6 +345,12 @@
const manifestFmt = `<manifest
xmlns:android="http://schemas.android.com/apk/res/android" package=%q />`
fmt.Fprintf(w, manifestFmt, "go."+pkg.Name+".gojni")

+ w, err = aarwcreate("proguard.txt")
+ if err != nil {
+ return err
+ }
+ fmt.Fprintln(w, `-keep class go.** { *; }`)
+
w, err = aarwcreate("classes.jar")
if err != nil {
return err

--
https://go-review.googlesource.com/9802

David Crawshaw (Gerrit)

unread,
May 6, 2015, 6:49:43 PM5/6/15
to Elias Naur, golang-co...@googlegroups.com
David Crawshaw has posted comments on this change.

mobile/cmd/gomobile: add proguard.txt to gomobile bind .aar files

Patch Set 1: Code-Review+2

Thanks!

--
https://go-review.googlesource.com/9802
Gerrit-Reviewer: David Crawshaw <craw...@golang.org>
Gerrit-HasComments: No

David Crawshaw (Gerrit)

unread,
May 6, 2015, 6:49:49 PM5/6/15
to Elias Naur, golang-...@googlegroups.com, golang-co...@googlegroups.com
David Crawshaw has submitted this change and it was merged.

mobile/cmd/gomobile: add proguard.txt to gomobile bind .aar files

The gomobile bind command outputs an .aar file ready to include in an
Android project. If the including project use the minifyEnabled gradle
option the field go.Seq.memptr will be removed since it is only referenced
from C code.

Instruct the minifier to keep all go.* java code by adding an appropriate
proguard.txt file to the .aar file.

Change-Id: Ia1e89a5d8f4b4f349f9c2cf4d0dba2628557fdf9
Reviewed-on: https://go-review.googlesource.com/9802
Reviewed-by: David Crawshaw <craw...@golang.org>
---
M cmd/gomobile/bind.go
1 file changed, 7 insertions(+), 1 deletion(-)

Approvals:
David Crawshaw: Looks good to me, approved
Reply all
Reply to author
Forward
0 new messages