Merge "Reformat license code to comply with preupload checks"

This commit is contained in:
Paul Duffin 2021-03-05 08:51:49 +00:00 committed by Gerrit Code Review
commit 279790a48a
4 changed files with 63 additions and 63 deletions

View file

@ -19,7 +19,7 @@ import (
) )
type licenseKindDependencyTag struct { type licenseKindDependencyTag struct {
blueprint.BaseDependencyTag blueprint.BaseDependencyTag
} }
var ( var (

View file

@ -49,9 +49,9 @@ var licenseTests = []struct {
}`), }`),
}, },
expectedErrors: []string{ expectedErrors: []string{
`other/Blueprints:2:5: module "arule": depends on //top:top_allowed_as_notice `+ `other/Blueprints:2:5: module "arule": depends on //top:top_allowed_as_notice ` +
`which is not visible to this module`, `which is not visible to this module`,
`yetmore/Blueprints:2:5: module "//yetmore": depends on //top:top_allowed_as_notice `+ `yetmore/Blueprints:2:5: module "//yetmore": depends on //top:top_allowed_as_notice ` +
`which is not visible to this module`, `which is not visible to this module`,
}, },
}, },
@ -70,7 +70,7 @@ var licenseTests = []struct {
}`), }`),
}, },
expectedErrors: []string{ expectedErrors: []string{
`top/Blueprints:6:5: module "top_proprietary": license_kinds property `+ `top/Blueprints:6:5: module "top_proprietary": license_kinds property ` +
`"top_by_exception_only" is not a license_kind module`, `"top_by_exception_only" is not a license_kind module`,
}, },
}, },

View file

@ -51,7 +51,7 @@ type applicableLicensesPropertyImpl struct {
func newApplicableLicensesProperty(name string, licensesProperty *[]string) applicableLicensesProperty { func newApplicableLicensesProperty(name string, licensesProperty *[]string) applicableLicensesProperty {
return applicableLicensesPropertyImpl{ return applicableLicensesPropertyImpl{
name: name, name: name,
licensesProperty: licensesProperty, licensesProperty: licensesProperty,
} }
} }

View file

@ -7,15 +7,15 @@ import (
) )
var licensesTests = []struct { var licensesTests = []struct {
name string name string
fs map[string][]byte fs map[string][]byte
expectedErrors []string expectedErrors []string
effectiveLicenses map[string][]string effectiveLicenses map[string][]string
effectiveInheritedLicenses map[string][]string effectiveInheritedLicenses map[string][]string
effectivePackage map[string]string effectivePackage map[string]string
effectiveNotices map[string][]string effectiveNotices map[string][]string
effectiveKinds map[string][]string effectiveKinds map[string][]string
effectiveConditions map[string][]string effectiveConditions map[string][]string
}{ }{
{ {
name: "invalid module type without licenses property", name: "invalid module type without licenses property",
@ -71,28 +71,28 @@ var licensesTests = []struct {
}, },
effectiveLicenses: map[string][]string{ effectiveLicenses: map[string][]string{
"libexample1": []string{"top_Apache2"}, "libexample1": []string{"top_Apache2"},
"libnested": []string{"top_Apache2"}, "libnested": []string{"top_Apache2"},
"libother": []string{"top_Apache2"}, "libother": []string{"top_Apache2"},
}, },
effectiveKinds: map[string][]string{ effectiveKinds: map[string][]string{
"libexample1": []string{"notice"}, "libexample1": []string{"notice"},
"libnested": []string{"notice"}, "libnested": []string{"notice"},
"libother": []string{"notice"}, "libother": []string{"notice"},
}, },
effectivePackage: map[string]string{ effectivePackage: map[string]string{
"libexample1": "topDog", "libexample1": "topDog",
"libnested": "topDog", "libnested": "topDog",
"libother": "topDog", "libother": "topDog",
}, },
effectiveConditions: map[string][]string{ effectiveConditions: map[string][]string{
"libexample1": []string{"shownotice"}, "libexample1": []string{"shownotice"},
"libnested": []string{"shownotice"}, "libnested": []string{"shownotice"},
"libother": []string{"shownotice"}, "libother": []string{"shownotice"},
}, },
effectiveNotices: map[string][]string{ effectiveNotices: map[string][]string{
"libexample1": []string{"top/LICENSE", "top/NOTICE"}, "libexample1": []string{"top/LICENSE", "top/NOTICE"},
"libnested": []string{"top/LICENSE", "top/NOTICE"}, "libnested": []string{"top/LICENSE", "top/NOTICE"},
"libother": []string{"top/LICENSE", "top/NOTICE"}, "libother": []string{"top/LICENSE", "top/NOTICE"},
}, },
}, },
@ -147,28 +147,28 @@ var licensesTests = []struct {
}`), }`),
}, },
effectiveLicenses: map[string][]string{ effectiveLicenses: map[string][]string{
"libexample": []string{"nested_other", "top_other"}, "libexample": []string{"nested_other", "top_other"},
"libsamepackage": []string{}, "libsamepackage": []string{},
"libnested": []string{}, "libnested": []string{},
"libother": []string{}, "libother": []string{},
}, },
effectiveInheritedLicenses: map[string][]string{ effectiveInheritedLicenses: map[string][]string{
"libexample": []string{"nested_other", "top_other"}, "libexample": []string{"nested_other", "top_other"},
"libsamepackage": []string{"nested_other", "top_other"}, "libsamepackage": []string{"nested_other", "top_other"},
"libnested": []string{"nested_other", "top_other"}, "libnested": []string{"nested_other", "top_other"},
"libother": []string{"nested_other", "top_other"}, "libother": []string{"nested_other", "top_other"},
}, },
effectiveKinds: map[string][]string{ effectiveKinds: map[string][]string{
"libexample": []string{"nested_notice", "top_notice"}, "libexample": []string{"nested_notice", "top_notice"},
"libsamepackage": []string{}, "libsamepackage": []string{},
"libnested": []string{}, "libnested": []string{},
"libother": []string{}, "libother": []string{},
}, },
effectiveConditions: map[string][]string{ effectiveConditions: map[string][]string{
"libexample": []string{"notice"}, "libexample": []string{"notice"},
"libsamepackage": []string{}, "libsamepackage": []string{},
"libnested": []string{}, "libnested": []string{},
"libother": []string{}, "libother": []string{},
}, },
}, },
{ {
@ -218,32 +218,32 @@ var licensesTests = []struct {
}`), }`),
}, },
effectiveLicenses: map[string][]string{ effectiveLicenses: map[string][]string{
"libexample": []string{"other", "top_nested"}, "libexample": []string{"other", "top_nested"},
"libsamepackage": []string{}, "libsamepackage": []string{},
"libnested": []string{}, "libnested": []string{},
"libother": []string{}, "libother": []string{},
"liboutsider": []string{}, "liboutsider": []string{},
}, },
effectiveInheritedLicenses: map[string][]string{ effectiveInheritedLicenses: map[string][]string{
"libexample": []string{"other", "top_nested"}, "libexample": []string{"other", "top_nested"},
"libsamepackage": []string{"other", "top_nested"}, "libsamepackage": []string{"other", "top_nested"},
"libnested": []string{"other", "top_nested"}, "libnested": []string{"other", "top_nested"},
"libother": []string{"other", "top_nested"}, "libother": []string{"other", "top_nested"},
"liboutsider": []string{"other", "top_nested"}, "liboutsider": []string{"other", "top_nested"},
}, },
effectiveKinds: map[string][]string{ effectiveKinds: map[string][]string{
"libexample": []string{}, "libexample": []string{},
"libsamepackage": []string{}, "libsamepackage": []string{},
"libnested": []string{}, "libnested": []string{},
"libother": []string{}, "libother": []string{},
"liboutsider": []string{}, "liboutsider": []string{},
}, },
effectiveNotices: map[string][]string{ effectiveNotices: map[string][]string{
"libexample": []string{"top/nested/LICENSE.txt"}, "libexample": []string{"top/nested/LICENSE.txt"},
"libsamepackage": []string{}, "libsamepackage": []string{},
"libnested": []string{}, "libnested": []string{},
"libother": []string{}, "libother": []string{},
"liboutsider": []string{}, "liboutsider": []string{},
}, },
}, },
@ -285,11 +285,11 @@ var licensesTests = []struct {
}`), }`),
}, },
effectiveLicenses: map[string][]string{ effectiveLicenses: map[string][]string{
"libexample": []string{"by_exception_only"}, "libexample": []string{"by_exception_only"},
"libdefaults": []string{"notice"}, "libdefaults": []string{"notice"},
}, },
effectiveInheritedLicenses: map[string][]string{ effectiveInheritedLicenses: map[string][]string{
"libexample": []string{"by_exception_only"}, "libexample": []string{"by_exception_only"},
"libdefaults": []string{"notice"}, "libdefaults": []string{"notice"},
}, },
}, },
@ -327,11 +327,11 @@ var licensesTests = []struct {
}`), }`),
}, },
effectiveLicenses: map[string][]string{ effectiveLicenses: map[string][]string{
"libexample": []string{"top_notice"}, "libexample": []string{"top_notice"},
"liboutsider": []string{}, "liboutsider": []string{},
}, },
effectiveInheritedLicenses: map[string][]string{ effectiveInheritedLicenses: map[string][]string{
"libexample": []string{"top_notice"}, "libexample": []string{"top_notice"},
"liboutsider": []string{"top_notice"}, "liboutsider": []string{"top_notice"},
}, },
}, },
@ -370,15 +370,15 @@ var licensesTests = []struct {
}`), }`),
}, },
effectiveLicenses: map[string][]string{ effectiveLicenses: map[string][]string{
"libexample": []string{"top_notice"}, "libexample": []string{"top_notice"},
"libnested": []string{"outsider"}, "libnested": []string{"outsider"},
"libother": []string{}, "libother": []string{},
"liboutsider": []string{}, "liboutsider": []string{},
}, },
effectiveInheritedLicenses: map[string][]string{ effectiveInheritedLicenses: map[string][]string{
"libexample": []string{"top_notice"}, "libexample": []string{"top_notice"},
"libnested": []string{"outsider"}, "libnested": []string{"outsider"},
"libother": []string{}, "libother": []string{},
"liboutsider": []string{"top_notice", "outsider"}, "liboutsider": []string{"top_notice", "outsider"},
}, },
}, },
@ -449,7 +449,7 @@ var licensesTests = []struct {
}, },
effectiveInheritedLicenses: map[string][]string{ effectiveInheritedLicenses: map[string][]string{
"module": []string{"prebuilt", "top_sources"}, "module": []string{"prebuilt", "top_sources"},
"other": []string{"prebuilt", "top_sources"}, "other": []string{"prebuilt", "top_sources"},
}, },
}, },
} }