HIRS/HIRS_AttestationCAPortal/build.gradle
2022-11-30 16:43:23 -05:00

173 lines
5.4 KiB
Groovy

plugins {
id 'java'
id 'war'
id "nebula.ospackage" version "9.1.1"
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}
repositories {
flatDir { dirs "lib" }
mavenCentral()
}
dependencies {
implementation project(':HIRS_Utils')
implementation project(':HIRS_AttestationCA')
implementation libs.bouncy.castle
implementation libs.servlet.api
implementation libs.commons.io
implementation libs.commons.lang
implementation libs.commons.upload
implementation libs.gson
implementation libs.guava // for com.google.common
implementation libs.hibernate
implementation libs.hibernate.validator
implementation libs.http
implementation libs.jstl
implementation libs.javax.validation
implementation libs.log4j2
implementation libs.log4j2.web
implementation libs.pci.ids
implementation libs.servlet.api
implementation libs.spring.context
implementation libs.spring.jdbc
implementation libs.spring.orm
implementation libs.spring.transaction
implementation libs.spring.webmvc
testImplementation libs.hamcrest
// override the servlet API for testing. Required for Spring Integration tests
testImplementation libs.servlet.api
testImplementation libs.hsqldb
testImplementation libs.spring.test
testImplementation libs.testng
testImplementation libs.mockito
testImplementation libs.testng
testImplementation libs.jsonassert
testImplementation libs.jsonpath
}
def copyVersion = project.task('copyVersion')
copyVersion.dependsOn compileJava
war.dependsOn copyVersion
war {
from(buildDir) {
include 'VERSION'
into 'WEB-INF/classes'
archiveFileName = 'HIRS_AttestationCAPortal.war'
}
}
ext.configDir = new File(projectDir, 'config')
ext.checkstyleConfigDir = "$configDir/checkstyle"
ext.findbugsConfigDir = "$configDir/findbugs"
// Get version from main project gradle
def packVersion = properties.get("packageVersion");
//println "packageVersion is ${packVersion}"
ospackage {
packageName = 'HIRS_AttestationCA'
os = LINUX
arch = NOARCH
version = "$packVersion"
release = '1'
user 'root'
fileMode = 0755
def tpath="/opt"
addParentDirs = true
createDirectoryEntry true
preInstall "rm -rf /opt/hirs/default-properties"
preInstall "mkdir -p /opt/hirs/default-properties/"
preInstall "mkdir -p /tmp/hirs/default-properties/"
// Setup /etc/hirs
into ('/etc/hirs/aca/') {
from '../HIRS_AttestationCA/src/main/resources/defaults.properties'
rename {'aca.properties'}
}
into ('/etc/hirs/') {
from '../HIRS_Utils/src/main/resources/banner.properties'
from '../HIRS_Utils/src/main/resources/persistence.properties'
from '../HIRS_Utils/src/main/resources/logging.properties'
}
// Setup tomcat files
// Create and package HIRS_AttestationCA:war
into ("${tpath}/tomcat/webapps") {
from war.outputs.files
from '../HIRS_AttestationCA/build/libs/HIRS_AttestationCA.war'
user 'root'
fileMode = 0755
}
into ("${tpath}/tomcat/lib") {
from 'lib'
from configurations.runtimeClasspath
}
into ("/opt/hirs/scripts/aca/") {
from '../package/conf/tomcat.service'
from '../package/scripts/install_tomcat.sh'
from '../package/scripts/aca/certificate_generate.sh'
}
into ("/opt/hirs/scripts/common") {
from '../package/scripts/common/'
}
into ('/opt/hirs/extras/aca/') {
from '../package/extras/aca/'
}
// Copy json files to /tmp and move into /opt/hirs in postInstall section
// Allows HIRS tools to be installed using the same files
into ('/tmp/aca/default-properties/') {
from '../HIRS_Utils/src/main/resources/vendor-table.json'
from '../HIRS_Utils/src/main/resources/component-class.json'
}
// Post Install
postInstall file('../package/scripts/install_tomcat.sh')
postInstall 'mkdir -p /etc/hirs/aca/client_files'
postInstall 'mkdir -p /etc/hirs/aca/certificates'
postInstall 'cp /tmp/aca/default-properties/* /opt/hirs/default-properties/.'
postInstall 'rm -rf /tmp/aca/'
// Old post install files, to be removed...
// Note /etc/hirs/aca/certificates files are created by certificate_generate.sh
// /etc/hirs/aca/client-files files are created by certificate_generate.sh
// /etc/hirs/certificates/ files are created by ssl_configure.sh
// /etc/hirs/certificates/mysql/ files are created by ssl_configure.sh
// /etc/hirs/certificates/private/ files are created by ssl_configure.sh
// postInstall file('../package/scripts/common/firewall_configure_tomcat.sh')
// postInstall file('../package/scripts/common/ssl_configure.sh')
// postInstall file('../package/scripts/common/db_create.sh')
// postInstall file('../package/scripts/aca/certificate_generate.sh')
// postInstall 'if [ selinuxenabled ]; then semodule -i /opt/hirs/extras/aca/tomcat-mysql-hirs.pp; fi'
//postInstall file('/opt/tomcat/libs/catalina.sh')
// Post Uninstall
// Copy files to /tmp that package manager will be expecting them there
preUninstall 'mkdir -p /tmp/aca/default-properties/'
preUninstall 'cp /opt/hirs/default-properties/* /tmp/aca/default-properties/.'
buildRpm.dependsOn ':HIRS_AttestationCA:war'
buildRpm {
arch = X86_64
}
buildDeb {
arch = 'amd64'
}
}