diff options
| author | 2024-03-19 21:57:36 +0000 | |
|---|---|---|
| committer | 2024-03-20 00:06:05 +0000 | |
| commit | 9049c2725a232bab8ee4f181c25cfe5fbdcf7e90 (patch) | |
| tree | 0a3f953f034851b7935431fb9faf67b65a281811 /java/aar.go | |
| parent | f11f786571282209093b9988065fa259fd3b056b (diff) | |
Add aconfig flag support for android_library
This change adds the support that was added to android_app in
https://r.android.com/2854663 for android_library modules.
Implementation details:
- Move `Flags_packages` to aaptProperties, so that it can be utilized
for both android_app and android_library.
- Wrap `VisitDirectDeps` of aconfig_declarations to a function that
takes a ModuleContext as an input, so that it can be utilized in the
`GenerateAndroidBuildActions` of both android_app and android_library.
Test: m nothing --no-skip-soong-tests
Bug: 330222981
Change-Id: I8a755f5ca615c8a1651afcd2ec441fc9fbd82c61
Diffstat (limited to 'java/aar.go')
| -rw-r--r-- | java/aar.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/java/aar.go b/java/aar.go index 27dd38b3f..d29c2fbf4 100644 --- a/java/aar.go +++ b/java/aar.go @@ -104,6 +104,9 @@ type aaptProperties struct { // Filter only specified product and ignore other products Filter_product *string `blueprint:"mutated"` + + // Names of aconfig_declarations modules that specify aconfig flags that the module depends on. + Flags_packages []string } type aapt struct { @@ -804,6 +807,10 @@ func (a *AndroidLibrary) DepsMutator(ctx android.BottomUpMutatorContext) { a.aapt.deps(ctx, sdkDep) } a.usesLibrary.deps(ctx, false) + + for _, aconfig_declaration := range a.aaptProperties.Flags_packages { + ctx.AddDependency(ctx.Module(), aconfigDeclarationTag, aconfig_declaration) + } } func (a *AndroidLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) { @@ -817,6 +824,7 @@ func (a *AndroidLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) sdkContext: android.SdkContext(a), classLoaderContexts: a.classLoaderContexts, enforceDefaultTargetSdkVersion: false, + aconfigTextFiles: getAconfigFilePaths(ctx), }, ) |