contract-java-example/backend/build.gradle

108 lines
2.9 KiB
Groovy
Raw Normal View History

2021-11-17 03:28:40 +00:00
buildscript {
2022-05-20 01:23:29 +00:00
repositories {
2022-04-22 06:10:09 +00:00
mavenCentral()
}
2021-11-17 03:28:40 +00:00
dependencies {
2023-06-16 10:55:51 +00:00
classpath "org.bdware.bdcontract:simple-ypk-packer:0.6.0"
classpath "org.bdware.bdcontract:ypk-deploy-tool:0.7.4"
2021-11-17 03:28:40 +00:00
}
}
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 {
2022-04-20 16:50:40 +00:00
api 'org.apache.logging.log4j:log4j-core:2.17.2'
api 'org.apache.logging.log4j:log4j-api:2.17.2'
2023-06-16 10:55:51 +00:00
implementation 'org.bdware.sc:cp:1.9.1'
2021-11-17 03:28:40 +00:00
testImplementation 'junit:junit:4.13.2'
}
task copyLibs(type: Copy) {
from configurations.runtimeClasspath
into "./build/output/libs/"
}
task copyYJS(type: Copy) {
from "./yjs"
into "./build/output/"
}
2023-03-18 13:57:34 +00:00
//TODO 针对不同的前端,可以仅复制所需的前端代码,而不是整个前端目录。
//比如: from "../front/vite/dist"
task copyFront(type: Copy) {
from "../front"
into "./build/output/assets"
}
2021-12-07 09:00:03 +00:00
task sourcesJar(type: Jar) {
2021-11-17 03:28:40 +00:00
from sourceSets.main.allJava
archiveClassifier = 'sources'
}
2021-12-07 09:00:03 +00:00
task copyAssets(type: Copy) {
2021-11-17 03:28:40 +00:00
from "../front"
into "./build/output/assets/"
}
2022-04-20 16:50:40 +00:00
task copyJar(type: Copy, dependsOn: [":backend:jar", ":backend:copyLibs"]) {
from "./build/libs/$project.name-${project.version}.jar"
2021-11-17 03:28:40 +00:00
into "./build/output"
rename { String fileName -> "sc-example.jar" }
2021-11-17 03:28:40 +00:00
doFirst {
println "copyJar start"
}
}
2022-04-20 16:50:40 +00:00
def reltivePath = "./backend"
//reltivePath="."
2023-06-16 10:55:51 +00:00
def currVersion = "1.3.4"
2022-05-20 01:23:29 +00:00
task grepCP(dependsOn: ["copyJar"]) {
2022-04-20 16:50:40 +00:00
doLast {
2023-06-16 10:55:51 +00:00
org.bdware.datanet.YPKPacker.grepJarByCPVersion("${reltivePath}/build/output/libs", org.bdware.datanet.CPVersion.cp_1_8_3)
org.bdware.datanet.YPKPacker.grepJarByListFile("${reltivePath}/build/output/libs", "${reltivePath}/grepcp.list")
2022-04-20 16:50:40 +00:00
}
}
tasks.processResources.setDuplicatesStrategy(DuplicatesStrategy.INCLUDE)
tasks.processTestResources.setDuplicatesStrategy(DuplicatesStrategy.INCLUDE)
2021-11-17 03:28:40 +00:00
2023-03-18 13:57:34 +00:00
task buildZip(type: Zip, dependsOn: ["copyAssets", "copyJar", "copyYJS", "grepCP", "copyFront"]) {
2021-11-17 03:28:40 +00:00
from './build/output/'
duplicatesStrategy = DuplicatesStrategy.INCLUDE
archiveFileName = 'contractexample.zip'
2021-11-17 03:28:40 +00:00
destinationDirectory = file('build/')
}
2021-12-07 09:00:03 +00:00
task buildYPK(dependsOn: ["buildZip"]) {
2021-11-17 03:28:40 +00:00
doLast {
org.bdware.datanet.YPKPacker.staticPack("${reltivePath}/build/contractexample.zip", "${reltivePath}/build/contractexample-${currVersion}.ypk")
2021-11-17 03:28:40 +00:00
}
2022-04-22 06:10:09 +00:00
}
2023-03-18 13:57:34 +00:00
2022-05-20 01:23:29 +00:00
task deploy(dependsOn: ["buildYPK"]) {
2022-04-22 06:10:09 +00:00
doLast {
org.bdware.ypkdeploy.HTTPTool.deployWithYpk("${reltivePath}/debugconf.json", "${reltivePath}/build/contractexample-${currVersion}.ypk")
2022-04-22 06:10:09 +00:00
}
2022-04-20 16:50:40 +00:00
}