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 {
id 'java'
id 'io.spring.dependency-management' version '1.1.0'
id 'io.spring.dependency-management' version '1.1.7'
id 'com.google.protobuf' version '0.9.4'
id 'checkstyle'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
repositories {
mavenCentral()
flatDir { dirs "lib" }
}
configurations {
@ -27,63 +13,42 @@ dependencies {
implementation project(':HIRS_Utils')
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.commons.codec
implementation libs.commons.io
implementation libs.commons.lang3
implementation libs.jakarta.api
implementation libs.jakarta.xml
implementation libs.hibernate.core
implementation libs.pci
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
// 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 'org.apache.logging.log4j:log4j-core:2.19.0'
implementation 'org.apache.logging.log4j:log4j-api:2.19.0'
implementation libs.spring.boot.starter.data.jpa
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
implementation 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 {
protoc {
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)
@NonNull
private String name;
private String name = "";
@ToString.Exclude
@Column(nullable = false, unique = false)
@Column(nullable = false)
@NonNull
private String description = "";

View File

@ -1,25 +1,17 @@
plugins {
id 'application'
id 'java'
id 'war'
id 'com.netflix.nebula.ospackage' version '11.8.0'
id 'org.springframework.boot' version '3.0.6'
id 'io.spring.dependency-management' version '1.1.0'
id 'checkstyle'
id 'com.netflix.nebula.ospackage' version '11.10.0'
id 'org.springframework.boot' version '3.0.13'
id 'io.spring.dependency-management' version '1.1.7'
}
// Get version from main project gradle
def packVersion = properties.get("packageVersion");
def jarVersion = properties.get("jarVersion");
def projVersion = properties.get("projVersion");
def packVersion = properties.get("packageVersion")
def jarVersion = properties.get("jarVersion")
def projVersion = properties.get("projVersion")
//println "packageVersion is ${projVersion}"
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
bootRun {
if (project.hasProperty('debug')) {
jvmArgs project.debug
@ -33,63 +25,40 @@ configurations {
all*.exclude module: 'spring-boot-starter-logging'
}
repositories {
flatDir { dirs "lib" }
mavenCentral()
}
dependencies {
implementation project(':HIRS_Utils')
implementation project(':HIRS_AttestationCA')
implementation libs.pci
implementation libs.gson
implementation libs.bouncycastle
implementation libs.guava
implementation libs.gson
implementation libs.jakarta.persistence.api
implementation libs.jakarta.servlet
implementation libs.jakarta.api
implementation libs.jakarta.xml
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-log4j2'
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'
// pull the pci dependency and ...
implementation libs.pci
// and explicitly include the patched version of the apache http client dependency
implementation libs.apacheHttpClient
compileOnly 'org.projectlombok:lombok'
implementation 'org.mariadb.jdbc:mariadb-java-client:3.1.4'
annotationProcessor 'org.projectlombok:lombok'
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
implementation libs.mariadb.java.client
implementation libs.spring.boot.starter.web
//implementation libs.spring.framework.webmvc
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'
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.3'
testImplementation 'org.hsqldb:hsqldb'
}
compileOnly libs.lombok
annotationProcessor 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
}
providedRuntime libs.spring.boot.starter.tomcat
testImplementation libs.hsqldb
testImplementation libs.spring.boot.starter.test
testCompileOnly libs.lombok
testAnnotationProcessor libs.lombok
}
test {

View File

@ -1,56 +1,19 @@
plugins {
id 'java'
id 'checkstyle'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
repositories {
mavenCentral()
flatDir { dirs "lib" }
}
dependencies {
implementation 'org.apache.commons:commons-lang3:3.13.0'
implementation libs.commons.lang3
// testCompile libs.mockito
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'
compileOnly libs.lombok
annotationProcessor libs.lombok
testImplementation libs.spring.boot.starter.test
testCompileOnly libs.lombok
testAnnotationProcessor libs.lombok
}
test {
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 {
// publications {
// 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
def packVersion = properties.get("packageVersion")
def jarVersion = properties.get("jarVersion")
//println "packageVersion is ${projVersion}"
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
repositories {
mavenCentral()
flatDir { dirs "lib" }
}
configurations {
compileOnly {
extendsFrom annotationProcessor
@ -28,54 +12,33 @@ configurations {
dependencies {
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.lang3
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
// pull the pci dependency and ...
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 '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')
implementation libs.slf4j.simple
compileOnly libs.lombok
annotationProcessor 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
}
testImplementation libs.spring.boot.starter.test
testImplementation project(path: ':HIRS_AttestationCA')
testCompileOnly libs.lombok
testAnnotationProcessor libs.lombok
}
test {

View File

@ -1,9 +1,13 @@
import com.github.spotbugs.snom.SpotBugsTask
import java.util.concurrent.TimeUnit
plugins {
// Apply the application plugin to add support for building a CLI application in Java.
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
@ -11,12 +15,44 @@ ext.checkstyleConfigFile = new File(rootDir, "/config/checkstyle/sun_checks.xml"
subprojects {
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 {
excludeFilter = file('config/spotbugs/spotbugs-exclude.xml')
}
tasks.withType(com.github.spotbugs.snom.SpotBugsTask) {
tasks.withType(SpotBugsTask).configureEach {
reports {
html.required = true
}

View File

@ -1,7 +1,5 @@
excludeGroups=rhel-6,performance
includeGroups=
org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m
org.gradle.jvmargs=-Xms1g -Xmx4g
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
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
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -9,34 +9,8 @@ include 'HIRS_Utils',
dependencyResolutionManagement {
versionCatalogs {
libs {
version('springboot', '3.0.1')
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')
create("libs") {
from(files("gradle/versions.toml"))
}
}
}

View File

@ -1,67 +1,33 @@
import java.util.concurrent.TimeUnit
plugins {
id "java"
id "com.netflix.nebula.ospackage" version "11.4.0"
id 'checkstyle'
id "com.netflix.nebula.ospackage" version "11.10.0"
}
// Get version from main project gradle
def packVersion = properties.get("packageVersion");
def jarVersion = properties.get("jarVersion");
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
repositories {
mavenCentral()
flatDir { dirs "lib" }
}
dependencies {
implementation project(':HIRS_Utils')
implementation libs.jcommander
implementation libs.commons.io
implementation libs.jcommander
}
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 {
// Keep jar clean:
exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes(
"Main-Class": "hirs.tcg_eventlog.Main",
'Class-Path':configurations.runtimeClasspath.files.collect { it.getName() }.join(' ')
)
}
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
//jar name format: [archiveBaseName]-[archiveAppendix]-[archiveVersion]-[archiveClassifier].[archiveExtension]
archiveVersion = jarVersion
"Main-Class": "hirs.tcg_eventlog.Main",
'Class-Path': configurations.runtimeClasspath.files.collect { it.getName() }.join(' ')
)
}
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
//jar name format: [archiveBaseName]-[archiveAppendix]-[archiveVersion]-[archiveClassifier].[archiveExtension]
archiveVersion = jarVersion
}
// Produce packages
@ -75,37 +41,37 @@ ospackage {
user 'root'
fileMode = 0755
into ('/opt/eltool/lib') {
from jar.outputs.files
from configurations.runtimeClasspath
into('/opt/eltool/lib') {
from jar.outputs.files
from configurations.runtimeClasspath
}
into ('/opt/eltool/scripts') {
from ('scripts') {
exclude {
FileTreeElement details ->
details.file.name.endsWith('.bat')
into('/opt/eltool/scripts') {
from('scripts') {
exclude {
FileTreeElement details ->
details.file.name.endsWith('.bat')
}
}
}
}
into ('/opt/eltool/docs') {
from ('docs') {
exclude {
FileTreeElement details ->
details.file.name.endsWith('.odt')
}
into('/opt/eltool/docs') {
from('docs') {
exclude {
FileTreeElement details ->
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
into('/opt/eltool/default-properties') {
from ('../../HIRS_Utils/src/main/resources/vendor-table.json') {
fileMode 0664
addParentDirs = true
from('../../HIRS_Utils/src/main/resources/vendor-table.json') {
fileMode 0664
addParentDirs = true
}
}
@ -129,11 +95,11 @@ ospackage {
}
task buildZip(type: Zip){
task buildZip(type: Zip) {
dependsOn jar
from(tasks.jar.archiveFile){
rename( filename ->
"${project.name}.jar")
from(tasks.jar.archiveFile) {
rename(filename ->
"${project.name}.jar")
into '/'
}

View File

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

View File

@ -9,6 +9,10 @@ import hirs.utils.xjc.ObjectFactory;
import hirs.utils.xjc.ResourceCollection;
import hirs.utils.xjc.SoftwareIdentity;
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.JAXBElement;
import jakarta.xml.bind.JAXBException;
@ -17,10 +21,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
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.XMLStructure;
import javax.xml.crypto.dom.DOMStructure;
@ -190,6 +190,7 @@ public class SwidTagGateway {
/**
* Setter for timestamp format in XML signature
*
* @param timestampFormat
*/
public void setTimestampFormat(String timestampFormat) {
@ -198,6 +199,7 @@ public class SwidTagGateway {
/**
* Setter for timestamp input - RFC3852 + file or RFC3339 + value
*
* @param timestampArgument
*/
public void setTimestampArgument(String timestampArgument) {
@ -269,7 +271,7 @@ public class SwidTagGateway {
writeSwidTagFile(signedSoftwareIdentity, filename);
} else {
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);
}
} catch (JsonException e) {
@ -555,6 +557,7 @@ public class SwidTagGateway {
addNonNullAttribute(attributes, key, value);
}
}
/**
* 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
* 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
* @return an XMLObject containing the timestamp element
*/
@ -735,7 +739,7 @@ public class SwidTagGateway {
timeStampElement = doc.createElementNS(SwidTagConstants.RFC3339_NS,
SwidTagConstants.RFC3339_PFX + ":TimeStamp");
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()) {
timeStampElement.setAttributeNS(SwidTagConstants.RFC3339_NS,
SwidTagConstants.RFC3339_PFX + ":" + SwidTagConstants.DATETIME,
@ -754,7 +758,7 @@ public class SwidTagGateway {
SignatureProperties signatureProperties = sigFactory.newSignatureProperties(
Collections.singletonList(signatureProperty), null);
XMLObject xmlObject = sigFactory.newXMLObject(
Collections.singletonList(signatureProperties), null,null,null);
Collections.singletonList(signatureProperties), null, null, null);
return xmlObject;
}