agent-backend/build.gradle
2021-09-26 12:49:24 +08:00

187 lines
5.5 KiB
Groovy

plugins {
id 'java'
id 'application'
}
mainClassName = 'org.bdware.server.CMHttpServer'
application {
mainClass = mainClassName
applicationDefaultJvmArgs = ['-Dfile.encoding=UTF-8', '-Djava.library.path="./dynamicLibrary"']
}
sourceSets {
main {
java {
srcDir 'src/main/java'
}
resources {
srcDir 'src/main/resources'
}
}
test {
java {
srcDir 'src/test/java'
}
resources {
srcDir 'src/test/resources'
}
}
}
dependencies {
implementation project(":cm")
implementation project(":mockjava")
implementation project(":front-base")
implementation 'io.prometheus:simpleclient_httpserver:0.12.0'
testImplementation 'junit:junit:4.13.2'
}
compileJava {
options.compilerArgs<<"-Xlint:unchecked"
}
jar {
String libs = ''
configurations.runtimeClasspath.each {
libs = libs + " libs/" + it.name
}
manifest {
attributes 'Manifest-Version': project.version
attributes 'Main-Class': mainClassName
attributes 'Class-Path': libs
}
}
tasks.processResources.setDuplicatesStrategy(DuplicatesStrategy.INCLUDE)
task copyScript(type: Copy) {
from("../script/") {
include 'cmstart.sh'
include 'cmstop.sh'
include 'cmconfig.json.template'
include 'killContracts.sh'
}
into "./build/output"
println("copyScript done !")
}
task copyScriptBDLedger(type: Copy) {
from("../script/") {
include 'cmstart.sh'
include 'cmconfig.json'
include 'cmstartbdledger.sh'
include 'cmstop.sh'
include 'cmconfig.json.template'
include 'killContracts.sh'
include 'updateContract.sh'
include 'installClusterWithBdledger.sh'
}
into "./build/output"
println("copyScript done !")
}
task copySsl(type: Copy) {
from './ssl'
into './build/output/ssl'
}
task copyDynamicLibrary(type: Copy) {
from './dynamicLibrary/'
into './build/output/dynamicLibrary'
}
task copyLibs(type: Copy, dependsOn: ["copyScript", 'copySsl']) {
from configurations.runtimeClasspath
into "./build/output/libs/"
}
//task copyJar(type: Exec, dependsOn: [":agent-backend:jar", ":agent-backend:copyLibs", ":agent-backend:copyDynamicLibrary"]) {
// println("copyJar start")
// commandLine "cp", "./build/libs/$project.name-${project.version}.jar", "./build/output/bdagent.jar"
//}
task copyJar(type: Copy, dependsOn: [":agent-backend:jar", ":agent-backend:copyLibs", ":agent-backend:copyDynamicLibrary"]) {
from "./build/libs/$project.name-${project.version}.jar"
into "./build/output"
rename { String fileName -> "bdagent.jar" }
doFirst {
println "copyJar start"
}
}
task copyBDWareProjectDir(type: Copy, dependsOn: [":agent-backend:copyJar", ":agent-backend:copyDockerfile"]) {
from "./contracts"
into "./build/output/BDWareProjectDir/public"
}
task copyWebContent(type: Copy) {
from("./WebContent") {
exclude 'ide/BaaSOnlineIDE.html'
exclude 'ide/.idea/'
exclude 'ide/.gitignore'
exclude 'client/BaaSClient.html'
exclude 'client/README.md'
exclude 'client/.idea/'
exclude 'client/.gitignore'
}
into "./build/output/WebContent"
}
task copyDockerfile(type: Copy) {
from "./Dockerfile"
into "./build/"
}
//task copyCP(type: Copy, dependsOn: ":cp:buildBundle") {
// from "../cp/build/output"
// into "./build/output"
//}
task copyKeys(type: Copy) {
from "./keys"
into "./build/output/keys"
}
task buildBDServerZip(type: Zip, dependsOn: [ ":agent-backend:copyWebContent",
":agent-backend:copyBDWareProjectDir", ":agent-backend:copyScript",
":agent-backend:copyJar", ":agent-backend:copyLibs", ":agent-backend:copyKeys"]) {
from './build/output/'
duplicatesStrategy = DuplicatesStrategy.INCLUDE
archiveFileName = 'bdserver.zip'
destinationDirectory = file('build/')
}
task buildBDServerZipLite(type: Zip, dependsOn: [ ":agent-backend:copyWebContent",
":agent-backend:copyBDWareProjectDir", ":agent-backend:copyScript",
":agent-backend:copyJar", ":agent-backend:copyLibs", ":agent-backend:copyKeys"]) {
from('./build/output/') {
exclude 'BDWareProjectDir/public/**'
exclude 'WebContent/doc/'
}
duplicatesStrategy = DuplicatesStrategy.INCLUDE
archiveFileName = 'bdserver-lite.zip'
destinationDirectory = file('build/')
}
task buildBDServerZipUpdate(type: Zip, dependsOn: [":agent-backend:copyCP", ":agent-backend:copyWebContent",
":agent-backend:copyBDWareProjectDir", ":agent-backend:copyScript",
":agent-backend:copyJar", ":agent-backend:copyLibs", ":agent-backend:copyKeys"]) {
from('./build/output/') {
include '*.jar'
include 'libs/'
include 'WebContent/'
exclude 'WebContent/doc/'
}
duplicatesStrategy = DuplicatesStrategy.INCLUDE
archiveFileName = 'bdserver-update.zip'
destinationDirectory = file('build/')
}
task buildWebContentZip(type: Zip, dependsOn: [":agent-backend:copyCP", ":agent-backend:copyWebContent"]) {
from "./build/output/WebContent"
duplicatesStrategy = DuplicatesStrategy.INCLUDE
archiveFileName = 'AgentWebContent.zip'
destinationDirectory = file('build/')
}