Switch noticeindex from regex to proto.
Bug: 254534552 Test: m droid dist cts alllicensemetadata Test: repo forall -c 'echo -n "$REPO_PATH " && $ANDROID_BUILD_TOP/out/host/linux-x86/bin/compliance_checkmetadata . 2>&1' | fgrep -v PASS Change-Id: I34dfe143cdc88432d6e33abee096409a37ce3b7e
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
|||||||
"io/fs"
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"android/soong/response"
|
"android/soong/response"
|
||||||
@@ -275,7 +276,8 @@ func htmlNotice(ctx *context, files ...string) error {
|
|||||||
}
|
}
|
||||||
fmt.Fprintln(ctx.stdout, "</body></html>")
|
fmt.Fprintln(ctx.stdout, "</body></html>")
|
||||||
|
|
||||||
*ctx.deps = ni.InputNoticeFiles()
|
*ctx.deps = ni.InputFiles()
|
||||||
|
sort.Strings(*ctx.deps)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@@ -78,7 +78,16 @@ func Test(t *testing.T) {
|
|||||||
usedBy{"highest.apex/lib/libb.so"},
|
usedBy{"highest.apex/lib/libb.so"},
|
||||||
firstParty{},
|
firstParty{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
|
"testdata/firstparty/bin/bin1.meta_lic",
|
||||||
|
"testdata/firstparty/bin/bin2.meta_lic",
|
||||||
|
"testdata/firstparty/highest.apex.meta_lic",
|
||||||
|
"testdata/firstparty/lib/liba.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libb.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libc.a.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
@@ -106,7 +115,16 @@ func Test(t *testing.T) {
|
|||||||
usedBy{"highest.apex/lib/libb.so"},
|
usedBy{"highest.apex/lib/libb.so"},
|
||||||
firstParty{},
|
firstParty{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
|
"testdata/firstparty/bin/bin1.meta_lic",
|
||||||
|
"testdata/firstparty/bin/bin2.meta_lic",
|
||||||
|
"testdata/firstparty/highest.apex.meta_lic",
|
||||||
|
"testdata/firstparty/lib/liba.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libb.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libc.a.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
@@ -124,7 +142,16 @@ func Test(t *testing.T) {
|
|||||||
usedBy{"highest.apex/lib/libb.so"},
|
usedBy{"highest.apex/lib/libb.so"},
|
||||||
firstParty{},
|
firstParty{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
|
"testdata/firstparty/bin/bin1.meta_lic",
|
||||||
|
"testdata/firstparty/bin/bin2.meta_lic",
|
||||||
|
"testdata/firstparty/highest.apex.meta_lic",
|
||||||
|
"testdata/firstparty/lib/liba.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libb.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libc.a.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
@@ -154,7 +181,16 @@ func Test(t *testing.T) {
|
|||||||
usedBy{"highest.apex/lib/libb.so"},
|
usedBy{"highest.apex/lib/libb.so"},
|
||||||
firstParty{},
|
firstParty{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
|
"testdata/firstparty/bin/bin1.meta_lic",
|
||||||
|
"testdata/firstparty/bin/bin2.meta_lic",
|
||||||
|
"testdata/firstparty/highest.apex.meta_lic",
|
||||||
|
"testdata/firstparty/lib/liba.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libb.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libc.a.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
@@ -170,7 +206,16 @@ func Test(t *testing.T) {
|
|||||||
usedBy{"container.zip/libb.so"},
|
usedBy{"container.zip/libb.so"},
|
||||||
firstParty{},
|
firstParty{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
|
"testdata/firstparty/bin/bin1.meta_lic",
|
||||||
|
"testdata/firstparty/bin/bin2.meta_lic",
|
||||||
|
"testdata/firstparty/container.zip.meta_lic",
|
||||||
|
"testdata/firstparty/lib/liba.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libb.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libc.a.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
@@ -182,7 +227,13 @@ func Test(t *testing.T) {
|
|||||||
usedBy{"application"},
|
usedBy{"application"},
|
||||||
firstParty{},
|
firstParty{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
|
"testdata/firstparty/application.meta_lic",
|
||||||
|
"testdata/firstparty/bin/bin3.meta_lic",
|
||||||
|
"testdata/firstparty/lib/liba.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libb.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
@@ -194,7 +245,12 @@ func Test(t *testing.T) {
|
|||||||
usedBy{"bin/bin1"},
|
usedBy{"bin/bin1"},
|
||||||
firstParty{},
|
firstParty{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
|
"testdata/firstparty/bin/bin1.meta_lic",
|
||||||
|
"testdata/firstparty/lib/liba.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libc.a.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
@@ -206,7 +262,10 @@ func Test(t *testing.T) {
|
|||||||
usedBy{"lib/libd.so"},
|
usedBy{"lib/libd.so"},
|
||||||
firstParty{},
|
firstParty{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
|
"testdata/firstparty/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "notice",
|
condition: "notice",
|
||||||
@@ -231,6 +290,13 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/notice/NOTICE_LICENSE",
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/notice/bin/bin1.meta_lic",
|
||||||
|
"testdata/notice/bin/bin2.meta_lic",
|
||||||
|
"testdata/notice/highest.apex.meta_lic",
|
||||||
|
"testdata/notice/lib/liba.so.meta_lic",
|
||||||
|
"testdata/notice/lib/libb.so.meta_lic",
|
||||||
|
"testdata/notice/lib/libc.a.meta_lic",
|
||||||
|
"testdata/notice/lib/libd.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -256,6 +322,13 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/notice/NOTICE_LICENSE",
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/notice/bin/bin1.meta_lic",
|
||||||
|
"testdata/notice/bin/bin2.meta_lic",
|
||||||
|
"testdata/notice/container.zip.meta_lic",
|
||||||
|
"testdata/notice/lib/liba.so.meta_lic",
|
||||||
|
"testdata/notice/lib/libb.so.meta_lic",
|
||||||
|
"testdata/notice/lib/libc.a.meta_lic",
|
||||||
|
"testdata/notice/lib/libd.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -275,6 +348,10 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/notice/NOTICE_LICENSE",
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/notice/application.meta_lic",
|
||||||
|
"testdata/notice/bin/bin3.meta_lic",
|
||||||
|
"testdata/notice/lib/liba.so.meta_lic",
|
||||||
|
"testdata/notice/lib/libb.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -296,6 +373,9 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/notice/NOTICE_LICENSE",
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/notice/bin/bin1.meta_lic",
|
||||||
|
"testdata/notice/lib/liba.so.meta_lic",
|
||||||
|
"testdata/notice/lib/libc.a.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -308,7 +388,10 @@ func Test(t *testing.T) {
|
|||||||
usedBy{"lib/libd.so"},
|
usedBy{"lib/libd.so"},
|
||||||
notice{},
|
notice{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/notice/NOTICE_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/notice/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "reciprocal",
|
condition: "reciprocal",
|
||||||
@@ -333,6 +416,13 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
||||||
|
"testdata/reciprocal/bin/bin1.meta_lic",
|
||||||
|
"testdata/reciprocal/bin/bin2.meta_lic",
|
||||||
|
"testdata/reciprocal/highest.apex.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/liba.so.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libb.so.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libc.a.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libd.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -358,6 +448,13 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
||||||
|
"testdata/reciprocal/bin/bin1.meta_lic",
|
||||||
|
"testdata/reciprocal/bin/bin2.meta_lic",
|
||||||
|
"testdata/reciprocal/container.zip.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/liba.so.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libb.so.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libc.a.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libd.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -377,6 +474,10 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
||||||
|
"testdata/reciprocal/application.meta_lic",
|
||||||
|
"testdata/reciprocal/bin/bin3.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/liba.so.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libb.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -398,6 +499,9 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
||||||
|
"testdata/reciprocal/bin/bin1.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/liba.so.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libc.a.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -410,7 +514,10 @@ func Test(t *testing.T) {
|
|||||||
usedBy{"lib/libd.so"},
|
usedBy{"lib/libd.so"},
|
||||||
notice{},
|
notice{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/notice/NOTICE_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/reciprocal/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "restricted",
|
condition: "restricted",
|
||||||
@@ -440,6 +547,13 @@ func Test(t *testing.T) {
|
|||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
||||||
"testdata/restricted/RESTRICTED_LICENSE",
|
"testdata/restricted/RESTRICTED_LICENSE",
|
||||||
|
"testdata/restricted/bin/bin1.meta_lic",
|
||||||
|
"testdata/restricted/bin/bin2.meta_lic",
|
||||||
|
"testdata/restricted/highest.apex.meta_lic",
|
||||||
|
"testdata/restricted/lib/liba.so.meta_lic",
|
||||||
|
"testdata/restricted/lib/libb.so.meta_lic",
|
||||||
|
"testdata/restricted/lib/libc.a.meta_lic",
|
||||||
|
"testdata/restricted/lib/libd.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -470,6 +584,13 @@ func Test(t *testing.T) {
|
|||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
||||||
"testdata/restricted/RESTRICTED_LICENSE",
|
"testdata/restricted/RESTRICTED_LICENSE",
|
||||||
|
"testdata/restricted/bin/bin1.meta_lic",
|
||||||
|
"testdata/restricted/bin/bin2.meta_lic",
|
||||||
|
"testdata/restricted/container.zip.meta_lic",
|
||||||
|
"testdata/restricted/lib/liba.so.meta_lic",
|
||||||
|
"testdata/restricted/lib/libb.so.meta_lic",
|
||||||
|
"testdata/restricted/lib/libc.a.meta_lic",
|
||||||
|
"testdata/restricted/lib/libd.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -489,6 +610,10 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/restricted/RESTRICTED_LICENSE",
|
"testdata/restricted/RESTRICTED_LICENSE",
|
||||||
|
"testdata/restricted/application.meta_lic",
|
||||||
|
"testdata/restricted/bin/bin3.meta_lic",
|
||||||
|
"testdata/restricted/lib/liba.so.meta_lic",
|
||||||
|
"testdata/restricted/lib/libb.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -513,6 +638,9 @@ func Test(t *testing.T) {
|
|||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
||||||
"testdata/restricted/RESTRICTED_LICENSE",
|
"testdata/restricted/RESTRICTED_LICENSE",
|
||||||
|
"testdata/restricted/bin/bin1.meta_lic",
|
||||||
|
"testdata/restricted/lib/liba.so.meta_lic",
|
||||||
|
"testdata/restricted/lib/libc.a.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -525,7 +653,10 @@ func Test(t *testing.T) {
|
|||||||
usedBy{"lib/libd.so"},
|
usedBy{"lib/libd.so"},
|
||||||
notice{},
|
notice{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/notice/NOTICE_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/restricted/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "proprietary",
|
condition: "proprietary",
|
||||||
@@ -555,6 +686,13 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/proprietary/PROPRIETARY_LICENSE",
|
"testdata/proprietary/PROPRIETARY_LICENSE",
|
||||||
|
"testdata/proprietary/bin/bin1.meta_lic",
|
||||||
|
"testdata/proprietary/bin/bin2.meta_lic",
|
||||||
|
"testdata/proprietary/highest.apex.meta_lic",
|
||||||
|
"testdata/proprietary/lib/liba.so.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libb.so.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libc.a.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libd.so.meta_lic",
|
||||||
"testdata/restricted/RESTRICTED_LICENSE",
|
"testdata/restricted/RESTRICTED_LICENSE",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -586,6 +724,13 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/proprietary/PROPRIETARY_LICENSE",
|
"testdata/proprietary/PROPRIETARY_LICENSE",
|
||||||
|
"testdata/proprietary/bin/bin1.meta_lic",
|
||||||
|
"testdata/proprietary/bin/bin2.meta_lic",
|
||||||
|
"testdata/proprietary/container.zip.meta_lic",
|
||||||
|
"testdata/proprietary/lib/liba.so.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libb.so.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libc.a.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libd.so.meta_lic",
|
||||||
"testdata/restricted/RESTRICTED_LICENSE",
|
"testdata/restricted/RESTRICTED_LICENSE",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -606,6 +751,10 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/proprietary/PROPRIETARY_LICENSE",
|
"testdata/proprietary/PROPRIETARY_LICENSE",
|
||||||
|
"testdata/proprietary/application.meta_lic",
|
||||||
|
"testdata/proprietary/bin/bin3.meta_lic",
|
||||||
|
"testdata/proprietary/lib/liba.so.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libb.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -627,6 +776,9 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/proprietary/PROPRIETARY_LICENSE",
|
"testdata/proprietary/PROPRIETARY_LICENSE",
|
||||||
|
"testdata/proprietary/bin/bin1.meta_lic",
|
||||||
|
"testdata/proprietary/lib/liba.so.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libc.a.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -639,7 +791,10 @@ func Test(t *testing.T) {
|
|||||||
usedBy{"lib/libd.so"},
|
usedBy{"lib/libd.so"},
|
||||||
notice{},
|
notice{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/notice/NOTICE_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/proprietary/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
@@ -23,6 +23,7 @@ import (
|
|||||||
"io/fs"
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"android/soong/response"
|
"android/soong/response"
|
||||||
@@ -230,7 +231,8 @@ func textNotice(ctx *context, files ...string) error {
|
|||||||
fmt.Fprintln(ctx.stdout)
|
fmt.Fprintln(ctx.stdout)
|
||||||
}
|
}
|
||||||
|
|
||||||
*ctx.deps = ni.InputNoticeFiles()
|
*ctx.deps = ni.InputFiles()
|
||||||
|
sort.Strings(*ctx.deps)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@@ -65,7 +65,16 @@ func Test(t *testing.T) {
|
|||||||
usedBy{"highest.apex/lib/libb.so"},
|
usedBy{"highest.apex/lib/libb.so"},
|
||||||
firstParty{},
|
firstParty{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
|
"testdata/firstparty/bin/bin1.meta_lic",
|
||||||
|
"testdata/firstparty/bin/bin2.meta_lic",
|
||||||
|
"testdata/firstparty/highest.apex.meta_lic",
|
||||||
|
"testdata/firstparty/lib/liba.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libb.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libc.a.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
@@ -81,7 +90,16 @@ func Test(t *testing.T) {
|
|||||||
usedBy{"container.zip/libb.so"},
|
usedBy{"container.zip/libb.so"},
|
||||||
firstParty{},
|
firstParty{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
|
"testdata/firstparty/bin/bin1.meta_lic",
|
||||||
|
"testdata/firstparty/bin/bin2.meta_lic",
|
||||||
|
"testdata/firstparty/container.zip.meta_lic",
|
||||||
|
"testdata/firstparty/lib/liba.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libb.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libc.a.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
@@ -93,7 +111,13 @@ func Test(t *testing.T) {
|
|||||||
usedBy{"application"},
|
usedBy{"application"},
|
||||||
firstParty{},
|
firstParty{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
|
"testdata/firstparty/application.meta_lic",
|
||||||
|
"testdata/firstparty/bin/bin3.meta_lic",
|
||||||
|
"testdata/firstparty/lib/liba.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libb.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
@@ -105,7 +129,12 @@ func Test(t *testing.T) {
|
|||||||
usedBy{"bin/bin1"},
|
usedBy{"bin/bin1"},
|
||||||
firstParty{},
|
firstParty{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
|
"testdata/firstparty/bin/bin1.meta_lic",
|
||||||
|
"testdata/firstparty/lib/liba.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libc.a.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
@@ -117,7 +146,10 @@ func Test(t *testing.T) {
|
|||||||
usedBy{"lib/libd.so"},
|
usedBy{"lib/libd.so"},
|
||||||
firstParty{},
|
firstParty{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
|
"testdata/firstparty/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "notice",
|
condition: "notice",
|
||||||
@@ -142,6 +174,13 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/notice/NOTICE_LICENSE",
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/notice/bin/bin1.meta_lic",
|
||||||
|
"testdata/notice/bin/bin2.meta_lic",
|
||||||
|
"testdata/notice/highest.apex.meta_lic",
|
||||||
|
"testdata/notice/lib/liba.so.meta_lic",
|
||||||
|
"testdata/notice/lib/libb.so.meta_lic",
|
||||||
|
"testdata/notice/lib/libc.a.meta_lic",
|
||||||
|
"testdata/notice/lib/libd.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -167,6 +206,13 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/notice/NOTICE_LICENSE",
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/notice/bin/bin1.meta_lic",
|
||||||
|
"testdata/notice/bin/bin2.meta_lic",
|
||||||
|
"testdata/notice/container.zip.meta_lic",
|
||||||
|
"testdata/notice/lib/liba.so.meta_lic",
|
||||||
|
"testdata/notice/lib/libb.so.meta_lic",
|
||||||
|
"testdata/notice/lib/libc.a.meta_lic",
|
||||||
|
"testdata/notice/lib/libd.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -186,6 +232,10 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/notice/NOTICE_LICENSE",
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/notice/application.meta_lic",
|
||||||
|
"testdata/notice/bin/bin3.meta_lic",
|
||||||
|
"testdata/notice/lib/liba.so.meta_lic",
|
||||||
|
"testdata/notice/lib/libb.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -207,6 +257,9 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/notice/NOTICE_LICENSE",
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/notice/bin/bin1.meta_lic",
|
||||||
|
"testdata/notice/lib/liba.so.meta_lic",
|
||||||
|
"testdata/notice/lib/libc.a.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -219,7 +272,10 @@ func Test(t *testing.T) {
|
|||||||
usedBy{"lib/libd.so"},
|
usedBy{"lib/libd.so"},
|
||||||
notice{},
|
notice{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/notice/NOTICE_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/notice/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "reciprocal",
|
condition: "reciprocal",
|
||||||
@@ -244,6 +300,13 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
||||||
|
"testdata/reciprocal/bin/bin1.meta_lic",
|
||||||
|
"testdata/reciprocal/bin/bin2.meta_lic",
|
||||||
|
"testdata/reciprocal/highest.apex.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/liba.so.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libb.so.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libc.a.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libd.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -269,6 +332,13 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
||||||
|
"testdata/reciprocal/bin/bin1.meta_lic",
|
||||||
|
"testdata/reciprocal/bin/bin2.meta_lic",
|
||||||
|
"testdata/reciprocal/container.zip.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/liba.so.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libb.so.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libc.a.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libd.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -288,6 +358,10 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
||||||
|
"testdata/reciprocal/application.meta_lic",
|
||||||
|
"testdata/reciprocal/bin/bin3.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/liba.so.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libb.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -309,6 +383,9 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
||||||
|
"testdata/reciprocal/bin/bin1.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/liba.so.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libc.a.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -323,6 +400,7 @@ func Test(t *testing.T) {
|
|||||||
},
|
},
|
||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/notice/NOTICE_LICENSE",
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/reciprocal/lib/libd.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -353,6 +431,13 @@ func Test(t *testing.T) {
|
|||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
||||||
"testdata/restricted/RESTRICTED_LICENSE",
|
"testdata/restricted/RESTRICTED_LICENSE",
|
||||||
|
"testdata/restricted/bin/bin1.meta_lic",
|
||||||
|
"testdata/restricted/bin/bin2.meta_lic",
|
||||||
|
"testdata/restricted/highest.apex.meta_lic",
|
||||||
|
"testdata/restricted/lib/liba.so.meta_lic",
|
||||||
|
"testdata/restricted/lib/libb.so.meta_lic",
|
||||||
|
"testdata/restricted/lib/libc.a.meta_lic",
|
||||||
|
"testdata/restricted/lib/libd.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -383,6 +468,13 @@ func Test(t *testing.T) {
|
|||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
||||||
"testdata/restricted/RESTRICTED_LICENSE",
|
"testdata/restricted/RESTRICTED_LICENSE",
|
||||||
|
"testdata/restricted/bin/bin1.meta_lic",
|
||||||
|
"testdata/restricted/bin/bin2.meta_lic",
|
||||||
|
"testdata/restricted/container.zip.meta_lic",
|
||||||
|
"testdata/restricted/lib/liba.so.meta_lic",
|
||||||
|
"testdata/restricted/lib/libb.so.meta_lic",
|
||||||
|
"testdata/restricted/lib/libc.a.meta_lic",
|
||||||
|
"testdata/restricted/lib/libd.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -402,6 +494,10 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/restricted/RESTRICTED_LICENSE",
|
"testdata/restricted/RESTRICTED_LICENSE",
|
||||||
|
"testdata/restricted/application.meta_lic",
|
||||||
|
"testdata/restricted/bin/bin3.meta_lic",
|
||||||
|
"testdata/restricted/lib/liba.so.meta_lic",
|
||||||
|
"testdata/restricted/lib/libb.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -426,6 +522,9 @@ func Test(t *testing.T) {
|
|||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
||||||
"testdata/restricted/RESTRICTED_LICENSE",
|
"testdata/restricted/RESTRICTED_LICENSE",
|
||||||
|
"testdata/restricted/bin/bin1.meta_lic",
|
||||||
|
"testdata/restricted/lib/liba.so.meta_lic",
|
||||||
|
"testdata/restricted/lib/libc.a.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -438,7 +537,10 @@ func Test(t *testing.T) {
|
|||||||
usedBy{"lib/libd.so"},
|
usedBy{"lib/libd.so"},
|
||||||
notice{},
|
notice{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/notice/NOTICE_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/restricted/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "proprietary",
|
condition: "proprietary",
|
||||||
@@ -468,6 +570,13 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/proprietary/PROPRIETARY_LICENSE",
|
"testdata/proprietary/PROPRIETARY_LICENSE",
|
||||||
|
"testdata/proprietary/bin/bin1.meta_lic",
|
||||||
|
"testdata/proprietary/bin/bin2.meta_lic",
|
||||||
|
"testdata/proprietary/highest.apex.meta_lic",
|
||||||
|
"testdata/proprietary/lib/liba.so.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libb.so.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libc.a.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libd.so.meta_lic",
|
||||||
"testdata/restricted/RESTRICTED_LICENSE",
|
"testdata/restricted/RESTRICTED_LICENSE",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -499,6 +608,13 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/proprietary/PROPRIETARY_LICENSE",
|
"testdata/proprietary/PROPRIETARY_LICENSE",
|
||||||
|
"testdata/proprietary/bin/bin1.meta_lic",
|
||||||
|
"testdata/proprietary/bin/bin2.meta_lic",
|
||||||
|
"testdata/proprietary/container.zip.meta_lic",
|
||||||
|
"testdata/proprietary/lib/liba.so.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libb.so.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libc.a.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libd.so.meta_lic",
|
||||||
"testdata/restricted/RESTRICTED_LICENSE",
|
"testdata/restricted/RESTRICTED_LICENSE",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -519,6 +635,10 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/proprietary/PROPRIETARY_LICENSE",
|
"testdata/proprietary/PROPRIETARY_LICENSE",
|
||||||
|
"testdata/proprietary/application.meta_lic",
|
||||||
|
"testdata/proprietary/bin/bin3.meta_lic",
|
||||||
|
"testdata/proprietary/lib/liba.so.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libb.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -540,6 +660,9 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/proprietary/PROPRIETARY_LICENSE",
|
"testdata/proprietary/PROPRIETARY_LICENSE",
|
||||||
|
"testdata/proprietary/bin/bin1.meta_lic",
|
||||||
|
"testdata/proprietary/lib/liba.so.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libc.a.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -552,7 +675,10 @@ func Test(t *testing.T) {
|
|||||||
usedBy{"lib/libd.so"},
|
usedBy{"lib/libd.so"},
|
||||||
notice{},
|
notice{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/notice/NOTICE_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/proprietary/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
@@ -24,6 +24,7 @@ import (
|
|||||||
"io/fs"
|
"io/fs"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"android/soong/response"
|
"android/soong/response"
|
||||||
@@ -238,7 +239,8 @@ func xmlNotice(ctx *context, files ...string) error {
|
|||||||
}
|
}
|
||||||
fmt.Fprintln(ctx.stdout, "</licenses>")
|
fmt.Fprintln(ctx.stdout, "</licenses>")
|
||||||
|
|
||||||
*ctx.deps = ni.InputNoticeFiles()
|
*ctx.deps = ni.InputFiles()
|
||||||
|
sort.Strings(*ctx.deps)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@@ -65,7 +65,16 @@ func Test(t *testing.T) {
|
|||||||
target{"highest.apex/lib/libb.so", "Android"},
|
target{"highest.apex/lib/libb.so", "Android"},
|
||||||
firstParty{},
|
firstParty{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
|
"testdata/firstparty/bin/bin1.meta_lic",
|
||||||
|
"testdata/firstparty/bin/bin2.meta_lic",
|
||||||
|
"testdata/firstparty/highest.apex.meta_lic",
|
||||||
|
"testdata/firstparty/lib/liba.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libb.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libc.a.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
@@ -79,7 +88,16 @@ func Test(t *testing.T) {
|
|||||||
target{"container.zip/libb.so", "Android"},
|
target{"container.zip/libb.so", "Android"},
|
||||||
firstParty{},
|
firstParty{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
|
"testdata/firstparty/bin/bin1.meta_lic",
|
||||||
|
"testdata/firstparty/bin/bin2.meta_lic",
|
||||||
|
"testdata/firstparty/container.zip.meta_lic",
|
||||||
|
"testdata/firstparty/lib/liba.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libb.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libc.a.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
@@ -89,7 +107,13 @@ func Test(t *testing.T) {
|
|||||||
target{"application", "Android"},
|
target{"application", "Android"},
|
||||||
firstParty{},
|
firstParty{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
|
"testdata/firstparty/application.meta_lic",
|
||||||
|
"testdata/firstparty/bin/bin3.meta_lic",
|
||||||
|
"testdata/firstparty/lib/liba.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libb.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
@@ -99,7 +123,12 @@ func Test(t *testing.T) {
|
|||||||
target{"bin/bin1", "Android"},
|
target{"bin/bin1", "Android"},
|
||||||
firstParty{},
|
firstParty{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
|
"testdata/firstparty/bin/bin1.meta_lic",
|
||||||
|
"testdata/firstparty/lib/liba.so.meta_lic",
|
||||||
|
"testdata/firstparty/lib/libc.a.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
@@ -109,7 +138,10 @@ func Test(t *testing.T) {
|
|||||||
target{"lib/libd.so", "Android"},
|
target{"lib/libd.so", "Android"},
|
||||||
firstParty{},
|
firstParty{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/firstparty/FIRST_PARTY_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
|
"testdata/firstparty/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "notice",
|
condition: "notice",
|
||||||
@@ -129,6 +161,13 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/notice/NOTICE_LICENSE",
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/notice/bin/bin1.meta_lic",
|
||||||
|
"testdata/notice/bin/bin2.meta_lic",
|
||||||
|
"testdata/notice/highest.apex.meta_lic",
|
||||||
|
"testdata/notice/lib/liba.so.meta_lic",
|
||||||
|
"testdata/notice/lib/libb.so.meta_lic",
|
||||||
|
"testdata/notice/lib/libc.a.meta_lic",
|
||||||
|
"testdata/notice/lib/libd.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -149,6 +188,13 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/notice/NOTICE_LICENSE",
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/notice/bin/bin1.meta_lic",
|
||||||
|
"testdata/notice/bin/bin2.meta_lic",
|
||||||
|
"testdata/notice/container.zip.meta_lic",
|
||||||
|
"testdata/notice/lib/liba.so.meta_lic",
|
||||||
|
"testdata/notice/lib/libb.so.meta_lic",
|
||||||
|
"testdata/notice/lib/libc.a.meta_lic",
|
||||||
|
"testdata/notice/lib/libd.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -164,6 +210,10 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/notice/NOTICE_LICENSE",
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/notice/application.meta_lic",
|
||||||
|
"testdata/notice/bin/bin3.meta_lic",
|
||||||
|
"testdata/notice/lib/liba.so.meta_lic",
|
||||||
|
"testdata/notice/lib/libb.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -180,6 +230,9 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/notice/NOTICE_LICENSE",
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/notice/bin/bin1.meta_lic",
|
||||||
|
"testdata/notice/lib/liba.so.meta_lic",
|
||||||
|
"testdata/notice/lib/libc.a.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -190,7 +243,10 @@ func Test(t *testing.T) {
|
|||||||
target{"lib/libd.so", "External"},
|
target{"lib/libd.so", "External"},
|
||||||
notice{},
|
notice{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/notice/NOTICE_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/notice/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "reciprocal",
|
condition: "reciprocal",
|
||||||
@@ -210,6 +266,13 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
||||||
|
"testdata/reciprocal/bin/bin1.meta_lic",
|
||||||
|
"testdata/reciprocal/bin/bin2.meta_lic",
|
||||||
|
"testdata/reciprocal/highest.apex.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/liba.so.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libb.so.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libc.a.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libd.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -230,6 +293,13 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
||||||
|
"testdata/reciprocal/bin/bin1.meta_lic",
|
||||||
|
"testdata/reciprocal/bin/bin2.meta_lic",
|
||||||
|
"testdata/reciprocal/container.zip.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/liba.so.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libb.so.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libc.a.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libd.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -245,6 +315,10 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
||||||
|
"testdata/reciprocal/application.meta_lic",
|
||||||
|
"testdata/reciprocal/bin/bin3.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/liba.so.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libb.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -261,6 +335,9 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
||||||
|
"testdata/reciprocal/bin/bin1.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/liba.so.meta_lic",
|
||||||
|
"testdata/reciprocal/lib/libc.a.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -271,7 +348,10 @@ func Test(t *testing.T) {
|
|||||||
target{"lib/libd.so", "External"},
|
target{"lib/libd.so", "External"},
|
||||||
notice{},
|
notice{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/notice/NOTICE_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/reciprocal/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "restricted",
|
condition: "restricted",
|
||||||
@@ -294,6 +374,13 @@ func Test(t *testing.T) {
|
|||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
||||||
"testdata/restricted/RESTRICTED_LICENSE",
|
"testdata/restricted/RESTRICTED_LICENSE",
|
||||||
|
"testdata/restricted/bin/bin1.meta_lic",
|
||||||
|
"testdata/restricted/bin/bin2.meta_lic",
|
||||||
|
"testdata/restricted/highest.apex.meta_lic",
|
||||||
|
"testdata/restricted/lib/liba.so.meta_lic",
|
||||||
|
"testdata/restricted/lib/libb.so.meta_lic",
|
||||||
|
"testdata/restricted/lib/libc.a.meta_lic",
|
||||||
|
"testdata/restricted/lib/libd.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -317,6 +404,13 @@ func Test(t *testing.T) {
|
|||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
||||||
"testdata/restricted/RESTRICTED_LICENSE",
|
"testdata/restricted/RESTRICTED_LICENSE",
|
||||||
|
"testdata/restricted/bin/bin1.meta_lic",
|
||||||
|
"testdata/restricted/bin/bin2.meta_lic",
|
||||||
|
"testdata/restricted/container.zip.meta_lic",
|
||||||
|
"testdata/restricted/lib/liba.so.meta_lic",
|
||||||
|
"testdata/restricted/lib/libb.so.meta_lic",
|
||||||
|
"testdata/restricted/lib/libc.a.meta_lic",
|
||||||
|
"testdata/restricted/lib/libd.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -332,6 +426,10 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/restricted/RESTRICTED_LICENSE",
|
"testdata/restricted/RESTRICTED_LICENSE",
|
||||||
|
"testdata/restricted/application.meta_lic",
|
||||||
|
"testdata/restricted/bin/bin3.meta_lic",
|
||||||
|
"testdata/restricted/lib/liba.so.meta_lic",
|
||||||
|
"testdata/restricted/lib/libb.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -350,6 +448,9 @@ func Test(t *testing.T) {
|
|||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
"testdata/reciprocal/RECIPROCAL_LICENSE",
|
||||||
"testdata/restricted/RESTRICTED_LICENSE",
|
"testdata/restricted/RESTRICTED_LICENSE",
|
||||||
|
"testdata/restricted/bin/bin1.meta_lic",
|
||||||
|
"testdata/restricted/lib/liba.so.meta_lic",
|
||||||
|
"testdata/restricted/lib/libc.a.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -360,7 +461,10 @@ func Test(t *testing.T) {
|
|||||||
target{"lib/libd.so", "External"},
|
target{"lib/libd.so", "External"},
|
||||||
notice{},
|
notice{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/notice/NOTICE_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/restricted/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "proprietary",
|
condition: "proprietary",
|
||||||
@@ -382,6 +486,13 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/proprietary/PROPRIETARY_LICENSE",
|
"testdata/proprietary/PROPRIETARY_LICENSE",
|
||||||
|
"testdata/proprietary/bin/bin1.meta_lic",
|
||||||
|
"testdata/proprietary/bin/bin2.meta_lic",
|
||||||
|
"testdata/proprietary/highest.apex.meta_lic",
|
||||||
|
"testdata/proprietary/lib/liba.so.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libb.so.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libc.a.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libd.so.meta_lic",
|
||||||
"testdata/restricted/RESTRICTED_LICENSE",
|
"testdata/restricted/RESTRICTED_LICENSE",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -405,6 +516,13 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/proprietary/PROPRIETARY_LICENSE",
|
"testdata/proprietary/PROPRIETARY_LICENSE",
|
||||||
|
"testdata/proprietary/bin/bin1.meta_lic",
|
||||||
|
"testdata/proprietary/bin/bin2.meta_lic",
|
||||||
|
"testdata/proprietary/container.zip.meta_lic",
|
||||||
|
"testdata/proprietary/lib/liba.so.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libb.so.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libc.a.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libd.so.meta_lic",
|
||||||
"testdata/restricted/RESTRICTED_LICENSE",
|
"testdata/restricted/RESTRICTED_LICENSE",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -421,6 +539,10 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/proprietary/PROPRIETARY_LICENSE",
|
"testdata/proprietary/PROPRIETARY_LICENSE",
|
||||||
|
"testdata/proprietary/application.meta_lic",
|
||||||
|
"testdata/proprietary/bin/bin3.meta_lic",
|
||||||
|
"testdata/proprietary/lib/liba.so.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libb.so.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -437,6 +559,9 @@ func Test(t *testing.T) {
|
|||||||
expectedDeps: []string{
|
expectedDeps: []string{
|
||||||
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
"testdata/firstparty/FIRST_PARTY_LICENSE",
|
||||||
"testdata/proprietary/PROPRIETARY_LICENSE",
|
"testdata/proprietary/PROPRIETARY_LICENSE",
|
||||||
|
"testdata/proprietary/bin/bin1.meta_lic",
|
||||||
|
"testdata/proprietary/lib/liba.so.meta_lic",
|
||||||
|
"testdata/proprietary/lib/libc.a.meta_lic",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -447,7 +572,10 @@ func Test(t *testing.T) {
|
|||||||
target{"lib/libd.so", "External"},
|
target{"lib/libd.so", "External"},
|
||||||
notice{},
|
notice{},
|
||||||
},
|
},
|
||||||
expectedDeps: []string{"testdata/notice/NOTICE_LICENSE"},
|
expectedDeps: []string{
|
||||||
|
"testdata/notice/NOTICE_LICENSE",
|
||||||
|
"testdata/proprietary/lib/libd.so.meta_lic",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
@@ -15,7 +15,6 @@
|
|||||||
package compliance
|
package compliance
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
@@ -25,16 +24,11 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
"android/soong/tools/compliance/projectmetadata"
|
||||||
noProjectName = "\u2205"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
nameRegexp = regexp.MustCompile(`^\s*name\s*:\s*"(.*)"\s*$`)
|
|
||||||
descRegexp = regexp.MustCompile(`^\s*description\s*:\s*"(.*)"\s*$`)
|
|
||||||
versionRegexp = regexp.MustCompile(`^\s*version\s*:\s*"(.*)"\s*$`)
|
|
||||||
licensesPathRegexp = regexp.MustCompile(`licen[cs]es?/`)
|
licensesPathRegexp = regexp.MustCompile(`licen[cs]es?/`)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -43,6 +37,8 @@ var (
|
|||||||
type NoticeIndex struct {
|
type NoticeIndex struct {
|
||||||
// lg identifies the license graph to which the index applies.
|
// lg identifies the license graph to which the index applies.
|
||||||
lg *LicenseGraph
|
lg *LicenseGraph
|
||||||
|
// pmix indexes project metadata
|
||||||
|
pmix *projectmetadata.Index
|
||||||
// rs identifies the set of resolutions upon which the index is based.
|
// rs identifies the set of resolutions upon which the index is based.
|
||||||
rs ResolutionSet
|
rs ResolutionSet
|
||||||
// shipped identifies the set of target nodes shipped directly or as derivative works.
|
// shipped identifies the set of target nodes shipped directly or as derivative works.
|
||||||
@@ -75,6 +71,7 @@ func IndexLicenseTexts(rootFS fs.FS, lg *LicenseGraph, rs ResolutionSet) (*Notic
|
|||||||
}
|
}
|
||||||
ni := &NoticeIndex{
|
ni := &NoticeIndex{
|
||||||
lg: lg,
|
lg: lg,
|
||||||
|
pmix: projectmetadata.NewIndex(rootFS),
|
||||||
rs: rs,
|
rs: rs,
|
||||||
shipped: ShippedNodes(lg),
|
shipped: ShippedNodes(lg),
|
||||||
rootFS: rootFS,
|
rootFS: rootFS,
|
||||||
@@ -110,9 +107,12 @@ func IndexLicenseTexts(rootFS fs.FS, lg *LicenseGraph, rs ResolutionSet) (*Notic
|
|||||||
return hashes, nil
|
return hashes, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
link := func(tn *TargetNode, hashes map[hash]struct{}, installPaths []string) {
|
link := func(tn *TargetNode, hashes map[hash]struct{}, installPaths []string) error {
|
||||||
for h := range hashes {
|
for h := range hashes {
|
||||||
libName := ni.getLibName(tn, h)
|
libName, err := ni.getLibName(tn, h)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if _, ok := ni.libHash[libName]; !ok {
|
if _, ok := ni.libHash[libName]; !ok {
|
||||||
ni.libHash[libName] = make(map[hash]struct{})
|
ni.libHash[libName] = make(map[hash]struct{})
|
||||||
}
|
}
|
||||||
@@ -145,6 +145,11 @@ func IndexLicenseTexts(rootFS fs.FS, lg *LicenseGraph, rs ResolutionSet) (*Notic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
cacheMetadata := func(tn *TargetNode) {
|
||||||
|
ni.pmix.MetadataForProjects(tn.Projects()...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns error from walk below.
|
// returns error from walk below.
|
||||||
@@ -157,13 +162,17 @@ func IndexLicenseTexts(rootFS fs.FS, lg *LicenseGraph, rs ResolutionSet) (*Notic
|
|||||||
if !ni.shipped.Contains(tn) {
|
if !ni.shipped.Contains(tn) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
go cacheMetadata(tn)
|
||||||
installPaths := getInstallPaths(tn, path)
|
installPaths := getInstallPaths(tn, path)
|
||||||
var hashes map[hash]struct{}
|
var hashes map[hash]struct{}
|
||||||
hashes, err = index(tn)
|
hashes, err = index(tn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
link(tn, hashes, installPaths)
|
err = link(tn, hashes, installPaths)
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
if tn.IsContainer() {
|
if tn.IsContainer() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -173,7 +182,10 @@ func IndexLicenseTexts(rootFS fs.FS, lg *LicenseGraph, rs ResolutionSet) (*Notic
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
link(r.actsOn, hashes, installPaths)
|
err = link(r.actsOn, hashes, installPaths)
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
@@ -214,12 +226,20 @@ func (ni *NoticeIndex) Hashes() chan hash {
|
|||||||
close(c)
|
close(c)
|
||||||
}()
|
}()
|
||||||
return c
|
return c
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// InputNoticeFiles returns the list of files that were hashed during IndexLicenseTexts.
|
// InputFiles returns the complete list of files read during indexing.
|
||||||
func (ni *NoticeIndex) InputNoticeFiles() []string {
|
func (ni *NoticeIndex) InputFiles() []string {
|
||||||
files := append([]string(nil), ni.files...)
|
licenseMeta := []string(nil)
|
||||||
sort.Strings(files)
|
for f := range ni.lg.targets {
|
||||||
|
licenseMeta = append(licenseMeta, f)
|
||||||
|
}
|
||||||
|
projectMeta := ni.pmix.AllMetadataFiles()
|
||||||
|
files := make([]string, 0, len(ni.files) + len(licenseMeta) + len(projectMeta))
|
||||||
|
files = append(files, ni.files...)
|
||||||
|
files = append(files, licenseMeta...)
|
||||||
|
files = append(files, projectMeta...)
|
||||||
return files
|
return files
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,15 +328,18 @@ func (ni *NoticeIndex) HashText(h hash) []byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// getLibName returns the name of the library associated with `noticeFor`.
|
// getLibName returns the name of the library associated with `noticeFor`.
|
||||||
func (ni *NoticeIndex) getLibName(noticeFor *TargetNode, h hash) string {
|
func (ni *NoticeIndex) getLibName(noticeFor *TargetNode, h hash) (string, error) {
|
||||||
for _, text := range noticeFor.LicenseTexts() {
|
for _, text := range noticeFor.LicenseTexts() {
|
||||||
if !strings.Contains(text, ":") {
|
if !strings.Contains(text, ":") {
|
||||||
if ni.hash[text].key != h.key {
|
if ni.hash[text].key != h.key {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ln := ni.checkMetadataForLicenseText(noticeFor, text)
|
ln, err := ni.checkMetadataForLicenseText(noticeFor, text)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
if len(ln) > 0 {
|
if len(ln) > 0 {
|
||||||
return ln
|
return ln, nil
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -331,17 +354,20 @@ func (ni *NoticeIndex) getLibName(noticeFor *TargetNode, h hash) string {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
return ln
|
return ln, nil
|
||||||
}
|
}
|
||||||
// use name from METADATA if available
|
// use name from METADATA if available
|
||||||
ln := ni.checkMetadata(noticeFor)
|
ln, err := ni.checkMetadata(noticeFor)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
if len(ln) > 0 {
|
if len(ln) > 0 {
|
||||||
return ln
|
return ln, nil
|
||||||
}
|
}
|
||||||
// use package_name: from license{} module if available
|
// use package_name: from license{} module if available
|
||||||
pn := noticeFor.PackageName()
|
pn := noticeFor.PackageName()
|
||||||
if len(pn) > 0 {
|
if len(pn) > 0 {
|
||||||
return pn
|
return pn, nil
|
||||||
}
|
}
|
||||||
for _, p := range noticeFor.Projects() {
|
for _, p := range noticeFor.Projects() {
|
||||||
if strings.HasPrefix(p, "prebuilts/") {
|
if strings.HasPrefix(p, "prebuilts/") {
|
||||||
@@ -385,7 +411,7 @@ func (ni *NoticeIndex) getLibName(noticeFor *TargetNode, h hash) string {
|
|||||||
match = match[:li]
|
match = match[:li]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return match
|
return match, nil
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -393,9 +419,9 @@ func (ni *NoticeIndex) getLibName(noticeFor *TargetNode, h hash) string {
|
|||||||
for _, safePathPrefix := range safePathPrefixes {
|
for _, safePathPrefix := range safePathPrefixes {
|
||||||
if strings.HasPrefix(p, safePathPrefix.prefix) {
|
if strings.HasPrefix(p, safePathPrefix.prefix) {
|
||||||
if safePathPrefix.strip {
|
if safePathPrefix.strip {
|
||||||
return p[len(safePathPrefix.prefix):]
|
return p[len(safePathPrefix.prefix):], nil
|
||||||
} else {
|
} else {
|
||||||
return p
|
return p, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -410,35 +436,26 @@ func (ni *NoticeIndex) getLibName(noticeFor *TargetNode, h hash) string {
|
|||||||
if fi > 0 {
|
if fi > 0 {
|
||||||
n = n[:fi]
|
n = n[:fi]
|
||||||
}
|
}
|
||||||
return n
|
return n, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkMetadata tries to look up a library name from a METADATA file associated with `noticeFor`.
|
// checkMetadata tries to look up a library name from a METADATA file associated with `noticeFor`.
|
||||||
func (ni *NoticeIndex) checkMetadata(noticeFor *TargetNode) string {
|
func (ni *NoticeIndex) checkMetadata(noticeFor *TargetNode) (string, error) {
|
||||||
for _, p := range noticeFor.Projects() {
|
pms, err := ni.pmix.MetadataForProjects(noticeFor.Projects()...)
|
||||||
if name, ok := ni.projectName[p]; ok {
|
|
||||||
if name == noProjectName {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
return name
|
|
||||||
}
|
|
||||||
name, err := ni.checkMetadataFile(filepath.Join(p, "METADATA"))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ni.projectName[p] = noProjectName
|
return "", err
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
if len(name) == 0 {
|
for _, pm := range pms {
|
||||||
ni.projectName[p] = noProjectName
|
name := pm.VersionedName()
|
||||||
continue
|
if name != "" {
|
||||||
|
return name, nil
|
||||||
}
|
}
|
||||||
ni.projectName[p] = name
|
|
||||||
return name
|
|
||||||
}
|
}
|
||||||
return ""
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkMetadataForLicenseText
|
// checkMetadataForLicenseText
|
||||||
func (ni *NoticeIndex) checkMetadataForLicenseText(noticeFor *TargetNode, licenseText string) string {
|
func (ni *NoticeIndex) checkMetadataForLicenseText(noticeFor *TargetNode, licenseText string) (string, error) {
|
||||||
p := ""
|
p := ""
|
||||||
for _, proj := range noticeFor.Projects() {
|
for _, proj := range noticeFor.Projects() {
|
||||||
if strings.HasPrefix(licenseText, proj) {
|
if strings.HasPrefix(licenseText, proj) {
|
||||||
@@ -456,79 +473,17 @@ func (ni *NoticeIndex) checkMetadataForLicenseText(noticeFor *TargetNode, licens
|
|||||||
p = filepath.Dir(p)
|
p = filepath.Dir(p)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
return ""
|
return "", nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if name, ok := ni.projectName[p]; ok {
|
pms, err := ni.pmix.MetadataForProjects(p)
|
||||||
if name == noProjectName {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return name
|
|
||||||
}
|
|
||||||
name, err := ni.checkMetadataFile(filepath.Join(p, "METADATA"))
|
|
||||||
if err == nil && len(name) > 0 {
|
|
||||||
ni.projectName[p] = name
|
|
||||||
return name
|
|
||||||
}
|
|
||||||
ni.projectName[p] = noProjectName
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// checkMetadataFile tries to look up a library name from a METADATA file at `path`.
|
|
||||||
func (ni *NoticeIndex) checkMetadataFile(path string) (string, error) {
|
|
||||||
f, err := ni.rootFS.Open(path)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
name := ""
|
if pms == nil {
|
||||||
description := ""
|
|
||||||
version := ""
|
|
||||||
s := bufio.NewScanner(f)
|
|
||||||
for s.Scan() {
|
|
||||||
line := s.Text()
|
|
||||||
m := nameRegexp.FindStringSubmatch(line)
|
|
||||||
if m != nil {
|
|
||||||
if 1 < len(m) && m[1] != "" {
|
|
||||||
name = m[1]
|
|
||||||
}
|
|
||||||
if version != "" {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
m = versionRegexp.FindStringSubmatch(line)
|
|
||||||
if m != nil {
|
|
||||||
if 1 < len(m) && m[1] != "" {
|
|
||||||
version = m[1]
|
|
||||||
}
|
|
||||||
if name != "" {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
m = descRegexp.FindStringSubmatch(line)
|
|
||||||
if m != nil {
|
|
||||||
if 1 < len(m) && m[1] != "" {
|
|
||||||
description = m[1]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ = s.Err()
|
|
||||||
_ = f.Close()
|
|
||||||
if name != "" {
|
|
||||||
if version != "" {
|
|
||||||
if version[0] == 'v' || version[0] == 'V' {
|
|
||||||
return name + "_" + version, nil
|
|
||||||
} else {
|
|
||||||
return name + "_v_" + version, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return name, nil
|
|
||||||
}
|
|
||||||
if description != "" {
|
|
||||||
return description, nil
|
|
||||||
}
|
|
||||||
return "", nil
|
return "", nil
|
||||||
|
}
|
||||||
|
return pms[0].VersionedName(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// addText reads and indexes the content of a license text file.
|
// addText reads and indexes the content of a license text file.
|
||||||
|
Reference in New Issue
Block a user