Always merge build files
Previous behavior:
- Packge not listed in bp2buildKeepExistingBuildFile:
- Use bp2build generated build file
- Package listed in bp2buildKeepExistingBuildFile:
- Use handcrafted build file even if there were allowlisted bp2build
modules in the same package.
- Package listed in bp2buildKeepExistingBuildFile and a soong module has
a bp2build: { label } attribute:
- Merge the handcrafted and bp2build generated build files
New behavior:
- Packge not listed in bp2buildKeepExistingBuildFile:
- Use bp2build generated build file
- Package listed in bp2buildKeepExistingBuildFile:
- Merge with bp2build generated build file.
Bug: 234167862
Test: ./build/bazel/ci/bp2build.sh
Change-Id: Ifbaf4f8f0f5158b5b2bd6d534eb2311e2e5f399b
diff --git a/android/bazel_test.go b/android/bazel_test.go
index 98f0a46..b578cca 100644
--- a/android/bazel_test.go
+++ b/android/bazel_test.go
@@ -158,7 +158,7 @@
type TestBazelConversionContext struct {
omc bazel.OtherModuleTestContext
- allowlist bp2BuildConversionAllowlist
+ allowlist Bp2BuildConversionAllowlist
errors []string
}
@@ -183,7 +183,7 @@
func (bcc *TestBazelConversionContext) Config() Config {
return Config{
&config{
- bp2buildPackageConfig: bcc.allowlist,
+ Bp2buildPackageConfig: bcc.allowlist,
},
}
}
@@ -202,7 +202,7 @@
shouldConvert bool
expectedErrors []string
module TestBazelModule
- allowlist bp2BuildConversionAllowlist
+ allowlist Bp2BuildConversionAllowlist
}{
{
description: "allowlist enables module",
@@ -215,7 +215,7 @@
},
BazelModuleBase: bazelableBazelModuleBase,
},
- allowlist: bp2BuildConversionAllowlist{
+ allowlist: Bp2BuildConversionAllowlist{
moduleAlwaysConvert: map[string]bool{
"foo": true,
},
@@ -233,7 +233,7 @@
},
BazelModuleBase: bazelableBazelModuleBase,
},
- allowlist: bp2BuildConversionAllowlist{
+ allowlist: Bp2BuildConversionAllowlist{
moduleAlwaysConvert: map[string]bool{
"foo": true,
},
@@ -254,7 +254,7 @@
},
BazelModuleBase: bazelableBazelModuleBase,
},
- allowlist: bp2BuildConversionAllowlist{
+ allowlist: Bp2BuildConversionAllowlist{
moduleAlwaysConvert: map[string]bool{
"foo": true,
},
@@ -264,27 +264,6 @@
},
},
{
- description: "module in allowlist and existing BUILD file",
- shouldConvert: false,
- expectedErrors: []string{"A module cannot be in a directory listed in keepExistingBuildFile and also be in moduleAlwaysConvert. Directory: 'existing/build/dir'"},
- module: TestBazelModule{
- TestModuleInfo: bazel.TestModuleInfo{
- ModuleName: "foo",
- Typ: "rule1",
- Dir: "existing/build/dir",
- },
- BazelModuleBase: bazelableBazelModuleBase,
- },
- allowlist: bp2BuildConversionAllowlist{
- moduleAlwaysConvert: map[string]bool{
- "foo": true,
- },
- keepExistingBuildFile: map[string]bool{
- "existing/build/dir": true,
- },
- },
- },
- {
description: "module allowlist and enabled directory",
shouldConvert: false,
expectedErrors: []string{"A module cannot be in a directory marked Bp2BuildDefaultTrue or Bp2BuildDefaultTrueRecursively and also be in moduleAlwaysConvert. Directory: 'existing/build/dir'"},
@@ -296,7 +275,7 @@
},
BazelModuleBase: bazelableBazelModuleBase,
},
- allowlist: bp2BuildConversionAllowlist{
+ allowlist: Bp2BuildConversionAllowlist{
moduleAlwaysConvert: map[string]bool{
"foo": true,
},
@@ -317,7 +296,7 @@
},
BazelModuleBase: bazelableBazelModuleBase,
},
- allowlist: bp2BuildConversionAllowlist{
+ allowlist: Bp2BuildConversionAllowlist{
moduleAlwaysConvert: map[string]bool{
"foo": true,
},
@@ -344,7 +323,7 @@
},
},
},
- allowlist: bp2BuildConversionAllowlist{
+ allowlist: Bp2BuildConversionAllowlist{
moduleAlwaysConvert: map[string]bool{
"foo": true,
},