Add some documentation and simplify data model.

Bug: 245562496

Test: m droid
Change-Id: Iae757a5767522e0734abbe3840ea0939620197e7
This commit is contained in:
Bob Badour
2022-10-28 12:06:08 -07:00
parent 904dd87a75
commit 43daade15f
10 changed files with 143 additions and 86 deletions

View File

@@ -117,32 +117,6 @@ func init() {
func LicenseConditionSetFromNames(tn *TargetNode, names ...string) LicenseConditionSet {
cs := NewLicenseConditionSet()
for _, name := range names {
if name == "restricted" {
if 0 == len(tn.LicenseKinds()) {
cs = cs.Plus(RestrictedCondition)
continue
}
hasLgpl := false
hasGeneric := false
for _, kind := range tn.LicenseKinds() {
if anyLgpl.MatchString(kind) {
cs = cs.Plus(WeaklyRestrictedCondition)
hasLgpl = true
} else if versionedGpl.MatchString(kind) {
cs = cs.Plus(RestrictedCondition)
} else if genericGpl.MatchString(kind) {
hasGeneric = true
} else if kind == "legacy_restricted" || ccBySa.MatchString(kind) {
cs = cs.Plus(RestrictedCondition)
} else {
cs = cs.Plus(RestrictedCondition)
}
}
if hasGeneric && !hasLgpl {
cs = cs.Plus(RestrictedCondition)
}
continue
}
if lc, ok := RecognizedConditionNames[name]; ok {
cs |= LicenseConditionSet(lc)
}