Check consistency of the BootJars/UpdatableBootJars config
Both out/soong/dexpreopt.config and out/soong/soong.variables contain configuration for the BootJars and UpdatableBootJars that MUST be identical. If they are not then it can lead to broken builds. This change adds a consistency check for them that will make the issue more obvious. Bug: 186195980 Test: DIST_DIR=out/bionic-dist ./art/tools/dist_linux_bionic.sh -j80 com.android.art.host com.android.support.apexer --skip-soong-tests Ran the previous command with and without the fix in https://r.android.com/1684877. Without the fix the build reported an inconsistency in the configuration, with that fix the build passed. Change-Id: I10fbe328ba4f1fbd9db4708409979e9824c196ef
This commit is contained in:
parent
a3693772a6
commit
7d1d083ec1
|
@ -17,6 +17,7 @@ package dexpreopt
|
|||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
|
@ -522,7 +523,27 @@ func ParseGlobalSoongConfig(ctx android.PathContext, data []byte) (*GlobalSoongC
|
|||
return config, nil
|
||||
}
|
||||
|
||||
// checkBootJarsConfigConsistency checks the consistency of BootJars and UpdatableBootJars fields in
|
||||
// DexpreoptGlobalConfig and Config.productVariables.
|
||||
func checkBootJarsConfigConsistency(ctx android.SingletonContext, dexpreoptConfig *GlobalConfig, config android.Config) {
|
||||
compareBootJars := func(property string, dexpreoptJars, variableJars android.ConfiguredJarList) {
|
||||
dexpreoptPairs := dexpreoptJars.CopyOfApexJarPairs()
|
||||
variablePairs := variableJars.CopyOfApexJarPairs()
|
||||
if !reflect.DeepEqual(dexpreoptPairs, variablePairs) {
|
||||
ctx.Errorf("Inconsistent configuration of %[1]s\n"+
|
||||
" dexpreopt.GlobalConfig.%[1]s = %[2]s\n"+
|
||||
" productVariables.%[1]s = %[3]s",
|
||||
property, dexpreoptPairs, variablePairs)
|
||||
}
|
||||
}
|
||||
|
||||
compareBootJars("BootJars", dexpreoptConfig.BootJars, config.NonUpdatableBootJars())
|
||||
compareBootJars("UpdatableBootJars", dexpreoptConfig.UpdatableBootJars, config.UpdatableBootJars())
|
||||
}
|
||||
|
||||
func (s *globalSoongConfigSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
||||
checkBootJarsConfigConsistency(ctx, GetGlobalConfig(ctx), ctx.Config())
|
||||
|
||||
if GetGlobalConfig(ctx).DisablePreopt {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue