Loading android/soong_config_modules.go +10 −4 Original line number Original line Diff line number Diff line Loading @@ -31,12 +31,18 @@ import ( ) ) func init() { func init() { RegisterModuleType("soong_config_module_type_import", SoongConfigModuleTypeImportFactory) RegisterSoongConfigModuleBuildComponents(InitRegistrationContext) RegisterModuleType("soong_config_module_type", SoongConfigModuleTypeFactory) RegisterModuleType("soong_config_string_variable", SoongConfigStringVariableDummyFactory) RegisterModuleType("soong_config_bool_variable", SoongConfigBoolVariableDummyFactory) } } func RegisterSoongConfigModuleBuildComponents(ctx RegistrationContext) { ctx.RegisterModuleType("soong_config_module_type_import", SoongConfigModuleTypeImportFactory) ctx.RegisterModuleType("soong_config_module_type", SoongConfigModuleTypeFactory) ctx.RegisterModuleType("soong_config_string_variable", SoongConfigStringVariableDummyFactory) ctx.RegisterModuleType("soong_config_bool_variable", SoongConfigBoolVariableDummyFactory) } var PrepareForTestWithSoongConfigModuleBuildComponents = FixtureRegisterWithContext(RegisterSoongConfigModuleBuildComponents) type soongConfigModuleTypeImport struct { type soongConfigModuleTypeImport struct { ModuleBase ModuleBase properties soongConfigModuleTypeImportProperties properties soongConfigModuleTypeImportProperties Loading android/soong_config_modules_test.go +11 −24 Original line number Original line Diff line number Diff line Loading @@ -53,6 +53,11 @@ func soongConfigTestModuleFactory() Module { func (t soongConfigTestModule) GenerateAndroidBuildActions(ModuleContext) {} func (t soongConfigTestModule) GenerateAndroidBuildActions(ModuleContext) {} var prepareForSoongConfigTestModule = FixtureRegisterWithContext(func(ctx RegistrationContext) { ctx.RegisterModuleType("test_defaults", soongConfigTestDefaultsModuleFactory) ctx.RegisterModuleType("test", soongConfigTestModuleFactory) }) func TestSoongConfigModule(t *testing.T) { func TestSoongConfigModule(t *testing.T) { configBp := ` configBp := ` soong_config_module_type { soong_config_module_type { Loading Loading @@ -309,14 +314,8 @@ func TestSoongConfigModule(t *testing.T) { result := GroupFixturePreparers( result := GroupFixturePreparers( tc.preparer, tc.preparer, PrepareForTestWithDefaults, PrepareForTestWithDefaults, FixtureRegisterWithContext(func(ctx RegistrationContext) { PrepareForTestWithSoongConfigModuleBuildComponents, ctx.RegisterModuleType("soong_config_module_type_import", SoongConfigModuleTypeImportFactory) prepareForSoongConfigTestModule, ctx.RegisterModuleType("soong_config_module_type", SoongConfigModuleTypeFactory) ctx.RegisterModuleType("soong_config_string_variable", SoongConfigStringVariableDummyFactory) ctx.RegisterModuleType("soong_config_bool_variable", SoongConfigBoolVariableDummyFactory) ctx.RegisterModuleType("test_defaults", soongConfigTestDefaultsModuleFactory) ctx.RegisterModuleType("test", soongConfigTestModuleFactory) }), fs.AddToFixture(), fs.AddToFixture(), FixtureWithRootAndroidBp(bp), FixtureWithRootAndroidBp(bp), ).RunTest(t) ).RunTest(t) Loading Loading @@ -371,14 +370,8 @@ func TestNonExistentPropertyInSoongConfigModule(t *testing.T) { GroupFixturePreparers( GroupFixturePreparers( fixtureForVendorVars(map[string]map[string]string{"acme": {"feature1": "1"}}), fixtureForVendorVars(map[string]map[string]string{"acme": {"feature1": "1"}}), PrepareForTestWithDefaults, PrepareForTestWithDefaults, FixtureRegisterWithContext(func(ctx RegistrationContext) { PrepareForTestWithSoongConfigModuleBuildComponents, ctx.RegisterModuleType("soong_config_module_type_import", SoongConfigModuleTypeImportFactory) prepareForSoongConfigTestModule, ctx.RegisterModuleType("soong_config_module_type", SoongConfigModuleTypeFactory) ctx.RegisterModuleType("soong_config_string_variable", SoongConfigStringVariableDummyFactory) ctx.RegisterModuleType("soong_config_bool_variable", SoongConfigBoolVariableDummyFactory) ctx.RegisterModuleType("test_defaults", soongConfigTestDefaultsModuleFactory) ctx.RegisterModuleType("test", soongConfigTestModuleFactory) }), FixtureWithRootAndroidBp(bp), FixtureWithRootAndroidBp(bp), ).ExtendWithErrorHandler(FixtureExpectsAllErrorsToMatchAPattern([]string{ ).ExtendWithErrorHandler(FixtureExpectsAllErrorsToMatchAPattern([]string{ // TODO(b/171232169): improve the error message for non-existent properties // TODO(b/171232169): improve the error message for non-existent properties Loading Loading @@ -411,14 +404,8 @@ func TestDuplicateStringValueInSoongConfigStringVariable(t *testing.T) { GroupFixturePreparers( GroupFixturePreparers( fixtureForVendorVars(map[string]map[string]string{"acme": {"feature1": "1"}}), fixtureForVendorVars(map[string]map[string]string{"acme": {"feature1": "1"}}), PrepareForTestWithDefaults, PrepareForTestWithDefaults, FixtureRegisterWithContext(func(ctx RegistrationContext) { PrepareForTestWithSoongConfigModuleBuildComponents, ctx.RegisterModuleType("soong_config_module_type_import", SoongConfigModuleTypeImportFactory) prepareForSoongConfigTestModule, ctx.RegisterModuleType("soong_config_module_type", SoongConfigModuleTypeFactory) ctx.RegisterModuleType("soong_config_string_variable", SoongConfigStringVariableDummyFactory) ctx.RegisterModuleType("soong_config_bool_variable", SoongConfigBoolVariableDummyFactory) ctx.RegisterModuleType("test_defaults", soongConfigTestDefaultsModuleFactory) ctx.RegisterModuleType("test", soongConfigTestModuleFactory) }), FixtureWithRootAndroidBp(bp), FixtureWithRootAndroidBp(bp), ).ExtendWithErrorHandler(FixtureExpectsAllErrorsToMatchAPattern([]string{ ).ExtendWithErrorHandler(FixtureExpectsAllErrorsToMatchAPattern([]string{ // TODO(b/171232169): improve the error message for non-existent properties // TODO(b/171232169): improve the error message for non-existent properties Loading bp2build/soong_config_module_type_conversion_test.go +1 −4 Original line number Original line Diff line number Diff line Loading @@ -29,10 +29,7 @@ func runSoongConfigModuleTypeTest(t *testing.T, tc Bp2buildTestCase) { func registerSoongConfigModuleTypes(ctx android.RegistrationContext) { func registerSoongConfigModuleTypes(ctx android.RegistrationContext) { cc.RegisterCCBuildComponents(ctx) cc.RegisterCCBuildComponents(ctx) ctx.RegisterModuleType("soong_config_module_type_import", android.SoongConfigModuleTypeImportFactory) android.RegisterSoongConfigModuleBuildComponents(ctx) ctx.RegisterModuleType("soong_config_module_type", android.SoongConfigModuleTypeFactory) ctx.RegisterModuleType("soong_config_string_variable", android.SoongConfigStringVariableDummyFactory) ctx.RegisterModuleType("soong_config_bool_variable", android.SoongConfigBoolVariableDummyFactory) ctx.RegisterModuleType("cc_library", cc.LibraryFactory) ctx.RegisterModuleType("cc_library", cc.LibraryFactory) } } Loading Loading
android/soong_config_modules.go +10 −4 Original line number Original line Diff line number Diff line Loading @@ -31,12 +31,18 @@ import ( ) ) func init() { func init() { RegisterModuleType("soong_config_module_type_import", SoongConfigModuleTypeImportFactory) RegisterSoongConfigModuleBuildComponents(InitRegistrationContext) RegisterModuleType("soong_config_module_type", SoongConfigModuleTypeFactory) RegisterModuleType("soong_config_string_variable", SoongConfigStringVariableDummyFactory) RegisterModuleType("soong_config_bool_variable", SoongConfigBoolVariableDummyFactory) } } func RegisterSoongConfigModuleBuildComponents(ctx RegistrationContext) { ctx.RegisterModuleType("soong_config_module_type_import", SoongConfigModuleTypeImportFactory) ctx.RegisterModuleType("soong_config_module_type", SoongConfigModuleTypeFactory) ctx.RegisterModuleType("soong_config_string_variable", SoongConfigStringVariableDummyFactory) ctx.RegisterModuleType("soong_config_bool_variable", SoongConfigBoolVariableDummyFactory) } var PrepareForTestWithSoongConfigModuleBuildComponents = FixtureRegisterWithContext(RegisterSoongConfigModuleBuildComponents) type soongConfigModuleTypeImport struct { type soongConfigModuleTypeImport struct { ModuleBase ModuleBase properties soongConfigModuleTypeImportProperties properties soongConfigModuleTypeImportProperties Loading
android/soong_config_modules_test.go +11 −24 Original line number Original line Diff line number Diff line Loading @@ -53,6 +53,11 @@ func soongConfigTestModuleFactory() Module { func (t soongConfigTestModule) GenerateAndroidBuildActions(ModuleContext) {} func (t soongConfigTestModule) GenerateAndroidBuildActions(ModuleContext) {} var prepareForSoongConfigTestModule = FixtureRegisterWithContext(func(ctx RegistrationContext) { ctx.RegisterModuleType("test_defaults", soongConfigTestDefaultsModuleFactory) ctx.RegisterModuleType("test", soongConfigTestModuleFactory) }) func TestSoongConfigModule(t *testing.T) { func TestSoongConfigModule(t *testing.T) { configBp := ` configBp := ` soong_config_module_type { soong_config_module_type { Loading Loading @@ -309,14 +314,8 @@ func TestSoongConfigModule(t *testing.T) { result := GroupFixturePreparers( result := GroupFixturePreparers( tc.preparer, tc.preparer, PrepareForTestWithDefaults, PrepareForTestWithDefaults, FixtureRegisterWithContext(func(ctx RegistrationContext) { PrepareForTestWithSoongConfigModuleBuildComponents, ctx.RegisterModuleType("soong_config_module_type_import", SoongConfigModuleTypeImportFactory) prepareForSoongConfigTestModule, ctx.RegisterModuleType("soong_config_module_type", SoongConfigModuleTypeFactory) ctx.RegisterModuleType("soong_config_string_variable", SoongConfigStringVariableDummyFactory) ctx.RegisterModuleType("soong_config_bool_variable", SoongConfigBoolVariableDummyFactory) ctx.RegisterModuleType("test_defaults", soongConfigTestDefaultsModuleFactory) ctx.RegisterModuleType("test", soongConfigTestModuleFactory) }), fs.AddToFixture(), fs.AddToFixture(), FixtureWithRootAndroidBp(bp), FixtureWithRootAndroidBp(bp), ).RunTest(t) ).RunTest(t) Loading Loading @@ -371,14 +370,8 @@ func TestNonExistentPropertyInSoongConfigModule(t *testing.T) { GroupFixturePreparers( GroupFixturePreparers( fixtureForVendorVars(map[string]map[string]string{"acme": {"feature1": "1"}}), fixtureForVendorVars(map[string]map[string]string{"acme": {"feature1": "1"}}), PrepareForTestWithDefaults, PrepareForTestWithDefaults, FixtureRegisterWithContext(func(ctx RegistrationContext) { PrepareForTestWithSoongConfigModuleBuildComponents, ctx.RegisterModuleType("soong_config_module_type_import", SoongConfigModuleTypeImportFactory) prepareForSoongConfigTestModule, ctx.RegisterModuleType("soong_config_module_type", SoongConfigModuleTypeFactory) ctx.RegisterModuleType("soong_config_string_variable", SoongConfigStringVariableDummyFactory) ctx.RegisterModuleType("soong_config_bool_variable", SoongConfigBoolVariableDummyFactory) ctx.RegisterModuleType("test_defaults", soongConfigTestDefaultsModuleFactory) ctx.RegisterModuleType("test", soongConfigTestModuleFactory) }), FixtureWithRootAndroidBp(bp), FixtureWithRootAndroidBp(bp), ).ExtendWithErrorHandler(FixtureExpectsAllErrorsToMatchAPattern([]string{ ).ExtendWithErrorHandler(FixtureExpectsAllErrorsToMatchAPattern([]string{ // TODO(b/171232169): improve the error message for non-existent properties // TODO(b/171232169): improve the error message for non-existent properties Loading Loading @@ -411,14 +404,8 @@ func TestDuplicateStringValueInSoongConfigStringVariable(t *testing.T) { GroupFixturePreparers( GroupFixturePreparers( fixtureForVendorVars(map[string]map[string]string{"acme": {"feature1": "1"}}), fixtureForVendorVars(map[string]map[string]string{"acme": {"feature1": "1"}}), PrepareForTestWithDefaults, PrepareForTestWithDefaults, FixtureRegisterWithContext(func(ctx RegistrationContext) { PrepareForTestWithSoongConfigModuleBuildComponents, ctx.RegisterModuleType("soong_config_module_type_import", SoongConfigModuleTypeImportFactory) prepareForSoongConfigTestModule, ctx.RegisterModuleType("soong_config_module_type", SoongConfigModuleTypeFactory) ctx.RegisterModuleType("soong_config_string_variable", SoongConfigStringVariableDummyFactory) ctx.RegisterModuleType("soong_config_bool_variable", SoongConfigBoolVariableDummyFactory) ctx.RegisterModuleType("test_defaults", soongConfigTestDefaultsModuleFactory) ctx.RegisterModuleType("test", soongConfigTestModuleFactory) }), FixtureWithRootAndroidBp(bp), FixtureWithRootAndroidBp(bp), ).ExtendWithErrorHandler(FixtureExpectsAllErrorsToMatchAPattern([]string{ ).ExtendWithErrorHandler(FixtureExpectsAllErrorsToMatchAPattern([]string{ // TODO(b/171232169): improve the error message for non-existent properties // TODO(b/171232169): improve the error message for non-existent properties Loading
bp2build/soong_config_module_type_conversion_test.go +1 −4 Original line number Original line Diff line number Diff line Loading @@ -29,10 +29,7 @@ func runSoongConfigModuleTypeTest(t *testing.T, tc Bp2buildTestCase) { func registerSoongConfigModuleTypes(ctx android.RegistrationContext) { func registerSoongConfigModuleTypes(ctx android.RegistrationContext) { cc.RegisterCCBuildComponents(ctx) cc.RegisterCCBuildComponents(ctx) ctx.RegisterModuleType("soong_config_module_type_import", android.SoongConfigModuleTypeImportFactory) android.RegisterSoongConfigModuleBuildComponents(ctx) ctx.RegisterModuleType("soong_config_module_type", android.SoongConfigModuleTypeFactory) ctx.RegisterModuleType("soong_config_string_variable", android.SoongConfigStringVariableDummyFactory) ctx.RegisterModuleType("soong_config_bool_variable", android.SoongConfigBoolVariableDummyFactory) ctx.RegisterModuleType("cc_library", cc.LibraryFactory) ctx.RegisterModuleType("cc_library", cc.LibraryFactory) } } Loading