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>
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 bd6e3e0..6fb7d98 100644
--- a/misc/androidstudio/src/main/groovy/org/golang/mobile/GobindPlugin.groovy
+++ b/misc/androidstudio/src/main/groovy/org/golang/mobile/GobindPlugin.groovy
@@ -216,9 +216,11 @@
}
def cmd = ["bind", "-i"]
// Add the generated R and databinding classes to the classpath.
- def classpath = project.files(javaCompile.classpath, javaCompile.destinationDir)
- cmd << "-classpath"
- cmd << classpath.join(File.pathSeparator)
+ if (javaCompile) {
+ def classpath = project.files(javaCompile.classpath, javaCompile.destinationDir)
+ cmd << "-classpath"
+ cmd << classpath.join(File.pathSeparator)
+ }
cmd << "-o"
cmd << outputFile.getAbsolutePath()
cmd << "-target"