2
0
mirror of synced 2025-02-24 07:18:15 +00:00
mobile/misc/androidstudio
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
..

gobindPlugin invokes gomobile bind command on the specified package.

Usage

build.gradle:

plugins {
  id "org.golang.mobile.bind" version "0.2.4"
}

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
  GOMOBILE "/mypath/bin/gomobile"

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

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

For details: https://plugins.gradle.org/plugin/org.golang.mobile.bind

TODO

  • Find the stale aar file (how?)