ControlProxy/backend/build.gradle
2023-07-04 10:49:09 +08:00

119 lines
3.4 KiB
Groovy

buildscript {
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
classpath "org.bdware.bdcontract:simple-ypk-packer:0.5.5"
classpath "org.bdware.bdcontract:ypk-deploy-tool:0.7.1"
}
}
plugins {
id 'java'
id 'java-library'
}
version = "1.4.0"
group = 'org.bdware.sc.controlproxy'
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:none'
options.compilerArgs << '-Xlint:deprecation' << "-Werror"
}
sourceSets {
main {
java {
srcDirs 'src/main/java'
}
resources {
srcDir 'src/main/resources'
}
}
test {
java {
srcDir 'src/test/java'
}
resources {
srcDir 'src/test/resources'
}
}
}
dependencies {
api 'org.apache.logging.log4j:log4j-core:2.17.2'
api 'org.apache.logging.log4j:log4j-api:2.17.2'
api 'com.google.code.gson:gson:2.8.8'
implementation 'org.bdware.sc:cp:1.6.8'
implementation 'org.bdware.doip:doip-audit-tool:1.1.3'
implementation 'org.bdware.bdcontract:sdk-java:1.0.2'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.bdware.bdcontract:ypk-deploy-tool:0.7.1'
}
task copyLibs(type: Copy) {
from configurations.runtimeClasspath
into "./build/output/libs/"
}
task copyYJS(type: Copy) {
from "./yjs"
into "./build/output/"
}
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
archiveClassifier = 'sources'
}
task copyAssets(type: Copy) {
from "../front"
into "./build/output/assets/"
}
task copyJar(type: Copy, dependsOn: [":backend:jar", ":backend:copyLibs"]) {
from "./build/libs/$project.name-${project.version}.jar"
into "./build/output"
rename { String fileName -> "controlproxy-${project.version}.jar" }
doFirst {
println "copyJar start"
}
}
tasks.processResources.setDuplicatesStrategy(DuplicatesStrategy.INCLUDE)
tasks.processTestResources.setDuplicatesStrategy(DuplicatesStrategy.INCLUDE)
task grepCP(dependsOn: [":backend:copyJar"]) {
doLast {
org.bdware.datanet.YPKPacker.grepJarByCPVersion("./backend/build/output/libs", org.bdware.datanet.CPVersion.cp_1_6_8)
// org.bdware.datanet.YPKPacker.grepCPLibWithFilter("./backend/cplibs/libs/", "./backend/build/output/libs", "./backend/grepcp.list")
}
}
task buildZip(type: Zip, dependsOn: ["copyAssets", "grepCP", "copyJar", "copyYJS"]) {
from './build/output/'
duplicatesStrategy = DuplicatesStrategy.INCLUDE
archiveFileName = 'ControlProxy.zip'
destinationDirectory = file('build/')
}
task buildYPK(dependsOn: ["buildZip", "grepCP"]) {
doLast {
org.bdware.datanet.YPKPacker.staticPack("./backend/build/ControlProxy.zip", "./backend/build/ControlProxy-${project.version}.ypk")
}
}
task deploy(dependsOn: ["buildYPK"]) {
doLast {
org.bdware.ypkdeploy.HTTPTool.deployWithYpk("./backend/deployconfig.json","./backend/build/ControlProxy-${project.version}.ypk")
//org.bdware.ypkdeploy.HTTPTool.batchRun("./backend/deployconfig.json", true)
}
}
task putPackage(type: Exec, dependsOn: ["buildYPK"]) {
workingDir "./build"
commandLine "pwd"
commandLine "curl", "--user", "${REPO_USRNAME}:${REPO_PASSWORD}", "--upload-file", "./ControlProxy-${project.version}.ypk","${REPO_HOST}api/packages/iod/generic/ControlProxy/${project.version}/ControlProxy-${project.version}.ypk"
doLast {
println "Executed!"
}
}