Loading dexpreopt/class_loader_context.go +5 −0 Original line number Diff line number Diff line Loading @@ -291,6 +291,11 @@ func (clcMap ClassLoaderContextMap) addContext(ctx android.ModuleInstallPathCont // For prebuilts, library should have the same name as the source module. lib = android.RemoveOptionalPrebuiltPrefix(lib) // Bootclasspath libraries should not be added to CLC. if android.InList(lib, ctx.Config().BootJars()) { return nil } devicePath := UnknownInstallLibraryPath if installPath == nil { if android.InList(lib, CompatUsesLibs) || android.InList(lib, OptionalCompatUsesLibs) { Loading java/java.go +1 −1 Original line number Diff line number Diff line Loading @@ -483,7 +483,7 @@ var ( ) func IsLibDepTag(depTag blueprint.DependencyTag) bool { return depTag == libTag || depTag == sdkLibTag return depTag == libTag } func IsStaticLibDepTag(depTag blueprint.DependencyTag) bool { Loading java/java_test.go +69 −0 Original line number Diff line number Diff line Loading @@ -3128,3 +3128,72 @@ cc_library_shared { deps := findDepsOfModule(res, res.ModuleForTests("myjavabin", "android_common").Module(), "mynativelib") android.AssertIntEquals(t, "Create a dep on the first variant", 1, len(deps)) } func TestBootJarNotInUsesLibs(t *testing.T) { t.Parallel() result := android.GroupFixturePreparers( PrepareForTestWithJavaDefaultModules, PrepareForTestWithJavaSdkLibraryFiles, FixtureWithLastReleaseApis("mysdklibrary", "myothersdklibrary"), FixtureConfigureApexBootJars("myapex:mysdklibrary"), ).RunTestWithBp(t, ` bootclasspath_fragment { name: "myfragment", contents: ["mysdklibrary"], hidden_api: { split_packages: ["*"], }, } java_sdk_library { name: "mysdklibrary", srcs: ["Test.java"], compile_dex: true, public: {enabled: true}, min_sdk_version: "2", permitted_packages: ["mysdklibrary"], sdk_version: "current", } java_sdk_library { name: "myothersdklibrary", srcs: ["Test.java"], compile_dex: true, public: {enabled: true}, min_sdk_version: "2", permitted_packages: ["myothersdklibrary"], sdk_version: "current", } java_library { name: "foo", libs: [ "bar", "mysdklibrary.stubs", ], srcs: ["A.java"], } java_library { name: "bar", libs: [ "myothersdklibrary.stubs" ], } `) ctx := result.TestContext fooModule := ctx.ModuleForTests("foo", "android_common") androidMkEntries := android.AndroidMkEntriesForTest(t, ctx, fooModule.Module())[0] localExportSdkLibraries := androidMkEntries.EntryMap["LOCAL_EXPORT_SDK_LIBRARIES"] android.AssertStringListDoesNotContain(t, "boot jar should not be included in uses libs entries", localExportSdkLibraries, "mysdklibrary", ) android.AssertStringListContains(t, "non boot jar is included in uses libs entries", localExportSdkLibraries, "myothersdklibrary", ) } Loading
dexpreopt/class_loader_context.go +5 −0 Original line number Diff line number Diff line Loading @@ -291,6 +291,11 @@ func (clcMap ClassLoaderContextMap) addContext(ctx android.ModuleInstallPathCont // For prebuilts, library should have the same name as the source module. lib = android.RemoveOptionalPrebuiltPrefix(lib) // Bootclasspath libraries should not be added to CLC. if android.InList(lib, ctx.Config().BootJars()) { return nil } devicePath := UnknownInstallLibraryPath if installPath == nil { if android.InList(lib, CompatUsesLibs) || android.InList(lib, OptionalCompatUsesLibs) { Loading
java/java.go +1 −1 Original line number Diff line number Diff line Loading @@ -483,7 +483,7 @@ var ( ) func IsLibDepTag(depTag blueprint.DependencyTag) bool { return depTag == libTag || depTag == sdkLibTag return depTag == libTag } func IsStaticLibDepTag(depTag blueprint.DependencyTag) bool { Loading
java/java_test.go +69 −0 Original line number Diff line number Diff line Loading @@ -3128,3 +3128,72 @@ cc_library_shared { deps := findDepsOfModule(res, res.ModuleForTests("myjavabin", "android_common").Module(), "mynativelib") android.AssertIntEquals(t, "Create a dep on the first variant", 1, len(deps)) } func TestBootJarNotInUsesLibs(t *testing.T) { t.Parallel() result := android.GroupFixturePreparers( PrepareForTestWithJavaDefaultModules, PrepareForTestWithJavaSdkLibraryFiles, FixtureWithLastReleaseApis("mysdklibrary", "myothersdklibrary"), FixtureConfigureApexBootJars("myapex:mysdklibrary"), ).RunTestWithBp(t, ` bootclasspath_fragment { name: "myfragment", contents: ["mysdklibrary"], hidden_api: { split_packages: ["*"], }, } java_sdk_library { name: "mysdklibrary", srcs: ["Test.java"], compile_dex: true, public: {enabled: true}, min_sdk_version: "2", permitted_packages: ["mysdklibrary"], sdk_version: "current", } java_sdk_library { name: "myothersdklibrary", srcs: ["Test.java"], compile_dex: true, public: {enabled: true}, min_sdk_version: "2", permitted_packages: ["myothersdklibrary"], sdk_version: "current", } java_library { name: "foo", libs: [ "bar", "mysdklibrary.stubs", ], srcs: ["A.java"], } java_library { name: "bar", libs: [ "myothersdklibrary.stubs" ], } `) ctx := result.TestContext fooModule := ctx.ModuleForTests("foo", "android_common") androidMkEntries := android.AndroidMkEntriesForTest(t, ctx, fooModule.Module())[0] localExportSdkLibraries := androidMkEntries.EntryMap["LOCAL_EXPORT_SDK_LIBRARIES"] android.AssertStringListDoesNotContain(t, "boot jar should not be included in uses libs entries", localExportSdkLibraries, "mysdklibrary", ) android.AssertStringListContains(t, "non boot jar is included in uses libs entries", localExportSdkLibraries, "myothersdklibrary", ) }