Skip to content

Commit e1947a4

Browse files
authored
Merge pull request #1163 from mikepenz/develop
dev -> main
2 parents 6271c8b + 8c57260 commit e1947a4

File tree

7 files changed

+30
-25
lines changed

7 files changed

+30
-25
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ This library collects dependency details, including licenses at compile time, an
4242
## Latest releases 🛠
4343

4444
- Compose UI updates | Gradle Plugin refresh | [v12.0.1](https://github.com/mikepenz/AboutLibraries/tree/12.0.1)
45-
- Compose 1.8.x | Plugin refactor | [v12.1.0](https://github.com/mikepenz/AboutLibraries/tree/12.1.0)
45+
- Compose 1.8.x | Plugin refactor | [v12.1.1](https://github.com/mikepenz/AboutLibraries/tree/12.1.1)
4646

4747
## Gradle Plugin
4848

app-test/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
### Generate Dependency Information
44

55
```bash
6-
./gradlew :app-test:exportLibraryDefinitions -PaboutLibraries.exportPath=files/
6+
./gradlew :app-test:exportLibraryDefinitions
77
```

app-test/files/aboutlibraries.json

Lines changed: 3 additions & 4 deletions
Large diffs are not rendered by default.

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
GROUP=com.mikepenz
22

3-
VERSION_NAME=12.1.0
4-
VERSION_CODE=120100
3+
VERSION_NAME=12.1.1
4+
VERSION_CODE=120101
55

66
POM_URL=https://github.com/mikepenz/AboutLibraries
77
POM_SCM_URL=https://github.com/mikepenz/AboutLibraries

plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/mapping/License.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ data class License(
2525
} else {
2626
field
2727
}
28+
set(value) {
29+
// do not set `NOASSERTION` as spdxId
30+
if (value != "NOASSERTION") {
31+
field = value
32+
}
33+
}
2834

2935
override fun equals(other: Any?): Boolean {
3036
if (this === other) return true
@@ -51,7 +57,7 @@ data class License(
5157
* Ensures and applies fixes to the library names (shorten, ...)
5258
*/
5359
private fun resolveLicenseId(name: String, url: String?): String? {
54-
for (l: SpdxLicense in SpdxLicense.values()) {
60+
for (l: SpdxLicense in SpdxLicense.entries) {
5561
val matcher = l.customMatcher
5662
if (l.id.equals(name, true) || l.name.equals(name, true) || l.fullName.equals(name, true) || (matcher != null && matcher.invoke(name, url))) {
5763
return l.id

plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/mapping/SpdxLicense.kt

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ enum class SpdxLicense(
151151
EPL_1_0("Eclipse Public License 1.0", "EPL-1.0"),
152152
EPL_2_0("Eclipse Public License 2.0", "EPL-2.0", "epl_2_0", customMatcher = { _, url ->
153153
url == "https://www.eclipse.org/legal/epl-v20.html"
154+
|| url == "https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt"
154155
}),
155156
ErlPL_1_1("Erlang Public License v1.1", "ErlPL-1.1"),
156157
etalab_2_0("Etalab Open License 2.0", "etalab-2.0"),
@@ -392,19 +393,19 @@ enum class SpdxLicense(
392393

393394
// Special handling section
394395
Apache_2_0("Apache License 2.0", "Apache-2.0", customMatcher = { name, url ->
395-
name.contains("Apache", true) || url?.endsWith("LICENSE-2.0.txt") == true
396+
name.contains("Apache", true)
397+
|| url?.endsWith("LICENSE-2.0.txt") == true
396398
}),
397399
BSD_2_Clause("BSD 2-Clause \"Simplified\" License", "BSD-2-Clause", customMatcher = { name, url ->
398400
name.equals("BSD 2-Clause License", true)
399401
|| url?.endsWith("opensource.org/licenses/BSD-2-Clause", true) == true
400402
|| url?.endsWith("opensource.org/licenses/bsd-license", true) == true
401403
}),
402404
BSD_3_Clause("BSD 3-Clause \"New\" or \"Revised\" License", "BSD-3-Clause", customMatcher = { name, url ->
403-
name.equals("New BSD License", true) || name.equals("Modified BSD License", true) || name.equals(
404-
"BSD 3-clause",
405-
true
406-
) ||
407-
url?.endsWith("opensource.org/licenses/BSD-3-Clause", true) == true
405+
name.equals("New BSD License", true)
406+
|| name.equals("Modified BSD License", true)
407+
|| name.equals("BSD 3-clause", true)
408+
|| url?.endsWith("opensource.org/licenses/BSD-3-Clause", true) == true
408409
}),
409410
MIT("MIT License", "MIT", customMatcher = { name, _ ->
410411
name.contains("MIT", true)
@@ -426,7 +427,10 @@ enum class SpdxLicense(
426427
GPL_2_0_CPE(
427428
"GNU General Public License, version 2, with the Classpath Exception",
428429
"GPL-2.0-CPE",
429-
customUrl = "https://openjdk.org/legal/gplv2+ce.html"
430+
customUrl = "https://openjdk.org/legal/gplv2+ce.html",
431+
customMatcher = { name, url ->
432+
url?.equals("https://www.gnu.org/software/classpath/license.html") == true
433+
}
430434
);
431435

432436
fun getUrl(): String = customUrl ?: "https://spdx.org/licenses/$id.html"

plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/util/DependencyCollector.kt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,12 @@ internal class DependencyCollector(
208208
if (artifactVersion.isNullOrBlank()) LOGGER.info("----> Failed to identify version for: $uniqueId")
209209
val libraryWebsite = chooseStringValue(pom, parentRawModel) { it.url }
210210

211-
val licenses = combineValues(pom, parentRawModel) { it.licenses }.map { License(it.name, it.url) }.toHashSet()
211+
val licenses = chooseValue(pom, parentRawModel) { it.licenses }?.map {
212+
if (it.name == null) LOGGER.info("----> License name was null url: ${it.url} for: $uniqueId")
213+
License(it.name ?: "", it.url)
214+
}?.toHashSet() ?: emptySet()
212215
val scm = chooseValue(pom, parentRawModel) { it.scm }?.let { Scm(it.connection, it.developerConnection, it.url) }
213-
val developers = combineValues(pom, parentRawModel) { it.developers }.map { Developer(it.name, it.organizationUrl) }.toHashSet().toList()
216+
val developers = chooseValue(pom, parentRawModel) { it.developers }?.map { Developer(it.name, it.organizationUrl) }?.toHashSet()?.toList() ?: emptyList()
214217
val organization = chooseValue(pom, parentRawModel) { it.organization }?.let { Organization(it.name, it.url) }
215218
return DependencyData(
216219
dependencyCoordinates = coordinates,
@@ -233,13 +236,6 @@ internal class DependencyCollector(
233236

234237
private fun <T> chooseValue(pom: Model, parentRawModel: List<Model>, block: (Model) -> T?): T? = pom.let(block) ?: parentRawModel.firstOrNull()?.let(block)
235238

236-
private fun <T> combineValues(pom: Model, parentRawModel: List<Model>, block: (Model) -> List<T>): List<T> {
237-
val combined = mutableListOf<T>()
238-
pom.let(block).also { combined.addAll(it) }
239-
parentRawModel.onEach { block(it).also { value -> combined.addAll(value) } }
240-
return combined
241-
}
242-
243239
/**
244240
* Fetches the pom files for all [ResolvedVariantResult]s.
245241
*

0 commit comments

Comments
 (0)