refactor bp2build module allowlists into struct
To make testing easier, refactor existing module-global variables into a
struct that can be mocked.
Test: build/bazel/bp2build.go
Change-Id: I9d177677644ea743641a745b1839a3a8b29f902a
diff --git a/bp2build/testing.go b/bp2build/testing.go
index 53b60fa..156e082 100644
--- a/bp2build/testing.go
+++ b/bp2build/testing.go
@@ -25,14 +25,17 @@
"testing"
"android/soong/android"
+ "android/soong/android/allowlists"
"android/soong/bazel"
)
var (
// A default configuration for tests to not have to specify bp2build_available on top level targets.
- bp2buildConfig = android.Bp2BuildConfig{
- android.BP2BUILD_TOPLEVEL: android.Bp2BuildDefaultTrueRecursively,
- }
+ bp2buildConfig = android.NewBp2BuildAllowlist().SetDefaultConfig(
+ allowlists.Bp2BuildConfig{
+ android.Bp2BuildTopLevel: allowlists.Bp2BuildDefaultTrueRecursively,
+ },
+ )
buildDir string
)