GeezerVison is showing github.com — Merge pull request #1163 from mikepenz/develop · felex13/AboutLibraries@e1947a4
File treeExpand file treeCollapse file tree Open diff view settings plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: README.md +1-1Lines changed: 1 addition & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -42,7 +42,7 @@ This library collects dependency details, including licenses at compile time, an | 42 | 42 | ## Latest releases 🛠 | 43 | 43 |
| 44 | 44 | - 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) | 46 | 46 |
| 47 | 47 | ## Gradle Plugin | 48 | 48 |
| |
Collapse file Copy file name to clipboardExpand all lines: app-test/README.md +1-1Lines changed: 1 addition & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 3 | 3 | ### Generate Dependency Information | 4 | 4 |
| 5 | 5 | ```bash | 6 | | -./gradlew :app-test:exportLibraryDefinitions -PaboutLibraries.exportPath=files/ | | 6 | +./gradlew :app-test:exportLibraryDefinitions | 7 | 7 | ``` |
Collapse file Copy file name to clipboardExpand all lines: app-test/files/aboutlibraries.json +3-4Lines changed: 3 additions & 4 deletions Large diffs are not rendered by default. Collapse file Copy file name to clipboardExpand all lines: gradle.properties +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | GROUP=com.mikepenz | 2 | 2 |
| 3 | | -VERSION_NAME=12.1.0 | 4 | | -VERSION_CODE=120100 | | 3 | +VERSION_NAME=12.1.1 | | 4 | +VERSION_CODE=120101 | 5 | 5 |
| 6 | 6 | POM_URL=https://github.com/mikepenz/AboutLibraries | 7 | 7 | POM_SCM_URL=https://github.com/mikepenz/AboutLibraries | |
Collapse file Copy file name to clipboardExpand all lines: plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/mapping/License.kt +7-1Lines changed: 7 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -25,6 +25,12 @@ data class License( | 25 | 25 | } else { | 26 | 26 | field | 27 | 27 | } | | 28 | + set(value) { | | 29 | + // do not set `NOASSERTION` as spdxId | | 30 | + if (value != "NOASSERTION") { | | 31 | + field = value | | 32 | + } | | 33 | + } | 28 | 34 |
| 29 | 35 | override fun equals(other: Any?): Boolean { | 30 | 36 | if (this === other) return true | @@ -51,7 +57,7 @@ data class License( | 51 | 57 | * Ensures and applies fixes to the library names (shorten, ...) | 52 | 58 | */ | 53 | 59 | private fun resolveLicenseId(name: String, url: String?): String? { | 54 | | - for (l: SpdxLicense in SpdxLicense.values()) { | | 60 | + for (l: SpdxLicense in SpdxLicense.entries) { | 55 | 61 | val matcher = l.customMatcher | 56 | 62 | if (l.id.equals(name, true) || l.name.equals(name, true) || l.fullName.equals(name, true) || (matcher != null && matcher.invoke(name, url))) { | 57 | 63 | return l.id | |
Collapse file Copy file name to clipboardExpand all lines: plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/mapping/SpdxLicense.kt +11-7Lines changed: 11 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -151,6 +151,7 @@ enum class SpdxLicense( | 151 | 151 | EPL_1_0("Eclipse Public License 1.0", "EPL-1.0"), | 152 | 152 | EPL_2_0("Eclipse Public License 2.0", "EPL-2.0", "epl_2_0", customMatcher = { _, url -> | 153 | 153 | url == "https://www.eclipse.org/legal/epl-v20.html" | | 154 | + || url == "https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt" | 154 | 155 | }), | 155 | 156 | ErlPL_1_1("Erlang Public License v1.1", "ErlPL-1.1"), | 156 | 157 | etalab_2_0("Etalab Open License 2.0", "etalab-2.0"), | @@ -392,19 +393,19 @@ enum class SpdxLicense( | 392 | 393 |
| 393 | 394 | // Special handling section | 394 | 395 | 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 | 396 | 398 | }), | 397 | 399 | BSD_2_Clause("BSD 2-Clause \"Simplified\" License", "BSD-2-Clause", customMatcher = { name, url -> | 398 | 400 | name.equals("BSD 2-Clause License", true) | 399 | 401 | || url?.endsWith("opensource.org/licenses/BSD-2-Clause", true) == true | 400 | 402 | || url?.endsWith("opensource.org/licenses/bsd-license", true) == true | 401 | 403 | }), | 402 | 404 | 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 | 408 | 409 | }), | 409 | 410 | MIT("MIT License", "MIT", customMatcher = { name, _ -> | 410 | 411 | name.contains("MIT", true) | @@ -426,7 +427,10 @@ enum class SpdxLicense( | 426 | 427 | GPL_2_0_CPE( | 427 | 428 | "GNU General Public License, version 2, with the Classpath Exception", | 428 | 429 | "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 | + } | 430 | 434 | ); | 431 | 435 |
| 432 | 436 | fun getUrl(): String = customUrl ?: "https://spdx.org/licenses/$id.html" | |
Collapse file Copy file name to clipboardExpand all lines: plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/util/DependencyCollector.kt +5-9Lines changed: 5 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -208,9 +208,12 @@ internal class DependencyCollector( | 208 | 208 | if (artifactVersion.isNullOrBlank()) LOGGER.info("----> Failed to identify version for: $uniqueId") | 209 | 209 | val libraryWebsite = chooseStringValue(pom, parentRawModel) { it.url } | 210 | 210 |
| 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() | 212 | 215 | 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() | 214 | 217 | val organization = chooseValue(pom, parentRawModel) { it.organization }?.let { Organization(it.name, it.url) } | 215 | 218 | return DependencyData( | 216 | 219 | dependencyCoordinates = coordinates, | @@ -233,13 +236,6 @@ internal class DependencyCollector( | 233 | 236 |
| 234 | 237 | private fun <T> chooseValue(pom: Model, parentRawModel: List<Model>, block: (Model) -> T?): T? = pom.let(block) ?: parentRawModel.firstOrNull()?.let(block) | 235 | 238 |
| 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 | | - | 243 | 239 | /** | 244 | 240 | * Fetches the pom files for all [ResolvedVariantResult]s. | 245 | 241 | * | |
|