Fix turbine classpath arguments
We were passing "--classpath foo.jar --classpath bar.jar" to turbine,
it now wants (and may always have expected?)
"--classpath foo.jar bar.jar".
Test: m checkbuild
Change-Id: Ib7e0ca64a34e236110f7b785d6a0fb51ed75567e
diff --git a/java/builder.go b/java/builder.go
index b5dc88a..417a7fa 100644
--- a/java/builder.go
+++ b/java/builder.go
@@ -313,7 +313,7 @@
// ensure turbine does not fall back to the default bootclasspath.
bootClasspath = `--bootclasspath ""`
} else {
- bootClasspath = strings.Join(flags.bootClasspath.FormTurbineClasspath("--bootclasspath "), " ")
+ bootClasspath = flags.bootClasspath.FormTurbineClassPath("--bootclasspath ")
}
}
@@ -330,7 +330,7 @@
"javacFlags": flags.javacFlags,
"bootClasspath": bootClasspath,
"srcJars": strings.Join(srcJars.Strings(), " "),
- "classpath": strings.Join(classpath.FormTurbineClasspath("--classpath "), " "),
+ "classpath": classpath.FormTurbineClassPath("--classpath "),
"outDir": android.PathForModuleOut(ctx, "turbine", "classes").String(),
"javaVersion": flags.javaVersion.String(),
},
@@ -523,18 +523,26 @@
type classpath android.Paths
-func (x *classpath) FormJavaClassPath(optName string) string {
+func (x *classpath) formJoinedClassPath(optName string, sep string) string {
if optName != "" && !strings.HasSuffix(optName, "=") && !strings.HasSuffix(optName, " ") {
optName += " "
}
if len(*x) > 0 {
- return optName + strings.Join(x.Strings(), ":")
+ return optName + strings.Join(x.Strings(), sep)
} else {
return ""
}
}
+func (x *classpath) FormJavaClassPath(optName string) string {
+ return x.formJoinedClassPath(optName, ":")
+}
-func (x *classpath) FormTurbineClasspath(optName string) []string {
+func (x *classpath) FormTurbineClassPath(optName string) string {
+ return x.formJoinedClassPath(optName, " ")
+}
+
+// FormRepeatedClassPath returns a list of arguments with the given optName prefixed to each element of the classpath.
+func (x *classpath) FormRepeatedClassPath(optName string) []string {
if x == nil || *x == nil {
return nil
}