HIRS/HIRS_AttestationCAPortal/build.gradle

161 lines
4.8 KiB
Groovy
Raw Normal View History

plugins {
id 'application'
id 'java'
id 'war'
2023-02-23 17:28:52 +00:00
id "nebula.ospackage" version "9.1.1"
id 'org.springframework.boot' version '3.0.6'
id 'io.spring.dependency-management' version '1.1.0'
}
2018-09-06 13:47:33 +00:00
// 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)
2018-09-06 13:47:33 +00:00
}
}
configurations {
compileOnly {
extendsFrom annotationProcessor
2018-09-06 13:47:33 +00:00
}
}
repositories {
flatDir { dirs "lib" }
mavenCentral()
2018-09-06 13:47:33 +00:00
}
dependencies {
2023-03-07 01:54:49 +00:00
implementation project(':HIRS_Utils')
implementation project(':HIRS_AttestationCA')
implementation libs.pci
implementation libs.bouncycastle
implementation libs.guava
implementation libs.jakarta.servlet
2023-02-16 17:05:36 +00:00
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 'com.github.darrachequesne:spring-data-jpa-datatables:6.0.1'
2023-02-23 17:28:52 +00:00
implementation 'org.projectlombok:lombok'
2023-03-07 01:54:49 +00:00
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client'
annotationProcessor 'org.projectlombok:lombok'
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
2018-09-06 13:47:33 +00:00
war {
from(buildDir) {
include 'VERSION'
into 'WEB-INF/classes'
}
archiveFileName = 'HIRS_AttestationCAPortal.war'
2018-09-06 13:47:33 +00:00
}
ospackage {
packageName = 'HIRS_AttestationCA'
os = LINUX
arch = NOARCH
version = "$packVersion"
release = '1'
user 'root'
fileMode = 0755
def tpath="/opt"
addParentDirs = true
createDirectoryEntry true
2023-05-03 16:54:35 +00:00
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 'libs'
from configurations.runtimeClasspath
}
into ("/opt/hirs/scripts/aca/") {
from '../package/conf/tomcat.service'
from '../package/scripts/install_tomcat.sh'
from '../package/scripts/aca/aca_property_setup.sh'
from '../package/scripts/aca/aca_setup.sh'
}
into ("/opt/hirs/scripts/pki/") {
from '../package/scripts/pki/ca.conf'
from '../package/scripts/pki/pki_setup.sh'
from '../package/scripts/pki/pki_chain_gen.sh'
}
into ("/opt/hirs/scripts/db/") {
from '../package/scripts/db/db_create.sh'
from '../package/scripts/db/db_create.sql'
from '../package/scripts/db/db_drop.sh'
from '../package/scripts/db/db_drop.sql'
from '../package/scripts/db/secure_mysql.sql'
}
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_AttestationCA/src/main/resources/vendor-table.json'
from '../HIRS_AttestationCA/src/main/resources/component-class.json'
}
// Post Install
postInstall file('../package/scripts/db/db_create.sh')
postInstall file('../package/scripts/pki/pki_setup.sh')
postInstall 'mkdir -p /etc/hirs/aca/certificates'
postInstall 'cp /tmp/aca/default-properties/* /opt/hirs/default-properties/.'
postInstall 'rm -rf /tmp/aca/'
// postInstall file('../package/scripts/install_tomcat.sh')
postInstall 'sh /opt/tomcat/bin/catalina.sh start'
// Post Uninstall
// Copy files to /tmp that package manager will be expecting them there
preUninstall 'mkdir -p /tmp/aca/default-properties/'
preUninstall 'cp -f /opt/hirs/default-properties/* /tmp/aca/default-properties/.'
preUninstall file('../package/scripts/db/db_drop.sh')
buildRpm {
arch = X86_64
}
buildDeb {
arch = 'amd64'
}
}