Enforce exclusive release config component directories
Enforce this requirement for delivery to aosp: - "A release config shall exist in at most one of build/release and vendor/google_shared/build/release". Bug: 349843674 Bug: 370829778 Bug: 371026851 Test: manual, TH (cherry picked from https://android-review.googlesource.com/q/commit:639423daacc146457f10cf3d060bc2932dc903eb) Merged-In: Ie4bc8137f2bd10f3b90efcffe8d2c8e317dcc2fc Change-Id: Ie4bc8137f2bd10f3b90efcffe8d2c8e317dcc2fc
This commit is contained in:
committed by
Android Build Coastguard Worker
parent
3ff024c3a6
commit
2895eed928
@@ -280,11 +280,28 @@ func (config *ReleaseConfig) GenerateReleaseConfig(configs *ReleaseConfigs) erro
|
||||
|
||||
directories := []string{}
|
||||
valueDirectories := []string{}
|
||||
// These path prefixes are exclusive for a release config.
|
||||
// "A release config shall exist in at most one of these."
|
||||
// If we find a benefit to generalizing this, we can do so at that time.
|
||||
exclusiveDirPrefixes := []string{
|
||||
"build/release",
|
||||
"vendor/google_shared/build/release",
|
||||
}
|
||||
var exclusiveDir string
|
||||
for idx, confDir := range configs.configDirs {
|
||||
if _, ok := myDirsMap[idx]; ok {
|
||||
directories = append(directories, confDir)
|
||||
}
|
||||
if _, ok := myValueDirsMap[idx]; ok {
|
||||
for _, dir := range exclusiveDirPrefixes {
|
||||
if strings.HasPrefix(confDir, dir) {
|
||||
if exclusiveDir != "" && !strings.HasPrefix(exclusiveDir, dir) {
|
||||
return fmt.Errorf("%s is declared in both %s and %s",
|
||||
config.Name, exclusiveDir, confDir)
|
||||
}
|
||||
exclusiveDir = confDir
|
||||
}
|
||||
}
|
||||
valueDirectories = append(valueDirectories, confDir)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user