Fix bootclasspath for host variants of java_library modules

The partial hostdex support was causing the host variant of
java_library modules to depend on core-oj and core-libart,
which caused the tagsoup jar to use the wrong
java.lang.System.arraycopy signature.  Remove the hostdex
code that was causing the problem, and add a test.

Test: java_test.go
Change-Id: I4f7b1f29c99aae328ba19b042538d9d35544aa43
This commit is contained in:
Colin Cross 2017-10-03 20:57:01 -07:00
parent 19ab372dd8
commit 965714f139
2 changed files with 22 additions and 9 deletions

View File

@ -285,9 +285,7 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
ctx.AddDependency(ctx.Module(), bootClasspathTag, sdkDep.module) ctx.AddDependency(ctx.Module(), bootClasspathTag, sdkDep.module)
} }
} else { } else {
if j.deviceProperties.Dex { // TODO(ccross): add hostdex support
ctx.AddDependency(ctx.Module(), bootClasspathTag, config.DefaultBootclasspathLibraries...)
}
} }
} }
ctx.AddDependency(ctx.Module(), libTag, j.properties.Libs...) ctx.AddDependency(ctx.Module(), libTag, j.properties.Libs...)

View File

@ -185,6 +185,7 @@ func TestArchSpecific(t *testing.T) {
var classpathTestcases = []struct { var classpathTestcases = []struct {
name string name string
moduleType string
host android.OsClass host android.OsClass
properties string properties string
bootclasspath []string bootclasspath []string
@ -239,27 +240,41 @@ var classpathTestcases = []struct {
{ {
name: "host default", name: "host default",
host: android.Host, moduleType: "java_library_host",
properties: ``, properties: ``,
host: android.Host,
classpath: []string{}, classpath: []string{},
}, },
{ {
name: "host nostdlib", name: "host nostdlib",
moduleType: "java_library_host",
host: android.Host, host: android.Host,
properties: `no_standard_libs: true`, properties: `no_standard_libs: true`,
classpath: []string{}, classpath: []string{},
}, },
{
name: "host supported default",
host: android.Host,
properties: `host_supported: true,`,
classpath: []string{},
},
{
name: "host supported nostdlib",
host: android.Host,
properties: `host_supported: true, no_standard_libs: true`,
classpath: []string{},
},
} }
func TestClasspath(t *testing.T) { func TestClasspath(t *testing.T) {
for _, testcase := range classpathTestcases { for _, testcase := range classpathTestcases {
t.Run(testcase.name, func(t *testing.T) { t.Run(testcase.name, func(t *testing.T) {
hostExtra := "" moduleType := "java_library"
if testcase.host == android.Host { if testcase.moduleType != "" {
hostExtra = "_host" moduleType = testcase.moduleType
} }
ctx := testJava(t, ` ctx := testJava(t, moduleType+` {
java_library`+hostExtra+` {
name: "foo", name: "foo",
srcs: ["a.java"], srcs: ["a.java"],
`+testcase.properties+` `+testcase.properties+`