Move bootFrameworkProfileRule to platform_bootclasspath
Changes bootFrameworkProfileRule to use ModuleContext instead of SingletonContext and moves the call from dexpreoptBootJar's GenerateSingletonBuildActions method to platform_bootclasspath's GenerateAndroidBuildActions. Changing the context also allows the code to switch from bootFrameworkProfileRule to GetGlobalSoongConfig. Also extracts the shouldBuildBootImages function so it can be used by platform_bootclasspath to preserve the existing behavior. Bug: 177892522 Test: m droid Change-Id: I30d3ca10be7f84348ad3aa9cc984dd15b8f6f4e9
This commit is contained in:
@@ -423,14 +423,7 @@ func (d *dexpreoptBootJars) GenerateSingletonBuildActions(ctx android.SingletonC
|
||||
writeGlobalConfigForMake(ctx, d.dexpreoptConfigForMake)
|
||||
|
||||
global := dexpreopt.GetGlobalConfig(ctx)
|
||||
|
||||
// Skip recompiling the boot image for the second sanitization phase. We'll get separate paths
|
||||
// and invalidate first-stage artifacts which are crucial to SANITIZE_LITE builds.
|
||||
// Note: this is technically incorrect. Compiled code contains stack checks which may depend
|
||||
// on ASAN settings.
|
||||
if len(ctx.Config().SanitizeDevice()) == 1 &&
|
||||
ctx.Config().SanitizeDevice()[0] == "address" &&
|
||||
global.SanitizeLite {
|
||||
if !shouldBuildBootImages(ctx.Config(), global) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -438,9 +431,6 @@ func (d *dexpreoptBootJars) GenerateSingletonBuildActions(ctx android.SingletonC
|
||||
defaultImageConfig := defaultBootImageConfig(ctx)
|
||||
profile := bootImageProfileRule(ctx, defaultImageConfig)
|
||||
|
||||
// Generate the framework profile rule
|
||||
bootFrameworkProfileRule(ctx, defaultImageConfig)
|
||||
|
||||
// Generate the updatable bootclasspath packages rule.
|
||||
updatableBcpPackagesRule(ctx, defaultImageConfig)
|
||||
|
||||
@@ -455,6 +445,18 @@ func (d *dexpreoptBootJars) GenerateSingletonBuildActions(ctx android.SingletonC
|
||||
dumpOatRules(ctx, d.defaultBootImage)
|
||||
}
|
||||
|
||||
// shouldBuildBootImages determines whether boot images should be built.
|
||||
func shouldBuildBootImages(config android.Config, global *dexpreopt.GlobalConfig) bool {
|
||||
// Skip recompiling the boot image for the second sanitization phase. We'll get separate paths
|
||||
// and invalidate first-stage artifacts which are crucial to SANITIZE_LITE builds.
|
||||
// Note: this is technically incorrect. Compiled code contains stack checks which may depend
|
||||
// on ASAN settings.
|
||||
if len(config.SanitizeDevice()) == 1 && config.SanitizeDevice()[0] == "address" && global.SanitizeLite {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Inspect this module to see if it contains a bootclasspath dex jar.
|
||||
// Note that the same jar may occur in multiple modules.
|
||||
// This logic is tested in the apex package to avoid import cycle apex <-> java.
|
||||
@@ -853,8 +855,10 @@ func bootImageProfileRule(ctx android.SingletonContext, image *bootImageConfig)
|
||||
return profile
|
||||
}
|
||||
|
||||
func bootFrameworkProfileRule(ctx android.SingletonContext, image *bootImageConfig) android.WritablePath {
|
||||
globalSoong := dexpreopt.GetCachedGlobalSoongConfig(ctx)
|
||||
// bootFrameworkProfileRule generates the rule to create the boot framework profile and
|
||||
// returns a path to the generated file.
|
||||
func bootFrameworkProfileRule(ctx android.ModuleContext, image *bootImageConfig) android.WritablePath {
|
||||
globalSoong := dexpreopt.GetGlobalSoongConfig(ctx)
|
||||
global := dexpreopt.GetGlobalConfig(ctx)
|
||||
|
||||
if global.DisableGenerateProfile || ctx.Config().UnbundledBuild() {
|
||||
|
Reference in New Issue
Block a user