Workaround to make AlwaysUsePrebuiltSdks() work with platform_bootclasspath am: 59db6d4c5d
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/14640318 Change-Id: I14865260aaad92237e33788238cad46aa7508d69
This commit is contained in:
@@ -29,7 +29,7 @@ func init() {
|
||||
|
||||
func registerBootclasspathBuildComponents(ctx android.RegistrationContext) {
|
||||
ctx.FinalDepsMutators(func(ctx android.RegisterMutatorsContext) {
|
||||
ctx.BottomUp("bootclasspath_deps", bootclasspathDepsMutator)
|
||||
ctx.BottomUp("bootclasspath_deps", bootclasspathDepsMutator).Parallel()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -95,6 +95,15 @@ func addDependencyOntoApexModulePair(ctx android.BottomUpMutatorContext, apex st
|
||||
if ctx.OtherModuleDependencyVariantExists(variations, prebuiltName) {
|
||||
ctx.AddVariationDependencies(variations, tag, prebuiltName)
|
||||
addedDep = true
|
||||
} else if ctx.Config().AlwaysUsePrebuiltSdks() && len(variations) > 0 {
|
||||
// TODO(b/179354495): Remove this code path once the Android build has been fully migrated to
|
||||
// use bootclasspath_fragment properly.
|
||||
// Some prebuilt java_sdk_library modules do not yet have an APEX variations so try and add a
|
||||
// dependency on the non-APEX variant.
|
||||
if ctx.OtherModuleDependencyVariantExists(nil, prebuiltName) {
|
||||
ctx.AddVariationDependencies(nil, tag, prebuiltName)
|
||||
addedDep = true
|
||||
}
|
||||
}
|
||||
|
||||
// If no appropriate variant existing for this, so no dependency could be added, then it is an
|
||||
|
@@ -766,7 +766,7 @@ func generateUpdatableBcpPackagesRule(ctx android.ModuleContext, image *bootImag
|
||||
if len(pp) > 0 {
|
||||
updatablePackages = append(updatablePackages, pp...)
|
||||
} else {
|
||||
ctx.ModuleErrorf("Missing permitted_packages")
|
||||
ctx.OtherModuleErrorf(module, "Missing permitted_packages")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@
|
||||
package java
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"android/soong/android"
|
||||
@@ -560,7 +561,25 @@ func extractBootDexJarsFromHiddenAPIModules(ctx android.ModuleContext, contents
|
||||
for _, module := range contents {
|
||||
bootDexJar := module.bootDexJar()
|
||||
if bootDexJar == nil {
|
||||
ctx.ModuleErrorf("module %s does not provide a dex jar", module)
|
||||
if ctx.Config().AlwaysUsePrebuiltSdks() {
|
||||
// TODO(b/179354495): Remove this work around when it is unnecessary.
|
||||
// Prebuilt modules like framework-wifi do not yet provide dex implementation jars. So,
|
||||
// create a fake one that will cause a build error only if it is used.
|
||||
fake := android.PathForModuleOut(ctx, "fake/boot-dex/%s.jar", module.Name())
|
||||
|
||||
// Create an error rule that pretends to create the output file but will actually fail if it
|
||||
// is run.
|
||||
ctx.Build(pctx, android.BuildParams{
|
||||
Rule: android.ErrorRule,
|
||||
Output: fake,
|
||||
Args: map[string]string{
|
||||
"error": fmt.Sprintf("missing dependencies: boot dex jar for %s", module),
|
||||
},
|
||||
})
|
||||
bootDexJars = append(bootDexJars, fake)
|
||||
} else {
|
||||
ctx.ModuleErrorf("module %s does not provide a dex jar", module)
|
||||
}
|
||||
} else {
|
||||
bootDexJars = append(bootDexJars, bootDexJar)
|
||||
}
|
||||
|
@@ -242,8 +242,15 @@ func (b *platformBootclasspathModule) checkUpdatableModules(ctx android.ModuleCo
|
||||
} else {
|
||||
name := ctx.OtherModuleName(m)
|
||||
if apexInfo.IsForPlatform() {
|
||||
// error: this jar is part of the platform
|
||||
ctx.ModuleErrorf("module %q from platform is not allowed in the updatable boot jars list", name)
|
||||
// If AlwaysUsePrebuiltSdks() returns true then it is possible that the updatable list will
|
||||
// include platform variants of a prebuilt module due to workarounds elsewhere. In that case
|
||||
// do not treat this as an error.
|
||||
// TODO(b/179354495): Always treat this as an error when migration to bootclasspath_fragment
|
||||
// modules is complete.
|
||||
if !ctx.Config().AlwaysUsePrebuiltSdks() {
|
||||
// error: this jar is part of the platform
|
||||
ctx.ModuleErrorf("module %q from platform is not allowed in the updatable boot jars list", name)
|
||||
}
|
||||
} else {
|
||||
// TODO(b/177892522): Treat this as an error.
|
||||
// Cannot do that at the moment because framework-wifi and framework-tethering are in the
|
||||
|
Reference in New Issue
Block a user