diff options
author | 2024-11-18 19:22:39 +0000 | |
---|---|---|
committer | 2024-12-03 03:37:21 +0000 | |
commit | ef56908c70ae9777388987857995fd6e6404fdf6 (patch) | |
tree | 4a201ca8a0ecf3a1c4c4d5c127a8ca1e343780fb /java/rro_test.go | |
parent | 4e305cec97bd9bb6a9e4472a167efc4ac11a0836 (diff) |
Use soong built autogenerated RROs
At ToT, soong emits metadata to make (LOCAL_SOONG_PRODUCT_RRO_DIRS and
LOCAL_SOONG_DEVICE_RRO_DIRS), and make uses this metadata to build and
install apks that are intalled in /vendor or /product. This CL ports
this logic to soong.
This CL autogenerates these modules in a load hook for android_app and
override_android_app, and adds them to the `LOCAL_REQUIRED_MODULES` of
the base app. The autogenerated modules will inherit the enabled
property of the apps. This required me to add `Target.Android.Enabled`
to commonProperties in ModuleBase.
Since autogeneration happens in soong now,
`LOCAL_SOONG_(DEVICE|PRODUCT)_RRO_DIRS` no longer needs to be exported.
Followup work
- Installing the overlay variants for soong built filesystems.
Test: lunch aosp_cf_x86_64_phone-trunk_staging-userdebug
Test: no diff in system, vendor, product file_list.txt
Test: m out/target/product/vsoc_x86_64/vendor/overlay/SystemUI__aosp_cf_x86_64_phone__auto_generated_rro_vendor.apk
the apk is not bit-identical, but this is likely due to different
aapt link flags between make and soong (e.g. `--enable-compact-entries`
is added as default in soong but not in make
Test: aapt2 diff
SystemUI__aosp_cf_x86_64_phone__auto_generated_rro_vendor.apk.before
SystemUI__aosp_cf_x86_64_phone__auto_generated_rro_vendor.apk.after
reports no diffs
Change-Id: I9b212a4ed443250a63dbe27cb955c6f133cff9af
Diffstat (limited to 'java/rro_test.go')
-rw-r--r-- | java/rro_test.go | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/java/rro_test.go b/java/rro_test.go index 4d791305e..4d58bb498 100644 --- a/java/rro_test.go +++ b/java/rro_test.go @@ -255,103 +255,6 @@ func TestOverrideRuntimeResourceOverlay(t *testing.T) { } } -func TestEnforceRRO_propagatesToDependencies(t *testing.T) { - testCases := []struct { - name string - enforceRROTargets []string - rroDirs map[string][]string - }{ - { - name: "no RRO", - enforceRROTargets: nil, - rroDirs: map[string][]string{ - "foo": nil, - "bar": nil, - }, - }, - { - name: "enforce RRO on all", - enforceRROTargets: []string{"*"}, - rroDirs: map[string][]string{ - "foo": {"product/vendor/blah/overlay/lib2/res"}, - "bar": {"product/vendor/blah/overlay/lib2/res"}, - }, - }, - { - name: "enforce RRO on foo", - enforceRROTargets: []string{"foo"}, - rroDirs: map[string][]string{ - "foo": {"product/vendor/blah/overlay/lib2/res"}, - "bar": nil, - }, - }, - } - - productResourceOverlays := []string{ - "product/vendor/blah/overlay", - } - - fs := android.MockFS{ - "lib2/res/values/strings.xml": nil, - "product/vendor/blah/overlay/lib2/res/values/strings.xml": nil, - } - - bp := ` - android_app { - name: "foo", - sdk_version: "current", - resource_dirs: [], - static_libs: ["lib"], - } - - android_app { - name: "bar", - sdk_version: "current", - resource_dirs: [], - static_libs: ["lib"], - } - - android_library { - name: "lib", - sdk_version: "current", - resource_dirs: [], - static_libs: ["lib2"], - } - - android_library { - name: "lib2", - sdk_version: "current", - resource_dirs: ["lib2/res"], - } - ` - - for _, testCase := range testCases { - t.Run(testCase.name, func(t *testing.T) { - result := android.GroupFixturePreparers( - PrepareForTestWithJavaDefaultModules, - fs.AddToFixture(), - android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { - variables.ProductResourceOverlays = productResourceOverlays - if testCase.enforceRROTargets != nil { - variables.EnforceRROTargets = testCase.enforceRROTargets - } - }), - ).RunTestWithBp(t, bp) - - modules := []string{"foo", "bar"} - for _, moduleName := range modules { - module := result.ModuleForTests(moduleName, "android_common") - mkEntries := android.AndroidMkEntriesForTest(t, result.TestContext, module.Module())[0] - actualRRODirs := mkEntries.EntryMap["LOCAL_SOONG_PRODUCT_RRO_DIRS"] - if !reflect.DeepEqual(actualRRODirs, testCase.rroDirs[moduleName]) { - t.Errorf("exected %s LOCAL_SOONG_PRODUCT_RRO_DIRS entry: %v\ngot:%q", - moduleName, testCase.rroDirs[moduleName], actualRRODirs) - } - } - }) - } -} - func TestRuntimeResourceOverlayPartition(t *testing.T) { bp := ` runtime_resource_overlay { |