Files
p2rank/build.gradle
2026-01-22 09:07:17 +01:00

209 lines
5.7 KiB
Groovy

//file:noinspection SpellCheckingInspection
//file:noinspection GroovyAssignabilityCheck
buildscript { // for "com.github.ben-manes.versions" plugin
repositories {
maven {
url = "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.github.ben-manes:gradle-versions-plugin:0.53.0"
}
}
plugins {
id 'java'
id 'groovy'
}
apply plugin: "com.github.ben-manes.versions" // ./gradlew dependencyUpdates
group = 'cz.siret'
version = '2.5.2-dev.3'
description = 'Ligand binding site prediction based on machine learning.'
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
def distroDir = "$projectDir/distro"
repositories {
mavenCentral()
mavenLocal()
maven {url = "https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/" }
maven {
url = file('lib/local-mvn-repo')
}
flatDir(dirs: 'lib')
}
sourceSets {
main {
resources {
exclude 'scripts/out/*'
exclude 'models/*'
}
}
}
processResources {
filter org.apache.tools.ant.filters.ReplaceTokens, tokens: [
"project_version": project.version
]
}
tasks.register('copyDependenciesToDist', Copy) {
from configurations.runtimeClasspath
into "$distroDir/bin/lib"
}
tasks.register('copyBinaryToDist', Copy) {
dependsOn jar
from "$projectDir/build/bin"
into "$distroDir/bin"
include "*.jar"
}
tasks.register('copyDocumentation', Copy) {
from "$distroDir/../"
into "$distroDir"
include "README.md", "LICENSE.txt"
}
assemble {
dependsOn processResources
dependsOn copyBinaryToDist
dependsOn copyDependenciesToDist // copy dependencies to distro dir
dependsOn copyDocumentation
}
jar {
archiveFileName = "p2rank.jar"
destinationDirectory = file("build/bin")
manifest {
attributes 'Main-Class': 'cz.siret.prank.program.Main'
}
}
clean {
delete "$distroDir/bin"
delete "$distroDir/test_output"
}
test {
useJUnitPlatform()
// show standard out and standard error of the test JVM(s) on the console
// testLogging.showStandardStreams = true
// set heap size for the test JVM(s)
maxHeapSize = "2g"
inputs.dir "$distroDir/test_data"
inputs.files("$distroDir/models", "$distroDir/config/default.groovy")
// listen to events in the test execution lifecycle
beforeTest { descriptor ->
logger.lifecycle("Running test: " + descriptor)
}
testLogging {
//events = "failed" // "standardOut", "standardError", "passed", "skipped"
showExceptions = true
exceptionFormat = "full"
showCauses = true
showStackTraces = true
showStandardStreams = false
}
// listen to standard out and standard error of the test JVM(s)
// onOutput { descriptor, event ->
// logger.lifecycle("Test: " + descriptor + " produced standard out/err: " + event.message )
// }
}
configurations {
runtimeClasspath.extendsFrom implementation
}
/**
* Returns an int representing how mature [version] is.
* Higher numbers are more mature.
*/
static def maturityLevel(String version) {
/**
* Version qualifiers, in order from least to most mature.
* The most mature is to have no qualifier at all.
*/
def qualifiers = ["preview", "alpha", "beta", "m", "cr", "rc"]
def qualifiersRegex = qualifiers.collect { /(?i).*[.\-]$it[.\-\d]*/ }
def index = qualifiersRegex.findIndexOf { version ==~ it }
return (index < 0) ? qualifiers.size() : index
}
tasks.named("dependencyUpdates").configure {
rejectVersionIf {
def candidateMaturity = maturityLevel(it.candidate.version)
def currentMaturity = maturityLevel(it.currentVersion)
candidateMaturity < currentMaturity
}
}
dependencies {
implementation 'org.apache.groovy:groovy:4.0.30'
implementation 'org.codehaus.gpars:gpars:1.2.1'
implementation 'org.apache.commons:commons-lang3:3.20.0'
implementation 'org.apache.commons:commons-math3:3.6.1'
implementation 'commons-io:commons-io:2.21.0'
implementation 'com.google.guava:guava:33.5.0-jre'
implementation 'com.google.code.gson:gson:2.13.2'
implementation 'com.univocity:univocity-parsers:2.9.1' // csv parser
implementation 'org.apache.commons:commons-csv:1.14.1'
implementation 'org.zeroturnaround:zt-zip:1.17'
implementation 'org.apache.commons:commons-compress:1.28.0'
implementation 'org.tukaani:xz:1.11'
implementation 'com.github.luben:zstd-jni:1.5.7-6'
implementation 'com.github.dpaukov:combinatoricslib3:3.4.0'
implementation 'us.ihmc:euclid:0.22.5'
implementation 'org.slf4j:slf4j-api:2.0.17'
implementation 'org.slf4j:jul-to-slf4j:2.0.17' // for netlib logging messages
implementation 'org.apache.logging.log4j:log4j-core:2.24.0' // 2.24.1-3 causes messy output at startup
implementation 'org.apache.logging.log4j:log4j-slf4j2-impl:2.24.0'
implementation 'org.biojava:biojava-core:7.2.2'
implementation 'org.biojava:biojava-alignment:7.2.2'
implementation 'org.biojava:biojava-structure:7.2.2-rdk.1' // forked version with new parseSites param
implementation 'org.openscience.cdk:cdk-qsarmolecular:2.11' // for NumericalSurface class
implementation 'org.openscience.cdk:cdk-silent:2.11' // for Atom class
implementation 'cz.cuni.cusbg:faster-molecular-surface:1.0'
implementation 'nz.ac.waikato.cms.weka:weka-dev:3.9.6'
implementation fileTree(dir: 'lib', include: '*.jar')
testImplementation 'org.junit.jupiter:junit-jupiter:6.0.2'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}