Files
p2rank/build.gradle

234 lines
6.9 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.54.0"
}
}
plugins {
id 'java'
id 'groovy'
}
apply plugin: "com.github.ben-manes.versions" // ./gradlew dependencyUpdates
group = 'cz.siret'
version = '2.6.0-dev.7'
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 = 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()
// Gradle detects overlap: test inputs (distro/test_data, models, config) vs copyDocumentation output (distro/).
// mustRunAfter establishes ordering without forcing copyDocumentation to run for local test-only builds.
mustRunAfter copyDocumentation
// 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"
// JVM flags for test compatibility with Java 17+
// --add-opens: required by Apache Arrow and Netty for direct memory access via sun.misc.Unsafe
// --enable-native-access: required by zstd-jni for native library loading
jvmArgs '--add-opens=java.base/java.nio=ALL-UNNAMED',
'--enable-native-access=ALL-UNNAMED'
// --sun-misc-unsafe-memory-access: suppresses warnings from parquet-hadoop CleanUtil
// which uses sun.misc.Unsafe (upstream unfixed). Only available in Java 23+.
if (JavaVersion.current() >= JavaVersion.VERSION_23) {
jvmArgs '--sun-misc-unsafe-memory-access=allow'
}
// Forward kdtree benchmark properties to test JVM
systemProperties System.properties.subMap([
'kdtree.benchmark', 'kdtree.points', 'kdtree.queries',
'kdtree.iterations', 'kdtree.seed', 'kdtree.radii'
])
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
all {
exclude group: 'openchart', module: 'openchart' // unavailable transitive dep from forester
}
}
/**
* 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:5.0.5'
implementation 'org.apache.commons:commons-lang3:3.20.0'
implementation 'org.apache.commons:commons-math3:3.6.1'
implementation 'commons-io:commons-io:2.22.0'
implementation 'com.google.guava:guava:33.6.0-jre'
implementation 'com.google.code.gson:gson:2.14.0'
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.12'
implementation 'com.github.luben:zstd-jni:1.5.7-7'
implementation 'com.github.dpaukov:combinatoricslib3:3.4.0'
implementation 'us.ihmc:euclid:0.22.5'
implementation 'org.apache.arrow:arrow-vector:19.0.0'
implementation 'org.apache.arrow:arrow-memory-netty:19.0.0'
implementation 'blue.strategic.parquet:parquet-floor:1.65'
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.25.4'
implementation 'org.apache.logging.log4j:log4j-slf4j2-impl:2.25.4'
implementation 'org.biojava:biojava-core:7.2.4'
implementation 'org.biojava:biojava-alignment:7.2.4'
implementation 'org.biojava:biojava-structure:7.2.4-rdk.1' // forked version with new parseSites param
implementation 'org.openscience.cdk:cdk-qsarmolecular:2.12' // for NumericalSurface class
implementation 'org.openscience.cdk:cdk-silent:2.12' // for Atom class
implementation 'cz.cuni.cusbg:faster-molecular-surface:1.0'
implementation 'cz.siret.prank:FasterForest:2.10.2'
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.3'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}