Loading OWNERS +1 −17 Original line number Diff line number Diff line Loading @@ -3,29 +3,13 @@ # approving build related projects. # AMER agespino@google.com #{LAST_RESORT_SUGGESTION} ccross@android.com colefaust@google.com cparsons@google.com #{LAST_RESORT_SUGGESTION} dacek@google.com #{LAST_RESORT_SUGGESTION} delmerico@google.com #{LAST_RESORT_SUGGESTION} dwillemsen@google.com eakammer@google.com #{LAST_RESORT_SUGGESTION} jihoonkang@google.com jobredeaux@google.com #{LAST_RESORT_SUGGESTION} joeo@google.com juu@google.com #{LAST_RESORT_SUGGESTION} lamontjones@google.com mrziwang@google.com spandandas@google.com tradical@google.com #{LAST_RESORT_SUGGESTION} usta@google.com #{LAST_RESORT_SUGGESTION} vinhdaitran@google.com #{LAST_RESORT_SUGGESTION} weiwli@google.com yudiliu@google.com No newline at end of file # APAC jingwen@google.com #{LAST_RESORT_SUGGESTION} # EMEA lberki@google.com #{LAST_RESORT_SUGGESTION} aconfig/Android.bp +0 −9 Original line number Diff line number Diff line Loading @@ -12,28 +12,19 @@ bootstrap_go_package { "soong", "soong-android", "soong-bazel", "soong-android", "soong-java", "soong-rust", ], srcs: [ "aconfig_declarations.go", "aconfig_values.go", "aconfig_value_set.go", "all_aconfig_declarations.go", "cc_aconfig_library.go", "init.go", "java_aconfig_library.go", "testing.go", "rust_aconfig_library.go", ], testSrcs: [ "aconfig_declarations_test.go", "aconfig_values_test.go", "aconfig_value_set_test.go", "java_aconfig_library_test.go", "cc_aconfig_library_test.go", "rust_aconfig_library_test.go", ], pluginFor: ["soong_build"], } aconfig/aconfig_declarations.go +53 −3 Original line number Diff line number Diff line Loading @@ -38,6 +38,9 @@ type DeclarationsModule struct { // Values from TARGET_RELEASE / RELEASE_ACONFIG_VALUE_SETS Values []string `blueprint:"mutated"` // Container(system/vendor/apex) that this module belongs to Container string } intermediatePath android.WritablePath Loading Loading @@ -69,6 +72,8 @@ func (module *DeclarationsModule) DepsMutator(ctx android.BottomUpMutatorContext if len(module.properties.Package) == 0 { ctx.PropertyErrorf("package", "missing package property") } // TODO(b/311155208): Add mandatory check for container after all pre-existing // ones are changed. // Add a dependency on the aconfig_value_sets defined in // RELEASE_ACONFIG_VALUE_SETS, and add any aconfig_values that Loading Loading @@ -110,12 +115,21 @@ func optionalVariable(prefix string, value string) string { } // Provider published by aconfig_value_set type declarationsProviderData struct { type DeclarationsProviderData struct { Package string Container string IntermediatePath android.WritablePath } var declarationsProviderKey = blueprint.NewProvider(declarationsProviderData{}) var DeclarationsProviderKey = blueprint.NewProvider(DeclarationsProviderData{}) // This is used to collect the aconfig declarations info on the transitive closure, // the data is keyed on the container. type TransitiveDeclarationsInfo struct { AconfigFiles map[string]*android.DepSet[android.Path] } var TransitiveDeclarationsInfoProvider = blueprint.NewProvider(TransitiveDeclarationsInfo{}) func (module *DeclarationsModule) GenerateAndroidBuildActions(ctx android.ModuleContext) { // Get the values that came from the global RELEASE_ACONFIG_VALUE_SETS flag Loading Loading @@ -156,13 +170,49 @@ func (module *DeclarationsModule) GenerateAndroidBuildActions(ctx android.Module }, }) ctx.SetProvider(declarationsProviderKey, declarationsProviderData{ ctx.SetProvider(DeclarationsProviderKey, DeclarationsProviderData{ Package: module.properties.Package, Container: module.properties.Container, IntermediatePath: intermediatePath, }) } func CollectTransitiveAconfigFiles(ctx android.ModuleContext, transitiveAconfigFiles *map[string]*android.DepSet[android.Path]) { if *transitiveAconfigFiles == nil { *transitiveAconfigFiles = make(map[string]*android.DepSet[android.Path]) } ctx.VisitDirectDeps(func(module android.Module) { if dep := ctx.OtherModuleProvider(module, DeclarationsProviderKey).(DeclarationsProviderData); dep.IntermediatePath != nil { aconfigMap := make(map[string]*android.DepSet[android.Path]) aconfigMap[dep.Container] = android.NewDepSet(android.POSTORDER, []android.Path{dep.IntermediatePath}, nil) mergeTransitiveAconfigFiles(aconfigMap, *transitiveAconfigFiles) return } if dep := ctx.OtherModuleProvider(module, TransitiveDeclarationsInfoProvider).(TransitiveDeclarationsInfo); len(dep.AconfigFiles) > 0 { mergeTransitiveAconfigFiles(dep.AconfigFiles, *transitiveAconfigFiles) } }) ctx.SetProvider(TransitiveDeclarationsInfoProvider, TransitiveDeclarationsInfo{ AconfigFiles: *transitiveAconfigFiles, }) } func mergeTransitiveAconfigFiles(from, to map[string]*android.DepSet[android.Path]) { for fromKey, fromValue := range from { if fromValue == nil { continue } toValue, ok := to[fromKey] if !ok { to[fromKey] = fromValue } else { to[fromKey] = android.NewDepSet(android.POSTORDER, toValue.ToList(), []*android.DepSet[android.Path]{fromValue}) } } } type bazelAconfigDeclarationsAttributes struct { Srcs bazel.LabelListAttribute Package string Loading aconfig/aconfig_declarations_test.go +3 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ func TestAconfigDeclarations(t *testing.T) { aconfig_declarations { name: "module_name", package: "com.example.package", container: "com.android.foo", srcs: [ "foo.aconfig", "bar.aconfig", Loading @@ -37,8 +38,9 @@ func TestAconfigDeclarations(t *testing.T) { module := result.ModuleForTests("module_name", "").Module().(*DeclarationsModule) // Check that the provider has the right contents depData := result.ModuleProvider(module, declarationsProviderKey).(declarationsProviderData) depData := result.ModuleProvider(module, DeclarationsProviderKey).(DeclarationsProviderData) android.AssertStringEquals(t, "package", depData.Package, "com.example.package") android.AssertStringEquals(t, "container", depData.Container, "com.android.foo") if !strings.HasSuffix(depData.IntermediatePath.String(), "/intermediate.pb") { t.Errorf("Missing intermediates path in provider: %s", depData.IntermediatePath.String()) } Loading aconfig/all_aconfig_declarations.go +3 −3 Original line number Diff line number Diff line Loading @@ -37,17 +37,17 @@ func (this *allAconfigDeclarationsSingleton) GenerateBuildActions(ctx android.Si // Find all of the aconfig_declarations modules var cacheFiles android.Paths ctx.VisitAllModules(func(module android.Module) { if !ctx.ModuleHasProvider(module, declarationsProviderKey) { if !ctx.ModuleHasProvider(module, DeclarationsProviderKey) { return } decl := ctx.ModuleProvider(module, declarationsProviderKey).(declarationsProviderData) decl := ctx.ModuleProvider(module, DeclarationsProviderKey).(DeclarationsProviderData) cacheFiles = append(cacheFiles, decl.IntermediatePath) }) // Generate build action for aconfig this.intermediatePath = android.PathForIntermediates(ctx, "all_aconfig_declarations.pb") ctx.Build(pctx, android.BuildParams{ Rule: allDeclarationsRule, Rule: AllDeclarationsRule, Inputs: cacheFiles, Output: this.intermediatePath, Description: "all_aconfig_declarations", Loading Loading
OWNERS +1 −17 Original line number Diff line number Diff line Loading @@ -3,29 +3,13 @@ # approving build related projects. # AMER agespino@google.com #{LAST_RESORT_SUGGESTION} ccross@android.com colefaust@google.com cparsons@google.com #{LAST_RESORT_SUGGESTION} dacek@google.com #{LAST_RESORT_SUGGESTION} delmerico@google.com #{LAST_RESORT_SUGGESTION} dwillemsen@google.com eakammer@google.com #{LAST_RESORT_SUGGESTION} jihoonkang@google.com jobredeaux@google.com #{LAST_RESORT_SUGGESTION} joeo@google.com juu@google.com #{LAST_RESORT_SUGGESTION} lamontjones@google.com mrziwang@google.com spandandas@google.com tradical@google.com #{LAST_RESORT_SUGGESTION} usta@google.com #{LAST_RESORT_SUGGESTION} vinhdaitran@google.com #{LAST_RESORT_SUGGESTION} weiwli@google.com yudiliu@google.com No newline at end of file # APAC jingwen@google.com #{LAST_RESORT_SUGGESTION} # EMEA lberki@google.com #{LAST_RESORT_SUGGESTION}
aconfig/Android.bp +0 −9 Original line number Diff line number Diff line Loading @@ -12,28 +12,19 @@ bootstrap_go_package { "soong", "soong-android", "soong-bazel", "soong-android", "soong-java", "soong-rust", ], srcs: [ "aconfig_declarations.go", "aconfig_values.go", "aconfig_value_set.go", "all_aconfig_declarations.go", "cc_aconfig_library.go", "init.go", "java_aconfig_library.go", "testing.go", "rust_aconfig_library.go", ], testSrcs: [ "aconfig_declarations_test.go", "aconfig_values_test.go", "aconfig_value_set_test.go", "java_aconfig_library_test.go", "cc_aconfig_library_test.go", "rust_aconfig_library_test.go", ], pluginFor: ["soong_build"], }
aconfig/aconfig_declarations.go +53 −3 Original line number Diff line number Diff line Loading @@ -38,6 +38,9 @@ type DeclarationsModule struct { // Values from TARGET_RELEASE / RELEASE_ACONFIG_VALUE_SETS Values []string `blueprint:"mutated"` // Container(system/vendor/apex) that this module belongs to Container string } intermediatePath android.WritablePath Loading Loading @@ -69,6 +72,8 @@ func (module *DeclarationsModule) DepsMutator(ctx android.BottomUpMutatorContext if len(module.properties.Package) == 0 { ctx.PropertyErrorf("package", "missing package property") } // TODO(b/311155208): Add mandatory check for container after all pre-existing // ones are changed. // Add a dependency on the aconfig_value_sets defined in // RELEASE_ACONFIG_VALUE_SETS, and add any aconfig_values that Loading Loading @@ -110,12 +115,21 @@ func optionalVariable(prefix string, value string) string { } // Provider published by aconfig_value_set type declarationsProviderData struct { type DeclarationsProviderData struct { Package string Container string IntermediatePath android.WritablePath } var declarationsProviderKey = blueprint.NewProvider(declarationsProviderData{}) var DeclarationsProviderKey = blueprint.NewProvider(DeclarationsProviderData{}) // This is used to collect the aconfig declarations info on the transitive closure, // the data is keyed on the container. type TransitiveDeclarationsInfo struct { AconfigFiles map[string]*android.DepSet[android.Path] } var TransitiveDeclarationsInfoProvider = blueprint.NewProvider(TransitiveDeclarationsInfo{}) func (module *DeclarationsModule) GenerateAndroidBuildActions(ctx android.ModuleContext) { // Get the values that came from the global RELEASE_ACONFIG_VALUE_SETS flag Loading Loading @@ -156,13 +170,49 @@ func (module *DeclarationsModule) GenerateAndroidBuildActions(ctx android.Module }, }) ctx.SetProvider(declarationsProviderKey, declarationsProviderData{ ctx.SetProvider(DeclarationsProviderKey, DeclarationsProviderData{ Package: module.properties.Package, Container: module.properties.Container, IntermediatePath: intermediatePath, }) } func CollectTransitiveAconfigFiles(ctx android.ModuleContext, transitiveAconfigFiles *map[string]*android.DepSet[android.Path]) { if *transitiveAconfigFiles == nil { *transitiveAconfigFiles = make(map[string]*android.DepSet[android.Path]) } ctx.VisitDirectDeps(func(module android.Module) { if dep := ctx.OtherModuleProvider(module, DeclarationsProviderKey).(DeclarationsProviderData); dep.IntermediatePath != nil { aconfigMap := make(map[string]*android.DepSet[android.Path]) aconfigMap[dep.Container] = android.NewDepSet(android.POSTORDER, []android.Path{dep.IntermediatePath}, nil) mergeTransitiveAconfigFiles(aconfigMap, *transitiveAconfigFiles) return } if dep := ctx.OtherModuleProvider(module, TransitiveDeclarationsInfoProvider).(TransitiveDeclarationsInfo); len(dep.AconfigFiles) > 0 { mergeTransitiveAconfigFiles(dep.AconfigFiles, *transitiveAconfigFiles) } }) ctx.SetProvider(TransitiveDeclarationsInfoProvider, TransitiveDeclarationsInfo{ AconfigFiles: *transitiveAconfigFiles, }) } func mergeTransitiveAconfigFiles(from, to map[string]*android.DepSet[android.Path]) { for fromKey, fromValue := range from { if fromValue == nil { continue } toValue, ok := to[fromKey] if !ok { to[fromKey] = fromValue } else { to[fromKey] = android.NewDepSet(android.POSTORDER, toValue.ToList(), []*android.DepSet[android.Path]{fromValue}) } } } type bazelAconfigDeclarationsAttributes struct { Srcs bazel.LabelListAttribute Package string Loading
aconfig/aconfig_declarations_test.go +3 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ func TestAconfigDeclarations(t *testing.T) { aconfig_declarations { name: "module_name", package: "com.example.package", container: "com.android.foo", srcs: [ "foo.aconfig", "bar.aconfig", Loading @@ -37,8 +38,9 @@ func TestAconfigDeclarations(t *testing.T) { module := result.ModuleForTests("module_name", "").Module().(*DeclarationsModule) // Check that the provider has the right contents depData := result.ModuleProvider(module, declarationsProviderKey).(declarationsProviderData) depData := result.ModuleProvider(module, DeclarationsProviderKey).(DeclarationsProviderData) android.AssertStringEquals(t, "package", depData.Package, "com.example.package") android.AssertStringEquals(t, "container", depData.Container, "com.android.foo") if !strings.HasSuffix(depData.IntermediatePath.String(), "/intermediate.pb") { t.Errorf("Missing intermediates path in provider: %s", depData.IntermediatePath.String()) } Loading
aconfig/all_aconfig_declarations.go +3 −3 Original line number Diff line number Diff line Loading @@ -37,17 +37,17 @@ func (this *allAconfigDeclarationsSingleton) GenerateBuildActions(ctx android.Si // Find all of the aconfig_declarations modules var cacheFiles android.Paths ctx.VisitAllModules(func(module android.Module) { if !ctx.ModuleHasProvider(module, declarationsProviderKey) { if !ctx.ModuleHasProvider(module, DeclarationsProviderKey) { return } decl := ctx.ModuleProvider(module, declarationsProviderKey).(declarationsProviderData) decl := ctx.ModuleProvider(module, DeclarationsProviderKey).(DeclarationsProviderData) cacheFiles = append(cacheFiles, decl.IntermediatePath) }) // Generate build action for aconfig this.intermediatePath = android.PathForIntermediates(ctx, "all_aconfig_declarations.pb") ctx.Build(pctx, android.BuildParams{ Rule: allDeclarationsRule, Rule: AllDeclarationsRule, Inputs: cacheFiles, Output: this.intermediatePath, Description: "all_aconfig_declarations", Loading