HIRS/tools/tcg_eventlog_tool/build.gradle

103 lines
2.7 KiB
Groovy
Raw Normal View History

import java.util.concurrent.TimeUnit
plugins {
id "java"
id "nebula.ospackage" version "9.1.1"
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}
repositories {
mavenCentral()
}
dependencies {
implementation project(':HIRS_Utils')
implementation libs.jcommander
implementation libs.commons.io
}
ext.configDir = new File(projectDir, 'config')
ext.checkstyleConfigDir = "$configDir/checkstyle"
ext.findbugsConfigDir = "$configDir/findbugs"
jar {
2022-11-30 21:43:23 +00:00
// Keep the jar clean:
exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF'
manifest {
attributes(
'Main-Class': 'hirs.tcg_eventlog.Main',
'Class-Path': configurations.runtimeClasspath.files.collect { it.getName() }.join(' ')
)
}
}
2020-05-29 21:20:06 +00:00
// Get version from main project gradle
def packVersion = properties.get("packageVersion");
//println "packageVersion is ${projVersion}"
2020-05-29 21:20:06 +00:00
// Produce packages
ospackage {
packageName = 'tcg-eventlog-tool'
os = LINUX
arch = NOARCH
version = "$packVersion"
release = '1'
2020-05-29 21:20:06 +00:00
user 'root'
fileMode = 0755
2022-11-30 21:43:23 +00:00
into ('/opt/hirs/eventlog/lib') {
from jar.outputs.files
from 'lib'
from 'configurations.runtimeClasspath'
2020-05-29 21:20:06 +00:00
}
2022-11-30 21:43:23 +00:00
into ('/opt/hirs/eventlog/scripts') {
from ('scripts') {
2020-05-29 21:20:06 +00:00
exclude {
2022-11-30 21:43:23 +00:00
FileTreeElement details ->
details.file.name.endsWith('.bat')
2020-05-29 21:20:06 +00:00
}
2022-11-30 21:43:23 +00:00
}
2020-05-29 21:20:06 +00:00
}
2022-11-30 21:43:23 +00:00
into ('/opt/hirs/eventlog/docs') {
from ('docs') {
exclude {
FileTreeElement details ->
details.file.name.endsWith('.odt')
}
2020-05-29 21:20:06 +00:00
}
}
2022-11-30 21:43:23 +00:00
// 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') {
2022-11-30 21:43:23 +00:00
fileMode 0664
addParentDirs = true
}
}
2022-11-30 21:43:23 +00:00
// place elt link in system path to enable command line access
link("/usr/local/bin/elt", "/opt/hirs/eventlog/scripts/eventlog.sh", 0x755)
2022-11-30 21:43:23 +00:00
// 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
}
buildDeb {
arch = 'amd64'
2020-05-29 21:20:06 +00:00
}
}