Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91dd2720 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Skip `none` system_modules from module_bp_java_deps.json" into main

parents 20c3e5ef 4f443e78
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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.
+39 −0
Original line number Diff line number Diff line
@@ -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")
}