Skip to content

Commit 5858cfa

Browse files
committed
feat(freemarker): Add val PackageModel.labels for convenient access
Package labels can be used for injecting custom data into any plain text report. So, make it more convenient for the '.ftl' to access the labels. Signed-off-by: Frank Viernau <[email protected]>
1 parent e1d45fb commit 5858cfa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

plugins/reporters/freemarker/src/main/kotlin/FreemarkerTemplateProcessor.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,12 @@ class FreemarkerTemplateProcessor(
160160
*/
161161
val excluded: Boolean by lazy { input.ortResult.isExcluded(id) }
162162

163+
/**
164+
* The labels for the package.
165+
*/
166+
@Suppress("UNUSED") // This function is used in the templates.
167+
val labels: Map<String, String> by lazy { input.ortResult.getPackage(id)?.metadata?.labels.orEmpty() }
168+
163169
/**
164170
* The resolved license information for the package.
165171
*/

0 commit comments

Comments
 (0)