aboutsummaryrefslogtreecommitdiff
path: root/aconfig/build_flags/build_flags_singleton.go
diff options
context:
space:
mode:
authormosimchah <mosimchah@gmail.com>2025-12-02 09:27:38 -0500
committermosimchah <mosimchah@gmail.com>2025-12-02 09:27:38 -0500
commitc7bade461dc55726f62997d13a48582f7c4b4655 (patch)
treeea0588da76060a2038f54f67efd046ca77634b10 /aconfig/build_flags/build_flags_singleton.go
parent0f5414d19317805e8bbbe7c4db5f0fd78769bad5 (diff)
parent89d78cff8b00d3b20a90074635c3fe5a2ee49474 (diff)
Merge branch 'lineage-23.1' of https://github.com/LineageOS/android_build_soong into HEADw16.1
* 'lineage-23.1' of https://github.com/LineageOS/android_build_soong: (528 commits) Revert "install_symlink: Make symlink target configurable" Reapply "Clear as much of cc.Module as possible after GenerateBuildActions" Revert "rust: config: Fix missing CPU variant LD flags in Rust" Rename build-flag in outdir Revert^4 "cipd: Default CIPD proxy server to on, add opt-out" Convert check-vintf-all to phony with actions Create a partial implementation of check-vintf-all for soong-only Configure RBE rust pool based on build variant Revert^3 "Add sdk version check to arr" Add jdk.internal.invoke to the allowlist Make droid always depend on symbols zip Import Device and Odm skus Don't install gob_gen in Soong Remove bazel reference from run_integration_tests.sh Fix bootstrap_test.sh Don't panic in aconfig libraries when AllowMissingDependencies is set Avoid returning nil paths from PathForModuleSrc Revert "Flag controled clang version" Rework module target dependencies on required deps Revert^2 "Add sdk version check to arr" ... Change-Id: I6e9a63fa14fda917a42e426e5dcebbad7f67e1de
Diffstat (limited to 'aconfig/build_flags/build_flags_singleton.go')
-rw-r--r--aconfig/build_flags/build_flags_singleton.go58
1 files changed, 46 insertions, 12 deletions
diff --git a/aconfig/build_flags/build_flags_singleton.go b/aconfig/build_flags/build_flags_singleton.go
index 3a06e72d6..68d8cda88 100644
--- a/aconfig/build_flags/build_flags_singleton.go
+++ b/aconfig/build_flags/build_flags_singleton.go
@@ -38,6 +38,10 @@ type allBuildFlagDeclarationsSingleton struct {
configsTextProtoPath android.OutputPath
}
+var buildFlagArtifactsDistGoals = []string{
+ "docs", "droid", "sdk", "release_config_metadata", "gms",
+}
+
func (this *allBuildFlagDeclarationsSingleton) GenerateBuildActions(ctx android.SingletonContext) {
// Find all of the build_flag_declarations modules
var flagsFiles android.Paths
@@ -55,8 +59,10 @@ func (this *allBuildFlagDeclarationsSingleton) GenerateBuildActions(ctx android.
}
})
+ basePath := android.PathForIntermediates(ctx, "release_configs")
+
// Generate build action for build_flag (binary proto output)
- this.flagsBinaryProtoPath = android.PathForIntermediates(ctx, "all_build_flag_declarations.pb")
+ this.flagsBinaryProtoPath = basePath.Join(ctx, "all_build_flag_declarations.pb")
ctx.Build(pctx, android.BuildParams{
Rule: allDeclarationsRule,
Inputs: flagsFiles,
@@ -69,7 +75,7 @@ func (this *allBuildFlagDeclarationsSingleton) GenerateBuildActions(ctx android.
ctx.Phony("all_build_flag_declarations", this.flagsBinaryProtoPath)
// Generate build action for build_flag (text proto output)
- this.flagsTextProtoPath = android.PathForIntermediates(ctx, "all_build_flag_declarations.textproto")
+ this.flagsTextProtoPath = basePath.Join(ctx, "all_build_flag_declarations.textproto")
ctx.Build(pctx, android.BuildParams{
Rule: allDeclarationsRuleTextProto,
Input: this.flagsBinaryProtoPath,
@@ -79,7 +85,7 @@ func (this *allBuildFlagDeclarationsSingleton) GenerateBuildActions(ctx android.
ctx.Phony("all_build_flag_declarations_textproto", this.flagsTextProtoPath)
// Generate build action for release_configs (binary proto output)
- this.configsBinaryProtoPath = android.PathForIntermediates(ctx, "all_release_config_contributions.pb")
+ this.configsBinaryProtoPath = basePath.Join(ctx, "all_release_config_contributions.pb")
ctx.Build(pctx, android.BuildParams{
Rule: allReleaseConfigContributionsRule,
Inputs: contributionDirs,
@@ -92,7 +98,7 @@ func (this *allBuildFlagDeclarationsSingleton) GenerateBuildActions(ctx android.
})
ctx.Phony("all_release_config_contributions", this.configsBinaryProtoPath)
- this.configsTextProtoPath = android.PathForIntermediates(ctx, "all_release_config_contributions.textproto")
+ this.configsTextProtoPath = basePath.Join(ctx, "all_release_config_contributions.textproto")
ctx.Build(pctx, android.BuildParams{
Rule: allReleaseConfigContributionsRule,
Inputs: contributionDirs,
@@ -105,29 +111,57 @@ func (this *allBuildFlagDeclarationsSingleton) GenerateBuildActions(ctx android.
})
ctx.Phony("all_release_config_contributions_textproto", this.configsTextProtoPath)
+ // Validator to ensure that there are no duplicate flag declarations.
+ // The Validator timestamp file.
+ mapsListPath := basePath.Join(ctx, "release_config_map.list")
+ duplicatesPath := basePath.Join(ctx, "duplicate_allowlist.list")
+ validatorPath := basePath.Join(ctx, "release_config_map.timestamp")
+
+ // The file containing the list of all `release_config_map.textproto` files in the source tree.
+ ctx.Build(pctx, android.BuildParams{
+ Rule: android.CpIfChanged,
+ Input: android.PathForArbitraryOutput(ctx, ".module_paths", "release_config_map.list"),
+ Output: mapsListPath,
+ Validation: validatorPath,
+ })
+ ctx.Build(pctx, android.BuildParams{
+ Rule: android.CpIfChanged,
+ Input: android.PathForArbitraryOutput(ctx, ".module_paths", "duplicate_allowlist.list"),
+ Output: duplicatesPath,
+ Validation: validatorPath,
+ })
+ ctx.Build(pctx, android.BuildParams{
+ Rule: flagDeclarationsValidationRule,
+ Input: mapsListPath,
+ Implicits: append(android.Paths{duplicatesPath}, flagsFiles...),
+ Output: validatorPath,
+ })
+ // Make sure that this is at least built on CI machines.
+ ctx.Phony("droid", mapsListPath)
+
// Add a simple target for ci/build_metadata to use.
ctx.Phony("release_config_metadata",
this.flagsBinaryProtoPath,
this.flagsTextProtoPath,
this.configsBinaryProtoPath,
this.configsTextProtoPath,
+ mapsListPath,
)
ctx.DistForGoal("droid", this.flagsBinaryProtoPath)
- for _, goal := range []string{"docs", "droid", "sdk", "release_config_metadata"} {
- ctx.DistForGoalWithFilename(goal, this.flagsBinaryProtoPath, "build_flags/all_flags.pb")
- ctx.DistForGoalWithFilename(goal, this.flagsTextProtoPath, "build_flags/all_flags.textproto")
- ctx.DistForGoalWithFilename(goal, this.configsBinaryProtoPath, "build_flags/all_release_config_contributions.pb")
- ctx.DistForGoalWithFilename(goal, this.configsTextProtoPath, "build_flags/all_release_config_contributions.textproto")
- }
+
+ ctx.DistForGoalsWithFilename(buildFlagArtifactsDistGoals, this.flagsBinaryProtoPath, "build_flags/all_flags.pb")
+ ctx.DistForGoalsWithFilename(buildFlagArtifactsDistGoals, this.flagsTextProtoPath, "build_flags/all_flags.textproto")
+ ctx.DistForGoalsWithFilename(buildFlagArtifactsDistGoals, this.configsBinaryProtoPath, "build_flags/all_release_config_contributions.pb")
+ ctx.DistForGoalsWithFilename(buildFlagArtifactsDistGoals, this.configsTextProtoPath, "build_flags/all_release_config_contributions.textproto")
if ctx.Config().HasDeviceProduct() {
flagsDir := android.PathForOutput(ctx, "release-config")
baseAllRelease := fmt.Sprintf("all_release_configs-%s", ctx.Config().DeviceProduct())
distAllReleaseConfigsArtifact := func(ext string) {
- ctx.DistForGoalWithFilename(
- "droid",
+ ctx.DistForGoalsWithFilename(
+ buildFlagArtifactsDistGoals,
flagsDir.Join(ctx, fmt.Sprintf("%s.%s", baseAllRelease, ext)),
fmt.Sprintf("build_flags/all_release_configs.%s", ext),
)