Fix kotlin -classpath argument
kotlinc expects -classpath, not --classpath. Also add a test that uses only .kt files to exercise the code when there are no java sources. Test: java_test.go Change-Id: Ifa5a007b460b40ea2188d0907570fbdca6c48da7
This commit is contained in:
@@ -203,7 +203,7 @@ func TransformKotlinToClasses(ctx android.ModuleContext, outputFile android.Writ
|
|||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
Inputs: inputs,
|
Inputs: inputs,
|
||||||
Args: map[string]string{
|
Args: map[string]string{
|
||||||
"classpath": flags.kotlincClasspath.FormJavaClassPath("--classpath"),
|
"classpath": flags.kotlincClasspath.FormJavaClassPath("-classpath"),
|
||||||
"kotlincFlags": flags.kotlincFlags,
|
"kotlincFlags": flags.kotlincFlags,
|
||||||
"outDir": classDir.String(),
|
"outDir": classDir.String(),
|
||||||
"javaVersion": flags.javaVersion,
|
"javaVersion": flags.javaVersion,
|
||||||
|
@@ -631,6 +631,11 @@ func TestKotlin(t *testing.T) {
|
|||||||
name: "foo",
|
name: "foo",
|
||||||
srcs: ["a.java", "b.kt"],
|
srcs: ["a.java", "b.kt"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
java_library {
|
||||||
|
name: "bar",
|
||||||
|
srcs: ["b.kt"],
|
||||||
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
kotlinc := ctx.ModuleForTests("foo", "android_common").Rule("kotlinc")
|
kotlinc := ctx.ModuleForTests("foo", "android_common").Rule("kotlinc")
|
||||||
@@ -655,6 +660,13 @@ func TestKotlin(t *testing.T) {
|
|||||||
t.Errorf("foo jar inputs %v does not contain %q",
|
t.Errorf("foo jar inputs %v does not contain %q",
|
||||||
jar.Inputs.Strings(), kotlinc.Output.String())
|
jar.Inputs.Strings(), kotlinc.Output.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kotlinc = ctx.ModuleForTests("bar", "android_common").Rule("kotlinc")
|
||||||
|
jar = ctx.ModuleForTests("bar", "android_common").Output("combined/bar.jar")
|
||||||
|
|
||||||
|
if len(kotlinc.Inputs) != 1 || kotlinc.Inputs[0].String() != "b.kt" {
|
||||||
|
t.Errorf(`bar kotlinc inputs %v != ["b.kt"]`, kotlinc.Inputs)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func fail(t *testing.T, errs []error) {
|
func fail(t *testing.T, errs []error) {
|
||||||
|
Reference in New Issue
Block a user