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

Commit 04f23857 authored by /e/ robot's avatar /e/ robot
Browse files

Merge remote-tracking branch 'origin/lineage-22.2' into a15

parents 76e6e520 f7442576
Loading
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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) {
+1 −1
Original line number Diff line number Diff line
@@ -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 {
+69 −0
Original line number Diff line number Diff line
@@ -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",
	)
}