Remove "Test" prop from xx_aconfig_library build rules

Test: CI

Bug: 309990433
Change-Id: Id78f65d4083571f310686589a18cabe13bbd5d62
This commit is contained in:
Zi Wang
2023-11-13 16:01:13 -08:00
parent 6f9522e4a8
commit d72e2dbbff
6 changed files with 1 additions and 44 deletions

View File

@@ -38,10 +38,6 @@ type CcAconfigLibraryProperties struct {
// name of the aconfig_declarations module to generate a library for
Aconfig_declarations string
// whether to generate test mode version of the library
// TODO: remove "Test" property when "Mode" can be used in all the branches
Test *bool
// default mode is "production", the other accepted modes are:
// "test": to generate test mode version of the library
// "exported": to generate exported mode version of the library
@@ -128,17 +124,11 @@ func (this *CcAconfigLibraryCallbacks) GeneratorBuildActions(ctx cc.ModuleContex
}
declarations := ctx.OtherModuleProvider(declarationsModules[0], declarationsProviderKey).(declarationsProviderData)
if this.properties.Mode != nil && this.properties.Test != nil {
ctx.PropertyErrorf("test", "test prop should not be specified when mode prop is set")
}
mode := proptools.StringDefault(this.properties.Mode, "production")
if !isModeSupported(mode) {
ctx.PropertyErrorf("mode", "%q is not a supported mode", mode)
}
// TODO: remove "Test" property
if proptools.Bool(this.properties.Test) {
mode = "test"
}
ctx.Build(pctx, android.BuildParams{
Rule: cppRule,
Input: declarations.IntermediatePath,

View File

@@ -71,8 +71,6 @@ var incorrectCCCodegenModeTestData = []struct {
setting, expectedErr string
}{
{"mode: `unsupported`,", "mode: \"unsupported\" is not a supported mode"},
// TODO: remove this test case when test prop is removed
{"mode: `test`, test: true", "test prop should not be specified when mode prop is set"},
}
func TestIncorrectCCCodegenMode(t *testing.T) {

View File

@@ -36,10 +36,6 @@ type JavaAconfigDeclarationsLibraryProperties struct {
// name of the aconfig_declarations module to generate a library for
Aconfig_declarations string
// whether to generate test mode version of the library
// TODO: remove "Test" property when "Mode" can be used in all the branches
Test *bool
// default mode is "production", the other accepted modes are:
// "test": to generate test mode version of the library
// "exported": to generate exported mode version of the library
@@ -82,17 +78,10 @@ func (callbacks *JavaAconfigDeclarationsLibraryCallbacks) GenerateSourceJarBuild
// Generate the action to build the srcjar
srcJarPath := android.PathForModuleGen(ctx, ctx.ModuleName()+".srcjar")
if callbacks.properties.Mode != nil && callbacks.properties.Test != nil {
ctx.PropertyErrorf("test", "test prop should not be specified when mode prop is set")
}
mode := proptools.StringDefault(callbacks.properties.Mode, "production")
if !isModeSupported(mode) {
ctx.PropertyErrorf("mode", "%q is not a supported mode", mode)
}
// TODO: remove "Test" property
if proptools.Bool(callbacks.properties.Test) {
mode = "test"
}
ctx.Build(pctx, android.BuildParams{
Rule: javaRule,

View File

@@ -217,9 +217,3 @@ func TestExportedMode(t *testing.T) {
func TestUnsupportedMode(t *testing.T) {
testCodegenModeWithError(t, "mode: `unsupported`,", "mode: \"unsupported\" is not a supported mode")
}
// TODO: remove this test case when test prop is removed
func TestBothModeAndTestAreSet(t *testing.T) {
testCodegenModeWithError(t, "mode: `test`, test: true",
"test prop should not be specified when mode prop is set")
}

View File

@@ -20,10 +20,6 @@ type RustAconfigLibraryProperties struct {
// name of the aconfig_declarations module to generate a library for
Aconfig_declarations string
// whether to generate test mode version of the library
// TODO: remove "Test" property when "Mode" can be used in all the branches
Test *bool
// default mode is "production", the other accepted modes are:
// "test": to generate test mode version of the library
// "exported": to generate exported mode version of the library
@@ -70,19 +66,11 @@ func (a *aconfigDecorator) GenerateSource(ctx rust.ModuleContext, deps rust.Path
}
declarations := ctx.OtherModuleProvider(declarationsModules[0], declarationsProviderKey).(declarationsProviderData)
if a.Properties.Mode != nil && a.Properties.Test != nil {
ctx.PropertyErrorf("test", "test prop should not be specified when mode prop is set")
}
mode := proptools.StringDefault(a.Properties.Mode, "production")
if !isModeSupported(mode) {
ctx.PropertyErrorf("mode", "%q is not a supported mode", mode)
}
// TODO: remove "Test" property
if proptools.Bool(a.Properties.Test) {
mode = "test"
}
ctx.Build(pctx, android.BuildParams{
Rule: rustRule,
Input: declarations.IntermediatePath,

View File

@@ -119,8 +119,6 @@ var incorrectRustCodegenModeTestData = []struct {
setting, expectedErr string
}{
{"mode: `unsupported`,", "mode: \"unsupported\" is not a supported mode"},
// TODO: remove this test case when test prop is removed
{"mode: `test`, test: true", "test prop should not be specified when mode prop is set"},
}
func TestIncorrectRustCodegenMode(t *testing.T) {