diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-09-01 19:55:53 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-09-01 19:55:53 +0000 |
commit | b0579d70b867e6480fb041965636806feac01df3 (patch) | |
tree | 40ba10f95a141e35c24d9a4fa314dcbd2036a361 | |
parent | 379877d7941edf66b1b5916dd77ab3bce7648cc9 (diff) | |
parent | 227d4369431f630e00dc976853e541c9ad6c4054 (diff) | |
download | android_build_soong-b0579d70b867e6480fb041965636806feac01df3.tar.gz android_build_soong-b0579d70b867e6480fb041965636806feac01df3.tar.bz2 android_build_soong-b0579d70b867e6480fb041965636806feac01df3.zip |
Merge "Add core-oj to bootclasspath"
-rw-r--r-- | java/java.go | 15 | ||||
-rw-r--r-- | java/java_test.go | 22 |
2 files changed, 24 insertions, 13 deletions
diff --git a/java/java.go b/java/java.go index 9888b387..d18656c6 100644 --- a/java/java.go +++ b/java/java.go @@ -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 { diff --git a/java/java_test.go b/java/java_test.go index eb116c99..d73ae0bd 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -20,6 +20,7 @@ import ( "io/ioutil" "os" "path/filepath" + "reflect" "strings" "testing" ) @@ -62,7 +63,7 @@ func testJava(t *testing.T, bp string) *android.TestContext { ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) ctx.Register() - extraModules := []string{"core-libart", "frameworks", "sdk_v14"} + extraModules := []string{"core-oj", "core-libart", "frameworks", "sdk_v14"} for _, extra := range extraModules { bp += fmt.Sprintf(` @@ -173,10 +174,11 @@ func TestSdk(t *testing.T) { bootclasspathLib ) - check := func(module, dep string, depType depType) { - if dep != "" { - dep = filepath.Join(buildDir, ".intermediates", dep, "classes-full-debug.jar") + check := func(module string, depType depType, deps ...string) { + for i := range deps { + deps[i] = filepath.Join(buildDir, ".intermediates", deps[i], "classes-full-debug.jar") } + dep := strings.Join(deps, ":") javac := ctx.ModuleForTests(module, "").Rule("javac") @@ -192,12 +194,18 @@ func TestSdk(t *testing.T) { } } - if len(javac.Implicits) != 1 || javac.Implicits[0].String() != dep { - t.Errorf("module %q implicits != [%q]", dep) + if !reflect.DeepEqual(javac.Implicits.Strings(), deps) { + t.Errorf("module %q implicits %q != %q", module, javac.Implicits.Strings(), deps) } } - check("foo1", "core-libart", bootclasspathLib) + check("foo1", bootclasspathLib, "core-oj", "core-libart") + check("foo2", bootclasspathLib, "core-oj", "core-libart") + // TODO(ccross): these need the arch mutator to run to work correctly + //check("foo3", bootclasspathLib, "sdk_v14") + //check("foo4", bootclasspathLib, "android_stubs_current") + //check("foo5", bootclasspathLib, "android_system_stubs_current") + //check("foo6", bootclasspathLib, "android_test_stubs_current") } func TestPrebuilts(t *testing.T) { |