Build: Refactor sbom configuration & wire it with main publication

This commit is contained in:
Vyacheslav Gerasimov
2023-05-24 11:11:02 +02:00
committed by Space Team
parent 18f52832f5
commit e0a477f16d
9 changed files with 61 additions and 48 deletions
+11 -9
View File
@@ -250,8 +250,16 @@ dependencies {
fatJarContentsStripVersions(commonDependency("one.util:streamex")) { isTransitive = false }
}
configureSbom() // sbom for main maven publication
publish()
// sbom for dist
val distSbomTask = configureSbom(
target = "Dist",
documentName = "Kotlin Compiler Distribution",
setOf(configurations.runtimeClasspath.name, libraries.name, librariesStripVersion.name, compilerPlugins.name)
)
val packCompiler by task<Jar> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
destinationDirectory.set(File(buildDir, "libs"))
@@ -430,12 +438,6 @@ val distJs = distTask<Sync>("distJs") {
from(distJSContents)
}
val compilerZipSbomName = "kotlin-compiler-zip"
val sbom = configureSbom(
moduleName = compilerZipSbomName,
gradleConfigurations = setOf("runtimeClasspath", libraries.name, librariesStripVersion.name, compilerPlugins.name)
)
distTask<Copy>("dist") {
destinationDir = File(distDir)
@@ -443,12 +445,12 @@ distTask<Copy>("dist") {
dependsOn(distCommon)
dependsOn(distMaven)
dependsOn(distJs)
dependsOn("spdxSbomForKotlin-compiler-zip")
dependsOn(distSbomTask)
from(buildNumber)
from(distStdlibMinimalForTests)
from(sbom.file) {
rename("$compilerZipSbomName.spdx.json", "${project.name}-${project.version}.spdx.json")
from(distSbomTask.map { it.outputDirectory.file("dist.spdx.json") }) {
rename(".*", "${project.name}-${project.version}.spdx.json")
}
}