Add exported_bootclasspath_fragments to prebuilt_apex/apex_set
This is needed to allow a prebuilt_bootclasspath_fragment to be used interchangeably with a bootclasspath_fragment in the platform_bootclasspath module. The platform_bootclasspath module depends on APEX specific variants of bootclasspath_fragment modules. That works because the bootclasspath_fragment modules are part of an apex and so have an APEX specific variant which the platform_bootclasspath can specify. Using a prebuilt_bootclasspath_fragment in place of a bootclasspath_fragment requires that the prebuilt also has an APEX specific variant. Specifying exported_bootclasspath_fragments on a prebuilt_apex/apex_set will cause it to create an APEX variant for the named module whcih will allow it to be selected by the platform_bootclasspath module. Bug: 186034565 Bug: 177892522 Test: m nothing Change-Id: I7ddacc6498ec3a4a9f26c5f78b7f9a033e494d78
This commit is contained in:
@@ -44,9 +44,13 @@ import (
|
||||
// module.`
|
||||
type DeapexerProperties struct {
|
||||
// List of java libraries that are embedded inside this prebuilt APEX bundle and for which this
|
||||
// APEX bundle will provide dex implementation jars for use by dexpreopt and boot jars package
|
||||
// check.
|
||||
// APEX bundle will create an APEX variant and provide dex implementation jars for use by
|
||||
// dexpreopt and boot jars package check.
|
||||
Exported_java_libs []string
|
||||
|
||||
// List of bootclasspath fragments inside this prebuiltd APEX bundle and for which this APEX
|
||||
// bundle will create an APEX variant.
|
||||
Exported_bootclasspath_fragments []string
|
||||
}
|
||||
|
||||
type SelectedApexProperties struct {
|
||||
|
@@ -97,10 +97,17 @@ func (p *prebuiltCommon) checkForceDisable(ctx android.ModuleContext) bool {
|
||||
func (p *prebuiltCommon) deapexerDeps(ctx android.BottomUpMutatorContext) {
|
||||
// Add dependencies onto the java modules that represent the java libraries that are provided by
|
||||
// and exported from this prebuilt apex.
|
||||
for _, lib := range p.deapexerProperties.Exported_java_libs {
|
||||
dep := prebuiltApexExportedModuleName(ctx, lib)
|
||||
for _, exported := range p.deapexerProperties.Exported_java_libs {
|
||||
dep := prebuiltApexExportedModuleName(ctx, exported)
|
||||
ctx.AddFarVariationDependencies(ctx.Config().AndroidCommonTarget.Variations(), exportedJavaLibTag, dep)
|
||||
}
|
||||
|
||||
// Add dependencies onto the bootclasspath fragment modules that are exported from this prebuilt
|
||||
// apex.
|
||||
for _, exported := range p.deapexerProperties.Exported_bootclasspath_fragments {
|
||||
dep := prebuiltApexExportedModuleName(ctx, exported)
|
||||
ctx.AddFarVariationDependencies(ctx.Config().AndroidCommonTarget.Variations(), exportedBootclasspathFragmentTag, dep)
|
||||
}
|
||||
}
|
||||
|
||||
// apexInfoMutator marks any modules for which this apex exports a file as requiring an apex
|
||||
@@ -137,18 +144,19 @@ func (p *prebuiltCommon) apexInfoMutator(mctx android.TopDownMutatorContext) {
|
||||
var dependencies []android.ApexModule
|
||||
mctx.VisitDirectDeps(func(m android.Module) {
|
||||
tag := mctx.OtherModuleDependencyTag(m)
|
||||
if tag == exportedJavaLibTag {
|
||||
if exportedTag, ok := tag.(exportedDependencyTag); ok {
|
||||
propertyName := exportedTag.name
|
||||
depName := mctx.OtherModuleName(m)
|
||||
|
||||
// It is an error if the other module is not a prebuilt.
|
||||
if _, ok := m.(android.PrebuiltInterface); !ok {
|
||||
mctx.PropertyErrorf("exported_java_libs", "%q is not a prebuilt module", depName)
|
||||
mctx.PropertyErrorf(propertyName, "%q is not a prebuilt module", depName)
|
||||
return
|
||||
}
|
||||
|
||||
// It is an error if the other module is not an ApexModule.
|
||||
if _, ok := m.(android.ApexModule); !ok {
|
||||
mctx.PropertyErrorf("exported_java_libs", "%q is not usable within an apex", depName)
|
||||
mctx.PropertyErrorf(propertyName, "%q is not usable within an apex", depName)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -451,7 +459,8 @@ type exportedDependencyTag struct {
|
||||
func (t exportedDependencyTag) ExcludeFromVisibilityEnforcement() {}
|
||||
|
||||
var (
|
||||
exportedJavaLibTag = exportedDependencyTag{name: "exported_java_lib"}
|
||||
exportedJavaLibTag = exportedDependencyTag{name: "exported_java_libs"}
|
||||
exportedBootclasspathFragmentTag = exportedDependencyTag{name: "exported_bootclasspath_fragments"}
|
||||
)
|
||||
|
||||
func (p *Prebuilt) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
|
Reference in New Issue
Block a user