Skip to content

Commit

Permalink
added new list for MPL 2.0
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Zheng <[email protected]>
  • Loading branch information
Two-Hearts committed Oct 27, 2023
1 parent 45c9d9c commit e1157dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions assets/compatibility/Apache-2.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,6 @@ incompatible:
- CPOL-1.02
- NPL-1.0
- NPL-1.1

compatible-with-conditions:
- MPL-2.0
9 changes: 5 additions & 4 deletions pkg/deps/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ import (
)

type CompatibilityMatrix struct {
Compatible []string `yaml:"compatible"`
Incompatible []string `yaml:"incompatible"`
Compatible []string `yaml:"compatible"`
Incompatible []string `yaml:"incompatible"`
CompatibleWithConditions []string `yaml:"compatible-with-conditions"`
}

var matrices = make(map[string]CompatibilityMatrix)
Expand Down Expand Up @@ -108,7 +109,7 @@ func CheckWithMatrix(mainLicenseSpdxID string, matrix *CompatibilityMatrix, repo
switch operator {
case LicenseOperatorAND:
if compareAll(spdxIDs, func(spdxID string) bool {
return compare(matrix.Compatible, spdxID)
return compare(matrix.Compatible, spdxID) || compare(matrix.CompatibleWithConditions, spdxID)
}) {
continue
}
Expand All @@ -120,7 +121,7 @@ func CheckWithMatrix(mainLicenseSpdxID string, matrix *CompatibilityMatrix, repo

case LicenseOperatorOR:
if compareAny(spdxIDs, func(spdxID string) bool {
return compare(matrix.Compatible, spdxID)
return compare(matrix.Compatible, spdxID) || compare(matrix.CompatibleWithConditions, spdxID)
}) {
continue
}
Expand Down

0 comments on commit e1157dc

Please sign in to comment.