registry/backend/build.gradle
2022-05-30 15:34:01 +08:00

123 lines
3.0 KiB
Groovy

buildscript {
repositories{
mavenCentral()
mavenLocal()
}
dependencies {
classpath "org.bdware.bdcontract:simple-ypk-packer:0.3.0"
classpath "org.bdware.bdcontract:ypk-deploy-tool:0.4.0"
classpath 'org.apache.logging.log4j:log4j-core:2.17.2'
classpath 'org.apache.logging.log4j:log4j-api:2.17.2'
}
}
plugins {
id 'java'
id 'java-library'
}
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 {
implementation fileTree(dir: 'cplibs', include: '*.jar')
implementation fileTree(dir: 'cplibs/libs/', include: '*.jar')
testImplementation 'junit:junit:4.13.2'
// api project(":datanet-search-engine-backend")
implementation 'org.postgresql:postgresql:42.3.1'
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
tasks.withType(Javadoc) {
options.encoding = "UTF-8"
}
//task copyLibs(type: Copy) {
// from configurations.runtimeClasspath
// into "./build/output/libs/"
//}
def reltivePath = "./backend"
task grepCP(dependsOn: ["copyLibs"]) {
doLast {
org.bdware.datanet.YPKPacker.grepCPLibWithFilter("${reltivePath}/cplibs/libs", "${reltivePath}/build/output/libs", "${reltivePath}/grepcp.list")
}
}
//task copyLibs(type: Copy) {
// from configurations.runtimeClasspath
// into "./build/output/libs/"
//}
task copyLibs(type: Copy ) {
from configurations.runtimeClasspath
exclude {
details-> details.file.getAbsolutePath().contains("cplibs")
}
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/"
}
def currVersion = "0.0.9"
task copyJar(type: Copy, dependsOn: [":backend:copyLibs",":backend:jar"]) {
from "./build/libs/$project.name-${project.version}.jar"
into "./build/output/libs"
rename { String fileName -> "registry-${currVersion}.jar" }
doFirst {
println "copyJar start"
}
}
task buildZip(type: Zip, dependsOn: ["copyAssets", "copyJar", "copyYJS", "grepCP"]) {
from './build/output/'
duplicatesStrategy = DuplicatesStrategy.INCLUDE
archiveFileName = 'registry.zip'
destinationDirectory = file('build/')
}
task buildYPK(dependsOn: ["buildZip"]) {
doLast {
org.bdware.datanet.YPKPacker.staticPack("./backend/build/registry.zip", "./backend/build/registry-${currVersion}.ypk")
}
}
task deploy(dependsOn: ["buildYPK"]) {
doLast {
org.bdware.ypkdeploy.HTTPTool.batchRun("./backend/deployconfig.json", true)
}
}