-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Licenses from license files are not considered in HTML reports #290
Comments
This of course also means that the |
I have a PR open: #297 which should fix the issue. I think it was not the problem, that the License came from a license file, but that the plugin currently isn't handling multiple licenses so well (checkLicense, and printing reports) |
That does not really fix the issue, as this issue is about missing the information in the report. |
Here a consumer-side work-around that "fixes" the inventory HTML report in Kotlin: class EnhancedInventoryHtmlReportRenderer : InventoryHtmlReportRenderer() {
override fun buildLicenseInventory(data: ProjectData): Map<String, List<ModuleData>> {
val inventory = super.buildLicenseInventory(data)
inventory
.values
.flatten()
.distinct()
.forEach { moduleData ->
moduleData
.licenseFiles
.flatMap { it.fileDetails }
.filter { it.license != null }
.forEach {
val moduleDatas = inventory.computeIfAbsent(it.license) {
mutableListOf()
}
if (!moduleDatas.contains(moduleData)) {
moduleDatas.add(moduleData)
}
}
}
return inventory
}
override fun printDependencyLicenseFiles(licenseFiles: TreeSet<LicenseFileData>) {
licenseFiles
.flatMap { it.fileDetails }
.groupBy { it.file }
.forEach { (file, details) ->
val embeddedLicenses = details.joinToString(separator = "<br>") {
when {
it.license == null -> "No license recognized"
it.licenseUrl == null -> it.license
maybeLicenseUrl(it.licenseUrl) -> "${it.license} - ${link(it.licenseUrl, it.licenseUrl)}"
else -> "${it.license} - ${section("License", it.licenseUrl)}"
}
}
output.appendText(section("Embedded license file ${link(file, file)}", embeddedLicenses))
}
}
fun section(label: String, value: String) = """
<label>$label</label>
<div class='dependency-value'>$value</div>
""".trimIndent()
fun link(name: String, url: String) = "<a href='$url'>$name</a>"
} |
Neither the simple nor the inventory html report renderer print out the licenses found in a license file.
If you for example have in the
project-licenses-for-check-license-task.json
filewhere the EPL was found in the POM and the ASLv2 was found in
about.html
license file,The simple HTML report just shows:
![image](https://private-user-images.githubusercontent.com/325196/322885765-372895bb-b9c4-4926-9f88-3334de3281a5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwOTEyOTQsIm5iZiI6MTczOTA5MDk5NCwicGF0aCI6Ii8zMjUxOTYvMzIyODg1NzY1LTM3Mjg5NWJiLWI5YzQtNDkyNi05Zjg4LTMzMzRkZTMyODFhNS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOVQwODQ5NTRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04M2Y5M2ZjZjgzNGVlMjFmODM4ZGI3ODhiYmI2OWRiODI1YmRiNjdhZmIwNTU4M2MyM2ZkZDNlNzI0M2U3Nzg4JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.pPgWFcGd1T8s0AIkuAXyvt16bPmLmGewPoqjGcDlTQ0)
The inventory HTML report also just shows:
![image](https://private-user-images.githubusercontent.com/325196/322885966-30c2b3f6-78d7-43ad-b21f-dc9a9887c5ce.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwOTEyOTQsIm5iZiI6MTczOTA5MDk5NCwicGF0aCI6Ii8zMjUxOTYvMzIyODg1OTY2LTMwYzJiM2Y2LTc4ZDctNDNhZC1iMjFmLWRjOWE5ODg3YzVjZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOVQwODQ5NTRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yNWUwOGJmMzJjMmExZTk2ZTUwNmI0NmY4ZDFkZGU4ZjljZGQ0ZmU3ZDZiYWQ5Zjc5OTE3NmM0OGU2NTc2Zjg1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.8qmDy02XSz_Ih2x0t2vxlsm2Mr5jmus-Rl3ms1YJxRg)
The ASLv2 is nowhere mentioned in those reports for this dependency.
The text was updated successfully, but these errors were encountered: