mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-06-24 01:28:45 +00:00
Added build and package creation for tcg_eventlog_tool [no ci]
This commit is contained in:
committed by
iadgovuser26 iadgovuser26@empire.eclipse.ncsc.mil
parent
3a5f210b2f
commit
d862e95708
@ -1,122 +1,119 @@
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'findbugs'
|
||||
apply plugin: 'checkstyle'
|
||||
apply plugin: 'nebula.ospackage'
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
plugins {
|
||||
id "java"
|
||||
// id "findbugs"
|
||||
// id "checkstyle"
|
||||
id "nebula.ospackage" version "9.1.1"
|
||||
}
|
||||
version = '1.0'
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(17)
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(':HIRS_Utils')
|
||||
compile libs.jcommander
|
||||
compile libs.commons_io
|
||||
compileOnly libs.checkstyle
|
||||
compileOnly libs.findbugs
|
||||
testCompile libs.testng
|
||||
implementation project(':HIRS_Utils')
|
||||
implementation libs.jcommander
|
||||
implementation libs.commons.io
|
||||
// implementation libs.checkstyle
|
||||
// implementation libs.findbugs
|
||||
// testCompile libs.testng
|
||||
}
|
||||
|
||||
ext.configDir = new File(projectDir, 'config')
|
||||
ext.checkstyleConfigDir = "$configDir/checkstyle"
|
||||
checkstyle {
|
||||
toolVersion = '5.7'
|
||||
configFile = checkstyleConfigFile
|
||||
configProperties.put('basedir', checkstyleConfigDir)
|
||||
ignoreFailures = false
|
||||
showViolations = true
|
||||
}
|
||||
//ext.checkstyleConfigDir = "$configDir/checkstyle"
|
||||
//ext.findbugsConfigDir = "$configDir/findbugs"
|
||||
|
||||
ext.findbugsConfigDir = "$configDir/findbugs"
|
||||
//checkstyle {
|
||||
// toolVersion = '5.7'
|
||||
// configFile = checkstyleConfigFile
|
||||
// configProperties.put('basedir', checkstyleConfigDir)
|
||||
// ignoreFailures = false
|
||||
// showViolations = true
|
||||
//}
|
||||
|
||||
findbugs {
|
||||
toolVersion = '3.0.0'
|
||||
ignoreFailures = false
|
||||
effort = 'max'
|
||||
}
|
||||
|
||||
//findbugs {
|
||||
// toolVersion = '3.0.0'
|
||||
// ignoreFailures = false
|
||||
// effort = 'max'
|
||||
//}
|
||||
|
||||
jar {
|
||||
exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF'
|
||||
manifest {
|
||||
attributes("Main-Class": "hirs.tcg_eventlog.Main",
|
||||
"Class-Path": configurations.runtime.files.collect { "lib/$it.name" }.join(' ')
|
||||
)
|
||||
}
|
||||
from(configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }) {}
|
||||
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
|
||||
}
|
||||
|
||||
uploadArchives {
|
||||
repositories {
|
||||
flatDir {
|
||||
dirs "${buildDir}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.netflix.nebula:gradle-ospackage-plugin:4.9.3'
|
||||
attributes(
|
||||
"Main-Class": "hirs.tcg_eventlog.Main",
|
||||
'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'
|
||||
}
|
||||
// Get version from main project gradle
|
||||
def packVersion = properties.get("packageVersion");
|
||||
//println "packageVersion is ${projVersion}"
|
||||
|
||||
// Produce packages
|
||||
ospackage {
|
||||
def gitCommitHash = 'git rev-parse --verify --short HEAD'.execute().text.trim()
|
||||
packageName = 'tcg_eventlog_tool'
|
||||
packageName = 'tcg-eventlog-tool'
|
||||
os = LINUX
|
||||
arch = X86_64
|
||||
version = '2.1.0'
|
||||
release = gitCommitHash
|
||||
arch = NOARCH
|
||||
version = "$packVersion"
|
||||
release = '1'
|
||||
|
||||
into '/opt/hirs/eventlog'
|
||||
user 'root'
|
||||
fileMode = 0755
|
||||
|
||||
from(jar.outputs.files) {
|
||||
into 'lib'
|
||||
into ('/opt/hirs/eventlog/lib') {
|
||||
from jar.outputs.files
|
||||
from 'lib'
|
||||
from 'configurations.runtimeClasspath'
|
||||
}
|
||||
from('lib') {
|
||||
into 'lib'
|
||||
}
|
||||
from(configurations.runtime) {
|
||||
into 'lib'
|
||||
}
|
||||
from('scripts') {
|
||||
into ('/opt/hirs/eventlog/scripts') {
|
||||
from ('scripts') {
|
||||
exclude {
|
||||
FileTreeElement details ->
|
||||
details.file.name.endsWith('.bat')
|
||||
FileTreeElement details ->
|
||||
details.file.name.endsWith('.bat')
|
||||
}
|
||||
into 'scripts'
|
||||
}
|
||||
}
|
||||
from('docs') {
|
||||
exclude {
|
||||
FileTreeElement details ->
|
||||
details.file.name.endsWith('.odt')
|
||||
into ('/opt/hirs/eventlog/docs') {
|
||||
from ('docs') {
|
||||
exclude {
|
||||
FileTreeElement details ->
|
||||
details.file.name.endsWith('.odt')
|
||||
}
|
||||
}
|
||||
into 'docs'
|
||||
}
|
||||
from('./') {
|
||||
include {
|
||||
FileTreeElement details ->
|
||||
details.file.name.endsWith('.md')
|
||||
}
|
||||
into './'
|
||||
link("/usr/bin/elt", "/opt/hirs/eventlog/scripts/eventlog.sh", 0x755)
|
||||
}
|
||||
|
||||
into('/tmp/') {
|
||||
fileMode 0664
|
||||
// Copy vendor-table into /tmp to avoid conflict with the ACA
|
||||
into('/tmp/elt/default-properties') {
|
||||
from ('../../HIRS_Utils/src/main/resources/vendor-table.json') {
|
||||
addParentDirs true
|
||||
createDirectoryEntry true
|
||||
fileMode 0664
|
||||
addParentDirs = true
|
||||
}
|
||||
}
|
||||
|
||||
postInstall file('scripts/vendor-table.sh')
|
||||
// place elt link in system path to enable command line access
|
||||
link("/usr/local/bin/elt", "/opt/hirs/eventlog/scripts/eventlog.sh", 0x755)
|
||||
|
||||
// PostInstall
|
||||
// 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"
|
||||
|
||||
// Uninstall
|
||||
// copy files to where package manager exspects them and remove project files
|
||||
preUninstall "mkdir -p /tmp/elt/default-properties"
|
||||
preUninstall "cp /opt/hirs/default-properties/vendor-table.json /tmp/elt/default-properties/."
|
||||
postUninstall "rm -rf /tmp/elt"
|
||||
|
||||
buildRpm {
|
||||
arch = X86_64
|
||||
|
@ -11,8 +11,8 @@ import java.security.cert.CertificateException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import hirs.tpm.eventlog.TCGEventLog;
|
||||
import hirs.tpm.eventlog.TpmPcrEvent;
|
||||
import hirs.utils.tpm.eventlog.TCGEventLog;
|
||||
import hirs.utils.tpm.eventlog.TpmPcrEvent;
|
||||
import hirs.utils.HexUtils;
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user