From 31eac4e11d04b00a653494f66ffbd2f5cb5b17fc Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Fri, 11 Mar 2016 10:59:18 +0100 Subject: [PATCH] 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 --- misc/androidstudio/README.md | 2 +- .../src/main/groovy/org/golang/mobile/GobindPlugin.groovy | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/misc/androidstudio/README.md b/misc/androidstudio/README.md index bef878e..09c1f45 100644 --- a/misc/androidstudio/README.md +++ b/misc/androidstudio/README.md @@ -9,7 +9,7 @@ plugins { } gobind { - // package to bind + // Package to bind. Separate multiple packages with spaces. pkg "github.com/someone/somepackage" // GOPATH diff --git a/misc/androidstudio/src/main/groovy/org/golang/mobile/GobindPlugin.groovy b/misc/androidstudio/src/main/groovy/org/golang/mobile/GobindPlugin.groovy index d4df51f..6835029 100644 --- a/misc/androidstudio/src/main/groovy/org/golang/mobile/GobindPlugin.groovy +++ b/misc/androidstudio/src/main/groovy/org/golang/mobile/GobindPlugin.groovy @@ -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)