Skip to content

Commit

Permalink
StaticHtmlReporter: Add effective license
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.io>
  • Loading branch information
MarcelBochtler committed Mar 11, 2021
1 parent ff7e8ed commit 2b12afa
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,10 @@ <h3 class="">Packages</h3>
<div>MIT (<a href="https://github.com/oss-review-toolkit/ort/tree/master/analyzer/src/funTest/assets/projects/synthetic/gradle/lib/src/code.cpp#L1">link</a> to the location)</div>
</dd>
</dl>
<em>Effective License:</em>
<dl>
<dd>GPL-2.0-only WITH Classpath-exception-2.0 AND BSD-3-Clause AND LicenseRef-test-Apache-2.0-multi-line AND LicenseRef-test-Apache-2.0-single-line AND MIT AND LicenseRef-test-Apache-2.0-multi-line AND LicenseRef-test-Apache-2.0-single-line</dd>
</dl>
</td><td>
<ul></ul>
</td><td>
Expand All @@ -642,6 +646,10 @@ <h3 class="">Packages</h3>
<div>EPL-1.0</div>
</dd>
</dl>
<em>Effective License:</em>
<dl>
<dd>EPL-1.0</dd>
</dl>
</td><td>
<ul></ul>
</td><td>
Expand All @@ -661,6 +669,10 @@ <h3 class="">Packages</h3>
<div>Apache-2.0</div>
</dd>
</dl>
<em>Effective License:</em>
<dl>
<dd>Apache-2.0</dd>
</dl>
</td><td>
<ul></ul>
</td><td>
Expand All @@ -680,6 +692,10 @@ <h3 class="">Packages</h3>
<div>Apache-2.0</div>
</dd>
</dl>
<em>Effective License:</em>
<dl>
<dd>Apache-2.0</dd>
</dl>
</td><td>
<ul></ul>
</td><td>
Expand All @@ -698,6 +714,10 @@ <h3 class="">Packages</h3>
<div>BSD-3-Clause</div>
</dd>
</dl>
<em>Effective License:</em>
<dl>
<dd>BSD-3-Clause</dd>
</dl>
</td><td>
<ul></ul>
</td><td>
Expand Down Expand Up @@ -752,6 +772,10 @@ <h3 class="ort-excluded">Packages</h3>
<div class="ort-excluded">MIT (Excluded: EXAMPLE_OF - These are example files.)</div>
</dd>
</dl>
<em>Effective License:</em>
<dl>
<dd>GPL-3.0-only WITH GCC-exception-3.1 AND CC-BY-NC-3.0 AND Apache-2.0 AND MIT</dd>
</dl>
</td><td>
<ul></ul>
</td><td>
Expand Down
3 changes: 3 additions & 0 deletions reporter/src/main/kotlin/reporters/StaticHtmlReporter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,9 @@ class StaticHtmlReporter : Reporter {
}
}
}

em { +"Effective License:" }
dl { dd { +"${row.effectiveLicense ?: ""}" } }
}

td { issueList(row.analyzerIssues) }
Expand Down
6 changes: 6 additions & 0 deletions reporter/src/main/kotlin/utils/ReportTableModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ data class ReportTableModel(
*/
val detectedLicenses: List<ResolvedLicense>,

/**
* The effective license of the package derived from the licenses of the license sources chosen by a
* LicenseView, with optional choices applied.
*/
val effectiveLicense: SpdxExpression?,

/**
* All analyzer issues related to this package.
*/
Expand Down
3 changes: 3 additions & 0 deletions reporter/src/main/kotlin/utils/ReportTableModelMapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import org.ossreviewtoolkit.model.VcsInfo
import org.ossreviewtoolkit.model.config.Excludes
import org.ossreviewtoolkit.model.config.ScopeExclude
import org.ossreviewtoolkit.model.licenses.LicenseInfoResolver
import org.ossreviewtoolkit.model.licenses.LicenseView
import org.ossreviewtoolkit.model.utils.ResolutionProvider
import org.ossreviewtoolkit.reporter.HowToFixTextProvider
import org.ossreviewtoolkit.reporter.utils.ReportTableModel.DependencyRow
Expand Down Expand Up @@ -159,6 +160,8 @@ class ReportTableModelMapper(
concludedLicense = concludedLicense,
declaredLicenses = declaredLicenses,
detectedLicenses = detectedLicenses,
effectiveLicense = resolvedLicenseInfo
.effectiveLicense(LicenseView.CONCLUDED_OR_DECLARED_AND_DETECTED),
analyzerIssues = analyzerIssues.map { it.toResolvableIssue() },
scanIssues = scanIssues.map { it.toResolvableIssue() }
).also { row ->
Expand Down

0 comments on commit 2b12afa

Please sign in to comment.