Merge "Add "force-read-only" mode to xx_aconfig_library build rules" into main

This commit is contained in:
Zhi Dou
2024-01-03 23:00:33 +00:00
committed by Gerrit Code Review
6 changed files with 10 additions and 1 deletions

View File

@@ -40,6 +40,7 @@ type CcAconfigLibraryProperties struct {
// default mode is "production", the other accepted modes are: // default mode is "production", the other accepted modes are:
// "test": to generate test mode version of the library // "test": to generate test mode version of the library
// "exported": to generate exported mode version of the library // "exported": to generate exported mode version of the library
// "force-read-only": to generate force-read-only mode version of the library
// an error will be thrown if the mode is not supported // an error will be thrown if the mode is not supported
Mode *string Mode *string
} }

View File

@@ -29,6 +29,7 @@ var ccCodegenModeTestData = []struct {
{"mode: `production`,", "production"}, {"mode: `production`,", "production"},
{"mode: `test`,", "test"}, {"mode: `test`,", "test"},
{"mode: `exported`,", "exported"}, {"mode: `exported`,", "exported"},
{"mode: `force-read-only`,", "force-read-only"},
} }
func TestCCCodegenMode(t *testing.T) { func TestCCCodegenMode(t *testing.T) {

View File

@@ -30,7 +30,7 @@ type declarationsTagType struct {
var declarationsTag = declarationsTagType{} var declarationsTag = declarationsTagType{}
var aconfigSupportedModes = []string{"production", "test", "exported"} var aconfigSupportedModes = []string{"production", "test", "exported", "force-read-only"}
type JavaAconfigDeclarationsLibraryProperties struct { type JavaAconfigDeclarationsLibraryProperties struct {
// name of the aconfig_declarations module to generate a library for // name of the aconfig_declarations module to generate a library for
@@ -39,6 +39,7 @@ type JavaAconfigDeclarationsLibraryProperties struct {
// default mode is "production", the other accepted modes are: // default mode is "production", the other accepted modes are:
// "test": to generate test mode version of the library // "test": to generate test mode version of the library
// "exported": to generate exported mode version of the library // "exported": to generate exported mode version of the library
// "force-read-only": to generate force-read-only mode version of the library
// an error will be thrown if the mode is not supported // an error will be thrown if the mode is not supported
Mode *string Mode *string
} }

View File

@@ -227,6 +227,10 @@ func TestExportedMode(t *testing.T) {
testCodegenMode(t, "mode: `exported`,", "exported") testCodegenMode(t, "mode: `exported`,", "exported")
} }
func TestForceReadOnlyMode(t *testing.T) {
testCodegenMode(t, "mode: `force-read-only`,", "force-read-only")
}
func TestUnsupportedMode(t *testing.T) { func TestUnsupportedMode(t *testing.T) {
testCodegenModeWithError(t, "mode: `unsupported`,", "mode: \"unsupported\" is not a supported mode") testCodegenModeWithError(t, "mode: `unsupported`,", "mode: \"unsupported\" is not a supported mode")
} }

View File

@@ -23,6 +23,7 @@ type RustAconfigLibraryProperties struct {
// default mode is "production", the other accepted modes are: // default mode is "production", the other accepted modes are:
// "test": to generate test mode version of the library // "test": to generate test mode version of the library
// "exported": to generate exported mode version of the library // "exported": to generate exported mode version of the library
// "force-read-only": to generate force-read-only mode version of the library
// an error will be thrown if the mode is not supported // an error will be thrown if the mode is not supported
Mode *string Mode *string
} }

View File

@@ -72,6 +72,7 @@ var rustCodegenModeTestData = []struct {
{"mode: `production`,", "production"}, {"mode: `production`,", "production"},
{"mode: `test`,", "test"}, {"mode: `test`,", "test"},
{"mode: `exported`,", "exported"}, {"mode: `exported`,", "exported"},
{"mode: `force-read-only`,", "force-read-only"},
} }
func TestRustCodegenMode(t *testing.T) { func TestRustCodegenMode(t *testing.T) {