From e89191d2ce56dfe7891679f049860407b67b0414 Mon Sep 17 00:00:00 2001 From: CaiHQ Date: Tue, 12 Apr 2022 13:19:48 +0800 Subject: [PATCH] first commit --- build.gradle | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 build.gradle diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..13b3084 --- /dev/null +++ b/build.gradle @@ -0,0 +1,100 @@ +buildscript { + dependencies { + classpath files("buildlibs/simpleypkpacker.jar") + } +} + +plugins { + id 'java' + id 'java-library' +} + +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.0' + api 'org.apache.logging.log4j:log4j-api:2.17.0' + implementation project(":datanet-search-engine-backend") + testImplementation 'junit:junit:4.13.2' +} + +task copyLibs(type: Copy ) { + from configurations.runtimeClasspath + exclude { + details-> details.file.getAbsolutePath().contains("cplib") + } + into "./build/output/libs/" +} + +//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 mergeJar(dependsOn: ["sourcesJar", "jar"]){ + doLast { + org.bdware.datanet.YPKPacker.mergeJar("./datanet-search-engine-backend/build/libs/$project.name-${project.version}.jar", + "./datanet-search-engine-backend/build/libs/$project.name-${project.version}-sources.jar", + "./datanet-search-engine-backend/build/libs/$project.name-${project.version}-all.jar") + } +} + +task copyJar(type: Copy, dependsOn: ["mergeJar", ":datanet-search-engine-backend:copyLibs"]) { +//task copyJar(type: Copy, dependsOn: ["mergeJar"]) { + from "./build/libs/$project.name-${project.version}.jar" + into "./build/output" + rename { String fileName -> "SearchEngine.jar" } + doFirst { + println "copyJar start" + } +} +task copyFront(type: Copy){ + from "../datanet-search-engine-front/dist" + into "./build/output/assets/" + doFirst { + println "copyFront start" + } +} +task buildZip(type: Zip, dependsOn: ["copyJar", "copyYJS","copyFront"]) { + from './build/output/' + duplicatesStrategy = DuplicatesStrategy.INCLUDE + archiveFileName = 'SearchEngine.zip' + destinationDirectory = file('build/') +} + + + + +task buildYPK (dependsOn:["buildZip"]){ + doLast { + org.bdware.datanet.YPKPacker.staticPack("./datanet-search-engine-backend/build/SearchEngine.zip","./datanet-search-engine-backend/build/SearchEngine.ypk") + } +}