File tree Expand file tree Collapse file tree 4 files changed +4
-9
lines changed
plugins/license-gather-plugin/src/main/kotlin/com/github/vlsi/gradle Expand file tree Collapse file tree 4 files changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -74,9 +74,7 @@ internal class LicenseCompatibilityInterpreter(
7474 resolvedCases[licenseExpression]?.let { return it.asResolved(licenseExpression) }
7575
7676 // Expand the license (e.g. expand OR_LATER into OR ... OR)
77- val e = licenseEquivalence.expand(licenseExpression)
78-
79- return when (e) {
77+ return when (val e = licenseEquivalence.expand(licenseExpression)) {
8078 is DisjunctionLicenseExpression ->
8179 // A or X => A
8280 e.unordered.takeIf { it.isNotEmpty() }?.map { eval(it) }?.reduce { a, b ->
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ class LicenseEquivalence(
5555 }
5656 }
5757 val result = seq.toSet()
58- return if ( result.isEmpty()) null else result
58+ return result.ifEmpty { null }
5959 }
6060
6161 fun expand (licenseExpression : LicenseExpression ): LicenseExpression {
Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ fun LicenseExpression.weight(): Int =
160160 is JustLicense -> 1
161161 is OrLaterLicense -> 2
162162 is WithException -> license.weight() + 1
163- is ConjunctionLicenseExpression -> licenses.map { it.weight() + 1 }.maxOrNull() ? : 1
164- is DisjunctionLicenseExpression -> licenses.map { it.weight() + 1 }.maxOrNull() ? : 1
163+ is ConjunctionLicenseExpression -> licenses.maxOfOrNull { it.weight() + 1 } ? : 1
164+ is DisjunctionLicenseExpression -> licenses.maxOfOrNull { it.weight() + 1 } ? : 1
165165 else -> TODO (" Unexpected expression: ${this ::class .simpleName} : $this " )
166166 }
Original file line number Diff line number Diff line change @@ -22,11 +22,8 @@ import com.github.vlsi.gradle.license.api.License
2222import com.github.vlsi.gradle.license.api.LicenseEquivalence
2323import com.github.vlsi.gradle.license.api.LicenseExpression
2424import com.github.vlsi.gradle.license.api.LicenseExpressionSet
25- import com.github.vlsi.gradle.license.api.LicenseExpressionSetOperation
2625import com.github.vlsi.gradle.license.api.SpdxLicense
2726import com.github.vlsi.gradle.license.api.SpdxLicenseException
28- import com.github.vlsi.gradle.license.api.orLater
29- import com.github.vlsi.gradle.license.api.with
3027
3128/* *
3229 * See https://apache.org/legal/resolved.html
You can’t perform that action at this time.
0 commit comments