2
0
mirror of synced 2025-02-24 07:18:15 +00:00

16 Commits

Author SHA1 Message Date
Hana Kim
683b305bdb misc/androidstudio: version up gradle plugin to 0.2.9
Change-Id: Icedef49c575937fca885e050e569e513bb7880f7
Reviewed-on: https://go-review.googlesource.com/49258
Reviewed-by: Elias Naur <elias.naur@gmail.com>
2017-07-17 18:12:14 +00:00
Ernest Chiang
901bda64d6 misc/androidstudio: check on javaCompile to avoid exception
In commit https://git.io/vQ1gV, the classpath was delayed evaluated to
the task executions. But at Library mode, there will be exception
because the javaCompile involved is not intialized. Add check to fix it.

Change-Id: I23ab2374a704de9fd7bf74ccfaed255045032b3d
Reviewed-on: https://go-review.googlesource.com/48050
Reviewed-by: Elias Naur <elias.naur@gmail.com>
2017-07-11 14:22:22 +00:00
Elias Naur
d05d36a362 misc/androidstudio: fix the classpath for gobind and gomobile
Before this CL, the JavaCompile.classpath property was evaluated early,
which resulted in missing classpath entries for first-time runs of
gradle. Delay the evaluation, making sure gobind and gomobile receives
the complete classpath.

Change-Id: Iba9be0bbf9f563eb18b2549ac8267f8db3b7dec1
Reviewed-on: https://go-review.googlesource.com/35177
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2017-01-17 14:22:50 +00:00
Elias Naur
d8b1e1aab8 bind,misc: guard reverse generated import with mobile os tags
Running go get golang.org/x/mobile/... results in errors because the
go tool fails to find the reverse generated Java ("Java/...") and
Objective-C ("ObjC/...") packages. Work around the errors by adding
the android and ios tags, respectively, to files importing those
packages.

The gobind gradle plugin is updated to pass along GOOS=android to
ensure the gobind tool continues to build Android reverse packages.

Fixes golang/go#17750

Change-Id: Id66a3c6cdfe249c6ed494192eb12195d6509332f
Reviewed-on: https://go-review.googlesource.com/34956
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-01-17 14:22:42 +00:00
Elias Naur
82c03f1188 cmd/gomobile: document the GOMOBILEFLAGS, GOARCH, GOBIND plugin settings
Change-Id: I681ac02869e137f67880416743352951960f7d8a
Reviewed-on: https://go-review.googlesource.com/33950
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-01-12 21:57:09 +00:00
Takuya Ueda
98823363be misc/androidstudio: An example setting is wrong in README
REAME shows an example like this:

```
gobind {
  // Package to bind. Separate multiple packages with spaces.
  pkg "github.com/someone/somepackage"

  // GOPATH
  GOPATH "/home/gopher"

  // Optional list of architectures. Defaults to all supported architectures.
  GOARCH="arm amd64"

  // Absolute path to the gomobile binary. Optional.
  GOMOBILE "/mypath/bin/gomobile"

  // Absolute path to the gomobile binary. Optional.
  GOBIND "/mypath/bin/gobind"

  // Absolute path to the go binary. Optional.
  GO "/usr/local/go/bin/go"

  // Pass extra parameters to command line. Optional.
  GOMOBILEFLAGS "-javapkg my.java.package"
}
```

But this example is wrong because each settings need `=` between a key and value.

Fixes golang/go#17996

Change-Id: I0f7acca78aee1032a67c35308b4ce78f97b1aa43
Reviewed-on: https://go-review.googlesource.com/33372
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-11-21 14:18:27 +00:00
Elias Naur
276a798324 misc/androidstudio: fix gobind gradle plugin test
Change-Id: Icbec67cbc000e4770ccc82a95a1a9ce1e22bbc18
Reviewed-on: https://go-review.googlesource.com/32592
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-11-03 14:21:49 +00:00
Elias Naur
4db6347e33 misc/androidstudio: add support for the android gradle plugin
The gobind plugin exposes a set of Go packages as a AAR file ready to be
used by and Android project. Unfortunately, being a library project
limits the Go packages to access only the Java API from the standard
library and the Android SDK.

This CL tightens the integration with the Android plugin to support access
to project dependencies such as the Android Support Library, to the generated
R.* resource classes and finally to the Android databinding classes.

When the gradle project has loaded the Android plugin, the generation of
the Go library is split in two.
First, the gobind tool generates the Java classes for the bound Go
packages. In this step, Go packages can access the standard Java and Android
libraries as well as project dependencies. After this step, Android
databinding layout files can refer to Go classes.
In step two, the gomobile tool generates the JNI libraries
with the Go implementation of the generated Java classes. In this
step, Go can access the standard Java and Android libraries,
dependencies as well as R.* and generated databinding classes.

Change-Id: If853ecabdbd01eec5f89d064a6bc715cb20a4d83
Reviewed-on: https://go-review.googlesource.com/30094
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-10-05 13:08:54 +00:00
Hana Kim
df6b37ba82 misc/androidstudio: release gradle plugin 0.2.6
Also
- include a properties file for org.golang.mobile.bind.canary
which is used to canary before release.
- update example/bind/android gradle config.

Change-Id: I1dd0ff94a772b287a2f9be1a915ea72b1c3b0d52
Reviewed-on: https://go-review.googlesource.com/23678
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-06-02 18:18:59 +00:00
Kenneth Shaw
c435d0bad5 mobile: fix issues with GOMOBILEFLAGS in Gradle gobind plugin
A minor issue in the gobind gradle plugin script was preventing
GOMOBILEFLAGS from being correctly injected into the gomobile bind
command line. This change fixes that, as well as updates the
corresponding README.md with an example for passing the -javapkg flag to
gomobile.

The issue here is that after the split on GOMOBILEFLAGS, if
GOMOBILEFLAGS contained more than one parameter, ie "-javapkg my.pkg",
then the array gets aggregated into cmd, ie ["string1", ["-javapkg",
"my.pkg"], "string2"]. When join() is later called on cmd, this results
in a string looking like this: "string1 L[javajunk...] string2"

The cmd.addAll instead uses cmd's underlying Array Collection
interface to add all the elements from the gomobileFlags.split(" ")
call.

Change-Id: I45790035da7e09397ac2e610454ba7be1e619930
Reviewed-on: https://go-review.googlesource.com/22011
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-04-27 17:00:39 +00:00
Elias Naur
31eac4e11d mobile/misc/androidstudio: support multiple packages
Let the 'pkg' configuration contain multiple packages, separated by
spaces.

Change-Id: Iea4385c126aef7cf839b0fa542a3e6c4530f57fe
Reviewed-on: https://go-review.googlesource.com/20572
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-03-11 15:38:19 +00:00
Hyang-Ah Hana Kim
2e1e39e5a6 misc/androidstudio: release gobind gradle plugin 0.2.4
That supports GOARCH property.

Also this CL updates examples and upgrades the android gradle plugin
used in examples (from 1.2.3 to 1.5.0)

For golang/go#12819

Change-Id: Ibfed128eaf725775810aa539bd5c0e1ca88f1b85
Reviewed-on: https://go-review.googlesource.com/20331
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-03-08 02:06:34 +00:00
Elias Naur
493d0b451b modbile/misc/androidstudio: add GOARCH to the gradle plugin
Add GOARCH to the gobind gradle plugin to limit the architectures to
include in the fat .aar file. If GOARCH is empty or not specified,
every supported architecture is included.

GobindPlugin.groovy was indented with both tabs and (a varying number
of) spaces, so it is re-indented here with tabs. Sorry.

For golang/go#12819

Change-Id: I8b2cb72068df7750d20f474395944ca2968a2f1b
Reviewed-on: https://go-review.googlesource.com/20305
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-03-07 18:38:19 +00:00
Hyang-Ah (Hana) Kim
65551d85b6 misc/androidstudio: handle missing local.properties.
Fixes golang/go#12543

Change-Id: Ifb91e073ff2ebcba111e279949d5120a77b0dc2d
Reviewed-on: https://go-review.googlesource.com/14475
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-11 20:14:45 +00:00
Hyang-Ah (Hana) Kim
dc0c746bbb misc/androidstudio: change GobindPlugin parameters
Plugin version 0.2.2:

While debugging golang/go#11895 I noticed the PATH param is less
intuitive that I hoped for. This change makes the plugin requires
instead:

   pkg: the package to compile
   GOMOBILE: absolute path to gomobile
   GO: absolute path to go
   GOPATH: gopath.

GOMOBILE/GO params are optional if Android Studio is configured
to include right paths in its environment.

Additional changes included in this cl:
  - GOMOBILEFLAGS param for users to optionally specify gomobile
    options e.g. -v -x which will be useful for debugging.
  - Set src/target java version to 1.7. Previous versions of plugins
    were compiled with JDK8 by accident, which prevented use of
    the android studio recommended JDK7.

Change-Id: Ie7818eb20c5220b16ed0ebccfb91520fe03e6ccd
Reviewed-on: https://go-review.googlesource.com/12923
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-31 19:59:48 +00:00
Hyang-Ah (Hana) Kim
8c8ee830af misc/androidstudio: source code for gomobile bind gradle plugin.
Currently version 0.2.1

I messed up previous versions and plugins.gradle.org doesn't let me
remove the bad versions.

Change-Id: I9eef512633b461ff5a7fcbe11a3e104efb250d61
Reviewed-on: https://go-review.googlesource.com/12538
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-22 22:16:26 +00:00