diff --git a/android/apex.go b/android/apex.go index a014592ef..79d8cdda3 100644 --- a/android/apex.go +++ b/android/apex.go @@ -719,6 +719,8 @@ func (d *ApexBundleDepsInfo) FullListPath() Path { // Generate two module out files: // 1. FullList with transitive deps and their parents in the dep graph // 2. FlatList with a flat list of transitive deps +// In both cases transitive deps of external deps are not included. Neither are deps that are only +// available to APEXes; they are developed with updatability in mind and don't need manual approval. func (d *ApexBundleDepsInfo) BuildDepsInfoLists(ctx ModuleContext, minSdkVersion string, depInfos DepNameToDepInfoMap) { var fullContent strings.Builder var flatContent strings.Builder diff --git a/apex/apex_test.go b/apex/apex_test.go index 08f54f724..a8c691374 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -432,7 +432,7 @@ func TestBasicApex(t *testing.T) { } rust_binary { - name: "foo.rust", + name: "foo.rust", srcs: ["foo.rs"], rlibs: ["libfoo.rlib.rust"], dylibs: ["libfoo.dylib.rust"], @@ -440,14 +440,14 @@ func TestBasicApex(t *testing.T) { } rust_library_rlib { - name: "libfoo.rlib.rust", + name: "libfoo.rlib.rust", srcs: ["foo.rs"], crate_name: "foo", apex_available: ["myapex"], } rust_library_dylib { - name: "libfoo.dylib.rust", + name: "libfoo.dylib.rust", srcs: ["foo.rs"], crate_name: "foo", apex_available: ["myapex"], @@ -642,14 +642,12 @@ func TestBasicApex(t *testing.T) { fullDepsInfo := strings.Split(ctx.ModuleForTests("myapex", "android_common_myapex_image").Output("depsinfo/fulllist.txt").Args["content"], "\\n") ensureListContains(t, fullDepsInfo, " myjar(minSdkVersion:(no version)) <- myapex") - ensureListContains(t, fullDepsInfo, " mylib(minSdkVersion:(no version)) <- myapex") ensureListContains(t, fullDepsInfo, " mylib2(minSdkVersion:(no version)) <- mylib") ensureListContains(t, fullDepsInfo, " myotherjar(minSdkVersion:(no version)) <- myjar") ensureListContains(t, fullDepsInfo, " mysharedjar(minSdkVersion:(no version)) (external) <- myjar") flatDepsInfo := strings.Split(ctx.ModuleForTests("myapex", "android_common_myapex_image").Output("depsinfo/flatlist.txt").Args["content"], "\\n") ensureListContains(t, flatDepsInfo, "myjar(minSdkVersion:(no version))") - ensureListContains(t, flatDepsInfo, "mylib(minSdkVersion:(no version))") ensureListContains(t, flatDepsInfo, "mylib2(minSdkVersion:(no version))") ensureListContains(t, flatDepsInfo, "myotherjar(minSdkVersion:(no version))") ensureListContains(t, flatDepsInfo, "mysharedjar(minSdkVersion:(no version)) (external)") @@ -1148,13 +1146,9 @@ func TestApexWithExplicitStubsDependency(t *testing.T) { ensureNotContains(t, libFooStubsLdFlags, "libbar.so") fullDepsInfo := strings.Split(ctx.ModuleForTests("myapex2", "android_common_myapex2_image").Output("depsinfo/fulllist.txt").Args["content"], "\\n") - ensureListContains(t, fullDepsInfo, " mylib(minSdkVersion:(no version)) <- myapex2") - ensureListContains(t, fullDepsInfo, " libbaz(minSdkVersion:(no version)) <- mylib") ensureListContains(t, fullDepsInfo, " libfoo(minSdkVersion:(no version)) (external) <- mylib") flatDepsInfo := strings.Split(ctx.ModuleForTests("myapex2", "android_common_myapex2_image").Output("depsinfo/flatlist.txt").Args["content"], "\\n") - ensureListContains(t, flatDepsInfo, "mylib(minSdkVersion:(no version))") - ensureListContains(t, flatDepsInfo, "libbaz(minSdkVersion:(no version))") ensureListContains(t, flatDepsInfo, "libfoo(minSdkVersion:(no version)) (external)") } diff --git a/apex/builder.go b/apex/builder.go index 2663a679f..da800d4dc 100644 --- a/apex/builder.go +++ b/apex/builder.go @@ -926,9 +926,15 @@ func (a *apexBundle) buildApexDependencyInfo(ctx android.ModuleContext) { return !externalDep } + // Skip dependencies that are only available to APEXes; they are developed with updatability + // in mind and don't need manual approval. + if to.(android.ApexModule).NotAvailableForPlatform() { + return !externalDep + } + depTag := ctx.OtherModuleDependencyTag(to) + // Check to see if dependency been marked to skip the dependency check if skipDepCheck, ok := depTag.(android.SkipApexAllowedDependenciesCheck); ok && skipDepCheck.SkipApexAllowedDependenciesCheck() { - // Check to see if dependency been marked to skip the dependency check return !externalDep } diff --git a/java/app.go b/java/app.go index e98fe3114..eef627c14 100755 --- a/java/app.go +++ b/java/app.go @@ -812,6 +812,13 @@ func (a *AndroidApp) buildAppDependencyInfo(ctx android.ModuleContext) { depsInfo := android.DepNameToDepInfoMap{} a.WalkPayloadDeps(ctx, func(ctx android.ModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool) bool { depName := to.Name() + + // Skip dependencies that are only available to APEXes; they are developed with updatability + // in mind and don't need manual approval. + if to.(android.ApexModule).NotAvailableForPlatform() { + return true + } + if info, exist := depsInfo[depName]; exist { info.From = append(info.From, from.Name()) info.IsExternal = info.IsExternal && externalDep