aconfig: disable export mode for generated native flag libraries
Currently the default flag values are not loaded into sysprop. Since the
current requirements for export flag are for flagged api in java and the
new storage system will load default values for all, there won't be
changes to make the default value loaded into sysprop. Thus this change
disable export mode for generated native flag libraries for now. It will
be enabled once the new storage is landed.
Test: m libaconfig_test_rust_library_with_exported_mode and expect build
failure
Bug: 327392334
Change-Id: I2db814d015cdb533778822f7417d055b251ed589
diff --git a/tools/aconfig/TEST_MAPPING b/tools/aconfig/TEST_MAPPING
index e42b5d3..b07596f 100644
--- a/tools/aconfig/TEST_MAPPING
+++ b/tools/aconfig/TEST_MAPPING
@@ -20,10 +20,11 @@
// aconfig C++ integration tests (test mode auto-generated code)
"name": "aconfig.test.cpp.test_mode"
},
- {
- // aconfig C++ integration tests (exported mode auto-generated code)
- "name": "aconfig.test.cpp.exported_mode"
- },
+ // TODO(327420679): Enable export mode for native flag library
+ // {
+ // // aconfig C++ integration tests (exported mode auto-generated code)
+ // "name": "aconfig.test.cpp.exported_mode"
+ // },
{
// aconfig Rust integration tests (production mode auto-generated code)
"name": "aconfig.prod_mode.test.rust"
@@ -32,10 +33,11 @@
// aconfig Rust integration tests (test mode auto-generated code)
"name": "aconfig.test_mode.test.rust"
},
- {
- // aconfig Rust integration tests (exported mode auto-generated code)
- "name": "aconfig.exported_mode.test.rust"
- },
+ // TODO(327420679): Enable export mode for native flag library
+ // {
+ // // aconfig Rust integration tests (exported mode auto-generated code)
+ // "name": "aconfig.exported_mode.test.rust"
+ // },
{
// printflags unit tests
"name": "printflags.test"
diff --git a/tools/aconfig/aconfig/Android.bp b/tools/aconfig/aconfig/Android.bp
index 164bfe7..2c26166 100644
--- a/tools/aconfig/aconfig/Android.bp
+++ b/tools/aconfig/aconfig/Android.bp
@@ -143,12 +143,6 @@
}
cc_aconfig_library {
- name: "aconfig_test_cpp_library_exported_variant",
- aconfig_declarations: "aconfig.test.flags",
- mode: "exported",
-}
-
-cc_aconfig_library {
name: "aconfig_test_cpp_library_force_read_only_variant",
aconfig_declarations: "aconfig.test.flags",
mode: "force-read-only",
@@ -184,6 +178,14 @@
test_suites: ["general-tests"],
}
+// TODO(327420679): Enable export mode for native flag library
+/*
+cc_aconfig_library {
+ name: "aconfig_test_cpp_library_exported_variant",
+ aconfig_declarations: "aconfig.test.flags",
+ mode: "exported",
+}
+
cc_test {
name: "aconfig.test.cpp.exported_mode",
srcs: [
@@ -198,6 +200,7 @@
],
test_suites: ["general-tests"],
}
+*/
cc_test {
name: "aconfig.test.cpp.force_read_only_mode",
@@ -249,6 +252,8 @@
test_suites: ["general-tests"],
}
+// TODO(327420679): Enable export mode for native flag library
+/*
rust_aconfig_library {
name: "libaconfig_test_rust_library_with_exported_mode",
crate_name: "aconfig_test_rust_library",
@@ -266,6 +271,7 @@
],
test_suites: ["general-tests"],
}
+*/
rust_aconfig_library {
name: "libaconfig_test_rust_library_with_force_read_only_mode",
diff --git a/tools/aconfig/aconfig/src/commands.rs b/tools/aconfig/aconfig/src/commands.rs
index 59f349b..c1df16b 100644
--- a/tools/aconfig/aconfig/src/commands.rs
+++ b/tools/aconfig/aconfig/src/commands.rs
@@ -203,6 +203,11 @@
}
pub fn create_cpp_lib(mut input: Input, codegen_mode: CodegenMode) -> Result<Vec<OutputFile>> {
+ // TODO(327420679): Enable export mode for native flag library
+ ensure!(
+ codegen_mode != CodegenMode::Exported,
+ "Exported mode for generated c/c++ flag library is disabled"
+ );
let parsed_flags = input.try_parse_flags()?;
let modified_parsed_flags = modify_parsed_flags_based_on_mode(parsed_flags, codegen_mode)?;
let Some(package) = find_unique_package(&modified_parsed_flags) else {
@@ -214,6 +219,11 @@
}
pub fn create_rust_lib(mut input: Input, codegen_mode: CodegenMode) -> Result<OutputFile> {
+ // // TODO(327420679): Enable export mode for native flag library
+ ensure!(
+ codegen_mode != CodegenMode::Exported,
+ "Exported mode for generated rust flag library is disabled"
+ );
let parsed_flags = input.try_parse_flags()?;
let modified_parsed_flags = modify_parsed_flags_based_on_mode(parsed_flags, codegen_mode)?;
let Some(package) = find_unique_package(&modified_parsed_flags) else {