diff options
author | Colin Cross <ccross@android.com> | 2019-01-31 14:44:30 -0800 |
---|---|---|
committer | Anton Hansson <hansson@google.com> | 2019-02-06 10:18:30 +0000 |
commit | 6ed7deaf33135dc2f90e99a59cd822c58e5b9035 (patch) | |
tree | 395d91db2558c59b76c8d0bd479eaea9299ec97a /java/app_test.go | |
parent | 5c4791c71e613ef607aaa07a931fd966e45d233d (diff) | |
download | android_build_soong-6ed7deaf33135dc2f90e99a59cd822c58e5b9035.tar.gz android_build_soong-6ed7deaf33135dc2f90e99a59cd822c58e5b9035.tar.bz2 android_build_soong-6ed7deaf33135dc2f90e99a59cd822c58e5b9035.zip |
Add a static lib to TestEnforceRRO
Add a static lib dependency to TestEnforceRRO in preparation
for capturing static dependencies in rroDirs.
Bug: 123510624
Test: TestEnforceRRO
Change-Id: I9754ebf02866e8b3e4ad0c55ff099e546f8e2bc2
Diffstat (limited to 'java/app_test.go')
-rw-r--r-- | java/app_test.go | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/java/app_test.go b/java/app_test.go index e3b78e4e..6bbaac09 100644 --- a/java/app_test.go +++ b/java/app_test.go @@ -120,6 +120,8 @@ func TestEnforceRRO(t *testing.T) { enforceRROExcludedOverlays: nil, overlayFiles: map[string][]string{ "foo": []string{ + buildDir + "/.intermediates/lib/android_common/package-res.apk", + "foo/res/res/values/strings.xml", "device/vendor/blah/static_overlay/foo/res/values/strings.xml", "device/vendor/blah/overlay/foo/res/values/strings.xml", }, @@ -138,7 +140,11 @@ func TestEnforceRRO(t *testing.T) { enforceRROTargets: []string{"foo"}, enforceRROExcludedOverlays: []string{"device/vendor/blah/static_overlay"}, overlayFiles: map[string][]string{ - "foo": []string{"device/vendor/blah/static_overlay/foo/res/values/strings.xml"}, + "foo": []string{ + buildDir + "/.intermediates/lib/android_common/package-res.apk", + "foo/res/res/values/strings.xml", + "device/vendor/blah/static_overlay/foo/res/values/strings.xml", + }, "bar": []string{ "device/vendor/blah/static_overlay/bar/res/values/strings.xml", "device/vendor/blah/overlay/bar/res/values/strings.xml", @@ -158,7 +164,11 @@ func TestEnforceRRO(t *testing.T) { "device/vendor/blah/static_overlay/bar/res", }, overlayFiles: map[string][]string{ - "foo": []string{"device/vendor/blah/static_overlay/foo/res/values/strings.xml"}, + "foo": []string{ + buildDir + "/.intermediates/lib/android_common/package-res.apk", + "foo/res/res/values/strings.xml", + "device/vendor/blah/static_overlay/foo/res/values/strings.xml", + }, "bar": []string{"device/vendor/blah/static_overlay/bar/res/values/strings.xml"}, }, rroDirs: map[string][]string{ @@ -177,8 +187,10 @@ func TestEnforceRRO(t *testing.T) { fs := map[string][]byte{ "foo/res/res/values/strings.xml": nil, "bar/res/res/values/strings.xml": nil, + "lib/res/res/values/strings.xml": nil, "device/vendor/blah/overlay/foo/res/values/strings.xml": nil, "device/vendor/blah/overlay/bar/res/values/strings.xml": nil, + "device/vendor/blah/overlay/lib/res/values/strings.xml": nil, "device/vendor/blah/static_overlay/foo/res/values/strings.xml": nil, "device/vendor/blah/static_overlay/bar/res/values/strings.xml": nil, "device/vendor/blah/overlay2/res/values/strings.xml": nil, @@ -188,12 +200,18 @@ func TestEnforceRRO(t *testing.T) { android_app { name: "foo", resource_dirs: ["foo/res"], + static_libs: ["lib"], } android_app { name: "bar", resource_dirs: ["bar/res"], } + + android_library { + name: "lib", + resource_dirs: ["lib/res"], + } ` for _, testCase := range testCases { @@ -216,7 +234,15 @@ func TestEnforceRRO(t *testing.T) { var overlayFiles []string if overlayFile.Rule != nil { for _, o := range overlayFile.Inputs.Strings() { - overlayFiles = append(overlayFiles, module.Output(o).Inputs.Strings()...) + overlayOutput := module.MaybeOutput(o) + if overlayOutput.Rule != nil { + // If the overlay is compiled as part of this module (i.e. a .arsc.flat file), + // verify the inputs to the .arsc.flat rule. + overlayFiles = append(overlayFiles, overlayOutput.Inputs.Strings()...) + } else { + // Otherwise, verify the full path to the output of the other module + overlayFiles = append(overlayFiles, o) + } } } |