Loading java/java.go +1 −1 Original line number Diff line number Diff line Loading @@ -2454,7 +2454,7 @@ func (al *ApiLibrary) ideDeps(ctx android.BaseModuleContext) []string { ret := []string{} ret = append(ret, al.properties.Libs.GetOrDefault(ctx, nil)...) ret = append(ret, al.properties.Static_libs.GetOrDefault(ctx, nil)...) if al.properties.System_modules != nil { if proptools.StringDefault(al.properties.System_modules, "none") != "none" { ret = append(ret, proptools.String(al.properties.System_modules)) } // Other non java_library dependencies like java_api_contribution are ignored for now. Loading java/jdeps_test.go +39 −0 Original line number Diff line number Diff line Loading @@ -134,3 +134,42 @@ func TestCollectJavaLibraryLinkingAgainstVersionedSdk(t *testing.T) { android.AssertStringListContains(t, "IdeInfo.Deps should contain versioned sdk module", dpInfo.Deps, "sdk_public_29_android") } func TestDoNotAddNoneSystemModulesToDeps(t *testing.T) { ctx := android.GroupFixturePreparers( prepareForJavaTest, android.FixtureMergeEnv( map[string]string{ "DISABLE_STUB_VALIDATION": "true", }, ), ).RunTestWithBp(t, ` java_library { name: "javalib", srcs: ["foo.java"], sdk_version: "none", system_modules: "none", } java_api_library { name: "javalib.stubs", stubs_type: "everything", api_contributions: ["javalib-current.txt"], api_surface: "public", system_modules: "none", } java_api_contribution { name: "javalib-current.txt", api_file: "javalib-current.txt", api_surface: "public", } `) javalib := ctx.ModuleForTests("javalib", "android_common").Module().(*Library) dpInfo, _ := android.OtherModuleProvider(ctx, javalib, android.IdeInfoProviderKey) android.AssertStringListDoesNotContain(t, "IdeInfo.Deps should contain not contain `none`", dpInfo.Deps, "none") javalib_stubs := ctx.ModuleForTests("javalib.stubs", "android_common").Module().(*ApiLibrary) dpInfo, _ = android.OtherModuleProvider(ctx, javalib_stubs, android.IdeInfoProviderKey) android.AssertStringListDoesNotContain(t, "IdeInfo.Deps should contain not contain `none`", dpInfo.Deps, "none") } Loading
java/java.go +1 −1 Original line number Diff line number Diff line Loading @@ -2454,7 +2454,7 @@ func (al *ApiLibrary) ideDeps(ctx android.BaseModuleContext) []string { ret := []string{} ret = append(ret, al.properties.Libs.GetOrDefault(ctx, nil)...) ret = append(ret, al.properties.Static_libs.GetOrDefault(ctx, nil)...) if al.properties.System_modules != nil { if proptools.StringDefault(al.properties.System_modules, "none") != "none" { ret = append(ret, proptools.String(al.properties.System_modules)) } // Other non java_library dependencies like java_api_contribution are ignored for now. Loading
java/jdeps_test.go +39 −0 Original line number Diff line number Diff line Loading @@ -134,3 +134,42 @@ func TestCollectJavaLibraryLinkingAgainstVersionedSdk(t *testing.T) { android.AssertStringListContains(t, "IdeInfo.Deps should contain versioned sdk module", dpInfo.Deps, "sdk_public_29_android") } func TestDoNotAddNoneSystemModulesToDeps(t *testing.T) { ctx := android.GroupFixturePreparers( prepareForJavaTest, android.FixtureMergeEnv( map[string]string{ "DISABLE_STUB_VALIDATION": "true", }, ), ).RunTestWithBp(t, ` java_library { name: "javalib", srcs: ["foo.java"], sdk_version: "none", system_modules: "none", } java_api_library { name: "javalib.stubs", stubs_type: "everything", api_contributions: ["javalib-current.txt"], api_surface: "public", system_modules: "none", } java_api_contribution { name: "javalib-current.txt", api_file: "javalib-current.txt", api_surface: "public", } `) javalib := ctx.ModuleForTests("javalib", "android_common").Module().(*Library) dpInfo, _ := android.OtherModuleProvider(ctx, javalib, android.IdeInfoProviderKey) android.AssertStringListDoesNotContain(t, "IdeInfo.Deps should contain not contain `none`", dpInfo.Deps, "none") javalib_stubs := ctx.ModuleForTests("javalib.stubs", "android_common").Module().(*ApiLibrary) dpInfo, _ = android.OtherModuleProvider(ctx, javalib_stubs, android.IdeInfoProviderKey) android.AssertStringListDoesNotContain(t, "IdeInfo.Deps should contain not contain `none`", dpInfo.Deps, "none") }