Run gofmt on compliance
Test: builds Change-Id: I404b138faac0db9a92201be6163b19d9e6bff810
This commit is contained in:
@@ -31,9 +31,9 @@ func Test(t *testing.T) {
|
|||||||
expectedOut []string
|
expectedOut []string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
name: "apex",
|
name: "apex",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
stripPrefix: "out/target/product/fictional",
|
stripPrefix: "out/target/product/fictional",
|
||||||
expectedOut: []string{
|
expectedOut: []string{
|
||||||
"/system/apex/highest.apex",
|
"/system/apex/highest.apex",
|
||||||
@@ -44,9 +44,9 @@ func Test(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
name: "container",
|
name: "container",
|
||||||
roots: []string{"container.zip.meta_lic"},
|
roots: []string{"container.zip.meta_lic"},
|
||||||
stripPrefix: "out/target/product/fictional/data/",
|
stripPrefix: "out/target/product/fictional/data/",
|
||||||
expectedOut: []string{
|
expectedOut: []string{
|
||||||
"container.zip",
|
"container.zip",
|
||||||
@@ -57,23 +57,23 @@ func Test(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
name: "application",
|
name: "application",
|
||||||
roots: []string{"application.meta_lic"},
|
roots: []string{"application.meta_lic"},
|
||||||
stripPrefix: "out/target/product/fictional/bin/",
|
stripPrefix: "out/target/product/fictional/bin/",
|
||||||
expectedOut: []string{"application"},
|
expectedOut: []string{"application"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
name: "binary",
|
name: "binary",
|
||||||
roots: []string{"bin/bin1.meta_lic"},
|
roots: []string{"bin/bin1.meta_lic"},
|
||||||
stripPrefix: "out/target/product/fictional/system/",
|
stripPrefix: "out/target/product/fictional/system/",
|
||||||
expectedOut: []string{"bin/bin1"},
|
expectedOut: []string{"bin/bin1"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
name: "library",
|
name: "library",
|
||||||
roots: []string{"lib/libd.so.meta_lic"},
|
roots: []string{"lib/libd.so.meta_lic"},
|
||||||
stripPrefix: "out/target/product/fictional/system/",
|
stripPrefix: "out/target/product/fictional/system/",
|
||||||
expectedOut: []string{"lib/libd.so"},
|
expectedOut: []string{"lib/libd.so"},
|
||||||
},
|
},
|
||||||
@@ -102,27 +102,27 @@ func Test(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "notice",
|
condition: "notice",
|
||||||
name: "application",
|
name: "application",
|
||||||
roots: []string{"application.meta_lic"},
|
roots: []string{"application.meta_lic"},
|
||||||
expectedOut: []string{"out/target/product/fictional/bin/application"},
|
expectedOut: []string{"out/target/product/fictional/bin/application"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "notice",
|
condition: "notice",
|
||||||
name: "binary",
|
name: "binary",
|
||||||
roots: []string{"bin/bin1.meta_lic"},
|
roots: []string{"bin/bin1.meta_lic"},
|
||||||
expectedOut: []string{"out/target/product/fictional/system/bin/bin1"},
|
expectedOut: []string{"out/target/product/fictional/system/bin/bin1"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "notice",
|
condition: "notice",
|
||||||
name: "library",
|
name: "library",
|
||||||
roots: []string{"lib/libd.so.meta_lic"},
|
roots: []string{"lib/libd.so.meta_lic"},
|
||||||
expectedOut: []string{"out/target/product/fictional/system/lib/libd.so"},
|
expectedOut: []string{"out/target/product/fictional/system/lib/libd.so"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "reciprocal",
|
condition: "reciprocal",
|
||||||
name: "apex",
|
name: "apex",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
stripPrefix: "out/target/product/fictional/system/apex/",
|
stripPrefix: "out/target/product/fictional/system/apex/",
|
||||||
expectedOut: []string{
|
expectedOut: []string{
|
||||||
"highest.apex",
|
"highest.apex",
|
||||||
@@ -133,9 +133,9 @@ func Test(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "reciprocal",
|
condition: "reciprocal",
|
||||||
name: "container",
|
name: "container",
|
||||||
roots: []string{"container.zip.meta_lic"},
|
roots: []string{"container.zip.meta_lic"},
|
||||||
stripPrefix: "out/target/product/fictional/data/",
|
stripPrefix: "out/target/product/fictional/data/",
|
||||||
expectedOut: []string{
|
expectedOut: []string{
|
||||||
"container.zip",
|
"container.zip",
|
||||||
@@ -146,30 +146,30 @@ func Test(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "reciprocal",
|
condition: "reciprocal",
|
||||||
name: "application",
|
name: "application",
|
||||||
roots: []string{"application.meta_lic"},
|
roots: []string{"application.meta_lic"},
|
||||||
stripPrefix: "out/target/product/fictional/bin/",
|
stripPrefix: "out/target/product/fictional/bin/",
|
||||||
expectedOut: []string{"application"},
|
expectedOut: []string{"application"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "reciprocal",
|
condition: "reciprocal",
|
||||||
name: "binary",
|
name: "binary",
|
||||||
roots: []string{"bin/bin1.meta_lic"},
|
roots: []string{"bin/bin1.meta_lic"},
|
||||||
stripPrefix: "out/target/product/fictional/system/",
|
stripPrefix: "out/target/product/fictional/system/",
|
||||||
expectedOut: []string{"bin/bin1"},
|
expectedOut: []string{"bin/bin1"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "reciprocal",
|
condition: "reciprocal",
|
||||||
name: "library",
|
name: "library",
|
||||||
roots: []string{"lib/libd.so.meta_lic"},
|
roots: []string{"lib/libd.so.meta_lic"},
|
||||||
stripPrefix: "out/target/product/fictional/system/",
|
stripPrefix: "out/target/product/fictional/system/",
|
||||||
expectedOut: []string{"lib/libd.so"},
|
expectedOut: []string{"lib/libd.so"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "restricted",
|
condition: "restricted",
|
||||||
name: "apex",
|
name: "apex",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
stripPrefix: "out/target/product/fictional/system/apex/",
|
stripPrefix: "out/target/product/fictional/system/apex/",
|
||||||
expectedOut: []string{
|
expectedOut: []string{
|
||||||
"highest.apex",
|
"highest.apex",
|
||||||
@@ -180,9 +180,9 @@ func Test(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "restricted",
|
condition: "restricted",
|
||||||
name: "container",
|
name: "container",
|
||||||
roots: []string{"container.zip.meta_lic"},
|
roots: []string{"container.zip.meta_lic"},
|
||||||
stripPrefix: "out/target/product/fictional/data/",
|
stripPrefix: "out/target/product/fictional/data/",
|
||||||
expectedOut: []string{
|
expectedOut: []string{
|
||||||
"container.zip",
|
"container.zip",
|
||||||
@@ -193,30 +193,30 @@ func Test(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "restricted",
|
condition: "restricted",
|
||||||
name: "application",
|
name: "application",
|
||||||
roots: []string{"application.meta_lic"},
|
roots: []string{"application.meta_lic"},
|
||||||
stripPrefix: "out/target/product/fictional/bin/",
|
stripPrefix: "out/target/product/fictional/bin/",
|
||||||
expectedOut: []string{"application"},
|
expectedOut: []string{"application"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "restricted",
|
condition: "restricted",
|
||||||
name: "binary",
|
name: "binary",
|
||||||
roots: []string{"bin/bin1.meta_lic"},
|
roots: []string{"bin/bin1.meta_lic"},
|
||||||
stripPrefix: "out/target/product/fictional/system/",
|
stripPrefix: "out/target/product/fictional/system/",
|
||||||
expectedOut: []string{"bin/bin1"},
|
expectedOut: []string{"bin/bin1"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "restricted",
|
condition: "restricted",
|
||||||
name: "library",
|
name: "library",
|
||||||
roots: []string{"lib/libd.so.meta_lic"},
|
roots: []string{"lib/libd.so.meta_lic"},
|
||||||
stripPrefix: "out/target/product/fictional/system/",
|
stripPrefix: "out/target/product/fictional/system/",
|
||||||
expectedOut: []string{"lib/libd.so"},
|
expectedOut: []string{"lib/libd.so"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "proprietary",
|
condition: "proprietary",
|
||||||
name: "apex",
|
name: "apex",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
stripPrefix: "out/target/product/fictional/system/apex/",
|
stripPrefix: "out/target/product/fictional/system/apex/",
|
||||||
expectedOut: []string{
|
expectedOut: []string{
|
||||||
"highest.apex",
|
"highest.apex",
|
||||||
@@ -227,9 +227,9 @@ func Test(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "proprietary",
|
condition: "proprietary",
|
||||||
name: "container",
|
name: "container",
|
||||||
roots: []string{"container.zip.meta_lic"},
|
roots: []string{"container.zip.meta_lic"},
|
||||||
stripPrefix: "out/target/product/fictional/data/",
|
stripPrefix: "out/target/product/fictional/data/",
|
||||||
expectedOut: []string{
|
expectedOut: []string{
|
||||||
"container.zip",
|
"container.zip",
|
||||||
@@ -240,23 +240,23 @@ func Test(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "proprietary",
|
condition: "proprietary",
|
||||||
name: "application",
|
name: "application",
|
||||||
roots: []string{"application.meta_lic"},
|
roots: []string{"application.meta_lic"},
|
||||||
stripPrefix: "out/target/product/fictional/bin/",
|
stripPrefix: "out/target/product/fictional/bin/",
|
||||||
expectedOut: []string{"application"},
|
expectedOut: []string{"application"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "proprietary",
|
condition: "proprietary",
|
||||||
name: "binary",
|
name: "binary",
|
||||||
roots: []string{"bin/bin1.meta_lic"},
|
roots: []string{"bin/bin1.meta_lic"},
|
||||||
stripPrefix: "out/target/product/fictional/system/",
|
stripPrefix: "out/target/product/fictional/system/",
|
||||||
expectedOut: []string{"bin/bin1"},
|
expectedOut: []string{"bin/bin1"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "proprietary",
|
condition: "proprietary",
|
||||||
name: "library",
|
name: "library",
|
||||||
roots: []string{"lib/libd.so.meta_lic"},
|
roots: []string{"lib/libd.so.meta_lic"},
|
||||||
stripPrefix: "out/target/product/fictional/system/",
|
stripPrefix: "out/target/product/fictional/system/",
|
||||||
expectedOut: []string{"lib/libd.so"},
|
expectedOut: []string{"lib/libd.so"},
|
||||||
},
|
},
|
||||||
|
@@ -46,12 +46,11 @@ outputs "FAIL" to stdout and exits with status 1.
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
failConflicts = fmt.Errorf("conflicts")
|
failConflicts = fmt.Errorf("conflicts")
|
||||||
failNoneRequested = fmt.Errorf("\nNo metadata files requested")
|
failNoneRequested = fmt.Errorf("\nNo metadata files requested")
|
||||||
failNoLicenses = fmt.Errorf("No licenses")
|
failNoLicenses = fmt.Errorf("No licenses")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
// byError orders conflicts by error string
|
// byError orders conflicts by error string
|
||||||
type byError []compliance.SourceSharePrivacyConflict
|
type byError []compliance.SourceSharePrivacyConflict
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@ var (
|
|||||||
stripPrefix = flag.String("strip_prefix", "", "Prefix to remove from paths. i.e. path to root")
|
stripPrefix = flag.String("strip_prefix", "", "Prefix to remove from paths. i.e. path to root")
|
||||||
|
|
||||||
failNoneRequested = fmt.Errorf("\nNo license metadata files requested")
|
failNoneRequested = fmt.Errorf("\nNo license metadata files requested")
|
||||||
failNoLicenses = fmt.Errorf("No licenses found")
|
failNoLicenses = fmt.Errorf("No licenses found")
|
||||||
)
|
)
|
||||||
|
|
||||||
type context struct {
|
type context struct {
|
||||||
|
@@ -32,7 +32,7 @@ var (
|
|||||||
stripPrefix = flag.String("strip_prefix", "", "Prefix to remove from paths. i.e. path to root")
|
stripPrefix = flag.String("strip_prefix", "", "Prefix to remove from paths. i.e. path to root")
|
||||||
|
|
||||||
failNoneRequested = fmt.Errorf("\nNo license metadata files requested")
|
failNoneRequested = fmt.Errorf("\nNo license metadata files requested")
|
||||||
failNoLicenses = fmt.Errorf("No licenses found")
|
failNoLicenses = fmt.Errorf("No licenses found")
|
||||||
)
|
)
|
||||||
|
|
||||||
type context struct {
|
type context struct {
|
||||||
|
@@ -97,7 +97,7 @@ func Test_plaintext(t *testing.T) {
|
|||||||
name: "apex_trimmed_share",
|
name: "apex_trimmed_share",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
ctx: context{
|
ctx: context{
|
||||||
conditions: compliance.ImpliesShared.AsList(),
|
conditions: compliance.ImpliesShared.AsList(),
|
||||||
stripPrefix: "testdata/firstparty/",
|
stripPrefix: "testdata/firstparty/",
|
||||||
},
|
},
|
||||||
expectedOut: []string{},
|
expectedOut: []string{},
|
||||||
@@ -107,7 +107,7 @@ func Test_plaintext(t *testing.T) {
|
|||||||
name: "apex_trimmed_private",
|
name: "apex_trimmed_private",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
ctx: context{
|
ctx: context{
|
||||||
conditions: compliance.ImpliesPrivate.AsList(),
|
conditions: compliance.ImpliesPrivate.AsList(),
|
||||||
stripPrefix: "testdata/firstparty/",
|
stripPrefix: "testdata/firstparty/",
|
||||||
},
|
},
|
||||||
expectedOut: []string{},
|
expectedOut: []string{},
|
||||||
@@ -117,7 +117,7 @@ func Test_plaintext(t *testing.T) {
|
|||||||
name: "apex_trimmed_share_private",
|
name: "apex_trimmed_share_private",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
ctx: context{
|
ctx: context{
|
||||||
conditions: append(compliance.ImpliesPrivate.AsList(),compliance.ImpliesShared.AsList()...),
|
conditions: append(compliance.ImpliesPrivate.AsList(), compliance.ImpliesShared.AsList()...),
|
||||||
stripPrefix: "testdata/firstparty/",
|
stripPrefix: "testdata/firstparty/",
|
||||||
},
|
},
|
||||||
expectedOut: []string{},
|
expectedOut: []string{},
|
||||||
@@ -255,7 +255,7 @@ func Test_plaintext(t *testing.T) {
|
|||||||
name: "apex_trimmed_share",
|
name: "apex_trimmed_share",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
ctx: context{
|
ctx: context{
|
||||||
conditions: compliance.ImpliesShared.AsList(),
|
conditions: compliance.ImpliesShared.AsList(),
|
||||||
stripPrefix: "testdata/notice/",
|
stripPrefix: "testdata/notice/",
|
||||||
},
|
},
|
||||||
expectedOut: []string{},
|
expectedOut: []string{},
|
||||||
@@ -265,7 +265,7 @@ func Test_plaintext(t *testing.T) {
|
|||||||
name: "apex_trimmed_private",
|
name: "apex_trimmed_private",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
ctx: context{
|
ctx: context{
|
||||||
conditions: compliance.ImpliesPrivate.AsList(),
|
conditions: compliance.ImpliesPrivate.AsList(),
|
||||||
stripPrefix: "testdata/notice/",
|
stripPrefix: "testdata/notice/",
|
||||||
},
|
},
|
||||||
expectedOut: []string{},
|
expectedOut: []string{},
|
||||||
@@ -275,7 +275,7 @@ func Test_plaintext(t *testing.T) {
|
|||||||
name: "apex_trimmed_share_private",
|
name: "apex_trimmed_share_private",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
ctx: context{
|
ctx: context{
|
||||||
conditions: append(compliance.ImpliesShared.AsList(),compliance.ImpliesPrivate.AsList()...),
|
conditions: append(compliance.ImpliesShared.AsList(), compliance.ImpliesPrivate.AsList()...),
|
||||||
stripPrefix: "testdata/notice/",
|
stripPrefix: "testdata/notice/",
|
||||||
},
|
},
|
||||||
expectedOut: []string{},
|
expectedOut: []string{},
|
||||||
@@ -408,7 +408,7 @@ func Test_plaintext(t *testing.T) {
|
|||||||
name: "apex_trimmed_share",
|
name: "apex_trimmed_share",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
ctx: context{
|
ctx: context{
|
||||||
conditions: compliance.ImpliesShared.AsList(),
|
conditions: compliance.ImpliesShared.AsList(),
|
||||||
stripPrefix: "testdata/reciprocal/",
|
stripPrefix: "testdata/reciprocal/",
|
||||||
},
|
},
|
||||||
expectedOut: []string{
|
expectedOut: []string{
|
||||||
@@ -424,7 +424,7 @@ func Test_plaintext(t *testing.T) {
|
|||||||
name: "apex_trimmed_private",
|
name: "apex_trimmed_private",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
ctx: context{
|
ctx: context{
|
||||||
conditions: compliance.ImpliesPrivate.AsList(),
|
conditions: compliance.ImpliesPrivate.AsList(),
|
||||||
stripPrefix: "testdata/reciprocal/",
|
stripPrefix: "testdata/reciprocal/",
|
||||||
},
|
},
|
||||||
expectedOut: []string{},
|
expectedOut: []string{},
|
||||||
@@ -434,7 +434,7 @@ func Test_plaintext(t *testing.T) {
|
|||||||
name: "apex_trimmed_share_private",
|
name: "apex_trimmed_share_private",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
ctx: context{
|
ctx: context{
|
||||||
conditions: append(compliance.ImpliesShared.AsList(),compliance.ImpliesPrivate.AsList()...),
|
conditions: append(compliance.ImpliesShared.AsList(), compliance.ImpliesPrivate.AsList()...),
|
||||||
stripPrefix: "testdata/reciprocal/",
|
stripPrefix: "testdata/reciprocal/",
|
||||||
},
|
},
|
||||||
expectedOut: []string{
|
expectedOut: []string{
|
||||||
@@ -573,7 +573,7 @@ func Test_plaintext(t *testing.T) {
|
|||||||
name: "apex_trimmed_share",
|
name: "apex_trimmed_share",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
ctx: context{
|
ctx: context{
|
||||||
conditions: compliance.ImpliesShared.AsList(),
|
conditions: compliance.ImpliesShared.AsList(),
|
||||||
stripPrefix: "testdata/restricted/",
|
stripPrefix: "testdata/restricted/",
|
||||||
},
|
},
|
||||||
expectedOut: []string{
|
expectedOut: []string{
|
||||||
@@ -597,7 +597,7 @@ func Test_plaintext(t *testing.T) {
|
|||||||
name: "apex_trimmed_private",
|
name: "apex_trimmed_private",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
ctx: context{
|
ctx: context{
|
||||||
conditions: compliance.ImpliesPrivate.AsList(),
|
conditions: compliance.ImpliesPrivate.AsList(),
|
||||||
stripPrefix: "testdata/restricted/",
|
stripPrefix: "testdata/restricted/",
|
||||||
},
|
},
|
||||||
expectedOut: []string{},
|
expectedOut: []string{},
|
||||||
@@ -607,7 +607,7 @@ func Test_plaintext(t *testing.T) {
|
|||||||
name: "apex_trimmed_share_private",
|
name: "apex_trimmed_share_private",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
ctx: context{
|
ctx: context{
|
||||||
conditions: append(compliance.ImpliesShared.AsList(),compliance.ImpliesPrivate.AsList()...),
|
conditions: append(compliance.ImpliesShared.AsList(), compliance.ImpliesPrivate.AsList()...),
|
||||||
stripPrefix: "testdata/restricted/",
|
stripPrefix: "testdata/restricted/",
|
||||||
},
|
},
|
||||||
expectedOut: []string{
|
expectedOut: []string{
|
||||||
@@ -754,7 +754,7 @@ func Test_plaintext(t *testing.T) {
|
|||||||
name: "apex_trimmed_share",
|
name: "apex_trimmed_share",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
ctx: context{
|
ctx: context{
|
||||||
conditions: compliance.ImpliesShared.AsList(),
|
conditions: compliance.ImpliesShared.AsList(),
|
||||||
stripPrefix: "testdata/proprietary/",
|
stripPrefix: "testdata/proprietary/",
|
||||||
},
|
},
|
||||||
expectedOut: []string{
|
expectedOut: []string{
|
||||||
@@ -771,7 +771,7 @@ func Test_plaintext(t *testing.T) {
|
|||||||
name: "apex_trimmed_private",
|
name: "apex_trimmed_private",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
ctx: context{
|
ctx: context{
|
||||||
conditions: compliance.ImpliesPrivate.AsList(),
|
conditions: compliance.ImpliesPrivate.AsList(),
|
||||||
stripPrefix: "testdata/proprietary/",
|
stripPrefix: "testdata/proprietary/",
|
||||||
},
|
},
|
||||||
expectedOut: []string{
|
expectedOut: []string{
|
||||||
@@ -789,7 +789,7 @@ func Test_plaintext(t *testing.T) {
|
|||||||
name: "apex_trimmed_share_private",
|
name: "apex_trimmed_share_private",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
ctx: context{
|
ctx: context{
|
||||||
conditions: append(compliance.ImpliesShared.AsList(),compliance.ImpliesPrivate.AsList()...),
|
conditions: append(compliance.ImpliesShared.AsList(), compliance.ImpliesPrivate.AsList()...),
|
||||||
stripPrefix: "testdata/proprietary/",
|
stripPrefix: "testdata/proprietary/",
|
||||||
},
|
},
|
||||||
expectedOut: []string{
|
expectedOut: []string{
|
||||||
@@ -930,7 +930,7 @@ type targetMatcher struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// newTestCondition constructs a test license condition in the license graph.
|
// newTestCondition constructs a test license condition in the license graph.
|
||||||
func newTestCondition(lg *compliance.LicenseGraph, conditionName... string) compliance.LicenseConditionSet {
|
func newTestCondition(lg *compliance.LicenseGraph, conditionName ...string) compliance.LicenseConditionSet {
|
||||||
cs := compliance.NewLicenseConditionSet()
|
cs := compliance.NewLicenseConditionSet()
|
||||||
for _, name := range conditionName {
|
for _, name := range conditionName {
|
||||||
cs = cs.Plus(compliance.RecognizedConditionNames[name])
|
cs = cs.Plus(compliance.RecognizedConditionNames[name])
|
||||||
|
@@ -41,7 +41,7 @@ restricted (e.g. GPL) or reciprocal (e.g. MPL).
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
failNoneRequested = fmt.Errorf("\nNo license metadata files requested")
|
failNoneRequested = fmt.Errorf("\nNo license metadata files requested")
|
||||||
failNoLicenses = fmt.Errorf("No licenses found")
|
failNoLicenses = fmt.Errorf("No licenses found")
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@@ -26,16 +26,16 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
outputFile = flag.String("o", "-", "Where to write the library list. (default stdout)")
|
outputFile = flag.String("o", "-", "Where to write the library list. (default stdout)")
|
||||||
|
|
||||||
failNoneRequested = fmt.Errorf("\nNo license metadata files requested")
|
failNoneRequested = fmt.Errorf("\nNo license metadata files requested")
|
||||||
failNoLicenses = fmt.Errorf("No licenses found")
|
failNoLicenses = fmt.Errorf("No licenses found")
|
||||||
)
|
)
|
||||||
|
|
||||||
type context struct {
|
type context struct {
|
||||||
stdout io.Writer
|
stdout io.Writer
|
||||||
stderr io.Writer
|
stderr io.Writer
|
||||||
rootFS fs.FS
|
rootFS fs.FS
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@@ -30,153 +30,153 @@ func Test(t *testing.T) {
|
|||||||
expectedOut []string
|
expectedOut []string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
name: "apex",
|
name: "apex",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
expectedOut: []string{"Android"},
|
expectedOut: []string{"Android"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
name: "container",
|
name: "container",
|
||||||
roots: []string{"container.zip.meta_lic"},
|
roots: []string{"container.zip.meta_lic"},
|
||||||
expectedOut: []string{"Android"},
|
expectedOut: []string{"Android"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
name: "application",
|
name: "application",
|
||||||
roots: []string{"application.meta_lic"},
|
roots: []string{"application.meta_lic"},
|
||||||
expectedOut: []string{"Android"},
|
expectedOut: []string{"Android"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
name: "binary",
|
name: "binary",
|
||||||
roots: []string{"bin/bin1.meta_lic"},
|
roots: []string{"bin/bin1.meta_lic"},
|
||||||
expectedOut: []string{"Android"},
|
expectedOut: []string{"Android"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "firstparty",
|
condition: "firstparty",
|
||||||
name: "library",
|
name: "library",
|
||||||
roots: []string{"lib/libd.so.meta_lic"},
|
roots: []string{"lib/libd.so.meta_lic"},
|
||||||
expectedOut: []string{"Android"},
|
expectedOut: []string{"Android"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "notice",
|
condition: "notice",
|
||||||
name: "apex",
|
name: "apex",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
expectedOut: []string{"Android", "Device", "External"},
|
expectedOut: []string{"Android", "Device", "External"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "notice",
|
condition: "notice",
|
||||||
name: "container",
|
name: "container",
|
||||||
roots: []string{"container.zip.meta_lic"},
|
roots: []string{"container.zip.meta_lic"},
|
||||||
expectedOut: []string{"Android", "Device", "External"},
|
expectedOut: []string{"Android", "Device", "External"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "notice",
|
condition: "notice",
|
||||||
name: "application",
|
name: "application",
|
||||||
roots: []string{"application.meta_lic"},
|
roots: []string{"application.meta_lic"},
|
||||||
expectedOut: []string{"Android", "Device"},
|
expectedOut: []string{"Android", "Device"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "notice",
|
condition: "notice",
|
||||||
name: "binary",
|
name: "binary",
|
||||||
roots: []string{"bin/bin1.meta_lic"},
|
roots: []string{"bin/bin1.meta_lic"},
|
||||||
expectedOut: []string{"Android", "Device", "External"},
|
expectedOut: []string{"Android", "Device", "External"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "notice",
|
condition: "notice",
|
||||||
name: "library",
|
name: "library",
|
||||||
roots: []string{"lib/libd.so.meta_lic"},
|
roots: []string{"lib/libd.so.meta_lic"},
|
||||||
expectedOut: []string{"External"},
|
expectedOut: []string{"External"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "reciprocal",
|
condition: "reciprocal",
|
||||||
name: "apex",
|
name: "apex",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
expectedOut: []string{"Android", "Device", "External"},
|
expectedOut: []string{"Android", "Device", "External"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "reciprocal",
|
condition: "reciprocal",
|
||||||
name: "container",
|
name: "container",
|
||||||
roots: []string{"container.zip.meta_lic"},
|
roots: []string{"container.zip.meta_lic"},
|
||||||
expectedOut: []string{"Android", "Device", "External"},
|
expectedOut: []string{"Android", "Device", "External"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "reciprocal",
|
condition: "reciprocal",
|
||||||
name: "application",
|
name: "application",
|
||||||
roots: []string{"application.meta_lic"},
|
roots: []string{"application.meta_lic"},
|
||||||
expectedOut: []string{"Android", "Device"},
|
expectedOut: []string{"Android", "Device"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "reciprocal",
|
condition: "reciprocal",
|
||||||
name: "binary",
|
name: "binary",
|
||||||
roots: []string{"bin/bin1.meta_lic"},
|
roots: []string{"bin/bin1.meta_lic"},
|
||||||
expectedOut: []string{"Android", "Device", "External"},
|
expectedOut: []string{"Android", "Device", "External"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "reciprocal",
|
condition: "reciprocal",
|
||||||
name: "library",
|
name: "library",
|
||||||
roots: []string{"lib/libd.so.meta_lic"},
|
roots: []string{"lib/libd.so.meta_lic"},
|
||||||
expectedOut: []string{"External"},
|
expectedOut: []string{"External"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "restricted",
|
condition: "restricted",
|
||||||
name: "apex",
|
name: "apex",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
expectedOut: []string{"Android", "Device", "External"},
|
expectedOut: []string{"Android", "Device", "External"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "restricted",
|
condition: "restricted",
|
||||||
name: "container",
|
name: "container",
|
||||||
roots: []string{"container.zip.meta_lic"},
|
roots: []string{"container.zip.meta_lic"},
|
||||||
expectedOut: []string{"Android", "Device", "External"},
|
expectedOut: []string{"Android", "Device", "External"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "restricted",
|
condition: "restricted",
|
||||||
name: "application",
|
name: "application",
|
||||||
roots: []string{"application.meta_lic"},
|
roots: []string{"application.meta_lic"},
|
||||||
expectedOut: []string{"Android", "Device"},
|
expectedOut: []string{"Android", "Device"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "restricted",
|
condition: "restricted",
|
||||||
name: "binary",
|
name: "binary",
|
||||||
roots: []string{"bin/bin1.meta_lic"},
|
roots: []string{"bin/bin1.meta_lic"},
|
||||||
expectedOut: []string{"Android", "Device", "External"},
|
expectedOut: []string{"Android", "Device", "External"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "restricted",
|
condition: "restricted",
|
||||||
name: "library",
|
name: "library",
|
||||||
roots: []string{"lib/libd.so.meta_lic"},
|
roots: []string{"lib/libd.so.meta_lic"},
|
||||||
expectedOut: []string{"External"},
|
expectedOut: []string{"External"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "proprietary",
|
condition: "proprietary",
|
||||||
name: "apex",
|
name: "apex",
|
||||||
roots: []string{"highest.apex.meta_lic"},
|
roots: []string{"highest.apex.meta_lic"},
|
||||||
expectedOut: []string{"Android", "Device", "External"},
|
expectedOut: []string{"Android", "Device", "External"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "proprietary",
|
condition: "proprietary",
|
||||||
name: "container",
|
name: "container",
|
||||||
roots: []string{"container.zip.meta_lic"},
|
roots: []string{"container.zip.meta_lic"},
|
||||||
expectedOut: []string{"Android", "Device", "External"},
|
expectedOut: []string{"Android", "Device", "External"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "proprietary",
|
condition: "proprietary",
|
||||||
name: "application",
|
name: "application",
|
||||||
roots: []string{"application.meta_lic"},
|
roots: []string{"application.meta_lic"},
|
||||||
expectedOut: []string{"Android", "Device"},
|
expectedOut: []string{"Android", "Device"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "proprietary",
|
condition: "proprietary",
|
||||||
name: "binary",
|
name: "binary",
|
||||||
roots: []string{"bin/bin1.meta_lic"},
|
roots: []string{"bin/bin1.meta_lic"},
|
||||||
expectedOut: []string{"Android", "Device", "External"},
|
expectedOut: []string{"Android", "Device", "External"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
condition: "proprietary",
|
condition: "proprietary",
|
||||||
name: "library",
|
name: "library",
|
||||||
roots: []string{"lib/libd.so.meta_lic"},
|
roots: []string{"lib/libd.so.meta_lic"},
|
||||||
expectedOut: []string{"External"},
|
expectedOut: []string{"External"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@@ -61,16 +61,16 @@ const (
|
|||||||
var (
|
var (
|
||||||
// RecognizedConditionNames maps condition strings to LicenseCondition.
|
// RecognizedConditionNames maps condition strings to LicenseCondition.
|
||||||
RecognizedConditionNames = map[string]LicenseCondition{
|
RecognizedConditionNames = map[string]LicenseCondition{
|
||||||
"unencumbered": UnencumberedCondition,
|
"unencumbered": UnencumberedCondition,
|
||||||
"permissive": PermissiveCondition,
|
"permissive": PermissiveCondition,
|
||||||
"notice": NoticeCondition,
|
"notice": NoticeCondition,
|
||||||
"reciprocal": ReciprocalCondition,
|
"reciprocal": ReciprocalCondition,
|
||||||
"restricted": RestrictedCondition,
|
"restricted": RestrictedCondition,
|
||||||
"restricted_with_classpath_exception": RestrictedClasspathExceptionCondition,
|
"restricted_with_classpath_exception": RestrictedClasspathExceptionCondition,
|
||||||
"restricted_allows_dynamic_linking": WeaklyRestrictedCondition,
|
"restricted_allows_dynamic_linking": WeaklyRestrictedCondition,
|
||||||
"proprietary": ProprietaryCondition,
|
"proprietary": ProprietaryCondition,
|
||||||
"by_exception_only": ByExceptionOnlyCondition,
|
"by_exception_only": ByExceptionOnlyCondition,
|
||||||
"not_allowed": NotAllowedCondition,
|
"not_allowed": NotAllowedCondition,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -33,82 +33,82 @@ func TestConditionSet(t *testing.T) {
|
|||||||
conditions: []string{},
|
conditions: []string{},
|
||||||
plus: &[]string{},
|
plus: &[]string{},
|
||||||
matchingAny: map[string][]string{
|
matchingAny: map[string][]string{
|
||||||
"notice": []string{},
|
"notice": []string{},
|
||||||
"restricted": []string{},
|
"restricted": []string{},
|
||||||
"restricted|reciprocal": []string{},
|
"restricted|reciprocal": []string{},
|
||||||
},
|
},
|
||||||
expected: []string{},
|
expected: []string{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "emptyminusnothing",
|
name: "emptyminusnothing",
|
||||||
conditions: []string{},
|
conditions: []string{},
|
||||||
minus: &[]string{},
|
minus: &[]string{},
|
||||||
matchingAny: map[string][]string{
|
matchingAny: map[string][]string{
|
||||||
"notice": []string{},
|
"notice": []string{},
|
||||||
"restricted": []string{},
|
"restricted": []string{},
|
||||||
"restricted|reciprocal": []string{},
|
"restricted|reciprocal": []string{},
|
||||||
},
|
},
|
||||||
expected: []string{},
|
expected: []string{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "emptyminusnotice",
|
name: "emptyminusnotice",
|
||||||
conditions: []string{},
|
conditions: []string{},
|
||||||
minus: &[]string{"notice"},
|
minus: &[]string{"notice"},
|
||||||
matchingAny: map[string][]string{
|
matchingAny: map[string][]string{
|
||||||
"notice": []string{},
|
"notice": []string{},
|
||||||
"restricted": []string{},
|
"restricted": []string{},
|
||||||
"restricted|reciprocal": []string{},
|
"restricted|reciprocal": []string{},
|
||||||
},
|
},
|
||||||
expected: []string{},
|
expected: []string{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "noticeonly",
|
name: "noticeonly",
|
||||||
conditions: []string{"notice"},
|
conditions: []string{"notice"},
|
||||||
matchingAny: map[string][]string{
|
matchingAny: map[string][]string{
|
||||||
"notice": []string{"notice"},
|
"notice": []string{"notice"},
|
||||||
"notice|proprietary": []string{"notice"},
|
"notice|proprietary": []string{"notice"},
|
||||||
"restricted": []string{},
|
"restricted": []string{},
|
||||||
},
|
},
|
||||||
expected: []string{"notice"},
|
expected: []string{"notice"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "allnoticeonly",
|
name: "allnoticeonly",
|
||||||
conditions: []string{"notice"},
|
conditions: []string{"notice"},
|
||||||
plus: &[]string{"notice"},
|
plus: &[]string{"notice"},
|
||||||
matchingAny: map[string][]string{
|
matchingAny: map[string][]string{
|
||||||
"notice": []string{"notice"},
|
"notice": []string{"notice"},
|
||||||
"notice|proprietary": []string{"notice"},
|
"notice|proprietary": []string{"notice"},
|
||||||
"restricted": []string{},
|
"restricted": []string{},
|
||||||
},
|
},
|
||||||
expected: []string{"notice"},
|
expected: []string{"notice"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "emptyplusnotice",
|
name: "emptyplusnotice",
|
||||||
conditions: []string{},
|
conditions: []string{},
|
||||||
plus: &[]string{"notice"},
|
plus: &[]string{"notice"},
|
||||||
matchingAny: map[string][]string{
|
matchingAny: map[string][]string{
|
||||||
"notice": []string{"notice"},
|
"notice": []string{"notice"},
|
||||||
"notice|proprietary": []string{"notice"},
|
"notice|proprietary": []string{"notice"},
|
||||||
"restricted": []string{},
|
"restricted": []string{},
|
||||||
},
|
},
|
||||||
expected: []string{"notice"},
|
expected: []string{"notice"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "everything",
|
name: "everything",
|
||||||
conditions: []string{"unencumbered", "permissive", "notice", "reciprocal", "restricted", "proprietary"},
|
conditions: []string{"unencumbered", "permissive", "notice", "reciprocal", "restricted", "proprietary"},
|
||||||
plus: &[]string{"restricted_with_classpath_exception", "restricted_allows_dynamic_linking", "by_exception_only", "not_allowed"},
|
plus: &[]string{"restricted_with_classpath_exception", "restricted_allows_dynamic_linking", "by_exception_only", "not_allowed"},
|
||||||
matchingAny: map[string][]string{
|
matchingAny: map[string][]string{
|
||||||
"unencumbered": []string{"unencumbered"},
|
"unencumbered": []string{"unencumbered"},
|
||||||
"permissive": []string{"permissive"},
|
"permissive": []string{"permissive"},
|
||||||
"notice": []string{"notice"},
|
"notice": []string{"notice"},
|
||||||
"reciprocal": []string{"reciprocal"},
|
"reciprocal": []string{"reciprocal"},
|
||||||
"restricted": []string{"restricted"},
|
"restricted": []string{"restricted"},
|
||||||
"restricted_with_classpath_exception": []string{"restricted_with_classpath_exception"},
|
"restricted_with_classpath_exception": []string{"restricted_with_classpath_exception"},
|
||||||
"restricted_allows_dynamic_linking": []string{"restricted_allows_dynamic_linking"},
|
"restricted_allows_dynamic_linking": []string{"restricted_allows_dynamic_linking"},
|
||||||
"proprietary": []string{"proprietary"},
|
"proprietary": []string{"proprietary"},
|
||||||
"by_exception_only": []string{"by_exception_only"},
|
"by_exception_only": []string{"by_exception_only"},
|
||||||
"not_allowed": []string{"not_allowed"},
|
"not_allowed": []string{"not_allowed"},
|
||||||
"notice|proprietary": []string{"notice", "proprietary"},
|
"notice|proprietary": []string{"notice", "proprietary"},
|
||||||
},
|
},
|
||||||
expected: []string{
|
expected: []string{
|
||||||
"unencumbered",
|
"unencumbered",
|
||||||
@@ -137,13 +137,13 @@ func TestConditionSet(t *testing.T) {
|
|||||||
"by_exception_only",
|
"by_exception_only",
|
||||||
"not_allowed",
|
"not_allowed",
|
||||||
},
|
},
|
||||||
plus: &[]string{},
|
plus: &[]string{},
|
||||||
minus: &[]string{},
|
minus: &[]string{},
|
||||||
matchingAny: map[string][]string{
|
matchingAny: map[string][]string{
|
||||||
"unencumbered|permissive|notice": []string{"unencumbered", "permissive", "notice"},
|
"unencumbered|permissive|notice": []string{"unencumbered", "permissive", "notice"},
|
||||||
"restricted|reciprocal": []string{"reciprocal", "restricted"},
|
"restricted|reciprocal": []string{"reciprocal", "restricted"},
|
||||||
"proprietary|by_exception_only": []string{"proprietary", "by_exception_only"},
|
"proprietary|by_exception_only": []string{"proprietary", "by_exception_only"},
|
||||||
"not_allowed": []string{"not_allowed"},
|
"not_allowed": []string{"not_allowed"},
|
||||||
},
|
},
|
||||||
expected: []string{
|
expected: []string{
|
||||||
"unencumbered",
|
"unencumbered",
|
||||||
@@ -159,21 +159,21 @@ func TestConditionSet(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "allbutone",
|
name: "allbutone",
|
||||||
conditions: []string{"unencumbered", "permissive", "notice", "reciprocal", "restricted", "proprietary"},
|
conditions: []string{"unencumbered", "permissive", "notice", "reciprocal", "restricted", "proprietary"},
|
||||||
plus: &[]string{"restricted_allows_dynamic_linking", "by_exception_only", "not_allowed"},
|
plus: &[]string{"restricted_allows_dynamic_linking", "by_exception_only", "not_allowed"},
|
||||||
matchingAny: map[string][]string{
|
matchingAny: map[string][]string{
|
||||||
"unencumbered": []string{"unencumbered"},
|
"unencumbered": []string{"unencumbered"},
|
||||||
"permissive": []string{"permissive"},
|
"permissive": []string{"permissive"},
|
||||||
"notice": []string{"notice"},
|
"notice": []string{"notice"},
|
||||||
"reciprocal": []string{"reciprocal"},
|
"reciprocal": []string{"reciprocal"},
|
||||||
"restricted": []string{"restricted"},
|
"restricted": []string{"restricted"},
|
||||||
"restricted_with_classpath_exception": []string{},
|
"restricted_with_classpath_exception": []string{},
|
||||||
"restricted_allows_dynamic_linking": []string{"restricted_allows_dynamic_linking"},
|
"restricted_allows_dynamic_linking": []string{"restricted_allows_dynamic_linking"},
|
||||||
"proprietary": []string{"proprietary"},
|
"proprietary": []string{"proprietary"},
|
||||||
"by_exception_only": []string{"by_exception_only"},
|
"by_exception_only": []string{"by_exception_only"},
|
||||||
"not_allowed": []string{"not_allowed"},
|
"not_allowed": []string{"not_allowed"},
|
||||||
"notice|proprietary": []string{"notice", "proprietary"},
|
"notice|proprietary": []string{"notice", "proprietary"},
|
||||||
},
|
},
|
||||||
expected: []string{
|
expected: []string{
|
||||||
"unencumbered",
|
"unencumbered",
|
||||||
@@ -203,17 +203,17 @@ func TestConditionSet(t *testing.T) {
|
|||||||
},
|
},
|
||||||
minus: &[]string{"restricted_allows_dynamic_linking"},
|
minus: &[]string{"restricted_allows_dynamic_linking"},
|
||||||
matchingAny: map[string][]string{
|
matchingAny: map[string][]string{
|
||||||
"unencumbered": []string{"unencumbered"},
|
"unencumbered": []string{"unencumbered"},
|
||||||
"permissive": []string{"permissive"},
|
"permissive": []string{"permissive"},
|
||||||
"notice": []string{"notice"},
|
"notice": []string{"notice"},
|
||||||
"reciprocal": []string{"reciprocal"},
|
"reciprocal": []string{"reciprocal"},
|
||||||
"restricted": []string{"restricted"},
|
"restricted": []string{"restricted"},
|
||||||
"restricted_with_classpath_exception": []string{"restricted_with_classpath_exception"},
|
"restricted_with_classpath_exception": []string{"restricted_with_classpath_exception"},
|
||||||
"restricted_allows_dynamic_linking": []string{},
|
"restricted_allows_dynamic_linking": []string{},
|
||||||
"proprietary": []string{"proprietary"},
|
"proprietary": []string{"proprietary"},
|
||||||
"by_exception_only": []string{"by_exception_only"},
|
"by_exception_only": []string{"by_exception_only"},
|
||||||
"not_allowed": []string{"not_allowed"},
|
"not_allowed": []string{"not_allowed"},
|
||||||
"restricted|proprietary": []string{"restricted", "proprietary"},
|
"restricted|proprietary": []string{"restricted", "proprietary"},
|
||||||
},
|
},
|
||||||
expected: []string{
|
expected: []string{
|
||||||
"unencumbered",
|
"unencumbered",
|
||||||
@@ -254,35 +254,35 @@ func TestConditionSet(t *testing.T) {
|
|||||||
"not_allowed",
|
"not_allowed",
|
||||||
},
|
},
|
||||||
matchingAny: map[string][]string{
|
matchingAny: map[string][]string{
|
||||||
"unencumbered": []string{},
|
"unencumbered": []string{},
|
||||||
"permissive": []string{},
|
"permissive": []string{},
|
||||||
"notice": []string{},
|
"notice": []string{},
|
||||||
"reciprocal": []string{},
|
"reciprocal": []string{},
|
||||||
"restricted": []string{},
|
"restricted": []string{},
|
||||||
"restricted_with_classpath_exception": []string{},
|
"restricted_with_classpath_exception": []string{},
|
||||||
"restricted_allows_dynamic_linking": []string{},
|
"restricted_allows_dynamic_linking": []string{},
|
||||||
"proprietary": []string{},
|
"proprietary": []string{},
|
||||||
"by_exception_only": []string{},
|
"by_exception_only": []string{},
|
||||||
"not_allowed": []string{},
|
"not_allowed": []string{},
|
||||||
"restricted|proprietary": []string{},
|
"restricted|proprietary": []string{},
|
||||||
},
|
},
|
||||||
expected: []string{},
|
expected: []string{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "restrictedplus",
|
name: "restrictedplus",
|
||||||
conditions: []string{"restricted", "restricted_with_classpath_exception", "restricted_allows_dynamic_linking"},
|
conditions: []string{"restricted", "restricted_with_classpath_exception", "restricted_allows_dynamic_linking"},
|
||||||
plus: &[]string{"permissive", "notice", "restricted", "proprietary"},
|
plus: &[]string{"permissive", "notice", "restricted", "proprietary"},
|
||||||
matchingAny: map[string][]string{
|
matchingAny: map[string][]string{
|
||||||
"unencumbered": []string{},
|
"unencumbered": []string{},
|
||||||
"permissive": []string{"permissive"},
|
"permissive": []string{"permissive"},
|
||||||
"notice": []string{"notice"},
|
"notice": []string{"notice"},
|
||||||
"restricted": []string{"restricted"},
|
"restricted": []string{"restricted"},
|
||||||
"restricted_with_classpath_exception": []string{"restricted_with_classpath_exception"},
|
"restricted_with_classpath_exception": []string{"restricted_with_classpath_exception"},
|
||||||
"restricted_allows_dynamic_linking": []string{"restricted_allows_dynamic_linking"},
|
"restricted_allows_dynamic_linking": []string{"restricted_allows_dynamic_linking"},
|
||||||
"proprietary": []string{"proprietary"},
|
"proprietary": []string{"proprietary"},
|
||||||
"restricted|proprietary": []string{"restricted", "proprietary"},
|
"restricted|proprietary": []string{"restricted", "proprietary"},
|
||||||
"by_exception_only": []string{},
|
"by_exception_only": []string{},
|
||||||
"proprietary|by_exception_only": []string{"proprietary"},
|
"proprietary|by_exception_only": []string{"proprietary"},
|
||||||
},
|
},
|
||||||
expected: []string{"permissive", "notice", "restricted", "restricted_with_classpath_exception", "restricted_allows_dynamic_linking", "proprietary"},
|
expected: []string{"permissive", "notice", "restricted", "restricted_with_classpath_exception", "restricted_allows_dynamic_linking", "proprietary"},
|
||||||
},
|
},
|
||||||
@@ -629,7 +629,7 @@ func TestConditionSet(t *testing.T) {
|
|||||||
if checkExpected(cs, t) {
|
if checkExpected(cs, t) {
|
||||||
checkMatching(cs, t)
|
checkMatching(cs, t)
|
||||||
}
|
}
|
||||||
if checkExpectedSet(cs, t){
|
if checkExpectedSet(cs, t) {
|
||||||
checkMatchingSet(cs, t)
|
checkMatchingSet(cs, t)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -639,7 +639,7 @@ func TestConditionSet(t *testing.T) {
|
|||||||
if checkExpected(cs, t) {
|
if checkExpected(cs, t) {
|
||||||
checkMatching(cs, t)
|
checkMatching(cs, t)
|
||||||
}
|
}
|
||||||
if checkExpectedSet(cs, t){
|
if checkExpectedSet(cs, t) {
|
||||||
checkMatchingSet(cs, t)
|
checkMatchingSet(cs, t)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -649,7 +649,7 @@ func TestConditionSet(t *testing.T) {
|
|||||||
if checkExpected(cs, t) {
|
if checkExpected(cs, t) {
|
||||||
checkMatching(cs, t)
|
checkMatching(cs, t)
|
||||||
}
|
}
|
||||||
if checkExpectedSet(cs, t){
|
if checkExpectedSet(cs, t) {
|
||||||
checkMatchingSet(cs, t)
|
checkMatchingSet(cs, t)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@@ -148,7 +148,7 @@ func (e *TargetEdge) String() string {
|
|||||||
type TargetEdgeList []*TargetEdge
|
type TargetEdgeList []*TargetEdge
|
||||||
|
|
||||||
// Len returns the count of the elmements in the list.
|
// Len returns the count of the elmements in the list.
|
||||||
func (l TargetEdgeList) Len() int { return len(l) }
|
func (l TargetEdgeList) Len() int { return len(l) }
|
||||||
|
|
||||||
// Swap rearranges 2 elements so that each occupies the other's former position.
|
// Swap rearranges 2 elements so that each occupies the other's former position.
|
||||||
func (l TargetEdgeList) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
|
func (l TargetEdgeList) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
|
||||||
@@ -171,7 +171,7 @@ func (l TargetEdgeList) Less(i, j int) bool {
|
|||||||
// edge with a context `ctx` defined by whatever process is creating the path.
|
// edge with a context `ctx` defined by whatever process is creating the path.
|
||||||
type TargetEdgePathSegment struct {
|
type TargetEdgePathSegment struct {
|
||||||
edge *TargetEdge
|
edge *TargetEdge
|
||||||
ctx interface{}
|
ctx interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Target identifies the target that depends on the dependency.
|
// Target identifies the target that depends on the dependency.
|
||||||
@@ -495,7 +495,7 @@ func (ts *TargetNodeSet) String() string {
|
|||||||
type TargetNodeList []*TargetNode
|
type TargetNodeList []*TargetNode
|
||||||
|
|
||||||
// Len returns the count of elements in the list.
|
// Len returns the count of elements in the list.
|
||||||
func (l TargetNodeList) Len() int { return len(l) }
|
func (l TargetNodeList) Len() int { return len(l) }
|
||||||
|
|
||||||
// Swap rearranges 2 elements so that each occupies the other's former position.
|
// Swap rearranges 2 elements so that each occupies the other's former position.
|
||||||
func (l TargetNodeList) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
|
func (l TargetNodeList) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
|
||||||
|
@@ -33,21 +33,21 @@ var (
|
|||||||
// proprietary or confidential pathnames to whether to strip the prefix
|
// proprietary or confidential pathnames to whether to strip the prefix
|
||||||
// from the path when used as the library name for notices.
|
// from the path when used as the library name for notices.
|
||||||
SafePathPrefixes = map[string]bool{
|
SafePathPrefixes = map[string]bool{
|
||||||
"external/": true,
|
"external/": true,
|
||||||
"art/": false,
|
"art/": false,
|
||||||
"build/": false,
|
"build/": false,
|
||||||
"cts/": false,
|
"cts/": false,
|
||||||
"dalvik/": false,
|
"dalvik/": false,
|
||||||
"developers/": false,
|
"developers/": false,
|
||||||
"development/": false,
|
"development/": false,
|
||||||
"frameworks/": false,
|
"frameworks/": false,
|
||||||
"packages/": true,
|
"packages/": true,
|
||||||
"prebuilts/": false,
|
"prebuilts/": false,
|
||||||
"sdk/": false,
|
"sdk/": false,
|
||||||
"system/": false,
|
"system/": false,
|
||||||
"test/": false,
|
"test/": false,
|
||||||
"toolchain/": false,
|
"toolchain/": false,
|
||||||
"tools/": false,
|
"tools/": false,
|
||||||
}
|
}
|
||||||
|
|
||||||
// SafePrebuiltPrefixes maps the regular expression to match a prebuilt
|
// SafePrebuiltPrefixes maps the regular expression to match a prebuilt
|
||||||
@@ -62,8 +62,8 @@ var (
|
|||||||
|
|
||||||
// ImpliesNotice lists the condition names implying a notice or attribution policy.
|
// ImpliesNotice lists the condition names implying a notice or attribution policy.
|
||||||
ImpliesNotice = LicenseConditionSet(UnencumberedCondition | PermissiveCondition | NoticeCondition | ReciprocalCondition |
|
ImpliesNotice = LicenseConditionSet(UnencumberedCondition | PermissiveCondition | NoticeCondition | ReciprocalCondition |
|
||||||
RestrictedCondition | RestrictedClasspathExceptionCondition | WeaklyRestrictedCondition |
|
RestrictedCondition | RestrictedClasspathExceptionCondition | WeaklyRestrictedCondition |
|
||||||
ProprietaryCondition | ByExceptionOnlyCondition)
|
ProprietaryCondition | ByExceptionOnlyCondition)
|
||||||
|
|
||||||
// ImpliesReciprocal lists the condition names implying a local source-sharing policy.
|
// ImpliesReciprocal lists the condition names implying a local source-sharing policy.
|
||||||
ImpliesReciprocal = LicenseConditionSet(ReciprocalCondition)
|
ImpliesReciprocal = LicenseConditionSet(ReciprocalCondition)
|
||||||
@@ -143,7 +143,6 @@ func LicenseConditionSetFromNames(tn *TargetNode, names ...string) LicenseCondit
|
|||||||
return cs
|
return cs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Resolution happens in three phases:
|
// Resolution happens in three phases:
|
||||||
//
|
//
|
||||||
// 1. A bottom-up traversal propagates (restricted) license conditions up to
|
// 1. A bottom-up traversal propagates (restricted) license conditions up to
|
||||||
@@ -182,7 +181,6 @@ func LicenseConditionSetFromNames(tn *TargetNode, names ...string) LicenseCondit
|
|||||||
// Not all restricted licenses are create equal. Some have special rules or
|
// Not all restricted licenses are create equal. Some have special rules or
|
||||||
// exceptions. e.g. LGPL or "with classpath excption".
|
// exceptions. e.g. LGPL or "with classpath excption".
|
||||||
|
|
||||||
|
|
||||||
// depConditionsPropagatingToTarget returns the conditions which propagate up an
|
// depConditionsPropagatingToTarget returns the conditions which propagate up an
|
||||||
// edge from dependency to target.
|
// edge from dependency to target.
|
||||||
//
|
//
|
||||||
@@ -204,7 +202,7 @@ func depConditionsPropagatingToTarget(lg *LicenseGraph, e *TargetEdge, depCondit
|
|||||||
}
|
}
|
||||||
|
|
||||||
result |= depConditions & LicenseConditionSet(RestrictedCondition)
|
result |= depConditions & LicenseConditionSet(RestrictedCondition)
|
||||||
if 0 != (depConditions & LicenseConditionSet(RestrictedClasspathExceptionCondition)) && !edgeNodesAreIndependentModules(e) {
|
if 0 != (depConditions&LicenseConditionSet(RestrictedClasspathExceptionCondition)) && !edgeNodesAreIndependentModules(e) {
|
||||||
result |= LicenseConditionSet(RestrictedClasspathExceptionCondition)
|
result |= LicenseConditionSet(RestrictedClasspathExceptionCondition)
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
@@ -264,13 +262,12 @@ func conditionsAttachingAcrossEdge(lg *LicenseGraph, e *TargetEdge, universe Lic
|
|||||||
}
|
}
|
||||||
|
|
||||||
result &= LicenseConditionSet(RestrictedCondition | RestrictedClasspathExceptionCondition)
|
result &= LicenseConditionSet(RestrictedCondition | RestrictedClasspathExceptionCondition)
|
||||||
if 0 != (result & LicenseConditionSet(RestrictedClasspathExceptionCondition)) && edgeNodesAreIndependentModules(e) {
|
if 0 != (result&LicenseConditionSet(RestrictedClasspathExceptionCondition)) && edgeNodesAreIndependentModules(e) {
|
||||||
result &= LicenseConditionSet(RestrictedCondition)
|
result &= LicenseConditionSet(RestrictedCondition)
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// edgeIsDynamicLink returns true for edges representing shared libraries
|
// edgeIsDynamicLink returns true for edges representing shared libraries
|
||||||
// linked dynamically at runtime.
|
// linked dynamically at runtime.
|
||||||
func edgeIsDynamicLink(e *TargetEdge) bool {
|
func edgeIsDynamicLink(e *TargetEdge) bool {
|
||||||
|
@@ -24,7 +24,7 @@ import (
|
|||||||
type byConflict []SourceSharePrivacyConflict
|
type byConflict []SourceSharePrivacyConflict
|
||||||
|
|
||||||
// Len returns the count of elements in the slice.
|
// Len returns the count of elements in the slice.
|
||||||
func (l byConflict) Len() int { return len(l) }
|
func (l byConflict) Len() int { return len(l) }
|
||||||
|
|
||||||
// Swap rearranged 2 elements so that each occupies the other's former
|
// Swap rearranged 2 elements so that each occupies the other's former
|
||||||
// position.
|
// position.
|
||||||
|
@@ -29,30 +29,30 @@ func TestShippedNodes(t *testing.T) {
|
|||||||
expectedNodes []string
|
expectedNodes []string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "singleton",
|
name: "singleton",
|
||||||
roots: []string{"apacheLib.meta_lic"},
|
roots: []string{"apacheLib.meta_lic"},
|
||||||
edges: []annotated{},
|
edges: []annotated{},
|
||||||
expectedNodes: []string{"apacheLib.meta_lic"},
|
expectedNodes: []string{"apacheLib.meta_lic"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "simplebinary",
|
name: "simplebinary",
|
||||||
roots: []string{"apacheBin.meta_lic"},
|
roots: []string{"apacheBin.meta_lic"},
|
||||||
edges: []annotated{
|
edges: []annotated{
|
||||||
{"apacheBin.meta_lic", "apacheLib.meta_lic", []string{"static"}},
|
{"apacheBin.meta_lic", "apacheLib.meta_lic", []string{"static"}},
|
||||||
},
|
},
|
||||||
expectedNodes: []string{"apacheBin.meta_lic", "apacheLib.meta_lic"},
|
expectedNodes: []string{"apacheBin.meta_lic", "apacheLib.meta_lic"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "simpledynamic",
|
name: "simpledynamic",
|
||||||
roots: []string{"apacheBin.meta_lic"},
|
roots: []string{"apacheBin.meta_lic"},
|
||||||
edges: []annotated{
|
edges: []annotated{
|
||||||
{"apacheBin.meta_lic", "lgplLib.meta_lic", []string{"dynamic"}},
|
{"apacheBin.meta_lic", "lgplLib.meta_lic", []string{"dynamic"}},
|
||||||
},
|
},
|
||||||
expectedNodes: []string{"apacheBin.meta_lic"},
|
expectedNodes: []string{"apacheBin.meta_lic"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "container",
|
name: "container",
|
||||||
roots: []string{"apacheContainer.meta_lic"},
|
roots: []string{"apacheContainer.meta_lic"},
|
||||||
edges: []annotated{
|
edges: []annotated{
|
||||||
{"apacheContainer.meta_lic", "apacheLib.meta_lic", []string{"static"}},
|
{"apacheContainer.meta_lic", "apacheLib.meta_lic", []string{"static"}},
|
||||||
{"apacheContainer.meta_lic", "gplLib.meta_lic", []string{"static"}},
|
{"apacheContainer.meta_lic", "gplLib.meta_lic", []string{"static"}},
|
||||||
@@ -64,8 +64,8 @@ func TestShippedNodes(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "binary",
|
name: "binary",
|
||||||
roots: []string{"apacheBin.meta_lic"},
|
roots: []string{"apacheBin.meta_lic"},
|
||||||
edges: []annotated{
|
edges: []annotated{
|
||||||
{"apacheBin.meta_lic", "apacheLib.meta_lic", []string{"static"}},
|
{"apacheBin.meta_lic", "apacheLib.meta_lic", []string{"static"}},
|
||||||
{"apacheBin.meta_lic", "gplLib.meta_lic", []string{"static"}},
|
{"apacheBin.meta_lic", "gplLib.meta_lic", []string{"static"}},
|
||||||
@@ -77,8 +77,8 @@ func TestShippedNodes(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "binarydynamic",
|
name: "binarydynamic",
|
||||||
roots: []string{"apacheBin.meta_lic"},
|
roots: []string{"apacheBin.meta_lic"},
|
||||||
edges: []annotated{
|
edges: []annotated{
|
||||||
{"apacheBin.meta_lic", "apacheLib.meta_lic", []string{"static"}},
|
{"apacheBin.meta_lic", "apacheLib.meta_lic", []string{"static"}},
|
||||||
{"apacheBin.meta_lic", "gplLib.meta_lic", []string{"dynamic"}},
|
{"apacheBin.meta_lic", "gplLib.meta_lic", []string{"dynamic"}},
|
||||||
@@ -89,8 +89,8 @@ func TestShippedNodes(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "containerdeep",
|
name: "containerdeep",
|
||||||
roots: []string{"apacheContainer.meta_lic"},
|
roots: []string{"apacheContainer.meta_lic"},
|
||||||
edges: []annotated{
|
edges: []annotated{
|
||||||
{"apacheContainer.meta_lic", "apacheBin.meta_lic", []string{"static"}},
|
{"apacheContainer.meta_lic", "apacheBin.meta_lic", []string{"static"}},
|
||||||
{"apacheBin.meta_lic", "apacheLib.meta_lic", []string{"static"}},
|
{"apacheBin.meta_lic", "apacheLib.meta_lic", []string{"static"}},
|
||||||
@@ -127,7 +127,7 @@ func TestShippedNodes(t *testing.T) {
|
|||||||
|
|
||||||
t.Logf("sorted nodes: [%s]", strings.Join(actualNodes, ", "))
|
t.Logf("sorted nodes: [%s]", strings.Join(actualNodes, ", "))
|
||||||
t.Logf("expected nodes: [%s]", strings.Join(expectedNodes, ", "))
|
t.Logf("expected nodes: [%s]", strings.Join(expectedNodes, ", "))
|
||||||
if len(expectedNodes) != len(actualNodes) {
|
if len(expectedNodes) != len(actualNodes) {
|
||||||
t.Errorf("unexpected number of shipped nodes: %d nodes, want %d nodes",
|
t.Errorf("unexpected number of shipped nodes: %d nodes, want %d nodes",
|
||||||
len(actualNodes), len(expectedNodes))
|
len(actualNodes), len(expectedNodes))
|
||||||
return
|
return
|
||||||
|
@@ -83,7 +83,7 @@ func WalkTopDown(ctx EdgeContextProvider, lg *LicenseGraph, visit VisitNode) {
|
|||||||
// specific set of conditions.
|
// specific set of conditions.
|
||||||
type resolutionKey struct {
|
type resolutionKey struct {
|
||||||
target *TargetNode
|
target *TargetNode
|
||||||
cs LicenseConditionSet
|
cs LicenseConditionSet
|
||||||
}
|
}
|
||||||
|
|
||||||
// WalkResolutionsForCondition performs a top-down walk of the LicenseGraph
|
// WalkResolutionsForCondition performs a top-down walk of the LicenseGraph
|
||||||
|
@@ -185,7 +185,7 @@ type targetNode struct {
|
|||||||
|
|
||||||
// addDependencies converts the proto AnnotatedDependencies into `edges`
|
// addDependencies converts the proto AnnotatedDependencies into `edges`
|
||||||
func addDependencies(lg *LicenseGraph, tn *TargetNode) error {
|
func addDependencies(lg *LicenseGraph, tn *TargetNode) error {
|
||||||
tn.edges = make(TargetEdgeList, 0,len(tn.proto.Deps))
|
tn.edges = make(TargetEdgeList, 0, len(tn.proto.Deps))
|
||||||
for _, ad := range tn.proto.Deps {
|
for _, ad := range tn.proto.Deps {
|
||||||
dependency := ad.GetFile()
|
dependency := ad.GetFile()
|
||||||
if len(dependency) == 0 {
|
if len(dependency) == 0 {
|
||||||
|
@@ -66,7 +66,7 @@ func (r Resolution) asString() string {
|
|||||||
type ResolutionList []Resolution
|
type ResolutionList []Resolution
|
||||||
|
|
||||||
// Len returns the count of elements in the list.
|
// Len returns the count of elements in the list.
|
||||||
func (l ResolutionList) Len() int { return len(l) }
|
func (l ResolutionList) Len() int { return len(l) }
|
||||||
|
|
||||||
// Swap rearranges 2 elements so that each occupies the other's former position.
|
// Swap rearranges 2 elements so that each occupies the other's former position.
|
||||||
func (l ResolutionList) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
|
func (l ResolutionList) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
|
||||||
|
@@ -65,7 +65,6 @@ func (rs ResolutionSet) AttachesTo() TargetNodeList {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// AttachesToTarget returns true if the set contains conditions that
|
// AttachesToTarget returns true if the set contains conditions that
|
||||||
// are `attachedTo`.
|
// are `attachedTo`.
|
||||||
func (rs ResolutionSet) AttachesToTarget(target *TargetNode) bool {
|
func (rs ResolutionSet) AttachesToTarget(target *TargetNode) bool {
|
||||||
@@ -73,7 +72,6 @@ func (rs ResolutionSet) AttachesToTarget(target *TargetNode) bool {
|
|||||||
return isPresent
|
return isPresent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Resolutions returns the list of resolutions that `attachedTo`
|
// Resolutions returns the list of resolutions that `attachedTo`
|
||||||
// target must resolve. Returns empty list if no conditions apply.
|
// target must resolve. Returns empty list if no conditions apply.
|
||||||
func (rs ResolutionSet) Resolutions(attachesTo *TargetNode) ResolutionList {
|
func (rs ResolutionSet) Resolutions(attachesTo *TargetNode) ResolutionList {
|
||||||
|
@@ -33,56 +33,56 @@ license_conditions: "notice"
|
|||||||
|
|
||||||
// GPL starts a test metadata file for GPL 2.0 licensing.
|
// GPL starts a test metadata file for GPL 2.0 licensing.
|
||||||
GPL = `` +
|
GPL = `` +
|
||||||
`package_name: "Free Software"
|
`package_name: "Free Software"
|
||||||
license_kinds: "SPDX-license-identifier-GPL-2.0"
|
license_kinds: "SPDX-license-identifier-GPL-2.0"
|
||||||
license_conditions: "restricted"
|
license_conditions: "restricted"
|
||||||
`
|
`
|
||||||
|
|
||||||
// Classpath starts a test metadata file for GPL 2.0 with classpath exception licensing.
|
// Classpath starts a test metadata file for GPL 2.0 with classpath exception licensing.
|
||||||
Classpath = `` +
|
Classpath = `` +
|
||||||
`package_name: "Free Software"
|
`package_name: "Free Software"
|
||||||
license_kinds: "SPDX-license-identifier-GPL-2.0-with-classpath-exception"
|
license_kinds: "SPDX-license-identifier-GPL-2.0-with-classpath-exception"
|
||||||
license_conditions: "restricted"
|
license_conditions: "restricted"
|
||||||
`
|
`
|
||||||
|
|
||||||
// DependentModule starts a test metadata file for a module in the same package as `Classpath`.
|
// DependentModule starts a test metadata file for a module in the same package as `Classpath`.
|
||||||
DependentModule = `` +
|
DependentModule = `` +
|
||||||
`package_name: "Free Software"
|
`package_name: "Free Software"
|
||||||
license_kinds: "SPDX-license-identifier-MIT"
|
license_kinds: "SPDX-license-identifier-MIT"
|
||||||
license_conditions: "notice"
|
license_conditions: "notice"
|
||||||
`
|
`
|
||||||
|
|
||||||
// LGPL starts a test metadata file for a module with LGPL 2.0 licensing.
|
// LGPL starts a test metadata file for a module with LGPL 2.0 licensing.
|
||||||
LGPL = `` +
|
LGPL = `` +
|
||||||
`package_name: "Free Library"
|
`package_name: "Free Library"
|
||||||
license_kinds: "SPDX-license-identifier-LGPL-2.0"
|
license_kinds: "SPDX-license-identifier-LGPL-2.0"
|
||||||
license_conditions: "restricted"
|
license_conditions: "restricted"
|
||||||
`
|
`
|
||||||
|
|
||||||
// MPL starts a test metadata file for a module with MPL 2.0 reciprical licensing.
|
// MPL starts a test metadata file for a module with MPL 2.0 reciprical licensing.
|
||||||
MPL = `` +
|
MPL = `` +
|
||||||
`package_name: "Reciprocal"
|
`package_name: "Reciprocal"
|
||||||
license_kinds: "SPDX-license-identifier-MPL-2.0"
|
license_kinds: "SPDX-license-identifier-MPL-2.0"
|
||||||
license_conditions: "reciprocal"
|
license_conditions: "reciprocal"
|
||||||
`
|
`
|
||||||
|
|
||||||
// MIT starts a test metadata file for a module with generic notice (MIT) licensing.
|
// MIT starts a test metadata file for a module with generic notice (MIT) licensing.
|
||||||
MIT = `` +
|
MIT = `` +
|
||||||
`package_name: "Android"
|
`package_name: "Android"
|
||||||
license_kinds: "SPDX-license-identifier-MIT"
|
license_kinds: "SPDX-license-identifier-MIT"
|
||||||
license_conditions: "notice"
|
license_conditions: "notice"
|
||||||
`
|
`
|
||||||
|
|
||||||
// Proprietary starts a test metadata file for a module with proprietary licensing.
|
// Proprietary starts a test metadata file for a module with proprietary licensing.
|
||||||
Proprietary = `` +
|
Proprietary = `` +
|
||||||
`package_name: "Android"
|
`package_name: "Android"
|
||||||
license_kinds: "legacy_proprietary"
|
license_kinds: "legacy_proprietary"
|
||||||
license_conditions: "proprietary"
|
license_conditions: "proprietary"
|
||||||
`
|
`
|
||||||
|
|
||||||
// ByException starts a test metadata file for a module with by_exception_only licensing.
|
// ByException starts a test metadata file for a module with by_exception_only licensing.
|
||||||
ByException = `` +
|
ByException = `` +
|
||||||
`package_name: "Special"
|
`package_name: "Special"
|
||||||
license_kinds: "legacy_by_exception_only"
|
license_kinds: "legacy_by_exception_only"
|
||||||
license_conditions: "by_exception_only"
|
license_conditions: "by_exception_only"
|
||||||
`
|
`
|
||||||
@@ -91,22 +91,22 @@ license_conditions: "by_exception_only"
|
|||||||
var (
|
var (
|
||||||
// meta maps test file names to metadata file content without dependencies.
|
// meta maps test file names to metadata file content without dependencies.
|
||||||
meta = map[string]string{
|
meta = map[string]string{
|
||||||
"apacheBin.meta_lic": AOSP,
|
"apacheBin.meta_lic": AOSP,
|
||||||
"apacheLib.meta_lic": AOSP,
|
"apacheLib.meta_lic": AOSP,
|
||||||
"apacheContainer.meta_lic": AOSP + "is_container: true\n",
|
"apacheContainer.meta_lic": AOSP + "is_container: true\n",
|
||||||
"dependentModule.meta_lic": DependentModule,
|
"dependentModule.meta_lic": DependentModule,
|
||||||
"gplWithClasspathException.meta_lic": Classpath,
|
"gplWithClasspathException.meta_lic": Classpath,
|
||||||
"gplBin.meta_lic": GPL,
|
"gplBin.meta_lic": GPL,
|
||||||
"gplLib.meta_lic": GPL,
|
"gplLib.meta_lic": GPL,
|
||||||
"gplContainer.meta_lic": GPL + "is_container: true\n",
|
"gplContainer.meta_lic": GPL + "is_container: true\n",
|
||||||
"lgplBin.meta_lic": LGPL,
|
"lgplBin.meta_lic": LGPL,
|
||||||
"lgplLib.meta_lic": LGPL,
|
"lgplLib.meta_lic": LGPL,
|
||||||
"mitBin.meta_lic": MIT,
|
"mitBin.meta_lic": MIT,
|
||||||
"mitLib.meta_lic": MIT,
|
"mitLib.meta_lic": MIT,
|
||||||
"mplBin.meta_lic": MPL,
|
"mplBin.meta_lic": MPL,
|
||||||
"mplLib.meta_lic": MPL,
|
"mplLib.meta_lic": MPL,
|
||||||
"proprietary.meta_lic": Proprietary,
|
"proprietary.meta_lic": Proprietary,
|
||||||
"by_exception.meta_lic": ByException,
|
"by_exception.meta_lic": ByException,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@ func (e edge) String() string {
|
|||||||
type byEdge []edge
|
type byEdge []edge
|
||||||
|
|
||||||
// Len returns the count of elements in the slice.
|
// Len returns the count of elements in the slice.
|
||||||
func (l byEdge) Len() int { return len(l) }
|
func (l byEdge) Len() int { return len(l) }
|
||||||
|
|
||||||
// Swap rearranges 2 elements of the slice so that each occupies the other's
|
// Swap rearranges 2 elements of the slice so that each occupies the other's
|
||||||
// former position.
|
// former position.
|
||||||
@@ -219,7 +219,6 @@ func (l byEdge) Less(i, j int) bool {
|
|||||||
return l[i].target < l[j].target
|
return l[i].target < l[j].target
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// annotated describes annotated test data edges to define test graphs.
|
// annotated describes annotated test data edges to define test graphs.
|
||||||
type annotated struct {
|
type annotated struct {
|
||||||
target, dep string
|
target, dep string
|
||||||
@@ -240,7 +239,7 @@ func (e annotated) IsEqualTo(other annotated) bool {
|
|||||||
if e.dep != other.dep {
|
if e.dep != other.dep {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if len(e.annotations) != len(other.annotations) {
|
if len(e.annotations) != len(other.annotations) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
a1 := append([]string{}, e.annotations...)
|
a1 := append([]string{}, e.annotations...)
|
||||||
@@ -401,7 +400,7 @@ func (l actionList) String() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Len returns the count of elements in the slice.
|
// Len returns the count of elements in the slice.
|
||||||
func (l actionList) Len() int { return len(l) }
|
func (l actionList) Len() int { return len(l) }
|
||||||
|
|
||||||
// Swap rearranges 2 elements of the slice so that each occupies the other's
|
// Swap rearranges 2 elements of the slice so that each occupies the other's
|
||||||
// former position.
|
// former position.
|
||||||
@@ -467,10 +466,10 @@ func toConflictList(lg *LicenseGraph, data []confl) []SourceSharePrivacyConflict
|
|||||||
oprivacy := fields[0]
|
oprivacy := fields[0]
|
||||||
cprivacy := fields[1]
|
cprivacy := fields[1]
|
||||||
result = append(result, SourceSharePrivacyConflict{
|
result = append(result, SourceSharePrivacyConflict{
|
||||||
newTestNode(lg, c.sourceNode),
|
newTestNode(lg, c.sourceNode),
|
||||||
newTestCondition(lg, oshare, cshare),
|
newTestCondition(lg, oshare, cshare),
|
||||||
newTestCondition(lg, oprivacy, cprivacy),
|
newTestCondition(lg, oprivacy, cprivacy),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user