updated with package for tcg_rim_tool [no ci]

This commit is contained in:
iadgovuser26 iadgovuser26@empire.eclipse.ncsc.mil 2023-03-17 14:47:10 -04:00
parent d862e95708
commit ef65c6ad8b
11 changed files with 143 additions and 55 deletions

View File

@ -7,6 +7,11 @@ plugins {
id 'io.spring.dependency-management' version '1.1.0'
}
// 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)
@ -53,3 +58,5 @@ war {
}
archiveFileName = 'HIRS_AttestationCAPortal.war'
}

View File

@ -1,6 +1,11 @@
plugins {
id 'java'
}
// Get version from main project gradle
def packVersion = properties.get("packageVersion");
def jarVersion = properties.get("jarVersion");
//println "packageVersion is ${projVersion}"
java {
toolchain {
@ -10,7 +15,6 @@ java {
repositories {
mavenCentral()
flatDir { dirs "lib" }
}
@ -47,9 +51,13 @@ test {
useJUnitPlatform()
}
//task generateXjcLibrary(type:Exec) {
// workingDir 'config'
//
// commandLine './genXjcLibrary.sh'
//}
//compileJava.dependsOn generateXjcLibrary
jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes(
'Class-Path': configurations.runtimeClasspath.files.collect { it.getName() }.join(' ')
)
}
//jar name format: [archiveBaseName]-[archiveAppendix]-[archiveVersion]-[archiveClassifier].[archiveExtension]
archiveVersion = jarVersion
}

View File

@ -257,14 +257,7 @@ public final class TCGEventLog {
return pcrs;
}
/**
* Returns a flag which is set if the event log follows the "Crypto Agile" Format Type.
* A false implies the type is SHA1 format.
* @return true if log follows the Crypto Agile format.
*/
public boolean isCryptoAgile() {
return bCryptoAgile;
}
/**
* Returns a list of event found in the Event Log.

View File

@ -36,6 +36,7 @@ def gitHash = { ->
return gitHash;
}
project.ext["jarVersion"] = "${projectVersion}.${buildTime}.${gitHash}"
project.ext["packageVersion"] = "${projectVersion}.${buildTime}.${gitHash}.el8"
//subprojects {

View File

@ -2,3 +2,4 @@ excludeGroups=rhel-6,performance
includeGroups=
org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m
org.gradle.caching=true

View File

@ -3,17 +3,20 @@ rootProject.name = 'HIRS'
include 'HIRS_Utils',
'HIRS_AttestationCA',
'HIRS_AttestationCAPortal',
':tools:tcg_eventlog_tool'
':tools:tcg_eventlog_tool',
':tools:tcg_rim_tool'
dependencyResolutionManagement {
versionCatalogs {
libs {
version('springboot', '3.0.1')
version('jackson', '2.14.2')
library('bouncycastle', 'org.bouncycastle:bcmail-jdk15on:1.70')
library('commons-codec', 'commons-codec:commons-codec:1.15')
library('commons-lang3', 'org.apache.commons:commons-lang3:3.12.0')
library('commons_io', 'commons-io:commons-io:2.11.0')
library('bouncycastle', 'org.bouncycastle:bcmail-jdk15on:1.70')
library('commons_io', 'commons-io:commons-io:2.11.0')
library('glassfish_json', 'org.glassfish:javax.json:1.1.4')
library('glassfish_jaxb_runtime', 'org.glassfish.jaxb:jaxb-runtime:2.3.1')
library('guava', 'com.google.guava:guava:31.1-jre')
library('minimal-json', 'com.eclipsesource.minimal-json:minimal-json:0.9.5')
library('jakarta-servlet', 'org.glassfish.web:jakarta.servlet.jsp.jstl:3.0.0')
@ -21,12 +24,15 @@ dependencyResolutionManagement {
library('jakarta-xml', 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.0')
library('jackson-core', 'com.fasterxml.jackson.core', 'jackson-core').versionRef('jackson')
library('jackson-databind', 'com.fasterxml.jackson.core', 'jackson-databind').versionRef('jackson')
library('jcommander', 'com.beust:jcommander:1.82')
library('jcommander', 'com.beust:jcommander:1.82')
// library('log4j2', 'org.apache.logging.log4j:log4j-api:2.17.1')
// library('log4j2-core', 'org.apache.logging.log4j:log4j-core:2.17.1')
library('lombok', 'org.projectlombok:lombok:1.18.26')
library('pci', 'com.github.marandus:pci-ids:0.3')
library('testng', 'org.testng:testng:7.4.0')
// 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')
}
}
}

View File

@ -1,12 +1,14 @@
import java.util.concurrent.TimeUnit
plugins {
id "java"
// id "findbugs"
// id "checkstyle"
id "nebula.ospackage" version "9.1.1"
}
version = '1.0'
// Get version from main project gradle
def packVersion = properties.get("packageVersion");
def jarVersion = properties.get("jarVersion");
//println "packageVersion is ${projVersion}"
java {
toolchain {
@ -16,9 +18,10 @@ java {
repositories {
mavenCentral()
flatDir { dirs "lib" }
}
dependencies {
dependencies {
implementation project(':HIRS_Utils')
implementation libs.jcommander
implementation libs.commons.io
@ -39,7 +42,6 @@ ext.configDir = new File(projectDir, 'config')
// showViolations = true
//}
//findbugs {
// toolVersion = '3.0.0'
// ignoreFailures = false
@ -47,19 +49,18 @@ ext.configDir = new File(projectDir, 'config')
//}
jar {
exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF'
// 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(' ')
'Class-Path':configurations.runtimeClasspath.files.collect { it.getName() }.join(' ')
)
}
// from(configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }) {}
// exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
}
//jar name format: [archiveBaseName]-[archiveAppendix]-[archiveVersion]-[archiveClassifier].[archiveExtension]
archiveVersion = jarVersion
}
// Get version from main project gradle
def packVersion = properties.get("packageVersion");
//println "packageVersion is ${projVersion}"
// Produce packages
ospackage {
@ -74,8 +75,7 @@ ospackage {
into ('/opt/hirs/eventlog/lib') {
from jar.outputs.files
from 'lib'
from 'configurations.runtimeClasspath'
from configurations.runtimeClasspath
}
into ('/opt/hirs/eventlog/scripts') {
from ('scripts') {
@ -92,6 +92,12 @@ ospackage {
details.file.name.endsWith('.odt')
}
}
from('./') {
include {
FileTreeElement details ->
details.file.name.endsWith('.md')
}
}
}
// Copy vendor-table into /tmp to avoid conflict with the ACA
into('/tmp/elt/default-properties') {
@ -105,10 +111,11 @@ ospackage {
link("/usr/local/bin/elt", "/opt/hirs/eventlog/scripts/eventlog.sh", 0x755)
// PostInstall
//postInstall "cp ../../HIRS_Utils/build/libs/* /opt/hirs/eventlog/lib/."
// Copy files from /opt/elt/default-properties/ to avoid conflicts with the ACA
postInstall "cp /tmp/elt/default-properties/vendor-table.json /opt/hirs/default-properties/."
postInstall "rm -rf /tmp/elt"
postInstall "cp /tmp/elt/default-properties/* /opt/hirs/default-properties/."
postInstall "rm -rf /tmp/elt"
// Uninstall
// copy files to where package manager exspects them and remove project files
preUninstall "mkdir -p /tmp/elt/default-properties"
@ -121,4 +128,4 @@ ospackage {
buildDeb {
arch = X86_64
}
}
}

View File

@ -4,5 +4,5 @@
scriptDir=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")")
baseDir=${scriptDir%/*}
libDir=$baseDir"/lib/"
jar="tcg_eventlog_tool-1.0.jar";
jar="tcg_eventlog_tool-*.jar";
java -jar $libDir$jar "$@"

View File

@ -115,7 +115,7 @@ final class Main {
// General event log output
if ((bEventFlag || bHexFlag) && !bPcrFlag) {
if (!bHexFlag) {
if (evLog.isCryptoAgile()) {
if (evLog.isBCryptoAgile()) {
writeOut("\nEvent Log follows the \"Crypto Agile\" format and has "
+ evLog.getEventList().size() + " events:\n\n");
} else {

View File

@ -1,12 +1,35 @@
apply plugin: 'java'
plugins {
id "java"
id "nebula.ospackage" version "9.1.1"
id 'com.intershop.gradle.jaxb' version '5.1.0'
}
// 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" }
}
dependencies {
compile 'javax.json:javax.json-api:1.1.4', 'org.glassfish:javax.json:1.1.4', 'com.beust:jcommander:1.72', 'org.bouncycastle:bcmail-jdk15on:1.59'
testCompile 'org.testng:testng:6.8.8'
implementation libs.bouncycastle
implementation libs.glassfish.json
implementation libs.glassfish.jaxb.runtime
implementation libs.jcommander
// implementation libs.javax.json
// implementation libs.javax.jaxb
// implementation libs.javax.annotation
testImplementation libs.testng
}
test {
@ -14,19 +37,61 @@ test {
}
jar {
exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF'
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes("Main-Class": "hirs.swid.Main",
"Class-Path": configurations.runtime.files.collect { "lib/$it.name" }.join(' ')
'Class-Path':configurations.runtimeClasspath.files.collect { it.getName() }.join(' ')
)
}
from(configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }) {}
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
//jar name format: [archiveBaseName]-[archiveAppendix]-[archiveVersion]-[archiveClassifier].[archiveExtension]
archiveVersion = jarVersion
}
uploadArchives {
repositories {
flatDir {
dirs "${buildDir}"
}
}
ospackage {
packageName = 'tcg-rim-tool'
os = LINUX
arch = NOARCH
version = "$packVersion"
release = '1'
user 'root'
fileMode = 0755
into ('/opt/hirs/rimtool/lib') {
from jar.outputs.files
from configurations.runtimeClasspath
from 'libs'
}
into ('/opt/hirs/rimtool/scripts') {
from ('scripts') {
exclude {
FileTreeElement details ->
details.file.name.endsWith('.bat')
}
}
}
into ('/opt/hirs/rimtool/docs') {
from('./') {
include {
FileTreeElement details ->
details.file.name.endsWith('.md')
}
}
}
into ('/opt/hirs/rimtool/data') {
from('src/test/resources/') {
}
}
link("/usr/local/bin/rim", "/opt/hirs/rimtool/scripts/rimtool.sh", 0x755)
}
buildRpm {
arch = X86_64
}
buildDeb {
arch = 'amd64'
}

View File

@ -3,6 +3,6 @@
# Calls the the_tcg_rim_tool and passes in parameters
scriptDir=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")")
baseDir=${scriptDir%/*}
jar="tcg_rim_tool-2.1.0.jar";
java -jar $baseDir/$jar "$@"
libDir=$baseDir"/lib/"
jar="tcg_rim_tool-*.jar";
java -jar $libDir$jar "$@"