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

Commit 09ada592 authored by Jooyung Han's avatar Jooyung Han Committed by android-build-merger
Browse files

Merge "apex: add llndk libs as requireNativeLibs" am: b020d570 am:...

Merge "apex: add llndk libs as requireNativeLibs" am: b020d570 am: 0836798f am: 5d6adacf am: 95de690a
am: 41620da4

Change-Id: If59e96b9daa5b281d6f24e436484ca1f4db80189
parents d935e4d9 41620da4
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -932,7 +932,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
			}
		} else {
			// indirect dependencies
			if am, ok := child.(android.ApexModule); ok && am.CanHaveApexVariants() && am.IsInstallableToApex() {
			if am, ok := child.(android.ApexModule); ok {
				// We cannot use a switch statement on `depTag` here as the checked
				// tags used below are private (e.g. `cc.sharedDepTag`).
				if cc.IsSharedDepTag(depTag) || cc.IsRuntimeDepTag(depTag) {
@@ -972,7 +972,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
						filesInfo = append(filesInfo, apexFile{fileToCopy, moduleName, dirInApex, nativeTest, cc, nil})
						return true
					}
				} else {
				} else if am.CanHaveApexVariants() && am.IsInstallableToApex() {
					ctx.ModuleErrorf("unexpected tag %q for indirect dependency %q", depTag, depName)
				}
			}
+52 −0
Original line number Diff line number Diff line
@@ -714,6 +714,58 @@ func TestApexWithRuntimeLibsDependency(t *testing.T) {

}

func TestApexDependencyToLLNDK(t *testing.T) {
	ctx, _ := testApex(t, `
		apex {
			name: "myapex",
			key: "myapex.key",
			use_vendor: true,
			native_shared_libs: ["mylib"],
		}

		apex_key {
			name: "myapex.key",
			public_key: "testkey.avbpubkey",
			private_key: "testkey.pem",
		}

		cc_library {
			name: "mylib",
			srcs: ["mylib.cpp"],
			vendor_available: true,
			shared_libs: ["libbar"],
			system_shared_libs: [],
			stl: "none",
		}

		cc_library {
			name: "libbar",
			srcs: ["mylib.cpp"],
			system_shared_libs: [],
			stl: "none",
		}

		llndk_library {
			name: "libbar",
			symbol_file: "",
		}

	`)

	apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule")
	copyCmds := apexRule.Args["copy_commands"]

	// Ensure that LLNDK dep is not included
	ensureNotContains(t, copyCmds, "image.apex/lib64/libbar.so")

	injectRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("injectApexDependency")
	ensureListEmpty(t, names(injectRule.Args["provideNativeLibs"]))

	// Ensure that LLNDK dep is required
	ensureListContains(t, names(injectRule.Args["requireNativeLibs"]), "libbar.so")

}

func TestApexWithSystemLibsStubs(t *testing.T) {
	ctx, _ := testApex(t, `
		apex {