ziggy/build.gradle

201 lines
7.6 KiB
Groovy

// Ziggy Gradle Build File
//
// This file contains the declarative portion of the build only.
// Imperative tasks are found in script-plugins and are applied at the
// bottom of this file.
// To view a dependency graph using the taskinfo plugin, run "./gradlew tiTree build"
plugins {
id 'com.github.spotbugs' version '6.1.+'
id 'eclipse'
id 'jacoco'
id 'java'
id 'jvm-test-suite'
id 'maven-publish'
id 'org.barfuin.gradle.taskinfo' version '2.2.+'
id 'signing'
}
defaultTasks ':buildSrc:publish', 'publish', 'test'
ext {
// Location of third-party sources.
outsideDir = "$rootDir/outside"
// The dependency group used for libraries from outside is called "outside".
// This variable contains the directory that contains the libraries from
// outside. Without the dependency group and the outside subdirectory,
// consumers of the published module will get "null" errors.
outsideGroupDir = "$buildDir/libs/outside"
// Name of the outside group, used in publishing artifacts.
outsideGroup = "outside"
}
repositories {
mavenCentral()
flatDir {
dirs "$outsideDir/lib"
}
}
dependencies {
// Needed to compile ziggy.
implementation files("$rootDir/buildSrc/build/libs/buildSrc-${version}.jar")
implementation 'com.github.librepdf:openpdf:2.0.+'
implementation 'com.github.spotbugs:spotbugs-annotations:4.8.+'
implementation 'com.google.guava:guava:33.4.+'
implementation 'com.jgoodies:jgoodies-forms:1.9.+'
implementation 'com.jgoodies:jgoodies-looks:2.7.+'
implementation 'commons-cli:commons-cli:1.9.+'
implementation 'commons-codec:commons-codec:1.18.+'
implementation 'commons-io:commons-io:2.18.+'
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.+'
implementation 'org.apache.commons:commons-collections4:4.4'
implementation 'org.apache.commons:commons-compress:1.27.+'
implementation 'org.apache.commons:commons-configuration2:2.11.+'
implementation 'org.apache.commons:commons-csv:1.13.+'
implementation 'org.apache.commons:commons-exec:1.4.+'
implementation 'org.apache.commons:commons-lang3:3.17.+'
implementation 'org.apache.commons:commons-math3:3.6.+'
implementation 'org.apache.commons:commons-text:1.13.+'
implementation 'org.apache.logging.log4j:log4j-core:2.24.+'
implementation 'org.apache.logging.log4j:log4j-slf4j2-impl:2.24.+'
implementation 'org.hibernate.orm:hibernate-ant:6.2.+'
implementation 'org.hibernate:hibernate-core:6.2.+'
implementation 'org.javassist:javassist:3.30.2-GA'
implementation 'org.jfree:jfreechart:1.5.+'
implementation 'org.jsoup:jsoup:1.18.+'
implementation 'org.netbeans.api:org-netbeans-swing-outline:RELEASE121'
implementation 'org.slf4j:slf4j-api:2.0.+'
implementation 'org.tros:l2fprod-properties-editor:1.3.+'
// Configuration2 declares the following as optional [1]. It's not, so it's added here.
// Occasionally, comment out this line--if the tests pass, delete it.
// 1. https://github.com/apache/commons-configuration/blob/master/pom.xml
implementation 'commons-beanutils:commons-beanutils:1.10.+'
// Libraries built outside.
implementation 'outside:jarhdf5:1.14.+'
implementation 'outside:wrapper:3.5.+'
// Needed to run unit tests and at runtime.
implementation 'org.hsqldb:hsqldb:2.7.+'
// Needed to compile unit tests.
testImplementation 'junit:junit:4.13.+'
testImplementation 'org.hamcrest:hamcrest:3.0'
testImplementation 'org.mockito:mockito-core:5.15.+'
// Needed at runtime.
runtimeOnly 'org.hibernate.orm:hibernate-hikaricp:6.2.+'
runtimeOnly 'org.postgresql:postgresql:42.7.+'
// Astonishingly, for some reason configuration2 doesn't work when
// called by MATLAB, but configuration does. Ziggy doesn't use MATLAB
// in its build but provides MATLAB utilities that pipelines can call,
// so I think that makes this a runtime dependency for Ziggy.
runtimeOnly 'commons-configuration:commons-configuration:1.10'
// The following plugin reveals some bugs in our code, but until
// the "The following classes needed for analysis were missing" bug
// is fixed, it is commented out for daily use.
// spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.13.+'
annotationProcessor 'org.hibernate.orm:hibernate-jpamodelgen:6.2.+'
}
tasks.withType(JavaCompile) {
options.deprecation = true
// Avoid the Eclipse "Project XXX has no explicit encoding set" warning.
// Until Eclipse Buildship issue #344 is fixed, remove the warning
// in Eclipse by using C-1 to apply a Quick Fix on the warning message.
options.encoding = 'UTF-8'
// Suppresses "Note: Hibernate JPA 2 Static-Metamodel Generator 6.2.32.Final" output
logging.captureStandardError LogLevel.INFO
}
// Add additional artifacts for publishing (see script-utils/publish.gradle).
java {
// This runs the javadoc task, which currently fails due to
// Javadoc errors. Enable after errors fixed, or ignored.
// withJavadocJar()
withSourcesJar()
}
// To view code coverage, run the jacocoTestReport task and view the output in:
// build/reports/jacoco/test/html/index.html.
check.dependsOn jacocoTestReport
jacocoTestReport {
// TODO Switch dependency to testAll to ensure that the integration tests are counted
// Depending on anything other than test results in this task
// getting SKIPPED, perhaps due to missing execution data. If code
// coverage of integration tests is desired, see comment in the test
// configuration.
// Switching to a recent version of JUnit 5+ was shown to work in one post
dependsOn test
// Since GUI code doesn't have unit tests, exclude it from the
// reports until the GUI code can be adequately unit tested. The
// main problem with leaving GUI code in the coverage report is
// that new GUI code can lower the total code coverage in
// violation of the coverage requirement in the SMP.
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: ['gov/nasa/ziggy/ui/*'])
}))
}
}
javadoc {
title = "Ziggy API"
options.overview = "src/main/java/overview.html"
options.addBooleanOption("Xdoclint:-missing", true)
}
check.dependsOn javadoc
// The SpotBugs plugin adds spotbugsMain and spotbugsTest to the check task.
spotbugs {
// The SMP requires that all high priority problems are addressed before testing can commence.
// Set reportLevel to 'LOW' to reveal a handful of interesting and potential bugs.
reportLevel = com.github.spotbugs.snom.Confidence.valueOf('HIGH')
}
tasks.withType(com.github.spotbugs.snom.SpotBugsTask) {
reports {
html.stylesheet = "fancy-hist.xsl"
}
}
// Outside build files should copy their jars to $outsideGroupDir and
// then make copyOutsideLibs depend on the task that performs that copy.
// This is used to publish the outside jars.
task copyOutsideLibs
compileJava.dependsOn copyOutsideLibs
// Apply Ziggy Gradle script plugins.
// A couple of the other scripts depend on integrationTest.
apply from: "script-plugins/test.gradle"
// Most scripts in alphabetical order.
apply from: "script-plugins/copy.gradle"
apply from: "script-plugins/database-schemas.gradle"
apply from: "script-plugins/eclipse.gradle"
apply from: "script-plugins/hdf5.gradle"
apply from: "script-plugins/misc.gradle"
apply from: "script-plugins/wrapper.gradle"
apply from: "script-plugins/xml-schemas.gradle"
apply from: "script-plugins/ziggy-libraries.gradle"
// Depends on versions set in hdf5.gradle and wrapper.gradle and copyBuildSrc from copy.gradle.
apply from: "script-plugins/publish.gradle"