Skip to content
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

It would be nice if the inventory report had a "multiple licenses" section #291

Open
Vampire opened this issue Apr 16, 2024 · 1 comment

Comments

@Vampire
Copy link

Vampire commented Apr 16, 2024

If a dependency has multiple licenses detected, this can basically mean four things.
Either the code is dual-licensed under both licenses (for example net.java.dev.jna:jna:5.6.0),
or the parent POM is covered by one license and the POM itself is covered by another license (for example org.ow2.asm:asm:9.6),
or some parts are covered by one license and other parts are covered by another license (for example org.jacoco:org.jacoco.report:0.8.11),
or some license detection rules are erroneous (for example org.hamcrest:hamcrest:2.2).

In any case, you most probably have to have a deeper look into those cases and evaluate on a case-by-case basis what the situation is, so it would be nice to have a section that lists all dependencies that have multiple licenses detected in the inventory HTML report to have a work-list to go through.

@Vampire Vampire changed the title It would be nice if the inventory report had a section multiple licenses It would be nice if the inventory report had a "multiple licenses" section Apr 16, 2024
@Vampire
Copy link
Author

Vampire commented Apr 25, 2024

Here a way to add this information as first section by customization using Kotlin:

class EnhancedInventoryHtmlReportRenderer : InventoryHtmlReportRenderer() {
    override fun buildLicenseInventory(data: ProjectData): Map<String, List<ModuleData>> {
        val inventory = super.buildLicenseInventory(data)
        inventory[" Multiple Licenses"] = inventory
            .flatMap { (license, modules) ->
                modules.map { license to it }
            }
            .groupBy({ it.second }) { it.first }
            .filter { it.value.size > 1 }
            .map { it.key }
        return inventory
    }

    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>"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant