Add extra dependency from apex to bootclasspath fragments to modules
An extra dependency from apex modules to their bootclasspath fragments
and from bootclasspath fragments to their contents is necessary, as the
existing one with bcpfTag return false from ReplaceSourceWithPrebuilt
to never rewrite the dependency to the prebuilt fragment, and we'll
need a dependency to the prebuilt fragment in the next CL.
Bug: 372543712
Test: all soong tests pass
Change-Id: I87ff3afa0d5c90936664dd493654f1d64230b8a9
diff --git a/apex/apex.go b/apex/apex.go
index bbcc4cc..1d74466 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -768,6 +768,17 @@
shBinaryTag = &dependencyTag{name: "shBinary", payload: true}
)
+type fragmentInApexDepTag struct {
+ blueprint.BaseDependencyTag
+ android.FragmentInApexTag
+}
+
+func (fragmentInApexDepTag) ExcludeFromVisibilityEnforcement() {}
+
+// fragmentInApexTag is used by apex modules to depend on their fragments. Java bootclasspath
+// modules can traverse from the apex to the fragment using android.IsFragmentInApexTag.
+var fragmentInApexTag = fragmentInApexDepTag{}
+
// TODO(jiyong): shorten this function signature
func addDependenciesForNativeModules(ctx android.BottomUpMutatorContext, nativeModules ResolvedApexNativeDependencies, target android.Target, imageVariation string) {
binVariations := target.Variations()
@@ -916,6 +927,7 @@
commonVariation := ctx.Config().AndroidCommonTarget.Variations()
ctx.AddFarVariationDependencies(commonVariation, rroTag, a.properties.Rros...)
ctx.AddFarVariationDependencies(commonVariation, bcpfTag, a.properties.Bootclasspath_fragments.GetOrDefault(ctx, nil)...)
+ ctx.AddFarVariationDependencies(commonVariation, fragmentInApexTag, a.properties.Bootclasspath_fragments.GetOrDefault(ctx, nil)...)
ctx.AddFarVariationDependencies(commonVariation, sscpfTag, a.properties.Systemserverclasspath_fragments.GetOrDefault(ctx, nil)...)
ctx.AddFarVariationDependencies(commonVariation, javaLibTag, a.properties.Java_libs...)
ctx.AddFarVariationDependencies(commonVariation, fsTag, a.properties.Filesystems...)
@@ -1048,6 +1060,12 @@
ApexAvailableName: proptools.String(a.properties.Apex_available_name),
}
mctx.WalkDeps(func(child, parent android.Module) bool {
+ if parent == mctx.Module() {
+ tag := mctx.OtherModuleDependencyTag(child)
+ if _, ok := tag.(*dependencyTag); !ok {
+ return false
+ }
+ }
if !continueApexDepsWalk(child, parent) {
return false
}