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
}
diff --git a/java/dex.go b/java/dex.go
index c8a4fa8..5b25b21 100644
--- a/java/dex.go
+++ b/java/dex.go
@@ -85,8 +85,8 @@
func (j *Module) d8Flags(ctx android.ModuleContext, flags javaBuilderFlags) ([]string, android.Paths) {
d8Flags := j.dexCommonFlags(ctx)
- d8Flags = append(d8Flags, flags.bootClasspath.FormTurbineClasspath("--lib ")...)
- d8Flags = append(d8Flags, flags.classpath.FormTurbineClasspath("--lib ")...)
+ d8Flags = append(d8Flags, flags.bootClasspath.FormRepeatedClassPath("--lib ")...)
+ d8Flags = append(d8Flags, flags.classpath.FormRepeatedClassPath("--lib ")...)
var d8Deps android.Paths
d8Deps = append(d8Deps, flags.bootClasspath...)
diff --git a/java/kotlin.go b/java/kotlin.go
index aa65314..5319a4f 100644
--- a/java/kotlin.go
+++ b/java/kotlin.go
@@ -133,7 +133,7 @@
deps = append(deps, srcJars...)
deps = append(deps, flags.processorPath...)
- kaptProcessorPath := flags.processorPath.FormTurbineClasspath("-P plugin:org.jetbrains.kotlin.kapt3:apclasspath=")
+ kaptProcessorPath := flags.processorPath.FormRepeatedClassPath("-P plugin:org.jetbrains.kotlin.kapt3:apclasspath=")
kaptProcessor := ""
if flags.processor != "" {