first commit

This commit is contained in:
CaiHQ 2022-04-12 13:19:48 +08:00
parent 336fa72a5f
commit e89191d2ce

100
build.gradle Normal file
View File

@ -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")
}
}