Skip to content

Commit

Permalink
Groovy4 (#279)
Browse files Browse the repository at this point in the history
Make work with 24.10

---------

Co-authored-by: Dr. Ernie Prabhakar <[email protected]>
  • Loading branch information
drernie and drernie authored Dec 22, 2024
1 parent bbced8d commit 2a9fc91
Show file tree
Hide file tree
Showing 18 changed files with 235 additions and 101 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
java_version: [11, 17, 19]
java_version: [17, 19, 21]
runs-on: ${{ matrix.os }}

steps:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.gradle
.idea
.nextflow*
gradle.properties
# gradle.properties

# Ignore Gradle build output directory
/build/
Expand Down
16 changes: 15 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ PROJECT ?= nf-quilt
WRITE_BUCKET ?= udp-spec
FRAGMENT ?= &path=.
NF_DIR ?= ../nextflow
NF_GIT ?= $(NF_DIR)/nextflow
NF_BIN ?= ./launch.sh
PID ?= $$$$
PIPELINE ?= sarek
QUERY ?= ?Name=$(USER)&Owner=Kevin+Moore&Date=2023-03-07&Type=CRISPR&Notebook+URL=http%3A%2F%2Fexample.com
VERSION ?= $(shell grep 'Plugin-Version' plugins/$(PROJECT)/src/resources/META-INF/MANIFEST.MF | awk '{ print $$2 }')
NXF_VER ?= $(shell cat VERSION)
TEST_URI ?= quilt+s3://$(WRITE_BUCKET)$(QUERY)\#package=nf-quilt/dest-$(VERSION)$(FRAGMENT)
PIPE_OUT ?= quilt+s3://$(WRITE_BUCKET)\#package=$(PROJECT)/$(PIPELINE)
S3_BASE = s3://$(WRITE_BUCKET)/$(PROJECT)
Expand All @@ -30,9 +32,15 @@ check-env:
clean:
./gradlew clean
rm -rf null results work
rm -rf */*/build plugins/nf-quilt/bin
rm -rf build */build */*/build plugins/nf-quilt/bin
rm -f .nextflow.log* .launch*classpath

clean-all: clean
rm -rf .gradle buildSrc/.gradle

rebuild:
./gradlew clean build --refresh-dependencies

compile:
./gradlew compileGroovy exportClasspath
@echo "DONE `date`"
Expand Down Expand Up @@ -107,6 +115,12 @@ $(PIPELINE): $(NF_BIN) install
$(NF_BIN) pull nf-core/$(PIPELINE)
$(NF_BIN) run nf-core/$(PIPELINE) -profile test,docker -plugins $(PROJECT)@$(VERSION) --outdir "$(PIPE_OUT)"

fetchngs: $(NF_GIT)
NXF_VER=$(NXF_VER) $(NF_BIN) run quiltdata/fetchngs -r master -profile test,docker --input wf/ids.csv --outdir "s3://$(WRITE_BUCKET)/nf-quilt/fetchngs"

nf-git-ver: $(NF_GIT)
NXF_VER=$(NXF_VER) $(NF_GIT) -v

#
# Show dependencies
#
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
23.04.3
23.10.0
78 changes: 40 additions & 38 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@ if (groovyVer) {
maven { url repo }
}

configurations.all {
configurations.configureEach {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.codehaus.groovy') {
force 'cglib:cglib-nodep:3.3.0'
force 'org.objenesis:objenesis:3.4'

// (Optional) If transitive Groovy dependencies cause conflicts
force "org.${groovySource}.groovy:groovy-all:$groovyVer"
if ((details.requested.group == 'org.codehaus.groovy') && details.requested.version != groovyVer) {
if (groovyVer.contains(':')) {
details.useTarget(groovyVer)
}
Expand All @@ -49,12 +54,8 @@ if (groovyVer) {
}
}

def projects(String...args) {
args.collect { project(it) }
}

group = 'io.nextflow'
version = rootProject.file('VERSION').text.trim()

allprojects {
apply plugin: 'java'
Expand All @@ -65,17 +66,17 @@ allprojects {

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
languageVersion = JavaLanguageVersion.of(javaLangVersion)
}
}

compileJava {
options.release = 11
options.release = jdkVersion.toInteger()
}

tasks.withType(GroovyCompile) {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
tasks.withType(GroovyCompile).configureEach {
sourceCompatibility = jdkVersion
targetCompatibility = jdkVersion
}

idea {
Expand All @@ -98,8 +99,7 @@ allprojects {

dependencies {
// see https://docs.gradle.org/4.1/userguide/dependency_management.html#sec:module_replacement
implementation 'com.github.groovy-wslite:groovy-wslite:1.1.3'
implementation 'org.codehaus.groovy:groovy-all:3.0.23'
implementation "org.${groovySource}.groovy:groovy-all:$groovyVersion"
implementation 'com.fasterxml.jackson.core:jackson-databind:2.18.2'
implementation 'com.upplication:s3fs:2.2.2'

Expand All @@ -108,8 +108,8 @@ allprojects {
}
// Documentation required libraries
groovyDoc 'org.fusesource.jansi:jansi:2.4.1'
groovyDoc 'org.codehaus.groovy:groovy-groovydoc:3.0.23'
groovyDoc 'org.codehaus.groovy:groovy-ant:3.0.23'
groovyDoc "org.${groovySource}.groovy:groovy-groovydoc:$groovyVersion"
groovyDoc "org.${groovySource}.groovy:groovy-ant:$groovyVersion"
}

test {
Expand All @@ -127,42 +127,44 @@ allprojects {
// Disable strict javadoc checks
// See http://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
tasks.withType(Javadoc).configureEach {
options.addStringOption('Xdoclint:none', '-quiet')
}
}

tasks.withType(Jar) {
tasks.withType(Jar).configureEach {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

// patched as described here
// http://forums.gradle.org/gradle/topics/gradle_task_groovydoc_failing_with_noclassdeffounderror
tasks.withType(Groovydoc) {
tasks.withType(Groovydoc).configureEach {
groovyClasspath = project.configurations.groovyDoc
includes = ['nextflow/**']
}

// Required to run tests on Java 9 and higher in compatibility mode
if (JavaVersion.current() >= JavaVersion.VERSION_1_9) {
tasks.withType(Test) {
jvmArgs([
'--add-opens=java.base/java.lang=ALL-UNNAMED',
'--add-opens=java.base/java.io=ALL-UNNAMED',
'--add-opens=java.base/java.nio=ALL-UNNAMED',
'--add-opens=java.base/java.nio.file.spi=ALL-UNNAMED',
'--add-opens=java.base/java.net=ALL-UNNAMED',
'--add-opens=java.base/java.util=ALL-UNNAMED',
'--add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED',
'--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED',
'--add-opens=java.base/sun.nio.ch=ALL-UNNAMED',
'--add-opens=java.base/sun.nio.fs=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.ftp=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.file=ALL-UNNAMED',
'--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED',
])
tasks.withType(Test).tap {
configureEach {
jvmArgs([
'--add-opens=java.base/java.lang=ALL-UNNAMED',
'--add-opens=java.base/java.io=ALL-UNNAMED',
'--add-opens=java.base/java.nio=ALL-UNNAMED',
'--add-opens=java.base/java.nio.file.spi=ALL-UNNAMED',
'--add-opens=java.base/java.net=ALL-UNNAMED',
'--add-opens=java.base/java.util=ALL-UNNAMED',
'--add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED',
'--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED',
'--add-opens=java.base/sun.nio.ch=ALL-UNNAMED',
'--add-opens=java.base/sun.nio.fs=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.ftp=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.file=ALL-UNNAMED',
'--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED',
])
}
}
}
}
Expand Down Expand Up @@ -195,8 +197,8 @@ task exportClasspath {
dependsOn allprojects.jar
doLast {
def all = getRuntimeConfigs()
def libs = all.collect { File file -> file.canonicalPath; }
['nextflow', 'nf-commons', 'nf-httfs'].each { libs << file("modules/$it/build/libs/${it}-${version}.jar").canonicalPath }
def libs = all.collect { File file -> file.canonicalPath }
['nextflow', 'nf-commons', 'nf-httfs'].each { libs << file("modules/$it/build/libs/${it}-${nextflowVersion}.jar").canonicalPath }
file('.launch.classpath').text = libs.unique().join(':')
}
}
14 changes: 14 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* This file was generated by the Gradle 'init' task.
*/

plugins {
// Support convention plugins written in Groovy. Convention plugins are build scripts in 'src/main' that automatically become available as plugins in the main build.
id 'groovy-gradle-plugin'
}

repositories {
// Use the plugin portal to apply community plugins in convention plugins.
gradlePluginPortal()
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* This file was generated by the Gradle 'init' task.
*/

plugins {
// Apply the common convention plugin for shared build configuration between library and application projects.
id 'io.nextflow.groovy-common-conventions'

// Apply the application plugin to add support for building a CLI application in Java.
id 'application'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* This file was generated by the Gradle 'init' task.
*/

plugins {
// Apply the groovy Plugin to add support for Groovy.
id 'groovy'
}

repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}

ext {
jdkVersion = '11'
javaLangVersion = 21
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(javaLangVersion) // from nf-schema
}
}

compileJava {
options.release.set(jdkVersion.toInteger())
}

tasks.withType(GroovyCompile) {
sourceCompatibility = jdkVersion
targetCompatibility = jdkVersion
}

tasks.withType(Test) {
jvmArgs ([
'--add-opens=java.base/java.lang=ALL-UNNAMED',
'--add-opens=java.base/java.io=ALL-UNNAMED',
'--add-opens=java.base/java.nio=ALL-UNNAMED',
'--add-opens=java.base/java.nio.file.spi=ALL-UNNAMED',
'--add-opens=java.base/java.net=ALL-UNNAMED',
'--add-opens=java.base/java.util=ALL-UNNAMED',
'--add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED',
'--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED',
'--add-opens=java.base/sun.nio.ch=ALL-UNNAMED',
'--add-opens=java.base/sun.nio.fs=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.ftp=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.file=ALL-UNNAMED',
'--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED',
])
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* This file was generated by the Gradle 'init' task.
*/

plugins {
// Apply the common convention plugin for shared build configuration between library and application projects.
id 'io.nextflow.groovy-common-conventions'
// Apply the java-library plugin for API and implementation separation.
id 'java-library'
}

4 changes: 2 additions & 2 deletions gradle-groovysh-init.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ gradle.projectsLoaded {
}

project.dependencies {
groovyshdependencies("org.codehaus.groovy:groovy-groovysh:${GroovySystem.version}") {
groovyshdependencies("org.${groovySource}.groovy:groovy-groovysh:${GroovySystem.version}") {
exclude group: 'org.codehaus.groovy'
}
}
Expand All @@ -31,7 +31,7 @@ gradle.projectsLoaded {
groovyObjectClassLoader.addURL(file.toURL())
}
Class.forName('jline.console.history.FileHistory', true, groovyObjectClassLoader)
groovyshClass = Class.forName('org.codehaus.groovy.tools.shell.Groovysh', true, groovyObjectClassLoader)
groovyshClass = Class.forName("org.${groovySource}.groovy.tools.shell.Groovysh", true, groovyObjectClassLoader)

if (groovyshClass) {
groovyShell = groovyshClass.newInstance()
Expand Down
6 changes: 6 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
nextflowVersion = 24.10.0
groovyVersion = 4.0.23
groovyV = groovy-4.0
groovySource = apache
jdkVersion = 11
javaLangVersion = 21
10 changes: 6 additions & 4 deletions groovysh-task.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ gradle.projectsLoaded {
afterEvaluate { project ->
if (!project.repositories.any { it.name == 'MavenRepo' }) {
project.repositories {
// To be able to load org.apache.groovy:groovy-groovysh and dependencies
// To be able to load org.codehaus.groovy:groovy-groovysh and dependencies
mavenCentral {
content {
includeGroup 'org.apache.groovy'
includeGroup 'org.codehaus.groovy'
includeGroup 'jline'
includeGroup 'com.github.javaparser'
includeGroup 'org.ow2.asm'
Expand All @@ -21,7 +21,9 @@ gradle.projectsLoaded {
}

project.dependencies {
groovyshdependencies 'org.apache.groovy:groovy-groovysh:4.0.24'
groovyshdependencies "org.${groovySource}.groovy:groovy-groovysh:$groovyVer" {
exclude group: 'org.codehaus.groovy'
}
}

project.tasks.register('groovysh') {
Expand All @@ -35,7 +37,7 @@ gradle.projectsLoaded {

def groovyshClass
def groovyShell
groovyshClass = Class.forName('org.apache.groovy.groovysh.Groovysh', true, groovyshClassLoader)
groovyshClass = Class.forName('org.codehaus.groovy.groovysh.Groovysh', true, groovyshClassLoader)
if (groovyshClass) {
groovyShell = groovyshClass.newInstance()
if (groovyShell) {
Expand Down
Loading

0 comments on commit 2a9fc91

Please sign in to comment.