Add aconfig flag support for runtime_resource_overlay
This change adds the support that was added to android_app in https://r.android.com/2854663 for runtime_resource_overlay modules. Implementation details: - Add flags_packages as dependencies of runtime_resouce_overlay modules - Pass the collected aconfig intermediate cache files to the aconfigBuildActionOptions. Test: m nothing --no-skip-soong-tests Bug: 330222981 Change-Id: I3e20f18e58be689ca32852f7bf0b7ea16024856b
This commit is contained in:
parent
8426848ade
commit
9f442dc5d4
2 changed files with 51 additions and 0 deletions
|
@ -122,6 +122,10 @@ func (r *RuntimeResourceOverlay) DepsMutator(ctx android.BottomUpMutatorContext)
|
||||||
|
|
||||||
ctx.AddVariationDependencies(nil, staticLibTag, r.properties.Static_libs...)
|
ctx.AddVariationDependencies(nil, staticLibTag, r.properties.Static_libs...)
|
||||||
ctx.AddVariationDependencies(nil, libTag, r.properties.Resource_libs...)
|
ctx.AddVariationDependencies(nil, libTag, r.properties.Resource_libs...)
|
||||||
|
|
||||||
|
for _, aconfig_declaration := range r.aaptProperties.Flags_packages {
|
||||||
|
ctx.AddDependency(ctx.Module(), aconfigDeclarationTag, aconfig_declaration)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RuntimeResourceOverlay) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (r *RuntimeResourceOverlay) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
|
@ -151,6 +155,7 @@ func (r *RuntimeResourceOverlay) GenerateAndroidBuildActions(ctx android.ModuleC
|
||||||
sdkContext: r,
|
sdkContext: r,
|
||||||
enforceDefaultTargetSdkVersion: false,
|
enforceDefaultTargetSdkVersion: false,
|
||||||
extraLinkFlags: aaptLinkFlags,
|
extraLinkFlags: aaptLinkFlags,
|
||||||
|
aconfigTextFiles: getAconfigFilePaths(ctx),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -405,3 +405,49 @@ func TestRuntimeResourceOverlayPartition(t *testing.T) {
|
||||||
android.AssertPathRelativeToTopEquals(t, "Install dir is not correct for "+testCase.name, testCase.expectedPath, mod.installDir)
|
android.AssertPathRelativeToTopEquals(t, "Install dir is not correct for "+testCase.name, testCase.expectedPath, mod.installDir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRuntimeResourceOverlayFlagsPackages(t *testing.T) {
|
||||||
|
result := android.GroupFixturePreparers(
|
||||||
|
prepareForJavaTest,
|
||||||
|
).RunTestWithBp(t, `
|
||||||
|
runtime_resource_overlay {
|
||||||
|
name: "foo",
|
||||||
|
sdk_version: "current",
|
||||||
|
flags_packages: [
|
||||||
|
"bar",
|
||||||
|
"baz",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
aconfig_declarations {
|
||||||
|
name: "bar",
|
||||||
|
package: "com.example.package.bar",
|
||||||
|
srcs: [
|
||||||
|
"bar.aconfig",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
aconfig_declarations {
|
||||||
|
name: "baz",
|
||||||
|
package: "com.example.package.baz",
|
||||||
|
srcs: [
|
||||||
|
"baz.aconfig",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
|
||||||
|
foo := result.ModuleForTests("foo", "android_common")
|
||||||
|
|
||||||
|
// runtime_resource_overlay module depends on aconfig_declarations listed in flags_packages
|
||||||
|
android.AssertBoolEquals(t, "foo expected to depend on bar", true,
|
||||||
|
CheckModuleHasDependency(t, result.TestContext, "foo", "android_common", "bar"))
|
||||||
|
|
||||||
|
android.AssertBoolEquals(t, "foo expected to depend on baz", true,
|
||||||
|
CheckModuleHasDependency(t, result.TestContext, "foo", "android_common", "baz"))
|
||||||
|
|
||||||
|
aapt2LinkRule := foo.Rule("android/soong/java.aapt2Link")
|
||||||
|
linkInFlags := aapt2LinkRule.Args["inFlags"]
|
||||||
|
android.AssertStringDoesContain(t,
|
||||||
|
"aapt2 link command expected to pass feature flags arguments",
|
||||||
|
linkInFlags,
|
||||||
|
"--feature-flags @out/soong/.intermediates/bar/intermediate.txt --feature-flags @out/soong/.intermediates/baz/intermediate.txt",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue