This is an automated email from the ASF dual-hosted git repository.
houston pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new 392b6284a47 SOLR-16796: Add Maven SBOMs via cyclonedx (#1203)
392b6284a47 is described below
commit 392b6284a477008866c5419ca44caccd2c9c8a8a
Author: Arnout Engelen <[email protected]>
AuthorDate: Mon Jun 10 19:13:35 2024 +0200
SOLR-16796: Add Maven SBOMs via cyclonedx (#1203)
Co-authored-by: Kevin Risden <[email protected]>
Co-authored-by: Houston Putman <[email protected]>
(cherry picked from commit a42c605fb916439222a086356f368f02cf80304a)
---
build.gradle | 2 ++
gradle/maven/cyclonedx-bom.gradle | 61 ++++++++++++++++++++++++++++++++++++++
gradle/maven/defaults-maven.gradle | 4 +++
solr/CHANGES.txt | 2 ++
4 files changed, 69 insertions(+)
diff --git a/build.gradle b/build.gradle
index 910714b7736..9706edc8f73 100644
--- a/build.gradle
+++ b/build.gradle
@@ -28,6 +28,7 @@ plugins {
id 'net.ltgt.errorprone' version '3.1.0' apply false
id 'com.diffplug.spotless' version '6.5.2' apply false
id 'com.github.node-gradle.node' version '7.0.1' apply false
+ id 'org.cyclonedx.bom' version '1.8.2' apply false
}
apply from: file('gradle/globals.gradle')
@@ -132,6 +133,7 @@ apply from:
file('gradle/testing/alternative-jdk-support.gradle')
apply from: file('gradle/java/jar-manifest.gradle')
// Publishing and releasing
+apply from: file('gradle/maven/cyclonedx-bom.gradle')
apply from: file('gradle/maven/defaults-maven.gradle')
// IDE support, settings and specials.
diff --git a/gradle/maven/cyclonedx-bom.gradle
b/gradle/maven/cyclonedx-bom.gradle
new file mode 100644
index 00000000000..6daa502b30c
--- /dev/null
+++ b/gradle/maven/cyclonedx-bom.gradle
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// This adds CycloneDX BOM (SBOM) generation for all Solr Maven artifacts
+
+allprojects { prj ->
+ plugins.withType(JavaPlugin) {
+ prj.apply plugin: 'org.cyclonedx.bom'
+
+ ext {
+ sbomDir = layout.buildDirectory.dir("sbom")
+ }
+
+ configurations {
+ sbom
+ }
+
+ def baseName = prj.archivesBaseName + "-" + version + "-cyclonedx"
+
+ cyclonedxBom {
+ includeConfigs = ["runtimeClasspath"]
+ skipConfigs = ["compileClasspath", "testCompileClasspath"]
+ projectType = "library"
+ destination = sbomDir.map(Directory::getAsFile)
+ outputName = baseName
+ outputFormat = "all"
+ includeBomSerialNumber = true
+ componentVersion = version
+ }
+ assemble.dependsOn cyclonedxBom
+
+ ext {
+ sbomXmlArtifact = artifacts.add('sbom', sbomDir.map(d -> d.file(baseName
+ ".xml"))) {
+ type 'cyclonedx'
+ extension = 'xml'
+ classifier = 'cyclonedx'
+ builtBy cyclonedxBom
+ }
+ sbomJsonArtifact = artifacts.add('sbom', sbomDir.map(d ->
d.file(baseName + ".json"))) {
+ type 'cyclonedx'
+ extension = 'json'
+ classifier = 'cyclonedx'
+ builtBy cyclonedxBom
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/gradle/maven/defaults-maven.gradle
b/gradle/maven/defaults-maven.gradle
index 96e82dcc1c4..14860a688c5 100644
--- a/gradle/maven/defaults-maven.gradle
+++ b/gradle/maven/defaults-maven.gradle
@@ -149,6 +149,10 @@ configure(subprojects.findAll { it.path in
rootProject.published }) { prj ->
artifact sourcesJar
artifact javadocJar
+ // Include SBOM artifacts
+ artifact(sbomXmlArtifact)
+ artifact(sbomJsonArtifact)
+
pom(configurePom)
pom({
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 267d99ddf2c..8ce3568fb36 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -75,6 +75,8 @@ Other Changes
* SOLR-16503: Use Jetty HTTP2 for SyncStrategy and PeerSyncWithLeader for
"recovery" operations (Sanjay Dutt, David Smiley)
+* SOLR-16796: Include cyclonedx SBOMs with maven artifacts (Arnout Engelen,
Houston Putman, Kevin Risden)
+
================== 9.6.1 ==================
Bug Fixes
---------------------