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>
This commit is contained in:
Elias Naur
2016-03-11 10:59:18 +01:00
parent 5b73745053
commit 31eac4e11d
2 changed files with 5 additions and 5 deletions

View File

@ -9,7 +9,7 @@ plugins {
}
gobind {
// package to bind
// Package to bind. Separate multiple packages with spaces.
pkg "github.com/someone/somepackage"
// GOPATH

View File

@ -46,10 +46,10 @@ class GobindTask extends DefaultTask implements OutputFileTask {
@TaskAction
def gobind() {
def pkg = project.gobind.pkg
def pkg = project.gobind.pkg.trim()
def gopath = (project.gobind.GOPATH ?: System.getenv("GOPATH"))?.trim()
if (!pkg || !gopath) {
throw new GradleException('gobind.pkg and gobind.GOPATH must be set')
throw new GradleException('gobind.pkg and gobind.GOPATH must be set')
}
def paths = (gopath.split(File.pathSeparator).collect{ "$it/bin" } +
@ -97,7 +97,7 @@ class GobindTask extends DefaultTask implements OutputFileTask {
if (gomobileFlags) {
cmd = cmd+gomobileFlags.split(" ")
}
cmd << pkg
cmd.addAll(pkg.split(" "))
args(cmd)
if (!androidHome?.trim()) {
@ -137,7 +137,7 @@ class GobindTask extends DefaultTask implements OutputFileTask {
}
class GobindExtension {
// Package to bind. (required)
// Package to bind. Separate multiple packages with spaces. (required)
def String pkg = ""
// GOPATH: necessary for gomobile tool. (required)