do not include sever_configurable_flags dependency when in
force-read-only-mode
Bug: b/316932568
Test: m --no-skip-soong-tests nothing
Change-Id: I02a7925dd6b5b33107dae1507447f8e7a1991795
diff --git a/aconfig/codegen/cc_aconfig_library_test.go b/aconfig/codegen/cc_aconfig_library_test.go
index d762e9b..ef92cc8 100644
--- a/aconfig/codegen/cc_aconfig_library_test.go
+++ b/aconfig/codegen/cc_aconfig_library_test.go
@@ -20,6 +20,8 @@
"android/soong/android"
"android/soong/cc"
+
+ "github.com/google/blueprint"
)
var ccCodegenModeTestData = []struct {
@@ -164,3 +166,34 @@
android.AssertIntEquals(t, "len(LOCAL_ACONFIG_FILES)", 1, len(makeVar))
android.EnsureListContainsSuffix(t, makeVar, "my_aconfig_declarations_foo/intermediate.pb")
}
+
+func TestForceReadOnly(t *testing.T) {
+ t.Helper()
+ result := android.GroupFixturePreparers(
+ PrepareForTestWithAconfigBuildComponents,
+ cc.PrepareForTestWithCcDefaultModules).
+ ExtendWithErrorHandler(android.FixtureExpectsNoErrors).
+ RunTestWithBp(t, fmt.Sprintf(`
+ aconfig_declarations {
+ name: "my_aconfig_declarations",
+ package: "com.example.package",
+ srcs: ["foo.aconfig"],
+ }
+
+ cc_aconfig_library {
+ name: "my_cc_aconfig_library",
+ aconfig_declarations: "my_aconfig_declarations",
+ mode: "force-read-only",
+ }
+ `))
+
+ module := result.ModuleForTests("my_cc_aconfig_library", "android_arm64_armv8-a_shared").Module()
+ dependOnBaseLib := false
+ result.VisitDirectDeps(module, func(dep blueprint.Module) {
+ if dep.Name() == baseLibDep {
+ dependOnBaseLib = true
+ }
+ })
+ android.AssertBoolEquals(t, "should not have dependency on server_configuriable_flags",
+ dependOnBaseLib, false)
+}