Skip to content

Commit

Permalink
Added metadata filtering of tool used for SBOM production
Browse files Browse the repository at this point in the history
The SBOM format has a section for identifying tool used to produce the file - this was previously left empty.

Signed-off-by: Leif Lislegard <[email protected]>
  • Loading branch information
lislei committed Feb 18, 2022
1 parent 430eed0 commit 20cb82c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
17 changes: 16 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

plugins {
id 'java-gradle-plugin'
id 'com.gradle.plugin-publish' version '0.12.0'
Expand Down Expand Up @@ -36,6 +35,22 @@ tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

def pluginProperties = [
'vendor': 'CycloneDX',
'name': 'CycloneDX Gradle plugin',
'version': project.version,
'groupId': project.group,
'artifactId': project.name,
] as Properties

def filterPluginProperties = tasks.register('filterPluginProperties', Copy) {
destinationDir = file("$buildDir/resources/filter")
inputs.properties pluginProperties
from('src/main/filter')
expand(pluginProperties)
}
sourceSets.main.resources.srcDirs filterPluginProperties

pluginBundle {
website = 'https://cyclonedx.org'
vcsUrl = 'https://github.com/CycloneDX/cyclonedx-gradle-plugin.git'
Expand Down
7 changes: 7 additions & 0 deletions src/main/filter/cyclonedx-gradle-plugin.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Automatically populated by Gradle build - do not modify
vendor=${vendor}
name=${name}
version=${version}
groupId=${groupId}
artifactId=${artifactId}
timestamp=${System.currentTimeMillis()}
4 changes: 2 additions & 2 deletions src/main/java/org/cyclonedx/gradle/CycloneDxTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,9 @@ protected Metadata createMetadata() {
private Properties readPluginProperties() {
final Properties props = new Properties();
try {
props.load(this.getClass().getClassLoader().getResourceAsStream("plugin.properties"));
props.load(this.getClass().getClassLoader().getResourceAsStream("cyclonedx-gradle-plugin.properties"));
} catch (NullPointerException | IOException e) {
getLogger().warn("Unable to load plugin.properties", e);
getLogger().warn("cyclonedx-gradle-plugin.properties", e);
}
return props;
}
Expand Down
7 changes: 0 additions & 7 deletions src/main/resources/plugin.properties

This file was deleted.

0 comments on commit 20cb82c

Please sign in to comment.