diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d106e15f..d8c94999 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -9,31 +9,31 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [8, 11] + java: [17, 21] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: cd $GITHUB_WORKSPACE - - uses: actions/setup-java@v1 + - uses: actions/setup-java@v4 with: java-version: ${{ matrix.java }} java-package: jdk architecture: x64 - + distribution: temurin - run: ./gradlew check - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 if: ${{ always() }} with: name: testreport-audit-test-${{ matrix.java }} path: examples/audit-test/build/reports/tests - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 if: ${{ always() }} with: name: testreport-audit-test-allow-update-outside-transaction-${{ matrix.java }} path: examples/audit-test-allow-update-outside-transaction/build/reports/tests - run: ./gradlew :examples:audit-test:check -Daudit-test.AuditTrail.datasource=DEFAULT - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 if: ${{ always() }} with: name: testreport-audit-test-single-datasource-${{ matrix.java }} diff --git a/README.md b/README.md index 4245808a..a08c1e14 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,9 @@ This repositories new artifacts are currently moved to Maven Central, sind Bintr * For 2.x documentation, see [2.x User Guide](https://gpc.github.io/grails-audit-logging-plugin/2.0.x/plugin.html) ## Grails versions - * Grails 4.0.x: [master branch (5.0.x version)](https://github.com/gpc/grails-audit-logging-plugin/tree/master) Alternatively up to Grails 4.0.9: [4.x_maintenance branch](https://github.com/gpc/grails-audit-logging-plugin/tree/4.x_maintenance) + * Grails 7.0.x: [6.0.x branch (6.0.x version)](https://github.com/gpc/grails-audit-logging-plugin/tree/6.0.x) + * Grails 4.0.10+: [5.0.x branch (5.0.x version)](https://github.com/gpc/grails-audit-logging-plugin/tree/5.0.x) + * Grails up to 4.0.9: [4.x_maintenance branch](https://github.com/gpc/grails-audit-logging-plugin/tree/4.x_maintenance) * Grails 3.3.x: [3.x_maintenance branch](https://github.com/gpc/grails-audit-logging-plugin/tree/3.x_maintenance) * Grails 3.0.x-3.2.x: [2.x_maintenance branch](https://github.com/gpc/grails-audit-logging-plugin/tree/2.x_maintenance) * Grails 2.x: [1.x_maintenance branch](https://github.com/gpc/grails-audit-logging-plugin/tree/1.x_maintenance) diff --git a/examples/audit-test-allow-update-outside-transaction/build.gradle b/examples/audit-test-allow-update-outside-transaction/build.gradle index cbf8c038..9a2ba0ae 100644 --- a/examples/audit-test-allow-update-outside-transaction/build.gradle +++ b/examples/audit-test-allow-update-outside-transaction/build.gradle @@ -3,20 +3,22 @@ buildscript { grailsVersion = project.grailsVersion } repositories { - mavenLocal() maven { url "https://repo.grails.org/grails/core" } } dependencies { - classpath "org.grails:grails-gradle-plugin:$grailsVersion" - classpath "com.bertramlabs.plugins:asset-pipeline-gradle:3.0.7" + classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion" } } -version file("$rootDir/version.txt").text.trim() +plugins { + id "com.bertramlabs.asset-pipeline" version "$assetPipelineVersion" +} + + +version project.projectVersion group "audit.test" apply plugin: "war" -apply plugin: "asset-pipeline" apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: "org.grails.grails-web" @@ -37,58 +39,44 @@ repositories { maven { url "https://repo.grails.org/grails/core" } } -grails { - plugins { - compile project(":audit-logging") - } -} - configurations { developmentOnly - runtimeClasspath { + runtimeOnlyClasspath { extendsFrom developmentOnly } } dependencies { developmentOnly("org.springframework.boot:spring-boot-devtools") - compile "org.springframework.boot:spring-boot-starter-logging" - compile "org.springframework.boot:spring-boot-autoconfigure" - compile "org.grails:grails-core" - compile "org.springframework.boot:spring-boot-starter-actuator" - compile "org.springframework.boot:spring-boot-starter-tomcat" - compile "org.grails:grails-web-boot" - compile "org.grails:grails-logging" - compile "org.grails:grails-plugin-rest" - compile "org.grails:grails-plugin-databinding" - compile "org.grails:grails-plugin-i18n" - compile "org.grails:grails-plugin-services" - compile "org.grails:grails-plugin-url-mappings" - compile "org.grails:grails-plugin-interceptors" - compile "org.grails.plugins:cache" - compile "org.grails.plugins:async" - compile "org.grails.plugins:scaffolding" - compile "org.grails.plugins:events" - compile "org.grails.plugins:hibernate5" - compile "org.hibernate:hibernate-core:5.4.0.Final" - compile "org.hibernate:hibernate-ehcache:5.4.0.Final" - compile "org.grails.plugins:gsp" + compileOnly "org.springframework.boot:spring-boot-starter-logging" + compileOnly "org.springframework.boot:spring-boot-autoconfigure" + compileOnly "org.grails:grails-core" + compileOnly "org.springframework.boot:spring-boot-starter-actuator" + compileOnly "org.springframework.boot:spring-boot-starter-tomcat" + compileOnly "org.grails:grails-web-boot" + compileOnly "org.grails:grails-logging" + compileOnly "org.grails:grails-plugin-rest" + compileOnly "org.grails:grails-plugin-databinding" + compileOnly "org.grails:grails-plugin-i18n" + compileOnly "org.grails:grails-plugin-services" + compileOnly "org.grails:grails-plugin-url-mappings" + compileOnly "org.grails:grails-plugin-interceptors" + compileOnly "org.grails.plugins:cache" + compileOnly "org.grails.plugins:async" + compileOnly "org.grails.plugins:scaffolding" + compileOnly "org.grails.plugins:events" + compileOnly "org.grails.plugins:hibernate5" + compileOnly "org.grails.plugins:gsp" + implementation project(":audit-logging") + implementation "org.apache.groovy:groovy" console "org.grails:grails-console" profile "org.grails.profiles:web" - runtime "org.glassfish.web:el-impl:2.1.2-b03" - runtime "com.h2database:h2" - runtime "org.apache.tomcat:tomcat-jdbc" - runtime "javax.xml.bind:jaxb-api:2.3.0" - runtime "com.bertramlabs.plugins:asset-pipeline-grails:3.0.7" - testCompile "org.grails:grails-gorm-testing-support" - testCompile "org.mockito:mockito-core" - testCompile "org.grails:grails-web-testing-support" - testCompile "org.grails.plugins:geb" - testCompile "org.seleniumhq.selenium:selenium-remote-driver:3.14.0" - testCompile "org.seleniumhq.selenium:selenium-api:3.14.0" - testCompile "org.seleniumhq.selenium:selenium-support:3.14.0" - testRuntime "org.seleniumhq.selenium:selenium-chrome-driver:3.14.0" - testRuntime "org.seleniumhq.selenium:selenium-firefox-driver:3.14.0" + runtimeOnly "com.h2database:h2" + runtimeOnly "org.apache.tomcat:tomcat-jdbc" + runtimeOnly "com.bertramlabs.plugins:asset-pipeline-grails" + testCompileOnly "org.grails:grails-gorm-testing-support" + testCompileOnly "org.mockito:mockito-core" + testImplementation "org.grails:grails-web-testing-support" } task wrapper(type: Wrapper) { diff --git a/examples/audit-test-allow-update-outside-transaction/grails-app/assets/.gitkeep b/examples/audit-test-allow-update-outside-transaction/grails-app/assets/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/examples/audit-test/build.gradle b/examples/audit-test/build.gradle index 160bec6b..8ee9f5b4 100644 --- a/examples/audit-test/build.gradle +++ b/examples/audit-test/build.gradle @@ -3,20 +3,21 @@ buildscript { grailsVersion = project.grailsVersion } repositories { - mavenLocal() maven { url "https://repo.grails.org/grails/core" } } dependencies { - classpath "org.grails:grails-gradle-plugin:$grailsVersion" - classpath "com.bertramlabs.plugins:asset-pipeline-gradle:3.0.7" + classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion" } } -version file("$rootDir/version.txt").text.trim() +plugins { + id "com.bertramlabs.asset-pipeline" version "$assetPipelineVersion" +} + +version project.projectVersion group "audit.test" apply plugin: "war" -apply plugin: "asset-pipeline" apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: "org.grails.grails-web" @@ -37,58 +38,44 @@ repositories { maven { url "https://repo.grails.org/grails/core" } } -grails { - plugins { - compile project(":audit-logging") - } -} - configurations { developmentOnly - runtimeClasspath { + runtimeOnlyClasspath { extendsFrom developmentOnly } } dependencies { - developmentOnly("org.springframework.boot:spring-boot-devtools") - compile "org.springframework.boot:spring-boot-starter-logging" - compile "org.springframework.boot:spring-boot-autoconfigure" - compile "org.grails:grails-core" - compile "org.springframework.boot:spring-boot-starter-actuator" - compile "org.springframework.boot:spring-boot-starter-tomcat" - compile "org.grails:grails-web-boot" - compile "org.grails:grails-logging" - compile "org.grails:grails-plugin-rest" - compile "org.grails:grails-plugin-databinding" - compile "org.grails:grails-plugin-i18n" - compile "org.grails:grails-plugin-services" - compile "org.grails:grails-plugin-url-mappings" - compile "org.grails:grails-plugin-interceptors" - compile "org.grails.plugins:cache" - compile "org.grails.plugins:async" - compile "org.grails.plugins:scaffolding" - compile "org.grails.plugins:events" - compile "org.grails.plugins:hibernate5" - compile "org.hibernate:hibernate-core:5.4.0.Final" - compile "org.hibernate:hibernate-ehcache:5.4.0.Final" - compile "org.grails.plugins:gsp" + developmentOnly "org.springframework.boot:spring-boot-devtools" + compileOnly "org.springframework.boot:spring-boot-starter-logging" + compileOnly "org.springframework.boot:spring-boot-autoconfigure" + compileOnly "org.springframework.boot:spring-boot-starter-actuator" + compileOnly "org.springframework.boot:spring-boot-starter-tomcat" + compileOnly "org.grails:grails-web-boot" + compileOnly "org.grails:grails-logging" + compileOnly "org.grails:grails-plugin-rest" + compileOnly "org.grails:grails-plugin-databinding" + compileOnly "org.grails:grails-plugin-i18n" + compileOnly "org.grails:grails-plugin-services" + compileOnly "org.grails:grails-plugin-url-mappings" + compileOnly "org.grails:grails-plugin-interceptors" + compileOnly "org.grails.plugins:cache" + compileOnly "org.grails.plugins:async" + compileOnly "org.grails.plugins:scaffolding" + compileOnly "org.grails.plugins:events" + compileOnly "org.grails.plugins:gsp" + implementation "org.grails:grails-core" + implementation project(":audit-logging") + implementation "org.apache.groovy:groovy" + implementation "org.grails.plugins:hibernate5" console "org.grails:grails-console" profile "org.grails.profiles:web" - runtime "org.glassfish.web:el-impl:2.1.2-b03" - runtime "com.h2database:h2" - runtime "org.apache.tomcat:tomcat-jdbc" - runtime "javax.xml.bind:jaxb-api:2.3.0" - runtime "com.bertramlabs.plugins:asset-pipeline-grails:3.0.7" - testCompile "org.grails:grails-gorm-testing-support" - testCompile "org.mockito:mockito-core" - testCompile "org.grails:grails-web-testing-support" - testCompile "org.grails.plugins:geb" - testCompile "org.seleniumhq.selenium:selenium-remote-driver:3.14.0" - testCompile "org.seleniumhq.selenium:selenium-api:3.14.0" - testCompile "org.seleniumhq.selenium:selenium-support:3.14.0" - testRuntime "org.seleniumhq.selenium:selenium-chrome-driver:3.14.0" - testRuntime "org.seleniumhq.selenium:selenium-firefox-driver:3.14.0" + runtimeOnly "com.h2database:h2" + runtimeOnly "org.apache.tomcat:tomcat-jdbc" + runtimeOnly "com.bertramlabs.plugins:asset-pipeline-grails" + testImplementation "org.grails:grails-gorm-testing-support" + testImplementation "org.grails:grails-web-testing-support" + testCompileOnly "org.mockito:mockito-core" } task wrapper(type: Wrapper) { diff --git a/gradle.properties b/gradle.properties index faad6f9f..743f047d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,10 +1,17 @@ -grailsVersion=4.0.3 -gormVersion=7.0.4.RELEASE -gradleWrapperVersion=5.6.4 +projectVersion=6.0.0-SNAPSHOT + +artifactoryVersion=5.2.5 +asciidoctorJvmVersion=4.0.3 +assetPipelineVersion=5.0.1 +grailsVersion=7.0.0-SNAPSHOT +grailsGradlePluginVersion=7.0.0-SNAPSHOT +gormVersion=9.0.0-SNAPSHOT +groovyVersion=4.0.24 +gradleWrapperVersion=8.11 org.gradle.daemon=true org.gradle.parallel=true org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1024M -vcsUrl=https://github.com/robertoschwald/grails-audit-logging-plugin -websiteUrl=https://github.com/robertoschwald/grails-audit-logging-plugin -issueTrackerUrl=https://github.com/robertoschwald/grails-audit-logging-plugin/issues +vcsUrl=https://github.com/gpc/grails-audit-logging-plugin +websiteUrl=https://github.com/gpc/grails-audit-logging-plugin +issueTrackerUrl=https://github.com/gpc/grails-audit-logging-plugin/issues diff --git a/gradle/grailsPublish.gradle b/gradle/grailsPublish.gradle index 14a3f41a..286b0b37 100644 --- a/gradle/grailsPublish.gradle +++ b/gradle/grailsPublish.gradle @@ -9,13 +9,13 @@ setIfNotSet 'websiteUrl', project.vcsUrl grailsPublish { user = System.getenv("BINTRAY_USER") ?: project.hasProperty("bintrayUser") ? project.bintrayUser : '' key = System.getenv("BINTRAY_KEY") ?: project.hasProperty("bintrayKey") ? project.bintrayKey : '' - githubSlug = 'robertoschwald/grails-audit-logging-plugin' + githubSlug = 'gpc/grails-audit-logging-plugin' websiteUrl = project.hasProperty('websiteUrl') ? project.websiteUrl : "https://grails.org/plugin/$project.name" license { name = project.hasProperty('license') ? [project.license] : ['Apache-2.0'] } issueTrackerUrl = project.hasProperty('issueTrackerUrl') ? project.issueTrackerUrl : "https://github.com/grails-plugins/$project.name/issues" - vcsUrl = project.hasProperty('vcsUrl') ? project.vcsUrl : "https://github.com/robertoschwald/$project.name" + vcsUrl = project.hasProperty('vcsUrl') ? project.vcsUrl : "https://github.com/gpc/$project.name" title = "Grails Audit-Logging Plugin" desc = "Grails Audit-Logging Plugin for Grails 4.x" developers = [robertoschwald:"Robert Oschwald", longwa:"Aaron Long", elkr:"Elmar Kretzer"] diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 87b738cb..a4b76b95 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 558870da..94113f20 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index af6708ff..f5feea6d 100755 --- a/gradlew +++ b/gradlew @@ -1,78 +1,130 @@ -#!/usr/bin/env sh +#!/bin/sh + +# +# 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. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## -## -## 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/platforms/jvm/plugins-application/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"` -# 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"' +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # 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 + # Determine the Java command to use to start the JVM. 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 @@ -81,92 +133,120 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - 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. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + 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 location of your Java installation." + fi 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=SC2039,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=SC2039,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" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; 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 # 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=$((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, 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" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" +# 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"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +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. +# + +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 6d57edc7..9d21a218 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,4 +1,22 @@ -@if "%DEBUG%" == "" @echo off +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -9,25 +27,29 @@ 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% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -35,48 +57,36 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :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/makedoc.sh b/makedoc.sh index 0525e9fc..09b0026f 100755 --- a/makedoc.sh +++ b/makedoc.sh @@ -30,7 +30,7 @@ if [[ -n $TRAVIS_TAG ]] || [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST echo " " echo "** Updating gh-pages branch **" pushd plugin/build - git clone https://github.com/robertoschwald/grails-audit-logging-plugin.git -b gh-pages gh-pages --single-branch > /dev/null + git clone https://github.com/gpc/grails-audit-logging-plugin.git -b gh-pages gh-pages --single-branch > /dev/null cd gh-pages # prepare index.html diff --git a/plugin/build.gradle b/plugin/build.gradle index cccf1247..f5aa63e8 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -2,29 +2,28 @@ import java.text.SimpleDateFormat buildscript { repositories { - mavenLocal() maven { url "https://repo.grails.org/grails/core" } mavenCentral() } dependencies { - classpath "org.grails:grails-gradle-plugin:$grailsVersion" + classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion" } } plugins { - id 'org.asciidoctor.jvm.convert' version '3.2.0' - id "org.asciidoctor.jvm.pdf" version "3.2.0" - id "org.asciidoctor.jvm.epub" version "3.2.0" - id "com.jfrog.artifactory" version "4.21.0" + id "org.asciidoctor.jvm.convert" version "$asciidoctorJvmVersion" + id "org.asciidoctor.jvm.pdf" version "$asciidoctorJvmVersion" + id "org.asciidoctor.jvm.epub" version "$asciidoctorJvmVersion" + id "com.jfrog.artifactory" version "$artifactoryVersion" } -version project.file("../version.txt").text.trim() +version project.projectVersion group "org.grails.plugins" apply plugin: "eclipse" apply plugin: "idea" apply plugin: "org.grails.grails-plugin" -apply plugin: "org.grails.grails-plugin-publish" +apply plugin:"org.grails.internal.grails-plugin-publish" apply plugin: "org.grails.grails-gsp" ext { @@ -38,32 +37,31 @@ repositories { maven { url "https://repo.grails.org/grails/core" } } -sourceCompatibility = targetCompatibility = 1.8 +compileJava.options.release = 17 dependencies { profile "org.grails.profiles:web-plugin" - - provided 'org.springframework.boot:spring-boot-starter-logging' - provided "org.springframework.boot:spring-boot-starter-actuator" - provided "org.springframework.boot:spring-boot-autoconfigure" - provided "org.springframework.boot:spring-boot-starter-tomcat" - provided "org.grails:grails-web-boot" - provided "org.grails:grails-core" - provided "org.grails:grails-logging" - provided "org.grails:grails-plugin-rest" - provided "org.grails:grails-plugin-i18n" - provided "org.grails:grails-plugin-services" - provided "org.grails:grails-plugin-url-mappings" - provided "org.grails:grails-plugin-interceptors" - provided "org.grails.plugins:gsp" - provided "org.grails:grails-console" - provided "org.grails:grails-plugin-services" - provided "org.grails:grails-plugin-domain-class" + compileOnly 'org.springframework.boot:spring-boot-starter-logging' + compileOnly "org.springframework.boot:spring-boot-starter-actuator" + compileOnly "org.springframework.boot:spring-boot-autoconfigure" + compileOnly "org.springframework.boot:spring-boot-starter-tomcat" + compileOnly "org.grails:grails-web-boot" + compileOnly "org.grails:grails-core" + compileOnly "org.grails:grails-logging" + compileOnly "org.grails:grails-plugin-rest" + compileOnly "org.grails:grails-plugin-i18n" + compileOnly "org.grails:grails-plugin-services" + compileOnly "org.grails:grails-plugin-url-mappings" + compileOnly "org.grails:grails-plugin-interceptors" + compileOnly "org.grails.plugins:gsp" + compileOnly "org.grails:grails-console" + compileOnly "org.grails:grails-plugin-services" + compileOnly "org.grails:grails-plugin-domain-class" // TODO: We need to make this configurable/pluggable - provided "org.grails.plugins:hibernate5" + compileOnly "org.grails.plugins:hibernate5" - testCompile "org.grails:grails-web-testing-support" + testCompileOnly "org.grails:grails-web-testing-support" } bootJar.enabled = false @@ -80,8 +78,4 @@ task wrapper(type: Wrapper) { apply from: "${rootProject.projectDir}/gradle/grailsPublish.gradle" apply from: "${rootProject.projectDir}/gradle/artifactoryPublish.gradle" -apply from: "${rootProject.projectDir}/gradle/docs.gradle" - - - - +apply from: "${rootProject.projectDir}/gradle/docs.gradle" \ No newline at end of file diff --git a/plugin/src/docs/changelog.adoc b/plugin/src/docs/changelog.adoc index e1737f1a..be5c5df9 100644 --- a/plugin/src/docs/changelog.adoc +++ b/plugin/src/docs/changelog.adoc @@ -1,4 +1,7 @@ == Change Log +* 6.0.0 +** Updated for Grails 7 + * 5.0.0 ** New: Participate in current Transaction by queuing audit logs. Supports nested transactions. Plugin is currently NOT ORM agnostic and needs Hibernate due to this change (PR #212). See documentation. ** Fix #213 nested withoutAuditLog calls diff --git a/plugin/src/docs/templates/index.tmpl b/plugin/src/docs/templates/index.tmpl index 590a2a04..b2d9dffa 100644 --- a/plugin/src/docs/templates/index.tmpl +++ b/plugin/src/docs/templates/index.tmpl @@ -59,7 +59,7 @@ - + Fork me on GitHub @@ -111,10 +111,10 @@
- + - +
@@ -122,11 +122,11 @@

Download Source

You can download this project in either - zip or - tar formats. + zip or + tar formats.

You can also clone the project with Git by running: -

$ git clone git://github.com/robertoschwald/grails-audit-logging-plugin
+
$ git clone git://github.com/gpc/grails-audit-logging-plugin

diff --git a/plugin/src/main/groovy/grails/plugins/orm/auditable/AuditLoggingGrailsPlugin.groovy b/plugin/src/main/groovy/grails/plugins/orm/auditable/AuditLoggingGrailsPlugin.groovy index 15f87119..8f542810 100755 --- a/plugin/src/main/groovy/grails/plugins/orm/auditable/AuditLoggingGrailsPlugin.groovy +++ b/plugin/src/main/groovy/grails/plugins/orm/auditable/AuditLoggingGrailsPlugin.groovy @@ -36,7 +36,7 @@ import org.springframework.beans.factory.NoSuchBeanDefinitionException * http://www.hibernate.org/318.html * * See Documentation: - * https://github.com/robertoschwald/grails-audit-logging-plugin + * https://github.com/gpc/grails-audit-logging-plugin * */ @Slf4j @@ -49,7 +49,7 @@ class AuditLoggingGrailsPlugin extends Plugin { def description = """ Automatically log change events for domain objects. Optionally supports Stamping. This plugin is ORM agnostic. """ - String documentation = 'https://github.com/robertoschwald/grails-audit-logging-plugin' + String documentation = 'https://github.com/gpc/grails-audit-logging-plugin' String license = 'APACHE' def developers = [ @@ -58,8 +58,8 @@ class AuditLoggingGrailsPlugin extends Plugin { [name: 'Aaron Long', email: 'longwa@gmail.com'] ] - def issueManagement = [system: 'GitHub', url: 'https://github.com/robertoschwald/grails-audit-logging-plugin/issues'] - def scm = [url: 'https://github.com/robertoschwald/grails-audit-logging-plugin'] + def issueManagement = [system: 'GitHub', url: 'https://github.com/gpc/grails-audit-logging-plugin/issues'] + def scm = [url: 'https://github.com/gpc/grails-audit-logging-plugin'] def loadAfter = ['core', 'dataSource', 'springSecurityCore'] // Register generic GORM listener diff --git a/version.txt b/version.txt deleted file mode 100644 index 5458ded0..00000000 --- a/version.txt +++ /dev/null @@ -1,2 +0,0 @@ -5.0.0-SNAPSHOT -