Skip to content

Commit ab3a44a

Browse files
committed
feat(freemarker): Add a helper function for constructing Identifiers
An example use case is when `Package.labels` contains an identifier string. Signed-off-by: Frank Viernau <[email protected]>
1 parent dc76373 commit ab3a44a

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
@@ -397,6 +397,12 @@ class FreemarkerTemplateProcessor(
397397
fun getPackage(id: Identifier): Package =
398398
input.ortResult.getPackage(id)?.metadata
399399
?: Package.EMPTY.also { logger.warn { "Could not resolve package '${id.toCoordinates()}'." } }
400+
401+
/**
402+
* Return an [Identifier] constructed from the given [identifier] string.
403+
*/
404+
@Suppress("UNUSED") // This function is used in the templates.
405+
fun identifierFromString(identifier: String) = Identifier(identifier)
400406
}
401407
}
402408

0 commit comments

Comments
 (0)