diff options
| author | 2022-03-31 23:13:51 +0000 | |
|---|---|---|
| committer | 2022-03-31 23:13:51 +0000 | |
| commit | 8d17118d5a85c3dd0a0f2ec0b3a4ac27321940f5 (patch) | |
| tree | 651316680931a1ef09e0f30dc7808712f1e0dda1 /java/app_test.go | |
| parent | 86aa11c043c05c809c332ef930b2b208752788c7 (diff) | |
| parent | cbcf8d9b058474ee96a6d34360d9904238ada07d (diff) | |
Build notice files from license metadata. am: 43c2dcaef6 am: 6f7de5b1a9 am: cbcf8d9b05
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2047886
Change-Id: I6a76eee6321538b70c331a2e2a9cb1e5b644ac04
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'java/app_test.go')
| -rw-r--r-- | java/app_test.go | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/java/app_test.go b/java/app_test.go index 73cf09227..48eeedeca 100644 --- a/java/app_test.go +++ b/java/app_test.go @@ -27,7 +27,6 @@ import ( "android/soong/android" "android/soong/cc" "android/soong/dexpreopt" - "android/soong/genrule" ) // testApp runs tests using the prepareForJavaTest @@ -2783,116 +2782,6 @@ func TestCodelessApp(t *testing.T) { } } -func TestEmbedNotice(t *testing.T) { - result := android.GroupFixturePreparers( - PrepareForTestWithJavaDefaultModules, - cc.PrepareForTestWithCcDefaultModules, - genrule.PrepareForTestWithGenRuleBuildComponents, - android.MockFS{ - "APP_NOTICE": nil, - "GENRULE_NOTICE": nil, - "LIB_NOTICE": nil, - "TOOL_NOTICE": nil, - }.AddToFixture(), - ).RunTestWithBp(t, ` - android_app { - name: "foo", - srcs: ["a.java"], - static_libs: ["javalib"], - jni_libs: ["libjni"], - notice: "APP_NOTICE", - embed_notices: true, - sdk_version: "current", - } - - // No embed_notice flag - android_app { - name: "bar", - srcs: ["a.java"], - jni_libs: ["libjni"], - notice: "APP_NOTICE", - sdk_version: "current", - } - - // No NOTICE files - android_app { - name: "baz", - srcs: ["a.java"], - embed_notices: true, - sdk_version: "current", - } - - cc_library { - name: "libjni", - system_shared_libs: [], - stl: "none", - notice: "LIB_NOTICE", - sdk_version: "current", - } - - java_library { - name: "javalib", - srcs: [ - ":gen", - ], - sdk_version: "current", - } - - genrule { - name: "gen", - tools: ["gentool"], - out: ["gen.java"], - notice: "GENRULE_NOTICE", - } - - java_binary_host { - name: "gentool", - srcs: ["b.java"], - notice: "TOOL_NOTICE", - } - `) - - // foo has NOTICE files to process, and embed_notices is true. - foo := result.ModuleForTests("foo", "android_common") - // verify merge notices rule. - mergeNotices := foo.Rule("mergeNoticesRule") - noticeInputs := mergeNotices.Inputs.Strings() - // TOOL_NOTICE should be excluded as it's a host module. - if len(mergeNotices.Inputs) != 3 { - t.Errorf("number of input notice files: expected = 3, actual = %q", noticeInputs) - } - if !inList("APP_NOTICE", noticeInputs) { - t.Errorf("APP_NOTICE is missing from notice files, %q", noticeInputs) - } - if !inList("LIB_NOTICE", noticeInputs) { - t.Errorf("LIB_NOTICE is missing from notice files, %q", noticeInputs) - } - if !inList("GENRULE_NOTICE", noticeInputs) { - t.Errorf("GENRULE_NOTICE is missing from notice files, %q", noticeInputs) - } - // aapt2 flags should include -A <NOTICE dir> so that its contents are put in the APK's /assets. - res := foo.Output("package-res.apk") - aapt2Flags := res.Args["flags"] - e := "-A out/soong/.intermediates/foo/android_common/NOTICE" - android.AssertStringDoesContain(t, "expected.apkPath", aapt2Flags, e) - - // bar has NOTICE files to process, but embed_notices is not set. - bar := result.ModuleForTests("bar", "android_common") - res = bar.Output("package-res.apk") - aapt2Flags = res.Args["flags"] - e = "-A out/soong/.intermediates/bar/android_common/NOTICE" - android.AssertStringDoesNotContain(t, "bar shouldn't have the asset dir flag for NOTICE", aapt2Flags, e) - - // baz's embed_notice is true, but it doesn't have any NOTICE files. - baz := result.ModuleForTests("baz", "android_common") - res = baz.Output("package-res.apk") - aapt2Flags = res.Args["flags"] - e = "-A out/soong/.intermediates/baz/android_common/NOTICE" - if strings.Contains(aapt2Flags, e) { - t.Errorf("baz shouldn't have the asset dir flag for NOTICE: %q", e) - } -} - func TestUncompressDex(t *testing.T) { testCases := []struct { name string |