Add aconfig flags and a generic generated library plugin module for cc

The generated module lets us keep the aconfig code in its own pacakge
and not infect all of the cc package with aconfig. It's also closer
to what bazel is going to do

Bug: 283479529
Test: m aconfig_hello_world_cc && adb push $TOP/out/target/product/panther/system/bin/aconfig_hello_world_cc /system/bin && adb shell aconfig_hello_world_cc
Change-Id: I2fb9e419939c7ca77b111da9c376af077e2348a9
This commit is contained in:
Joe Onorato
2023-07-18 16:58:16 -07:00
parent d07cb48c6f
commit 37f900ca7f
7 changed files with 239 additions and 2 deletions

View File

@@ -39,7 +39,7 @@ var (
}, "release_version", "package", "declarations", "values")
// For java_aconfig_library: Generate java file
srcJarRule = pctx.AndroidStaticRule("aconfig_srcjar",
javaRule = pctx.AndroidStaticRule("java_aconfig_library",
blueprint.RuleParams{
Command: `rm -rf ${out}.tmp` +
` && mkdir -p ${out}.tmp` +
@@ -55,6 +55,20 @@ var (
Restat: true,
})
// For java_aconfig_library: Generate java file
cppRule = pctx.AndroidStaticRule("cc_aconfig_library",
blueprint.RuleParams{
Command: `rm -rf ${gendir}` +
` && mkdir -p ${gendir}` +
` && ${aconfig} create-cpp-lib` +
` --cache ${in}` +
` --out ${gendir}`,
CommandDeps: []string{
"$aconfig",
"$soong_zip",
},
}, "gendir")
// For all_aconfig_declarations
allDeclarationsRule = pctx.AndroidStaticRule("all_aconfig_declarations_dump",
blueprint.RuleParams{
@@ -75,6 +89,7 @@ func registerBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("aconfig_declarations", DeclarationsFactory)
ctx.RegisterModuleType("aconfig_values", ValuesFactory)
ctx.RegisterModuleType("aconfig_value_set", ValueSetFactory)
ctx.RegisterModuleType("cc_aconfig_library", CcAconfigLibraryFactory)
ctx.RegisterModuleType("java_aconfig_library", JavaDeclarationsLibraryFactory)
ctx.RegisterParallelSingletonType("all_aconfig_declarations", AllAconfigDeclarationsFactory)
}