You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yacy_search_server/build.gradle

137 lines
3.9 KiB

buildscript {
dependencies {
classpath "org.mini2Dx:parcl:1.7.1"
}
}
plugins {
id 'java'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '5.1.0'
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'application'
apply plugin: "org.mini2Dx.parcl"
repositories {
flatDir {
dirs 'lib'
}
mavenCentral()
}
sourceSets {
main {
java {
srcDirs = ['source']
}
}
test {
java {
srcDirs = ['test/java']
}
}
}
group = 'net.yacy'
version = '1.925'
description = 'YaCy Search Server'
java.sourceCompatibility = JavaVersion.VERSION_1_8
java.targetCompatibility = JavaVersion.VERSION_1_8
mainClassName = "net.yacy.yacy"
applicationDefaultJvmArgs = ["-Xmx1024m"]
parcl {
exe {
exeName = "YaCy"
}
app {
vmArgs = ["-Xmx1g"]
appName = "YaCy"
icon = "addon/YaCy.icns"
applicationCategory = "Search-Engine"
displayName = 'YaCy Search Engine'
identifier = 'net.yacy'
copyright = 'Copyright 2021 Michael Peter Christen et al.'
zipName = 'YaCy.zip'
}
linux {
binName = "YaCy"
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
dependencies {
implementation(fileTree(dir : "lib", include : "*.jar"))
// need at least one entry to make references to configuragtion.xxxx work in combination with local lib directory
implementation 'com.ibm.icu:icu4j:63.1'
testImplementation('junit:junit:4.13.2')
}
// output to lib/yacycore.jar (like with ant with downside by determine class-path)
jar {
archiveFileName = 'yacycore.jar'
destinationDirectory = new File('lib')
// @TODO: class-path workaround until we've dependencies to use configurations.implementation instead of filetree.
FileTree libdir = fileTree("lib").include ("*.jar").exclude("yacycore.jar")
manifest {
attributes(
"Main-Class": mainClassName ,
"Class-Path": configurations.compileClasspath.collect { it.name }.join(' ')
)
}
}
shadowJar.zip64 = true // saw build error: Execution failed for task ':shadowJar'. shadow.org.apache.tools.zip.Zip64RequiredException: archive contains more than 65535 entries.
// mimic current config with dependencies in lib directory
// @TODO: maybe removed after complete Gradle migration
task copyDependenciesToLib(type: Copy) {
def destination = project.file("lib")
into destination
from configurations.compileClasspath
eachFile { // prevent overwriting existing files
if (it.getRelativePath().getFile(destination).exists()) {
it.exclude()
}
}
build.dependsOn(copyDependenciesToLib)
}
/** -----------------------------------------------------------
* Settings during the migration from Ant to Gradle build
* importing Ant targets and to use them within this Gradle build
* until/where functionality has not been migrated yet
* ------------------------------------------------------------
*/
// Import Ant build and prefix all task names with 'ant_' to prevent naming conflict with Gradle tasks.
ant.importBuild('build.xml') { antTaskName -> "ant_${antTaskName}".toString() }
// Set group property for all Ant tasks.
tasks.matching { task -> task.name.startsWith('ant_') }*.group = 'Ant'
// include compile of htroot servlets in Gradle lifecycle somewhere after compileJava
startScripts.dependsOn("ant_compile-htroot")
tasks.named('ant_buildGitRevTask') {
doFirst {
println '====================================='
println 'In case this imported Ant task fails'
println '(stop ant jvm which on failure keeps a lock on libbuild/GitRevTask.jar (making supsequent builds fail too)'
println '- run the normal ant build "ant all" ONCE (to complile the libbuild/GitRevTask.jar)'
println '- after this Gradle build should work'
println '====================================='
}
}