summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Marybeth Fair <marybethfair@google.com> 2025-01-21 16:25:33 -0500
committer Marybeth Fair <marybethfair@google.com> 2025-01-22 11:59:47 -0500
commit51684704f11ddc2f28941732093ae237fe6c2ec8 (patch)
tree4a8fdf7d7731479f6ba119c521f5225b3d1bcb0d
parente98f706c29d7f54c36371ca1b5a3636876dfbf20 (diff)
Connect SDK build flag to aconfig binary.
Also add lint check to ensure any changes to the exported lib binary call happen in both places. Test: manual via print statement in main.rs Flag: RELEASE_ACONFIG_SDK_CHECK (build) Change-Id: Ibd8508a62406b0d6d861f331a1b9747abae3483f
-rw-r--r--aconfig/codegen/init.go5
-rw-r--r--aconfig/codegen/java_aconfig_library.go7
-rw-r--r--aconfig/exported_java_aconfig_library.go1
-rw-r--r--aconfig/init.go5
-rw-r--r--android/config.go4
5 files changed, 17 insertions, 5 deletions
diff --git a/aconfig/codegen/init.go b/aconfig/codegen/init.go
index 34fdca3d1..385fa49f1 100644
--- a/aconfig/codegen/init.go
+++ b/aconfig/codegen/init.go
@@ -26,6 +26,7 @@ var (
// For java_aconfig_library: Generate java library
javaRule = pctx.AndroidStaticRule("java_aconfig_library",
blueprint.RuleParams{
+ // LINT.IfChange
Command: `rm -rf ${out}.tmp` +
` && mkdir -p ${out}.tmp` +
` && ${aconfig} create-java-lib` +
@@ -34,14 +35,16 @@ var (
` --out ${out}.tmp` +
` --allow-instrumentation ${debug}` +
` --new-exported ${new_exported}` +
+ ` --check-api-level ${check_api_level}` +
` && $soong_zip -write_if_changed -jar -o ${out} -C ${out}.tmp -D ${out}.tmp` +
` && rm -rf ${out}.tmp`,
+ // LINT.ThenChange(/aconfig/init.go)
CommandDeps: []string{
"$aconfig",
"$soong_zip",
},
Restat: true,
- }, "mode", "debug", "new_exported")
+ }, "mode", "debug", "new_exported", "check_api_level")
// For cc_aconfig_library: Generate C++ library
cppRule = pctx.AndroidStaticRule("cc_aconfig_library",
diff --git a/aconfig/codegen/java_aconfig_library.go b/aconfig/codegen/java_aconfig_library.go
index cd1767b95..7b9da8eb4 100644
--- a/aconfig/codegen/java_aconfig_library.go
+++ b/aconfig/codegen/java_aconfig_library.go
@@ -112,9 +112,10 @@ func (callbacks *JavaAconfigDeclarationsLibraryCallbacks) GenerateSourceJarBuild
Output: srcJarPath,
Description: "aconfig.srcjar",
Args: map[string]string{
- "mode": mode,
- "debug": strconv.FormatBool(ctx.Config().ReleaseReadFromNewStorage()),
- "new_exported": strconv.FormatBool(newExported),
+ "mode": mode,
+ "debug": strconv.FormatBool(ctx.Config().ReleaseReadFromNewStorage()),
+ "new_exported": strconv.FormatBool(newExported),
+ "check_api_level": strconv.FormatBool(ctx.Config().ReleaseAconfigCheckApiLevel()),
},
})
diff --git a/aconfig/exported_java_aconfig_library.go b/aconfig/exported_java_aconfig_library.go
index f7e6dcf6f..dd068d10a 100644
--- a/aconfig/exported_java_aconfig_library.go
+++ b/aconfig/exported_java_aconfig_library.go
@@ -59,6 +59,7 @@ func (this *exportedJavaDeclarationsLibrarySingleton) GenerateBuildActions(ctx a
"cache_files": android.JoinPathsWithPrefix(cacheFiles, " "),
"use_new_storage": strconv.FormatBool(newStorage),
"use_new_exported": strconv.FormatBool(newExported),
+ "check_api_level": strconv.FormatBool(ctx.Config().ReleaseAconfigCheckApiLevel()),
},
})
ctx.Phony("exported_java_aconfig_library", this.intermediatePath)
diff --git a/aconfig/init.go b/aconfig/init.go
index e221153a7..3d7b20d20 100644
--- a/aconfig/init.go
+++ b/aconfig/init.go
@@ -95,6 +95,7 @@ var (
// exported flags (only). Finally collect all generated code
// into the ${out} JAR file.
blueprint.RuleParams{
+ // LINT.IfChange
Command: `rm -rf ${out}.tmp` +
`&& for cache in ${cache_files}; do ` +
` if [ -n "$$(${aconfig} dump-cache --dedup --cache $$cache --filter=is_exported:true --format='{fully_qualified_name}')" ]; then ` +
@@ -103,16 +104,18 @@ var (
` --mode=exported` +
` --allow-instrumentation ${use_new_storage}` +
` --new-exported ${use_new_exported}` +
+ ` --check-api-level ${check_api_level}` +
` --out ${out}.tmp; ` +
` fi ` +
`done` +
`&& $soong_zip -write_if_changed -jar -o ${out} -C ${out}.tmp -D ${out}.tmp` +
`&& rm -rf ${out}.tmp`,
+ // LINT.ThenChange(/aconfig/codegen/init.go)
CommandDeps: []string{
"$aconfig",
"$soong_zip",
},
- }, "cache_files", "use_new_storage", "use_new_exported")
+ }, "cache_files", "use_new_storage", "use_new_exported", "check_api_level")
)
func init() {
diff --git a/android/config.go b/android/config.go
index 9c614f5b3..eda8e718a 100644
--- a/android/config.go
+++ b/android/config.go
@@ -294,6 +294,10 @@ func (c Config) ReleaseFingerprintAconfigPackages() bool {
return c.config.productVariables.GetBuildFlagBool("RELEASE_FINGERPRINT_ACONFIG_PACKAGES")
}
+func (c Config) ReleaseAconfigCheckApiLevel() bool {
+ return c.config.productVariables.GetBuildFlagBool("RELEASE_ACONFIG_CHECK_API_LEVEL")
+}
+
// A DeviceConfig object represents the configuration for a particular device
// being built. For now there will only be one of these, but in the future there
// may be multiple devices being built.