Merge branch 'v3_issue_863-write-dependencies-version-numbers-in-gradleproperties-file' into v3_issue_887-add-owasp-dependency-check

This commit is contained in:
TheSilentCoder 2024-12-19 16:35:01 -05:00
commit dcc2962b99
13 changed files with 304 additions and 428 deletions

View File

@ -1,20 +1,6 @@
plugins { plugins {
id 'java' id 'io.spring.dependency-management' version '1.1.7'
id 'io.spring.dependency-management' version '1.1.0'
id 'com.google.protobuf' version '0.9.4' id 'com.google.protobuf' version '0.9.4'
id 'checkstyle'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
repositories {
mavenCentral()
flatDir { dirs "lib" }
} }
configurations { configurations {
@ -27,63 +13,42 @@ dependencies {
implementation project(':HIRS_Utils') implementation project(':HIRS_Utils')
implementation project(':HIRS_Structs') implementation project(':HIRS_Structs')
implementation 'org.springframework.boot:spring-boot-starter-data-jpa:3.0.1'
implementation 'com.github.darrachequesne:spring-data-jpa-datatables:6.0.1'
implementation 'org.springframework.retry:spring-retry:2.0.0'
implementation libs.springdatajpa
implementation libs.bouncycastle implementation libs.bouncycastle
implementation libs.commons.codec implementation libs.commons.codec
implementation libs.commons.io
implementation libs.commons.lang3 implementation libs.commons.lang3
implementation libs.jakarta.api
implementation libs.jakarta.xml
implementation libs.hibernate.core
implementation libs.pci
implementation libs.guava implementation libs.guava
implementation libs.jackson.core implementation libs.jackson.core
implementation libs.jackson.databind implementation libs.jackson.databind
implementation libs.jakarta.persistence.api
implementation libs.jakarta.xml
implementation libs.spring.boot.starter.log4j2
implementation libs.minimal.json implementation libs.minimal.json
// pull the pci dependency and ...
implementation libs.pci
// and explicitly include the patched version of the apache http client dependency
implementation libs.apacheHttpClient
implementation libs.protobuf.java implementation libs.protobuf.java
implementation 'org.apache.logging.log4j:log4j-core:2.19.0' implementation libs.spring.boot.starter.data.jpa
implementation 'org.apache.logging.log4j:log4j-api:2.19.0' implementation libs.spring.retry
implementation libs.spring.boot.starter.web
implementation libs.spring.framework.webmvc
testImplementation 'org.apache.directory.studio:org.apache.commons.io:2.4'
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.3'
testImplementation 'org.junit.platform:junit-platform-launcher:1.9.3'
testImplementation 'org.mockito:mockito-core:4.2.0'
testImplementation 'org.springframework:spring-test:6.0.8'
compileOnly "com.github.spotbugs:spotbugs-annotations:${spotBugAnnotationVersion}"
annotationProcessor "com.github.spotbugs:spotbugs-annotations:${spotBugAnnotationVersion}"
// spring management
compileOnly libs.lombok compileOnly libs.lombok
implementation libs.lombok
annotationProcessor libs.lombok annotationProcessor libs.lombok
compileOnly libs.spotbugs.annotations
annotationProcessor libs.spotbugs.annotations
testImplementation libs.commons.io
testImplementation libs.spring.boot.starter.test
testCompileOnly libs.lombok
testAnnotationProcessor libs.lombok
} }
checkstyle {
toolVersion = '10.12.7'
configFile file("${rootDir}/config/checkstyle/checkstyle.xml")
}
// https://github.com/checkstyle/checkstyle/issues/14211#issuecomment-1884129948
configurations.checkstyle {
resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") {
select("com.google.guava:guava:0")
}
}
checkstyleMain {
source = 'src/main/java'
}
checkstyleTest {
source = 'src/test/java'
}
tasks.withType(Checkstyle) {
reports {
xml.required = false
html.required = true
}
}
protobuf { protobuf {
protoc { protoc {
artifact = 'com.google.protobuf:protoc:3.24.3' artifact = 'com.google.protobuf:protoc:3.24.3'

View File

@ -19,10 +19,10 @@ public abstract class UserDefinedEntity extends ArchivableEntity {
@Column(nullable = false, unique = true) @Column(nullable = false, unique = true)
@NonNull @NonNull
private String name; private String name = "";
@ToString.Exclude @ToString.Exclude
@Column(nullable = false, unique = false) @Column(nullable = false)
@NonNull @NonNull
private String description = ""; private String description = "";

View File

@ -1,25 +1,17 @@
plugins { plugins {
id 'application' id 'application'
id 'java'
id 'war' id 'war'
id 'com.netflix.nebula.ospackage' version '11.8.0' id 'com.netflix.nebula.ospackage' version '11.10.0'
id 'org.springframework.boot' version '3.0.6' id 'org.springframework.boot' version '3.0.13'
id 'io.spring.dependency-management' version '1.1.0' id 'io.spring.dependency-management' version '1.1.7'
id 'checkstyle'
} }
// Get version from main project gradle // Get version from main project gradle
def packVersion = properties.get("packageVersion"); def packVersion = properties.get("packageVersion")
def jarVersion = properties.get("jarVersion"); def jarVersion = properties.get("jarVersion")
def projVersion = properties.get("projVersion"); def projVersion = properties.get("projVersion")
//println "packageVersion is ${projVersion}" //println "packageVersion is ${projVersion}"
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
bootRun { bootRun {
if (project.hasProperty('debug')) { if (project.hasProperty('debug')) {
jvmArgs project.debug jvmArgs project.debug
@ -33,63 +25,40 @@ configurations {
all*.exclude module: 'spring-boot-starter-logging' all*.exclude module: 'spring-boot-starter-logging'
} }
repositories {
flatDir { dirs "lib" }
mavenCentral()
}
dependencies { dependencies {
implementation project(':HIRS_Utils') implementation project(':HIRS_Utils')
implementation project(':HIRS_AttestationCA') implementation project(':HIRS_AttestationCA')
implementation libs.pci
implementation libs.gson
implementation libs.bouncycastle implementation libs.bouncycastle
implementation libs.guava implementation libs.guava
implementation libs.gson
implementation libs.jakarta.persistence.api
implementation libs.jakarta.servlet implementation libs.jakarta.servlet
implementation libs.jakarta.api
implementation libs.jakarta.xml implementation libs.jakarta.xml
implementation 'org.springframework.boot:spring-boot-starter-web' // pull the pci dependency and ...
implementation 'org.springframework.boot:spring-boot-starter-validation' implementation libs.pci
implementation 'org.springframework.boot:spring-boot-starter-data-jpa' // and explicitly include the patched version of the apache http client dependency
implementation 'org.springframework.boot:spring-boot-starter-log4j2' implementation libs.apacheHttpClient
implementation 'org.apache.logging.log4j:log4j-spring-boot'
implementation 'org.projectlombok:lombok'
implementation 'commons-fileupload:commons-fileupload:1.5'
implementation 'org.apache.tomcat.embed:tomcat-embed-jasper:10.1.5'
compileOnly 'org.projectlombok:lombok' implementation libs.mariadb.java.client
implementation 'org.mariadb.jdbc:mariadb-java-client:3.1.4' implementation libs.spring.boot.starter.web
annotationProcessor 'org.projectlombok:lombok' //implementation libs.spring.framework.webmvc
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat' implementation libs.spring.boot.starter.validation
implementation libs.spring.boot.starter.data.jpa
implementation libs.spring.boot.starter.log4j2
implementation libs.tomcat.embed.jasper
testImplementation 'org.springframework.boot:spring-boot-starter-test' compileOnly libs.lombok
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.3' annotationProcessor libs.lombok
testImplementation 'org.hsqldb:hsqldb'
}
checkstyle { providedRuntime libs.spring.boot.starter.tomcat
toolVersion = '10.12.7'
configFile file("${rootDir}/config/checkstyle/checkstyle.xml") testImplementation libs.hsqldb
} testImplementation libs.spring.boot.starter.test
// https://github.com/checkstyle/checkstyle/issues/14211#issuecomment-1884129948
configurations.checkstyle { testCompileOnly libs.lombok
resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") { testAnnotationProcessor libs.lombok
select("com.google.guava:guava:0")
}
}
checkstyleMain {
source = 'src/main/java'
}
checkstyleTest {
source = 'src/test/java'
}
tasks.withType(Checkstyle) {
reports {
xml.required = false
html.required = true
}
} }
test { test {

View File

@ -1,56 +1,19 @@
plugins {
id 'java'
id 'checkstyle'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
repositories {
mavenCentral()
flatDir { dirs "lib" }
}
dependencies { dependencies {
implementation 'org.apache.commons:commons-lang3:3.13.0' implementation libs.commons.lang3
// testCompile libs.mockito compileOnly libs.lombok
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.3' annotationProcessor libs.lombok
testImplementation 'org.junit.platform:junit-platform-launcher:1.9.3'
testImplementation 'org.hamcrest:hamcrest:2.2' testImplementation libs.spring.boot.starter.test
testCompileOnly libs.lombok
testAnnotationProcessor libs.lombok
} }
test { test {
useJUnitPlatform() useJUnitPlatform()
} }
checkstyle {
toolVersion = '10.12.7'
configFile file("${rootDir}/config/checkstyle/checkstyle.xml")
}
// https://github.com/checkstyle/checkstyle/issues/14211#issuecomment-1884129948
configurations.checkstyle {
resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") {
select("com.google.guava:guava:0")
}
}
checkstyleMain {
source = 'src/main/java'
}
checkstyleTest {
source = 'src/test/java'
}
tasks.withType(Checkstyle) {
reports {
xml.required = false
html.required = true
}
}
//publishing { //publishing {
// publications { // publications {
// maven(MavenPublication) { // maven(MavenPublication) {
@ -59,5 +22,3 @@ tasks.withType(Checkstyle) {
// } // }
// } // }
//} //}

View File

@ -1,24 +1,8 @@
plugins {
id 'java'
id 'checkstyle'
}
// Get version from main project gradle // Get version from main project gradle
def packVersion = properties.get("packageVersion") def packVersion = properties.get("packageVersion")
def jarVersion = properties.get("jarVersion") def jarVersion = properties.get("jarVersion")
//println "packageVersion is ${projVersion}" //println "packageVersion is ${projVersion}"
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
repositories {
mavenCentral()
flatDir { dirs "lib" }
}
configurations { configurations {
compileOnly { compileOnly {
extendsFrom annotationProcessor extendsFrom annotationProcessor
@ -28,54 +12,33 @@ configurations {
dependencies { dependencies {
implementation libs.bouncycastle implementation libs.bouncycastle
implementation libs.lombok
implementation libs.jackson.core
implementation libs.jackson.databind
implementation libs.jakarta.api
implementation libs.jakarta.xml
implementation libs.guava
implementation libs.commons.codec implementation libs.commons.codec
implementation libs.commons.lang3 implementation libs.commons.lang3
implementation libs.commons.io implementation libs.commons.io
implementation libs.glassfish.jaxb.runtime
implementation libs.guava
implementation libs.jackson.core
implementation libs.jackson.databind
implementation libs.jakarta.persistence.api
implementation libs.jakarta.xml
implementation libs.spring.boot.starter.log4j2
implementation libs.minimal.json implementation libs.minimal.json
// pull the pci dependency and ...
implementation libs.pci implementation libs.pci
// and explicitly include the patched version of the apache http client dependency
implementation libs.apacheHttpClient
implementation 'org.apache.logging.log4j:log4j-core:2.19.0' implementation libs.slf4j.simple
implementation 'org.apache.logging.log4j:log4j-api:2.19.0'
implementation 'org.glassfish.jaxb:jaxb-runtime:4.0.1'
implementation 'org.slf4j:slf4j-simple:1.7.30'
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.3'
testImplementation 'org.junit.platform:junit-platform-launcher:1.9.3'
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.mockito:mockito-core:4.2.0'
testImplementation project(path: ':HIRS_AttestationCA')
compileOnly libs.lombok compileOnly libs.lombok
annotationProcessor libs.lombok annotationProcessor libs.lombok
}
checkstyle { testImplementation libs.spring.boot.starter.test
toolVersion = '10.12.7' testImplementation project(path: ':HIRS_AttestationCA')
configFile file("${rootDir}/config/checkstyle/checkstyle.xml")
} testCompileOnly libs.lombok
// https://github.com/checkstyle/checkstyle/issues/14211#issuecomment-1884129948 testAnnotationProcessor libs.lombok
configurations.checkstyle {
resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") {
select("com.google.guava:guava:0")
}
}
checkstyleMain {
source = 'src/main/java'
}
checkstyleTest {
source = 'src/test/java'
}
tasks.withType(Checkstyle) {
reports {
xml.required = false
html.required = true
}
} }
test { test {

View File

@ -1,9 +1,13 @@
import com.github.spotbugs.snom.SpotBugsTask
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
plugins { plugins {
// Apply the application plugin to add support for building a CLI application in Java. // Apply the application plugin to add support for building a CLI application in Java.
id 'application' id 'application'
id 'com.github.spotbugs' version '6.0.4' apply false id 'checkstyle'
id 'com.github.spotbugs' version '6.0.13' apply false
id 'java'
} }
// Global checkstyle file // Global checkstyle file
@ -11,12 +15,44 @@ ext.checkstyleConfigFile = new File(rootDir, "/config/checkstyle/sun_checks.xml"
subprojects { subprojects {
apply plugin: "com.github.spotbugs" apply plugin: "com.github.spotbugs"
apply plugin: "java"
apply plugin: "checkstyle"
repositories {
flatDir { dirs "lib" }
mavenCentral()
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
checkstyle {
toolVersion = '10.20.0'
configFile file("${rootDir}/config/checkstyle/checkstyle.xml")
}
checkstyleMain {
source = 'src/main/java'
}
checkstyleTest {
source = 'src/test/java'
}
tasks.withType(Checkstyle).configureEach {
reports {
xml.required = false
html.required = true
}
}
spotbugs { spotbugs {
excludeFilter = file('config/spotbugs/spotbugs-exclude.xml') excludeFilter = file('config/spotbugs/spotbugs-exclude.xml')
} }
tasks.withType(com.github.spotbugs.snom.SpotBugsTask) { tasks.withType(SpotBugsTask).configureEach {
reports { reports {
html.required = true html.required = true
} }

View File

@ -1,7 +1,5 @@
excludeGroups=rhel-6,performance excludeGroups=rhel-6,performance
includeGroups= includeGroups=
org.gradle.daemon=true org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m org.gradle.jvmargs=-Xms1g -Xmx4g
org.gradle.caching=true org.gradle.caching=true
#dependency versions
spotBugAnnotationVersion=4.8.6

70
gradle/versions.toml Normal file
View File

@ -0,0 +1,70 @@
[versions]
apacheHttpClientVersion = "4.5.14"
bouncyCastleVersion = "1.79"
commonsCodecVersion = "1.17.1"
commonsIoVersion = "2.18.0"
commonsLang3Version = "3.17.0"
gsonVersion = "2.11.0"
glassfishJakartaJsonVersion = "2.0.1"
glassfishJaxbRuntimeVersion = "4.0.5"
guavaVersion = "33.3.1-jre"
jacksonVersion = "2.18.2"
jakartaPersistenceApiVersion = "3.2.0"
jakartaServletVersion = "3.0.0"
jakartaXmlVersion = "4.0.2"
jcommanderVersion = "2.0"
lombokVersion = "1.18.36"
mariadbVersion = "3.5.1"
minimalJsonVersion = "0.9.5"
ospackageVersion = "11.2.0"
pciVersion = "0.3"
protobufJavaVersion = "4.28.3"
springBootVersion = "3.4.0"
springCoreVersion = "6.2.1"
springRetryVersion = "2.0.10"
testngVersion = "7.10.2"
tomcatVersion = "10.1.33"
#test dependencies versions
hsqldbVersion = "2.7.3"
slf4jVersion = "2.0.16"
spotBugAnnotationVersion = "4.8.6"
[libraries]
apacheHttpClient = { module = "org.apache.httpcomponents:httpclient", version.ref = "apacheHttpClientVersion" }
bouncycastle = { module = "org.bouncycastle:bcmail-jdk18on", version.ref = "bouncyCastleVersion" }
commons-codec = { module = "commons-codec:commons-codec", version.ref = "commonsCodecVersion" }
commons-io = { module = "commons-io:commons-io", version.ref = "commonsIoVersion" }
commons-lang3 = { module = "org.apache.commons:commons-lang3", version.ref = "commonsLang3Version" }
gson = { module = "com.google.code.gson:gson", version.ref = "gsonVersion" }
glassfish-jakarta-json = { module = "org.glassfish:jakarta.json", version.ref = "glassfishJakartaJsonVersion" }
glassfish-jaxb-runtime = { module = "org.glassfish.jaxb:jaxb-runtime", version.ref = "glassfishJaxbRuntimeVersion" }
guava = { module = "com.google.guava:guava", version.ref = "guavaVersion" }
jackson-core = { module = "com.fasterxml.jackson.core:jackson-core", version.ref = "jacksonVersion" }
jackson-databind = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jacksonVersion" }
jakarta-persistence-api = { module = "jakarta.persistence:jakarta.persistence-api", version.ref = "jakartaPersistenceApiVersion" }
jakarta-servlet = { module = "org.glassfish.web:jakarta.servlet.jsp.jstl", version.ref = "jakartaServletVersion" }
jakarta-xml = { module = "jakarta.xml.bind:jakarta.xml.bind-api", version.ref = "jakartaXmlVersion" }
jcommander = { module = "org.jcommander:jcommander", version.ref = "jcommanderVersion" }
lombok = { module = "org.projectlombok:lombok", version.ref = "lombokVersion" }
mariadb-java-client = { module = "org.mariadb.jdbc:mariadb-java-client", version.ref = "mariadbVersion" }
minimal-json = { module = "com.eclipsesource.minimal-json:minimal-json", version.ref = "minimalJsonVersion" }
pci = { module = "com.github.marandus:pci-ids", version.ref = "pciVersion" }
protobuf-java = { module = "com.google.protobuf:protobuf-java", version.ref = "protobufJavaVersion" }
slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "slf4jVersion" }
spring-boot-starter-data-jpa = { module = "org.springframework.boot:spring-boot-starter-data-jpa", version.ref = "springBootVersion" }
spring-boot-starter-log4j2 = { module = "org.springframework.boot:spring-boot-starter-log4j2", version.ref = "springBootVersion" }
spring-boot-starter-tomcat = { module = "org.springframework.boot:spring-boot-starter-tomcat", version.ref = "springBootVersion" }
spring-boot-starter-validation = { module = "org.springframework.boot:spring-boot-starter-validation", version.ref = "springBootVersion" }
spring-boot-starter-web = { module = "org.springframework.boot:spring-boot-starter-web", version.ref = "springBootVersion" }
spring-framework-webmvc = { module = "org.springframework:spring-webmvc", version.ref = "springCoreVersion" }
spring-retry = { module = "org.springframework.retry:spring-retry", version.ref = "springRetryVersion" }
tomcat-embed-jasper = { module = "org.apache.tomcat.embed:tomcat-embed-jasper", version.ref = "tomcatVersion" }
testng = { module = "org.testng:testng", version.ref = "testngVersion" }
# test dependencies
hsqldb = { module = "org.hsqldb:hsqldb", version.ref = "hsqldbVersion" }
spring-boot-starter-test = { module = "org.springframework.boot:spring-boot-starter-test", version.ref = "springBootVersion" }
spotbugs-annotations = { module = "com.github.spotbugs:spotbugs-annotations", version.ref = "spotBugAnnotationVersion" }
[plugins]

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000 networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@ -9,34 +9,8 @@ include 'HIRS_Utils',
dependencyResolutionManagement { dependencyResolutionManagement {
versionCatalogs { versionCatalogs {
libs { create("libs") {
version('springboot', '3.0.1') from(files("gradle/versions.toml"))
version('jackson', '2.14.2')
library('commons-codec', 'commons-codec:commons-codec:1.15')
library('commons_io', 'commons-io:commons-io:2.11.0')
library('commons-lang3', 'org.apache.commons:commons-lang3:3.13.0')
library('bouncycastle', 'org.bouncycastle:bcmail-jdk18on:1.77')
library('glassfish_json', 'org.glassfish:javax.json:1.1.4')
library('glassfish_jaxb_runtime', 'org.glassfish.jaxb:jaxb-runtime:2.3.1')
library('gson', 'com.google.code.gson:gson:2.10.1')
library('guava', 'com.google.guava:guava:31.1-jre')
library('minimal-json', 'com.eclipsesource.minimal-json:minimal-json:0.9.5')
library('protobuf-java', 'com.google.protobuf:protobuf-java:3.24.1')
library('jakarta-servlet', 'org.glassfish.web:jakarta.servlet.jsp.jstl:3.0.0')
library('jakarta-api', 'jakarta.persistence:jakarta.persistence-api:3.1.0')
library('jakarta-xml', 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.0')
library('jcommander', 'org.jcommander:jcommander:1.83')
library('hibernate-core', 'org.hibernate:hibernate-core:6.1.7.Final')
library('jackson-core', 'com.fasterxml.jackson.core', 'jackson-core').versionRef('jackson')
library('jackson-databind', 'com.fasterxml.jackson.core', 'jackson-databind').versionRef('jackson')
library('pci', 'com.github.marandus:pci-ids:0.3')
library('ospackage', 'com.netflix.nebula:gradle-ospackage-plugin:11.2.0')
library('springdatajpa', 'org.springframework.boot:spring-boot-starter-web:3.0.1')
// library('spring-datajpa', 'org.springframework.boot', 'spring-boot-starter-data-jpa').version('springboot')
// library('spring-datajpa', 'org.springframework.boot', 'spring-boot-starter-web').version('springboot')
// library('spring-datajpa', 'org.springframework.boot', 'spring-boot-starter-validation').version('springboot')
library('lombok', 'org.projectlombok:lombok:1.18.26')
library('testng', 'org.testng:testng:7.4.0')
} }
} }
} }

View File

@ -1,67 +1,33 @@
import java.util.concurrent.TimeUnit
plugins { plugins {
id "java" id "com.netflix.nebula.ospackage" version "11.10.0"
id "com.netflix.nebula.ospackage" version "11.4.0"
id 'checkstyle'
} }
// Get version from main project gradle // Get version from main project gradle
def packVersion = properties.get("packageVersion"); def packVersion = properties.get("packageVersion");
def jarVersion = properties.get("jarVersion"); def jarVersion = properties.get("jarVersion");
java { dependencies {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
repositories {
mavenCentral()
flatDir { dirs "lib" }
}
dependencies {
implementation project(':HIRS_Utils') implementation project(':HIRS_Utils')
implementation libs.jcommander
implementation libs.commons.io implementation libs.commons.io
implementation libs.jcommander
} }
ext.configDir = new File(projectDir, 'config') ext.configDir = new File(projectDir, 'config')
checkstyle {
toolVersion = '10.12.7'
configFile file("${rootDir}/config/checkstyle/checkstyle.xml")
}
// https://github.com/checkstyle/checkstyle/issues/14211#issuecomment-1884129948
configurations.checkstyle {
resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") {
select("com.google.guava:guava:0")
}
}
checkstyleMain {
source ='src/main/java'
}
tasks.withType(Checkstyle) {
reports {
xml.required = false
html.required = true
}
}
jar { jar {
// Keep jar clean: // Keep jar clean:
exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF' exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest { manifest {
attributes( attributes(
"Main-Class": "hirs.tcg_eventlog.Main", "Main-Class": "hirs.tcg_eventlog.Main",
'Class-Path':configurations.runtimeClasspath.files.collect { it.getName() }.join(' ') 'Class-Path': configurations.runtimeClasspath.files.collect { it.getName() }.join(' ')
) )
} }
from { from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
} }
//jar name format: [archiveBaseName]-[archiveAppendix]-[archiveVersion]-[archiveClassifier].[archiveExtension] //jar name format: [archiveBaseName]-[archiveAppendix]-[archiveVersion]-[archiveClassifier].[archiveExtension]
archiveVersion = jarVersion archiveVersion = jarVersion
} }
// Produce packages // Produce packages
@ -75,37 +41,37 @@ ospackage {
user 'root' user 'root'
fileMode = 0755 fileMode = 0755
into ('/opt/eltool/lib') { into('/opt/eltool/lib') {
from jar.outputs.files from jar.outputs.files
from configurations.runtimeClasspath from configurations.runtimeClasspath
} }
into ('/opt/eltool/scripts') { into('/opt/eltool/scripts') {
from ('scripts') { from('scripts') {
exclude { exclude {
FileTreeElement details -> FileTreeElement details ->
details.file.name.endsWith('.bat') details.file.name.endsWith('.bat')
}
} }
}
} }
into ('/opt/eltool/docs') { into('/opt/eltool/docs') {
from ('docs') { from('docs') {
exclude { exclude {
FileTreeElement details -> FileTreeElement details ->
details.file.name.endsWith('.odt') details.file.name.endsWith('.odt')
} }
}
from('./') {
include {
FileTreeElement details ->
details.file.name.endsWith('.md')
}
} }
from('./') {
include {
FileTreeElement details ->
details.file.name.endsWith('.md')
}
}
} }
// Copy vendor-table into /tmp to avoid conflict with the ACA // Copy vendor-table into /tmp to avoid conflict with the ACA
into('/opt/eltool/default-properties') { into('/opt/eltool/default-properties') {
from ('../../HIRS_Utils/src/main/resources/vendor-table.json') { from('../../HIRS_Utils/src/main/resources/vendor-table.json') {
fileMode 0664 fileMode 0664
addParentDirs = true addParentDirs = true
} }
} }
@ -129,11 +95,11 @@ ospackage {
} }
task buildZip(type: Zip){ task buildZip(type: Zip) {
dependsOn jar dependsOn jar
from(tasks.jar.archiveFile){ from(tasks.jar.archiveFile) {
rename( filename -> rename(filename ->
"${project.name}.jar") "${project.name}.jar")
into '/' into '/'
} }

View File

@ -1,83 +1,53 @@
plugins { plugins {
id "java" id 'com.netflix.nebula.ospackage' version '11.10.0'
id 'com.netflix.nebula.ospackage' version '11.4.0' id 'com.intershop.gradle.jaxb' version '7.0.1'
id 'com.intershop.gradle.jaxb' version '5.1.0'
id 'checkstyle'
} }
// Get version from main project gradle // Get version from main project gradle
def packVersion = properties.get("packageVersion"); def packVersion = properties.get("packageVersion");
def jarVersion = properties.get("jarVersion"); def jarVersion = properties.get("jarVersion");
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
repositories {
mavenCentral()
flatDir { dirs "lib" }
}
dependencies { dependencies {
implementation project(':HIRS_Utils') implementation project(':HIRS_Utils')
implementation libs.bouncycastle implementation libs.bouncycastle
implementation libs.glassfish.json implementation libs.commons.codec
implementation libs.glassfish.jaxb.runtime implementation libs.glassfish.jakarta.json
implementation libs.jcommander implementation libs.glassfish.jaxb.runtime
implementation libs.jakarta.api implementation libs.guava
implementation libs.jakarta.xml implementation libs.jcommander
implementation libs.commons.codec implementation libs.jackson.databind
implementation libs.hibernate.core implementation libs.jakarta.persistence.api
implementation libs.jackson.databind implementation libs.jakarta.xml
implementation 'org.apache.logging.log4j:log4j-core:2.19.0' implementation libs.spring.boot.starter.log4j2
implementation libs.guava implementation libs.spring.boot.starter.data.jpa
compileOnly libs.lombok compileOnly libs.lombok
implementation libs.lombok
annotationProcessor libs.lombok annotationProcessor libs.lombok
testImplementation libs.testng testImplementation libs.testng
testCompileOnly libs.lombok
testAnnotationProcessor libs.lombok
} }
test { test {
testLogging.showStandardStreams true testLogging.showStandardStreams true
}
checkstyle {
toolVersion = '10.12.7'
configFile file("${rootDir}/config/checkstyle/checkstyle.xml")
}
// https://github.com/checkstyle/checkstyle/issues/14211#issuecomment-1884129948
configurations.checkstyle {
resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") {
select("com.google.guava:guava:0")
}
}
checkstyleMain {
source ='src/main/java'
}
tasks.withType(Checkstyle) {
reports {
xml.required = false
html.required = true
}
} }
jar { jar {
exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF' exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest { manifest {
attributes "Main-Class": "hirs.swid.Main" attributes "Main-Class": "hirs.swid.Main"
}
from { }
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
} from {
//jar name format: [archiveBaseName]-[archiveAppendix]-[archiveVersion]-[archiveClassifier].[archiveExtension] configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
archiveVersion = jarVersion }
//jar name format: [archiveBaseName]-[archiveAppendix]-[archiveVersion]-[archiveClassifier].[archiveExtension]
archiveVersion = jarVersion
} }
ospackage { ospackage {
@ -90,32 +60,32 @@ ospackage {
user 'root' user 'root'
fileMode = 0755 fileMode = 0755
into ('/opt/rimtool/lib') { into('/opt/rimtool/lib') {
from jar.outputs.files from jar.outputs.files
from configurations.runtimeClasspath from configurations.runtimeClasspath
from 'libs' from 'libs'
} }
into ('/opt/rimtool/scripts') { into('/opt/rimtool/scripts') {
from ('scripts') { from('scripts') {
exclude { exclude {
FileTreeElement details -> FileTreeElement details ->
details.file.name.endsWith('.bat') details.file.name.endsWith('.bat')
}
}
}
into('/opt/rimtool/docs') {
from('./') {
include {
FileTreeElement details ->
details.file.name.endsWith('.md')
}
}
}
into('/opt/rimtool/data') {
from('src/test/resources/') {
} }
}
} }
into ('/opt/rimtool/docs') {
from('./') {
include {
FileTreeElement details ->
details.file.name.endsWith('.md')
}
}
}
into ('/opt/rimtool/data') {
from('src/test/resources/') {
}
}
link("/usr/local/bin/rim", "/opt/rimtool/scripts/rimtool.sh", 0x755) link("/usr/local/bin/rim", "/opt/rimtool/scripts/rimtool.sh", 0x755)
// Post Install // Post Install
@ -125,37 +95,37 @@ ospackage {
} }
buildRpm { buildRpm {
arch = X86_64 arch = X86_64
} }
buildDeb { buildDeb {
arch = 'amd64' arch = 'amd64'
} }
task buildZip(type: Zip){ task buildZip(type: Zip) {
dependsOn jar dependsOn jar
dependsOn jar dependsOn jar
from(tasks.jar.archiveFile){ from(tasks.jar.archiveFile) {
rename( filename -> rename(filename ->
"${project.name}.jar") "${project.name}.jar")
into '/' into '/'
} }
from('./build/resources/test/rim_fields.json'){ from('./build/resources/test/rim_fields.json') {
into '/' into '/'
} }
from('../../.ci/tcg-rim-tool/configs/Base_Rim_Config.json'){ from('../../.ci/tcg-rim-tool/configs/Base_Rim_Config.json') {
into '/' into '/'
} }
from('../../.ci/tcg-rim-tool/eventlogs/TpmLog.bin'){ from('../../.ci/tcg-rim-tool/eventlogs/TpmLog.bin') {
into '/' into '/'
} }
from('../../.ci/tcg-rim-tool/keys/PC_OEM1_rim_signer_rsa_3k_sha384.key'){ from('../../.ci/tcg-rim-tool/keys/PC_OEM1_rim_signer_rsa_3k_sha384.key') {
into '/' into '/'
} }
from('../../.ci/tcg-rim-tool/certs/PC_OEM1_rim_signer_rsa_3k_sha384.pem'){ from('../../.ci/tcg-rim-tool/certs/PC_OEM1_rim_signer_rsa_3k_sha384.pem') {
into '/' into '/'
} }
from('../../.ci/tcg-rim-tool/certs/PC_OEM1_Cert_Chain.pem'){ from('../../.ci/tcg-rim-tool/certs/PC_OEM1_Cert_Chain.pem') {
into '/' into '/'
} }

View File

@ -9,6 +9,10 @@ import hirs.utils.xjc.ObjectFactory;
import hirs.utils.xjc.ResourceCollection; import hirs.utils.xjc.ResourceCollection;
import hirs.utils.xjc.SoftwareIdentity; import hirs.utils.xjc.SoftwareIdentity;
import hirs.utils.xjc.SoftwareMeta; import hirs.utils.xjc.SoftwareMeta;
import jakarta.json.Json;
import jakarta.json.JsonException;
import jakarta.json.JsonObject;
import jakarta.json.JsonReader;
import jakarta.xml.bind.JAXBContext; import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBElement; import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBException; import jakarta.xml.bind.JAXBException;
@ -17,10 +21,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import javax.json.Json;
import javax.json.JsonException;
import javax.json.JsonObject;
import javax.json.JsonReader;
import javax.xml.crypto.MarshalException; import javax.xml.crypto.MarshalException;
import javax.xml.crypto.XMLStructure; import javax.xml.crypto.XMLStructure;
import javax.xml.crypto.dom.DOMStructure; import javax.xml.crypto.dom.DOMStructure;
@ -190,6 +190,7 @@ public class SwidTagGateway {
/** /**
* Setter for timestamp format in XML signature * Setter for timestamp format in XML signature
*
* @param timestampFormat * @param timestampFormat
*/ */
public void setTimestampFormat(String timestampFormat) { public void setTimestampFormat(String timestampFormat) {
@ -198,6 +199,7 @@ public class SwidTagGateway {
/** /**
* Setter for timestamp input - RFC3852 + file or RFC3339 + value * Setter for timestamp input - RFC3852 + file or RFC3339 + value
*
* @param timestampArgument * @param timestampArgument
*/ */
public void setTimestampArgument(String timestampArgument) { public void setTimestampArgument(String timestampArgument) {
@ -269,7 +271,7 @@ public class SwidTagGateway {
writeSwidTagFile(signedSoftwareIdentity, filename); writeSwidTagFile(signedSoftwareIdentity, filename);
} else { } else {
System.out.println("The following fields cannot be empty or null: " System.out.println("The following fields cannot be empty or null: "
+ errorRequiredFields.substring(0, errorRequiredFields.length()-2)); + errorRequiredFields.substring(0, errorRequiredFields.length() - 2));
System.exit(1); System.exit(1);
} }
} catch (JsonException e) { } catch (JsonException e) {
@ -555,6 +557,7 @@ public class SwidTagGateway {
addNonNullAttribute(attributes, key, value); addNonNullAttribute(attributes, key, value);
} }
} }
/** /**
* This utility method checks if an attribute value is empty before adding it to the map. * This utility method checks if an attribute value is empty before adding it to the map.
* *
@ -707,7 +710,8 @@ public class SwidTagGateway {
/** /**
* This method creates a timestamp element and populates it with data according to * This method creates a timestamp element and populates it with data according to
* the RFC format set in timestampFormat. The element is returned within an XMLObject. * the RFC format set in timestampFormat. The element is returned within an XMLObject.
* @param doc the Document representing the XML to be signed *
* @param doc the Document representing the XML to be signed
* @param sigFactory the SignatureFactory object * @param sigFactory the SignatureFactory object
* @return an XMLObject containing the timestamp element * @return an XMLObject containing the timestamp element
*/ */
@ -735,7 +739,7 @@ public class SwidTagGateway {
timeStampElement = doc.createElementNS(SwidTagConstants.RFC3339_NS, timeStampElement = doc.createElementNS(SwidTagConstants.RFC3339_NS,
SwidTagConstants.RFC3339_PFX + ":TimeStamp"); SwidTagConstants.RFC3339_PFX + ":TimeStamp");
timeStampElement.setAttributeNS("http://www.w3.org/2000/xmlns/", timeStampElement.setAttributeNS("http://www.w3.org/2000/xmlns/",
"xmlns:" + SwidTagConstants.RFC3339_PFX, SwidTagConstants.RFC3339_NS); "xmlns:" + SwidTagConstants.RFC3339_PFX, SwidTagConstants.RFC3339_NS);
if (timestampArgument.isEmpty()) { if (timestampArgument.isEmpty()) {
timeStampElement.setAttributeNS(SwidTagConstants.RFC3339_NS, timeStampElement.setAttributeNS(SwidTagConstants.RFC3339_NS,
SwidTagConstants.RFC3339_PFX + ":" + SwidTagConstants.DATETIME, SwidTagConstants.RFC3339_PFX + ":" + SwidTagConstants.DATETIME,
@ -754,7 +758,7 @@ public class SwidTagGateway {
SignatureProperties signatureProperties = sigFactory.newSignatureProperties( SignatureProperties signatureProperties = sigFactory.newSignatureProperties(
Collections.singletonList(signatureProperty), null); Collections.singletonList(signatureProperty), null);
XMLObject xmlObject = sigFactory.newXMLObject( XMLObject xmlObject = sigFactory.newXMLObject(
Collections.singletonList(signatureProperties), null,null,null); Collections.singletonList(signatureProperties), null, null, null);
return xmlObject; return xmlObject;
} }