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>
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>
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.
Fixesgolang/go#17750
Change-Id: Id66a3c6cdfe249c6ed494192eb12195d6509332f
Reviewed-on: https://go-review.googlesource.com/34956
Reviewed-by: David Crawshaw <crawshaw@golang.org>
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.
Fixesgolang/go#17996
Change-Id: I0f7acca78aee1032a67c35308b4ce78f97b1aa43
Reviewed-on: https://go-review.googlesource.com/33372
Reviewed-by: David Crawshaw <crawshaw@golang.org>
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>
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>
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>
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>
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>
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>
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>
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>