Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Gradle 8.10 #140

Merged
merged 4 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
with:
arguments: build
arguments: build -x test -x integrationTest
publish_documentation:
name: Publish Snapshot release
runs-on: ubuntu-latest
Expand Down
17 changes: 17 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,21 @@ dependencies {
runtimeOnly buildsrcLibs.grails.gradle.plugin
runtimeOnly buildsrcLibs.grails.views.gradle.plugin
runtimeOnly buildsrcLibs.groovydoc.gradle.plugin
}

def groovyVersion = project.rootProject
.extensions
.getByType(VersionCatalogsExtension.class)
.named("libs")
.findVersion("groovy")
.get()
.displayName

configurations.configureEach {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A number of dependencies were still pulling in org.codehaus.groovy at the time.

resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if ((details.requested.group == 'org.codehaus.groovy' || details.requested.group == 'org.apache.groovy') && details.requested.name != 'groovy-bom') {
details.useTarget(group: 'org.apache.groovy', name: details.requested.name, version: groovyVersion)
details.because "The dependency coordinates are changed in Apache Groovy 4, plus ensure version"
}
}
}
4 changes: 4 additions & 0 deletions buildSrc/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@ dependencyResolutionManagement {
buildsrcLibs {
from(files('../gradle/buildsrc.libs.versions.toml'))
}

libs {
from(files('../gradle/libs.versions.toml'))
}
}
}
2 changes: 1 addition & 1 deletion docs/src/main/docs/guide/events/consuming.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ If you wish to subscribe to events dynamically or need more flexibility, then an
.TotalService.groovy
----
import grails.events.bus.EventBusAware
import javax.annotation.PostConstruct
import jakarta.annotation.PostConstruct
...
include::{sourcedir}/grails-events-transform/src/test/groovy/grails/events/ManualPubSubSpec.groovy[tags=subscriber]
----
Expand Down
21 changes: 18 additions & 3 deletions examples/pubsub-demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id 'application'
id 'groovy'
id 'org.grails.grails-web'
id 'org.grails.plugins.views-json'
//id 'org.grails.plugins.views-json' error loading when following documentation and not required for test
}

group = 'pubsub.demo'
Expand Down Expand Up @@ -30,12 +30,14 @@ dependencies {
implementation 'org.grails:grails-web-boot'

implementation 'org.grails.plugins:hibernate5'
implementation 'org.grails.plugins:views-json'
implementation libs.grails.views.json
implementation libs.grails.views.json.templates

implementation 'org.springframework.boot:spring-boot-autoconfigure'
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.boot:spring-boot-starter-logging'
implementation 'org.springframework.boot:spring-boot-starter-tomcat'
implementation libs.micronaut.serde.jackson

runtimeOnly 'com.h2database:h2'
runtimeOnly 'org.apache.tomcat:tomcat-jdbc'
Expand All @@ -48,4 +50,17 @@ dependencies {
// Don't need groovydoc for example project
tasks.named('groovydoc') {
enabled = false
}
}

bootJar {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To work around duplicates that exist during the build. These were new after upgrade to gradle 8.10, but DuplicatesStrategy is set in other Grails projects.

duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

distTar {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

distZip {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

2 changes: 1 addition & 1 deletion gradle/buildsrc.libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
grails = '7.0.0-SNAPSHOT'
grails-gradle-plugin = '7.0.0-SNAPSHOT'
grails-views = '3.2.1'
grails-views = '4.0.0-SNAPSHOT'
groovy-doc = '1.0.1'
nexus-publish-gradle-plugin = '1.3.0'

Expand Down
13 changes: 9 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ bytebuddy = '1.14.12'
gpars = '1.2.1'
grails = '7.0.0-SNAPSHOT'
grails-gsp = '7.0.0-SNAPSHOT'
grails-views = '4.0.0-SNAPSHOT'
groovy = '4.0.22'
gorm = '8.1.2'
javax-annotation = '1.3.2'
gorm = '9.0.0-SNAPSHOT'
jakarta-annotation-api = '3.0.0'
micronaut-serde-jackson = '2.10.2'
objenesis = '3.3'
rxjava = '1.3.8'
rxjava2 = '2.2.21'
Expand All @@ -27,7 +29,7 @@ grails-web-mvc = { module = 'org.grails:grails-web-mvc', version.ref = 'grails'
grails-web-sitemesh = { module = 'org.grails:grails-web-sitemesh', version.ref = 'grails-gsp' }
gpars = { module = 'org.codehaus.gpars:gpars', version.ref = 'gpars' }
groovy-core = { module = 'org.apache.groovy:groovy', version.ref = 'groovy' }
javax-annotation-api = { module = 'javax.annotation:javax.annotation-api', version.ref = 'javax-annotation' }
jakarta-annotation-api = { module = 'jakarta.annotation:jakarta.annotation-api', version.ref = 'jakarta-annotation-api' }
objenesis = { module = 'org.objenesis:objenesis', version.ref = 'objenesis' }
rxjava = { module = 'io.reactivex:rxjava', version.ref = 'rxjava' }
rxjava2 = { module = 'io.reactivex.rxjava2:rxjava', version.ref = 'rxjava2' }
Expand All @@ -40,4 +42,7 @@ spring-beans = { module = 'org.springframework:spring-beans', version.ref = 'spr
spring-core = { module = 'org.springframework:spring-core', version.ref = 'spring' }
spring-context = { module = 'org.springframework:spring-context', version.ref = 'spring' }
spring-tx = { module = 'org.springframework:spring-tx', version.ref = 'spring' }
spring-web = { module = 'org.springframework:spring-web', version.ref = 'spring' }
spring-web = { module = 'org.springframework:spring-web', version.ref = 'spring' }
micronaut-serde-jackson = { module = 'io.micronaut.serde:micronaut-serde-jackson', version.ref = 'micronaut-serde-jackson' }
grails-views-json = { module = 'org.grails.plugins:views-json', version.ref = 'grails-views' }
grails-views-json-templates = { module = 'org.grails.plugins:views-json-templates', version.ref = 'grails-views' }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
34 changes: 21 additions & 13 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# 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
# 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/.
Expand Down Expand Up @@ -83,10 +85,9 @@ done
# 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"'
# 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
Expand Down Expand Up @@ -133,26 +134,29 @@ 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.
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" && ! "$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
# 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=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -197,11 +201,15 @@ if "$cygwin" || "$msys" ; then
done
fi

# 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.

# 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" \
Expand Down
22 changes: 12 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@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 ##########################################################################
Expand Down Expand Up @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
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

Expand All @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

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

Expand Down
3 changes: 2 additions & 1 deletion grails-async-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ dependencies {

implementation libs.groovy.core
implementation libs.slf4j.api
implementation libs.jakarta.annotation.api

compileOnly libs.javax.annotation.api
compileOnly libs.jakarta.annotation.api

testImplementation libs.spock.core

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import groovy.transform.AutoFinal
import groovy.transform.CompileStatic
import org.grails.async.factory.BoundPromise

import javax.annotation.PreDestroy
import jakarta.annotation.PreDestroy
import java.util.concurrent.*

/**
Expand Down
1 change: 1 addition & 0 deletions grails-events-transform/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dependencies {
implementation libs.spring.beans
implementation libs.spring.core
implementation libs.spring.tx
implementation libs.jakarta.annotation.api

testImplementation libs.grails.datastore.gorm.test, {
// TODO: Explain why this exclusion is done (I don't know)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import org.grails.datastore.mapping.engine.event.AbstractPersistenceEvent
import org.grails.events.EventIdUtils
import org.springframework.util.ReflectionUtils

import javax.annotation.PostConstruct
import jakarta.annotation.PostConstruct
import java.beans.Introspector
import java.lang.reflect.Method

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package grails.events
import grails.events.bus.EventBusAware
import spock.lang.Specification

import javax.annotation.PostConstruct
import jakarta.annotation.PostConstruct
import java.util.concurrent.atomic.AtomicInteger

/**
Expand Down
Loading