Add core-oj to bootclasspath

Also clear the bootclasspath for device builds so javac doesn't
fall back to the default rt.jar bootclasspath.

Test: java_test.go
Change-Id: Ia21f55c7d45db560e2f44be81b2f46587d9026f2
This commit is contained in:
Colin Cross
2017-08-30 14:14:52 -07:00
parent 595a406f88
commit 227d436943
2 changed files with 24 additions and 13 deletions

View File

@@ -178,11 +178,14 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
if ctx.Device() {
switch j.deviceProperties.Sdk_version {
case "":
ctx.AddDependency(ctx.Module(), bootClasspathTag, "core-libart")
ctx.AddDependency(ctx.Module(), bootClasspathTag, "core-oj", "core-libart")
ctx.AddDependency(ctx.Module(), libTag, config.DefaultLibraries...)
case "current":
// TODO: !TARGET_BUILD_APPS
// TODO: export preprocessed framework.aidl from android_stubs_current
ctx.AddDependency(ctx.Module(), bootClasspathTag, "android_stubs_current")
case "test_current":
ctx.AddDependency(ctx.Module(), bootClasspathTag, "android_test_stubs_current")
case "system_current":
ctx.AddDependency(ctx.Module(), bootClasspathTag, "android_system_stubs_current")
default:
@@ -190,13 +193,9 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) {
}
} else {
if j.deviceProperties.Dex {
ctx.AddDependency(ctx.Module(), bootClasspathTag, "core-libart")
ctx.AddDependency(ctx.Module(), bootClasspathTag, "core-oj", "core-libart")
}
}
if ctx.Device() && j.deviceProperties.Sdk_version == "" {
ctx.AddDependency(ctx.Module(), libTag, config.DefaultLibraries...)
}
}
ctx.AddDependency(ctx.Module(), libTag, j.properties.Libs...)
ctx.AddDependency(ctx.Module(), staticLibTag, j.properties.Static_libs...)
@@ -259,6 +258,7 @@ func (j *Module) collectDeps(ctx android.ModuleContext) (classpath android.Paths
}
case sdkDependencyTag:
sdkDep := module.(sdkDependency)
bootClasspath = append(bootClasspath, sdkDep.ClasspathFiles()...)
if sdkDep.AidlPreprocessed().Valid() {
if aidlPreprocess.Valid() {
ctx.ModuleErrorf("multiple dependencies with preprocessed aidls:\n %q\n %q",
@@ -311,6 +311,9 @@ func (j *Module) compile(ctx android.ModuleContext) {
if len(bootClasspath) > 0 {
flags.bootClasspath = "-bootclasspath " + strings.Join(bootClasspath.Strings(), ":")
deps = append(deps, bootClasspath...)
} else if ctx.Device() {
// Explicitly clear the bootclasspath for device builds
flags.bootClasspath = `-bootclasspath ""`
}
if len(classpath) > 0 {