diff --git a/HIRS_AttestationCA/build.gradle b/HIRS_AttestationCA/build.gradle index 28a586b2..09dc726e 100644 --- a/HIRS_AttestationCA/build.gradle +++ b/HIRS_AttestationCA/build.gradle @@ -27,15 +27,16 @@ 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.spring.data.jpa.datatables + implementation libs.spring.boot.starter.data.jpa + implementation libs.spring.retry + implementation libs.spring.boot.starter.web implementation libs.bouncycastle implementation libs.commons.codec implementation libs.commons.lang3 - implementation libs.jakarta.api + implementation libs.jakarta.persistence.api implementation libs.jakarta.xml implementation libs.hibernate.core implementation libs.pci @@ -44,18 +45,18 @@ dependencies { implementation libs.jackson.databind implementation libs.minimal.json 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.log4j.api + implementation libs.log4j.core - 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' + testImplementation libs.apache.commons.io + testImplementation libs.hamcrest + testImplementation libs.junit.jupiter + testImplementation libs.junit.platform.launcher + testImplementation libs.mockito.core + testImplementation libs.spring.test - compileOnly "com.github.spotbugs:spotbugs-annotations:${spotBugAnnotationVersion}" - annotationProcessor "com.github.spotbugs:spotbugs-annotations:${spotBugAnnotationVersion}" + compileOnly libs.spotbugs.annotations + annotationProcessor libs.spotbugs.annotations // spring management compileOnly libs.lombok diff --git a/HIRS_AttestationCAPortal/build.gradle b/HIRS_AttestationCAPortal/build.gradle index 310f0834..9e629013 100644 --- a/HIRS_AttestationCAPortal/build.gradle +++ b/HIRS_AttestationCAPortal/build.gradle @@ -47,26 +47,28 @@ dependencies { implementation libs.bouncycastle implementation libs.guava implementation libs.jakarta.servlet - implementation libs.jakarta.api + implementation libs.jakarta.persistence.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' + //implementation libs. - 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.spring.boot.starter.web + implementation libs.spring.boot.starter.validation + implementation libs.spring.boot.starter.data.jpa + implementation libs.spring.boot.starter.log4j2 + implementation libs.log4j.spring.boot + implementation libs.lombok + implementation libs.commons.fileupload + 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 + implementation libs.mariadb.java.client + annotationProcessor libs.lombok + providedRuntime libs.spring.boot.starter.tomcat + + testImplementation libs.spring.boot.starter.test + testImplementation libs.junit.jupiter + testImplementation libs.hsqldb } checkstyle { diff --git a/HIRS_Structs/build.gradle b/HIRS_Structs/build.gradle index b3c6a5f9..b363392b 100644 --- a/HIRS_Structs/build.gradle +++ b/HIRS_Structs/build.gradle @@ -16,12 +16,12 @@ repositories { } 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' + testImplementation libs.junit.jupiter + testImplementation libs.junit.platform.launcher + testImplementation libs.hamcrest } test { diff --git a/HIRS_Utils/build.gradle b/HIRS_Utils/build.gradle index 4a2dad4f..6f1d0695 100644 --- a/HIRS_Utils/build.gradle +++ b/HIRS_Utils/build.gradle @@ -31,7 +31,7 @@ dependencies { implementation libs.lombok implementation libs.jackson.core implementation libs.jackson.databind - implementation libs.jakarta.api + implementation libs.jakarta.persistence.api implementation libs.jakarta.xml implementation libs.guava implementation libs.commons.codec @@ -40,15 +40,15 @@ dependencies { implementation libs.minimal.json implementation libs.pci - 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' + implementation libs.log4j.core + implementation libs.log4j.api + implementation libs.glassfish.jaxb.runtime + implementation libs.slf4j.simple - 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 libs.junit.jupiter + testImplementation libs.junit.platform.launcher + testImplementation libs.hamcrest + testImplementation libs.mockito.core testImplementation project(path: ':HIRS_AttestationCA') compileOnly libs.lombok diff --git a/gradle.properties b/gradle.properties index b4b6c6a7..ebee5b8e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,6 +2,4 @@ excludeGroups=rhel-6,performance includeGroups= org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -org.gradle.caching=true -#dependency versions -spotBugAnnotationVersion=4.8.6 \ No newline at end of file +org.gradle.caching=true \ No newline at end of file diff --git a/gradle/versions.toml b/gradle/versions.toml new file mode 100644 index 00000000..60b9e22e --- /dev/null +++ b/gradle/versions.toml @@ -0,0 +1,87 @@ +[versions] +bouncyCastleVersion = "1.77" +commonsCodecVersion = "1.15" +commonsFileuploadVersion = "1.5" +commonsIoVersion = "2.11.0" +commonsLang3Version = "3.13.0" +gsonVersion = "2.10.1" +glassfishJsonVersion = "1.1.4" +glassfishJaxbRuntimeVersion = "2.3.1" +guavaVersion = "31.1-jre" +hibernateCoreVersion = "6.1.7.Final" +jacksonVersion = "2.14.2" +jakartaApiVersion = "3.1.0" +jakartaServletVersion = "3.0.0" +jakartaXmlVersion = "4.0.0" +jcommanderVersion = "1.83" +log4jVersion = "2.19.0" +lombokVersion = "1.18.26" +mariadbVersion = "3.1.4" +minimalJsonVersion = "0.9.5" +ospackageVersion = "11.2.0" +pciVersion = "0.3" +protobufJavaVersion = "3.24.1" +springBootVersion = "3.0.1" +springDataJpaDatatablesVersion = "6.0.1" +springRetryVersion = "2.0.0" +testngVersion = "7.4.0" +tomcatVersion = "10.1.5" + +#test dependencies versions +apacheCommonsVersion = "2.4" +hamcrestVersion = "2.2" +hsqldbVersion = "2.7.2" +junitJupiterVersion = "5.9.3" +junitPlatformVersion = "1.9.3" +mockitoVersion = "4.2.0" +slf4jVersion = "1.7.30" +springTestVersion = "6.0.8" +spotBugAnnotationVersion = "4.8.6" + +[libraries] +bouncycastle = { module = "org.bouncycastle:bcmail-jdk18on", version.ref = "bouncyCastleVersion" } +commons-codec = { module = "commons-codec:commons-codec", version.ref = "commonsCodecVersion" } +commons-fileupload = { module = "commons-fileupload:commons-fileupload", version.ref = "commonsFileuploadVersion" } +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-javax-json = { module = "org.glassfish:javax.json", version.ref = "glassfishJsonVersion" } +glassfish-jaxb-runtime = { module = "org.glassfish.jaxb:jaxb-runtime", version.ref = "glassfishJaxbRuntimeVersion" } +guava = { module = "com.google.guava:guava", version.ref = "guavaVersion" } +hibernate-core = { module = "org.hibernate:hibernate-core", version.ref = "hibernateCoreVersion" } +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 = "jakartaApiVersion" } +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" } +log4j-api = { module = "org.apache.logging.log4j:log4j-api", version.ref = "log4jVersion" } +log4j-core = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4jVersion" } +log4j-spring-boot = { module = "org.apache.logging.log4j:log4j-spring-boot", version.ref = "log4jVersion" } +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" } +ospackage = { module = "com.netflix.nebula:gradle-ospackage-plugin", version.ref = "ospackageVersion" } +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-data-jpa-datatables = { module = "com.github.darrachequesne:spring-data-jpa-datatables", version.ref = "springDataJpaDatatablesVersion" } +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 +apache-commons-io = { module = "org.apache.directory.studio:org.apache.commons.io", version.ref = "apacheCommonsVersion" } +hamcrest = { module = "org.hamcrest:hamcrest", version.ref = "hamcrestVersion" } +hsqldb = { module = "org.hsqldb:hsqldb", version.ref = "hsqldbVersion" } +junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junitJupiterVersion" } +junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "junitPlatformVersion" } +mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockitoVersion" } +spring-test = { module = "org.springframework:spring-test", version.ref = "springTestVersion" } +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" } \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 1d09049c..591b9bb8 100644 --- a/settings.gradle +++ b/settings.gradle @@ -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")) } } -} +} \ No newline at end of file diff --git a/tools/tcg_rim_tool/build.gradle b/tools/tcg_rim_tool/build.gradle index 92921f72..101c5e52 100644 --- a/tools/tcg_rim_tool/build.gradle +++ b/tools/tcg_rim_tool/build.gradle @@ -1,8 +1,8 @@ plugins { - id "java" - id 'com.netflix.nebula.ospackage' version '11.4.0' - id 'com.intershop.gradle.jaxb' version '5.1.0' - id 'checkstyle' + id "java" + id 'com.netflix.nebula.ospackage' version '11.4.0' + id 'com.intershop.gradle.jaxb' version '5.1.0' + id 'checkstyle' } // Get version from main project gradle @@ -16,33 +16,33 @@ java { } repositories { - mavenCentral() - flatDir { dirs "lib" } + 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.glassfish.javax.json + implementation libs.glassfish.jaxb.runtime + implementation libs.jcommander + implementation libs.jakarta.persistence.api + implementation libs.jakarta.xml + implementation libs.commons.codec + implementation libs.hibernate.core + implementation libs.jackson.databind + implementation libs.log4j.core + implementation libs.guava - compileOnly libs.lombok + compileOnly libs.lombok implementation libs.lombok annotationProcessor libs.lombok testImplementation libs.testng } test { - testLogging.showStandardStreams true + testLogging.showStandardStreams true } checkstyle { @@ -56,7 +56,7 @@ configurations.checkstyle { } } checkstyleMain { - source ='src/main/java' + source = 'src/main/java' } tasks.withType(Checkstyle) { reports { @@ -68,16 +68,16 @@ tasks.withType(Checkstyle) { 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 +90,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 +125,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 '/' }