diff options
| -rw-r--r-- | java/java.go | 2 | ||||
| -rw-r--r-- | java/jdeps_test.go | 39 |
2 files changed, 40 insertions, 1 deletions
diff --git a/java/java.go b/java/java.go index 0b48873f6..288042b42 100644 --- a/java/java.go +++ b/java/java.go @@ -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. diff --git a/java/jdeps_test.go b/java/jdeps_test.go index 7a0fb10cb..143500004 100644 --- a/java/jdeps_test.go +++ b/java/jdeps_test.go @@ -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") +} |