diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5e1ea01..4c63a02c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,44 +2,70 @@ name: CI on: ['push', 'pull_request'] +env: + PRIVATE_REPO: "${{ github.workspace }}/build/githubActionGrettyPrivateRepository" + jobs: - build-and-test: + + build: + name: Build Gretty + runs-on: ubuntu-latest + + env: + JDK_VERSION: "17" + GRADLE_VERSION: "7.6.2" + + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK ${{ env.JDK_VERSION }} + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: ${{ env.JDK_VERSION }} + + - name: Build with Gradle ${{ env.GRADLE_VERSION }} + run: | + set -e + ./gradlew --no-daemon wrapper --gradle-version $GRADLE_VERSION --distribution-type all + ./gradlew --no-daemon --warning-mode all -PprivateRepoDir=$PRIVATE_REPO build + set +e + + - uses: actions/upload-artifact@v3 + with: + name: gretty-private-repository + path: ${{ env.PRIVATE_REPO }} + + test: name: Gradle ${{ matrix.gradle }} on Java ${{ matrix.java }} runs-on: ubuntu-latest + needs: build strategy: matrix: - java: [11] - gradle: ['6.9.4'] include: + - java: 11 gradle: '7.6.2' - properties: '-Pspock_version=2.3-groovy-3.0 -PgebVersion=5.1' + - java: 17 gradle: '7.6.2' - properties: '-Pspock_version=2.3-groovy-3.0 -PgebVersion=5.1' + + - java: 17 + gradle: '8.2.1' env: - TEST_ALL_CONTAINERS: "['tomcat10','jetty11']" + TEST_ALL_CONTAINERS: ${{ matrix.container }} GRADLE_VERSION: ${{ matrix.gradle }} - BINTRAY_REPO: maven - BINTRAY_PACKAGE: org.gretty EXTRA_PROPERTIES: ${{ matrix.properties }} steps: - uses: actions/checkout@v3 - # Begin workaround: because the current Gradle wrapper does not support Java 17, - # we use JDK 15 to bootstrap the appropriate Gradle version, and then proceed - # to use a recent version of Gradle and Java. - - name: Set up JDK 15 - uses: actions/setup-java@v3 + - uses: actions/download-artifact@v3 with: - distribution: 'zulu' - java-version: 15 - - name: Bootstrap Gradle version - run: ./gradlew --no-daemon wrapper --gradle-version $GRADLE_VERSION --distribution-type all - # end workaround + name: gretty-private-repository + path: ${{ env.PRIVATE_REPO }} - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v3 @@ -47,20 +73,27 @@ jobs: distribution: 'zulu' java-version: ${{ matrix.java }} - - name: Cache Gradle stuff - uses: actions/cache@v2 - with: - path: | - ~/.gradle/wrapper - ~/.gradle/caches/modules-2 - key: ${{ runner.os }}-build-${{ env.GRADLE_VERSION }}-${{ hashFiles('**/*.gradle', 'gradle.properties') }} + - name: Set up Gradle ${{ matrix.gradle }} + run: ./gradlew --no-daemon wrapper --gradle-version $GRADLE_VERSION --distribution-type all - - name: Build and Test - # ./gradlew --no-daemon wrapper --gradle-version $GRADLE_VERSION --distribution-type all + # begin workaround - see also integrationTests/buildSrc/build.gradle + - name: Install buildSrc project (only required for Gradle 8) run: | - set -e - ./gradlew --no-daemon --warning-mode all $EXTRA_PROPERTIES build - cd integrationTests - ../gradlew --no-daemon --warning-mode all $EXTRA_PROPERTIES -PgeckoDriverPlatform=linux64 -PtestAllContainers=$TEST_ALL_CONTAINERS testAll - cd .. - set +e + ../../gradlew --no-daemon \ + --warning-mode all \ + -PprivateRepoDir=$PRIVATE_REPO \ + publishToPrivateRepo + if: "startsWith(env.GRADLE_VERSION, '8.')" + working-directory: integrationTests/buildSrc + # end workaround + + - name: Run Integration Tests + run: | + ../gradlew --no-daemon \ + --warning-mode all \ + -PprivateRepoDir=$PRIVATE_REPO \ + $EXTRA_PROPERTIES \ + -PgeckoDriverPlatform=linux64 \ + -PtestAllContainers=$TEST_ALL_CONTAINERS \ + testAll + working-directory: integrationTests diff --git a/.github/workflows/transition.yml b/.github/workflows/transition.yml deleted file mode 100644 index 257e7578..00000000 --- a/.github/workflows/transition.yml +++ /dev/null @@ -1,46 +0,0 @@ -# #231 If we decide to drop Gradle 6 support / Groovy 2 support or upgrade minimum JDK requirements, -# we might drop this build again. -# -# Extra one-off build for the transition from Gradle 6 to Gradle 7 -# Many things change under the hood: Gradle version, JDK version, Groovy version -# In particular, we must ensure that Gretty built with -# Gradle 6, Groovy 2, Java 11 -# works well on -# Gradle 7, Groovy 3, Java 17 - -name: the-great-divide - -on: ['pull_request', 'workflow_dispatch'] - -jobs: - build-and-test: - name: Gradle Transition Build - runs-on: ubuntu-latest - - env: - TEST_ALL_CONTAINERS: "['tomcat10','jetty11']" - GRADLE7_PROPERTIES: '-Pspock_version=2.1-groovy-3.0 -PgebVersion=5.1' - - steps: - - uses: actions/checkout@v2 - - - name: Set up JDK 11 - uses: actions/setup-java@v2 - with: - distribution: 'zulu' - java-version: 11 - - - name: Build - run: ./gradlew --no-daemon --warning-mode all build - - - name: Download Gradle 7 - run: ./gradlew --no-daemon wrapper --gradle-version 7.5 --distribution-type all - - - name: Set up JDK 17 - uses: actions/setup-java@v2 - with: - distribution: 'zulu' - java-version: 17 - - - name: Test - run: cd integrationTests && ../gradlew --no-daemon --warning-mode all $GRADLE7_PROPERTIES -PgeckoDriverPlatform=linux64 -PtestAllContainers=$TEST_ALL_CONTAINERS testAll diff --git a/README.md b/README.md index a795cc1a..daef9486 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ ![Build Status](https://github.com/gretty-gradle-plugin/gretty/workflows/CI/badge.svg) ![Maintenance Status](https://img.shields.io/maintenance/yes/2023.svg) -[![Latest release](https://img.shields.io/badge/release-4.0.3-47b31f.svg)](https://github.com/gretty-gradle-plugin/gretty/tree/v4.0.3) -[![Snapshot](https://img.shields.io/badge/current-4.0.4--SNAPSHOT-47b31f.svg)](https://github.com/gretty-gradle-plugin/gretty/tree/master) +[![Latest release](https://img.shields.io/badge/release-4.1.0-47b31f.svg)](https://github.com/gretty-gradle-plugin/gretty/tree/v4.1.0) +[![Snapshot](https://img.shields.io/badge/current-4.1.1--SNAPSHOT-47b31f.svg)](https://github.com/gretty-gradle-plugin/gretty/tree/master) [![License](https://img.shields.io/badge/license-MIT-47b31f.svg)](#copyright-and-license) Gretty is a feature-rich Gradle plugin for running web-apps on embedded servlet containers. @@ -22,6 +22,15 @@ If you are new with Gretty, try [getting started](https://gretty-gradle-plugin.g #### :star: What's new +### Version 4.1.0 +July 12, 2023, Gretty 4.1.0 is out and available at [Gradle Plugins](https://plugins.gradle.org/plugin/org.gretty) and [Maven Central](https://search.maven.org/artifact/org.gretty/gretty). + +* Drops Gradle 6 support + +* Enables stricter plugin validation + +* Adds Gradle 8 integration test build + August 24, 2022, Gretty 4.0.3 is out and available at [Gradle Plugins](https://plugins.gradle.org/plugin/org.gretty) and [Maven Central](https://search.maven.org/artifact/org.gretty/gretty). * Changes in this version: diff --git a/buildSrc/src/main/groovy/grettybuild.common.gradle b/buildSrc/src/main/groovy/grettybuild.common.gradle index b3c6d786..2d9cfe5c 100644 --- a/buildSrc/src/main/groovy/grettybuild.common.gradle +++ b/buildSrc/src/main/groovy/grettybuild.common.gradle @@ -21,12 +21,12 @@ configurations { } task javadocJar(type: Jar) { - classifier = 'javadoc' + archiveClassifier.set('javadoc') from javadoc } task sourcesJar(type: Jar) { - classifier = 'sources' + archiveClassifier.set('sources') from sourceSets.main.allSource } diff --git a/changes.md b/changes.md index 11610320..99e8d603 100644 --- a/changes.md +++ b/changes.md @@ -2,6 +2,12 @@ [![logo](https://gretty-gradle-plugin.github.io/gretty-doc/images/gretty_logo.png "gretty logo")](https://github.com/gretty-gradle-plugin/gretty) +### Version 4.1.0 + +* Drops Gradle 6 support +* Enables stricter plugin validation +* Adds Gradle 8 integration test build + ### Version 4.0.3 * Replace internal Gradle API usage with public API #263 diff --git a/gradle.properties b/gradle.properties index 5ef10133..3083656d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,13 +6,13 @@ developerId = gretty-gradle-plugin developerName = Andrey Hihlovskiy license = MIT group = org.gretty -version = 4.0.4-SNAPSHOT +version = 4.1.0 jetty11_version = 11.0.15 jetty11_servlet_api_version = 5.0.0 tomcat10_version = 10.1.10 tomcat10_servlet_api_version = 5.0.0 asm_version = 9.5 -spock_version = 1.3-groovy-2.5 +spock_version = 2.0-groovy-3.0 commons_cli_version = 1.5.0 commons_io_version = 2.13.0 slf4j_version = 2.0.7 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c0..afba1092 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7c7bf44e..f707610b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,8 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -# We want to build releases with Gradle 6 so we support both Gradle 6 and 7: +# We want to build releases with Gradle 7 so we support both Gradle 7 and 8: # https://github.com/gretty-gradle-plugin/gretty/pull/214#issuecomment-812289131 -distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 4f906e0c..65dcd68d 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,105 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index ac1b06f9..6689b85b 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/integrationTests/buildSrc/build.gradle b/integrationTests/buildSrc/build.gradle index 6215ea67..4be90475 100644 --- a/integrationTests/buildSrc/build.gradle +++ b/integrationTests/buildSrc/build.gradle @@ -73,6 +73,12 @@ subprojects { mustRunAfter project.tasks.check } + // FIXME this task dependency became obsolete with Gradle 8, + // because Gradle 8 no longer invokes the 'build' task on + // buildSrc projects, just the task that assembles the output. + // https://docs.gradle.org/8.0/release-notes.html#tests-for-buildsrc-are-no-longer-automatically-run + // As a result, we miss the gretty-integrationTest JAR from + // the private repo if we do not explicitly publish the JAR. project.build.dependsOn project.tasks.publishToPrivateRepository } // findPlugin java diff --git a/integrationTests/buildSrc/gradle.properties b/integrationTests/buildSrc/gradle.properties index 7b051e11..2d6fbd8d 100644 --- a/integrationTests/buildSrc/gradle.properties +++ b/integrationTests/buildSrc/gradle.properties @@ -3,7 +3,7 @@ geckoDriverVersion = 0.29.1 geckoDriverPlatform = macos gradle_download_task_version = 3.4.3 commons_configuration_version = 1.10 -gebVersion=2.3.1 +gebVersion=5.0 seleniumVersion=3.141.59 testAllContainers= diff --git a/jitpack.yml b/jitpack.yml index f9c4166a..855e3653 100644 --- a/jitpack.yml +++ b/jitpack.yml @@ -1,9 +1,9 @@ -# We want to build releases with Gradle 6 so we support both Gradle 6 and 7: +# We want to build releases with Gradle 7 so we support both Gradle 7 and 8: # https://github.com/gretty-gradle-plugin/gretty/pull/214#issuecomment-812289131 # And JitPack uses the Gradle Wrapper when building a new snapshot jdk: - openjdk11 install: - java -version - - ./gradlew --no-daemon wrapper --gradle-version 6.9.4 --distribution-type all - - ./gradlew --no-daemon --warning-mode all --stacktrace -Pspock_version=1.3-groovy-2.5 -PgebVersion=2.3.1 publishToMavenLocal + - ./gradlew --no-daemon wrapper --gradle-version 7.6.2 --distribution-type all + - ./gradlew --no-daemon --warning-mode all --stacktrace publishToMavenLocal diff --git a/libs/gretty/build.gradle b/libs/gretty/build.gradle index e88c2dc5..5ac1ab82 100644 --- a/libs/gretty/build.gradle +++ b/libs/gretty/build.gradle @@ -34,18 +34,6 @@ pluginBundle { validatePlugins { enableStricterValidation = true - // FIXME #235 - Pass stricter validation since Gradle 7.2 - // see PR #236 for the required changes - // - // We can't ship the improved plugin because passing the plugin validation requires - // adding an annotation which is not shipped with Gradle 6.9. - // As a result, we need to drop Gradle 6 compat, then add the annotation only present - // in Gradle 7.1 onwards, and then we can enable strict validation again. - // - // Unluckily, there is no way to selectively disable this validation for the Gradle 7 - // build. Also, faking the presence of the annotation to get the plugin to compile with - // Gradle 6 would complicate the build process by a lot. - ignoreFailures = true } tasks.named('publishPlugins').configure { diff --git a/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppAfterIntegrationTestTask.groovy b/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppAfterIntegrationTestTask.groovy index 04f9499a..cccdbec8 100644 --- a/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppAfterIntegrationTestTask.groovy +++ b/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppAfterIntegrationTestTask.groovy @@ -12,6 +12,7 @@ import groovy.transform.CompileStatic import groovy.transform.TypeCheckingMode import org.gradle.api.tasks.Internal import org.gradle.api.tasks.TaskAction +import org.gradle.work.DisableCachingByDefault import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -20,6 +21,7 @@ import org.slf4j.LoggerFactory * @author akhikhl */ @CompileStatic(TypeCheckingMode.SKIP) +@DisableCachingByDefault class AppAfterIntegrationTestTask extends AppStopTask { private static final Logger log = LoggerFactory.getLogger(AppAfterIntegrationTestTask) diff --git a/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppBeforeIntegrationTestTask.groovy b/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppBeforeIntegrationTestTask.groovy index 88a717d7..96ebb72e 100644 --- a/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppBeforeIntegrationTestTask.groovy +++ b/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppBeforeIntegrationTestTask.groovy @@ -12,6 +12,7 @@ import groovy.transform.CompileStatic import groovy.transform.TypeCheckingMode import org.gradle.api.tasks.Internal import org.gradle.process.JavaForkOptions +import org.gradle.work.DisableCachingByDefault import org.slf4j.Logger import org.slf4j.LoggerFactory /** @@ -19,6 +20,7 @@ import org.slf4j.LoggerFactory * @author akhikhl */ @CompileStatic(TypeCheckingMode.SKIP) +@DisableCachingByDefault class AppBeforeIntegrationTestTask extends AppStartTask { private static final Logger log = LoggerFactory.getLogger(AppBeforeIntegrationTestTask) diff --git a/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppRedeployTask.groovy b/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppRedeployTask.groovy index 66957c15..e5ae0ca9 100644 --- a/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppRedeployTask.groovy +++ b/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppRedeployTask.groovy @@ -1,10 +1,12 @@ package org.akhikhl.gretty import org.gradle.api.tasks.Internal +import org.gradle.work.DisableCachingByDefault /** * @author sala */ +@DisableCachingByDefault class AppRedeployTask extends AppServiceTask { @Internal List webapps = [] diff --git a/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppRestartTask.groovy b/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppRestartTask.groovy index 42c897e9..58759e8b 100644 --- a/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppRestartTask.groovy +++ b/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppRestartTask.groovy @@ -8,10 +8,13 @@ */ package org.akhikhl.gretty +import org.gradle.work.DisableCachingByDefault + /** * * @author akhikhl */ +@DisableCachingByDefault class AppRestartTask extends AppServiceTask { String getCommand() { diff --git a/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppServiceTask.groovy b/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppServiceTask.groovy index 51eb6d64..1eaf3448 100644 --- a/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppServiceTask.groovy +++ b/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppServiceTask.groovy @@ -14,6 +14,7 @@ import org.gradle.api.DefaultTask import org.gradle.api.GradleException import org.gradle.api.tasks.Internal import org.gradle.api.tasks.TaskAction +import org.gradle.work.DisableCachingByDefault import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -23,6 +24,7 @@ import org.slf4j.LoggerFactory * @author akhikhl */ @CompileStatic(TypeCheckingMode.SKIP) +@DisableCachingByDefault abstract class AppServiceTask extends DefaultTask { private static Logger log = LoggerFactory.getLogger(AppServiceTask) diff --git a/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppStartTask.groovy b/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppStartTask.groovy index 48424096..b9f5cf7f 100644 --- a/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppStartTask.groovy +++ b/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppStartTask.groovy @@ -11,6 +11,7 @@ package org.akhikhl.gretty import groovy.transform.CompileStatic import groovy.transform.TypeCheckingMode import org.gradle.api.tasks.Internal +import org.gradle.work.DisableCachingByDefault /** * Gradle task for starting jetty @@ -18,6 +19,7 @@ import org.gradle.api.tasks.Internal * @author akhikhl */ @CompileStatic(TypeCheckingMode.SKIP) +@DisableCachingByDefault class AppStartTask extends StartBaseTask implements TaskWithServerConfig, TaskWithWebAppConfig { @Delegate diff --git a/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppStopTask.groovy b/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppStopTask.groovy index 8b1b5bed..6e0adf1d 100644 --- a/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppStopTask.groovy +++ b/libs/gretty/src/main/groovy/org/akhikhl/gretty/AppStopTask.groovy @@ -8,10 +8,13 @@ */ package org.akhikhl.gretty +import org.gradle.work.DisableCachingByDefault + /** * * @author akhikhl */ +@DisableCachingByDefault class AppStopTask extends AppServiceTask { String getCommand() { diff --git a/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmAfterIntegrationTestTask.groovy b/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmAfterIntegrationTestTask.groovy index c3846728..d294e13d 100644 --- a/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmAfterIntegrationTestTask.groovy +++ b/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmAfterIntegrationTestTask.groovy @@ -13,6 +13,7 @@ import groovy.transform.TypeCheckingMode import org.gradle.api.Project import org.gradle.api.tasks.Internal import org.gradle.api.tasks.TaskAction +import org.gradle.work.DisableCachingByDefault import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -21,6 +22,7 @@ import org.slf4j.LoggerFactory * @author akhikhl */ @CompileStatic(TypeCheckingMode.SKIP) +@DisableCachingByDefault class FarmAfterIntegrationTestTask extends FarmStopTask { private static final Logger log = LoggerFactory.getLogger(FarmAfterIntegrationTestTask) diff --git a/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmBeforeIntegrationTestTask.groovy b/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmBeforeIntegrationTestTask.groovy index afd5e943..52ae7748 100644 --- a/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmBeforeIntegrationTestTask.groovy +++ b/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmBeforeIntegrationTestTask.groovy @@ -13,6 +13,7 @@ import groovy.transform.TypeCheckingMode import org.gradle.api.Task import org.gradle.api.tasks.Internal import org.gradle.process.JavaForkOptions +import org.gradle.work.DisableCachingByDefault import org.slf4j.Logger import org.slf4j.LoggerFactory /** @@ -20,6 +21,7 @@ import org.slf4j.LoggerFactory * @author akhikhl */ @CompileStatic(TypeCheckingMode.SKIP) +@DisableCachingByDefault class FarmBeforeIntegrationTestTask extends FarmStartTask { protected static final Logger log = LoggerFactory.getLogger(FarmBeforeIntegrationTestTask) diff --git a/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmIntegrationTestTask.groovy b/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmIntegrationTestTask.groovy index 3ce63ab4..3218b81a 100644 --- a/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmIntegrationTestTask.groovy +++ b/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmIntegrationTestTask.groovy @@ -14,6 +14,7 @@ import org.gradle.api.DefaultTask import org.gradle.api.Project import org.gradle.api.tasks.Input import org.gradle.api.tasks.Internal +import org.gradle.work.DisableCachingByDefault import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -22,6 +23,7 @@ import org.slf4j.LoggerFactory * @author akhikhl */ @CompileStatic(TypeCheckingMode.SKIP) +@DisableCachingByDefault class FarmIntegrationTestTask extends DefaultTask { protected static final Logger log = LoggerFactory.getLogger(FarmIntegrationTestTask) diff --git a/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmRestartTask.groovy b/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmRestartTask.groovy index 1c08f765..ae8624c9 100644 --- a/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmRestartTask.groovy +++ b/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmRestartTask.groovy @@ -8,10 +8,13 @@ */ package org.akhikhl.gretty +import org.gradle.work.DisableCachingByDefault + /** * * @author akhikhl */ +@DisableCachingByDefault class FarmRestartTask extends FarmServiceTask { @Override diff --git a/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmServiceTask.groovy b/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmServiceTask.groovy index 0cdcd31c..d75d8af6 100644 --- a/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmServiceTask.groovy +++ b/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmServiceTask.groovy @@ -13,12 +13,14 @@ import org.gradle.api.GradleException import org.gradle.api.tasks.Input import org.gradle.api.tasks.Optional import org.gradle.api.tasks.TaskAction +import org.gradle.work.DisableCachingByDefault import org.slf4j.Logger import org.slf4j.LoggerFactory /** * * @author akhikhl */ +@DisableCachingByDefault abstract class FarmServiceTask extends DefaultTask { private static Logger log = LoggerFactory.getLogger(FarmServiceTask) diff --git a/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmStartTask.groovy b/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmStartTask.groovy index d02d3242..1e0eec44 100644 --- a/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmStartTask.groovy +++ b/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmStartTask.groovy @@ -12,11 +12,13 @@ import org.gradle.api.Project import org.gradle.api.tasks.Input import org.gradle.api.tasks.Internal import org.gradle.api.tasks.Optional +import org.gradle.work.DisableCachingByDefault /** * * @author akhikhl */ +@DisableCachingByDefault class FarmStartTask extends StartBaseTask implements TaskWithServerConfig { @Input diff --git a/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmStopTask.groovy b/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmStopTask.groovy index 07e9d6c5..30944774 100644 --- a/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmStopTask.groovy +++ b/libs/gretty/src/main/groovy/org/akhikhl/gretty/FarmStopTask.groovy @@ -8,10 +8,13 @@ */ package org.akhikhl.gretty +import org.gradle.work.DisableCachingByDefault + /** * * @author akhikhl */ +@DisableCachingByDefault class FarmStopTask extends FarmServiceTask { @Override diff --git a/libs/gretty/src/main/groovy/org/akhikhl/gretty/JettyStartTask.groovy b/libs/gretty/src/main/groovy/org/akhikhl/gretty/JettyStartTask.groovy index 2d44e44a..97bbe852 100644 --- a/libs/gretty/src/main/groovy/org/akhikhl/gretty/JettyStartTask.groovy +++ b/libs/gretty/src/main/groovy/org/akhikhl/gretty/JettyStartTask.groovy @@ -8,10 +8,13 @@ */ package org.akhikhl.gretty +import org.gradle.work.DisableCachingByDefault + /** * * @author akhikhl */ +@DisableCachingByDefault class JettyStartTask extends AppStartTask { @Override diff --git a/libs/gretty/src/main/groovy/org/akhikhl/gretty/StartBaseTask.groovy b/libs/gretty/src/main/groovy/org/akhikhl/gretty/StartBaseTask.groovy index d4d67d4b..b6e70c25 100644 --- a/libs/gretty/src/main/groovy/org/akhikhl/gretty/StartBaseTask.groovy +++ b/libs/gretty/src/main/groovy/org/akhikhl/gretty/StartBaseTask.groovy @@ -18,12 +18,14 @@ import org.gradle.api.tasks.Internal import org.gradle.api.tasks.TaskAction import org.gradle.process.JavaForkOptions import org.gradle.testing.jacoco.plugins.JacocoTaskExtension +import org.gradle.work.DisableCachingByDefault /** * Base task for starting jetty * * @author akhikhl */ @CompileStatic(TypeCheckingMode.SKIP) +@DisableCachingByDefault abstract class StartBaseTask extends DefaultTask { @Internal diff --git a/libs/gretty/src/main/groovy/org/akhikhl/gretty/TomcatStartTask.groovy b/libs/gretty/src/main/groovy/org/akhikhl/gretty/TomcatStartTask.groovy index 1db546bf..776182b9 100644 --- a/libs/gretty/src/main/groovy/org/akhikhl/gretty/TomcatStartTask.groovy +++ b/libs/gretty/src/main/groovy/org/akhikhl/gretty/TomcatStartTask.groovy @@ -8,10 +8,13 @@ */ package org.akhikhl.gretty +import org.gradle.work.DisableCachingByDefault + /** * * @author akhikhl */ +@DisableCachingByDefault class TomcatStartTask extends AppStartTask { @Override diff --git a/pluginScripts/gretty-4.1.0.plugin b/pluginScripts/gretty-4.1.0.plugin new file mode 100644 index 00000000..4f0a8ec6 --- /dev/null +++ b/pluginScripts/gretty-4.1.0.plugin @@ -0,0 +1,16 @@ +buildscript { + repositories { + mavenCentral() + } + + dependencies { + classpath 'org.gretty:gretty:4.1.0' + } +} + +repositories { + mavenCentral() +} + +if (!project.plugins.findPlugin(org.akhikhl.gretty.GrettyPlugin)) + project.apply(plugin: org.akhikhl.gretty.GrettyPlugin) diff --git a/pluginScripts/gretty-SNAPSHOT.plugin b/pluginScripts/gretty-SNAPSHOT.plugin index e1968e66..8a4fbdec 100644 --- a/pluginScripts/gretty-SNAPSHOT.plugin +++ b/pluginScripts/gretty-SNAPSHOT.plugin @@ -5,7 +5,7 @@ buildscript { } dependencies { - classpath 'org.gretty:gretty:4.0.4-SNAPSHOT' + classpath 'org.gretty:gretty:4.1.1-SNAPSHOT' } } diff --git a/pluginScripts/gretty.plugin b/pluginScripts/gretty.plugin index 5659e086..4f0a8ec6 100644 --- a/pluginScripts/gretty.plugin +++ b/pluginScripts/gretty.plugin @@ -4,7 +4,7 @@ buildscript { } dependencies { - classpath 'org.gretty:gretty:4.0.3' + classpath 'org.gretty:gretty:4.1.0' } }