Skip to content

Commit

Permalink
feat(scanner): Record the scanner tool versions in the ORT result
Browse files Browse the repository at this point in the history
Resolves #4161.

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Nov 1, 2023
1 parent 0894374 commit b2aebfa
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion scanner/src/main/kotlin/Scanner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import org.ossreviewtoolkit.scanner.provenance.NestedProvenanceScanResult
import org.ossreviewtoolkit.scanner.provenance.PackageProvenanceResolver
import org.ossreviewtoolkit.scanner.provenance.ProvenanceDownloader
import org.ossreviewtoolkit.scanner.utils.FileListResolver
import org.ossreviewtoolkit.utils.common.CommandLineTool
import org.ossreviewtoolkit.utils.common.collectMessages
import org.ossreviewtoolkit.utils.common.safeDeleteRecursively
import org.ossreviewtoolkit.utils.ort.Environment
Expand Down Expand Up @@ -134,10 +135,18 @@ class Scanner(

val endTime = Instant.now()

val toolVersions = mutableMapOf<String, String>()

scannerWrappers.values.flatten().forEach { scanner ->
if (scanner is CommandLineTool) {
toolVersions[scanner.name] = scanner.getVersion()
}
}

val scannerRun = ScannerRun(
startTime = startTime,
endTime = endTime,
environment = Environment(),
environment = Environment(toolVersions = toolVersions),
config = scannerConfig,
provenances = projectResults.provenances + packageResults.provenances,
scanResults = projectResults.scanResults + packageResults.scanResults,
Expand Down

0 comments on commit b2aebfa

Please sign in to comment.