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

Use grails-bom, ContainerGebSpec, cleanup dependencies and fix tests #774

Merged
merged 6 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
8 changes: 0 additions & 8 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@
],
"groupName": "junit-jupiter monorepo"
},
{
"matchPackageNames": [
"io.netty:netty-transport",
"io.netty:netty-handler",
"io.netty:netty-codec"
],
"groupName": "netty monorepo"
},
{
"matchPackageNames": [
"org.grails:grails-datastore-core",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
with:
arguments: build -Dgeb.env=chromeHeadless -x test -x integrationTest
arguments: build
publish:
runs-on: ubuntu-latest
if: github.event_name == 'push'
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/groovy-joint-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,4 @@ jobs:
with:
arguments: |
build
-Dgeb.env=chromeHeadless
-x groovydoc
-x test
-x integrationTest
-x groovydoc
11 changes: 6 additions & 5 deletions boot-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
dependencies {
compileOnly "org.grails:grails-shell:$grailsShellVersion", {
implementation platform("org.grails:grails-bom:$grailsVersion")
compileOnly "org.grails:grails-shell", {
exclude group:'org.apache.groovy', module:'groovy'
}

api "org.springframework.boot:spring-boot-autoconfigure:$springBootVersion"
api "org.apache.groovy:groovy:$groovyVersion"
api "org.springframework.boot:spring-boot-autoconfigure"
api "org.apache.groovy:groovy"
api project(":grails-datastore-gorm-mongodb"), {
exclude group:'org.grails', module:'grails-datastore-gorm-plugin-support'
}
api project(":grails-datastore-gorm-mongodb-ext"), {
exclude group:'org.grails', module:'grails-datastore-gorm-mongodb'
}
api "org.springframework:spring-tx:$springVersion"
testImplementation "org.grails:grails-shell:$grailsShellVersion", {
api "org.springframework:spring-tx"
testImplementation "org.grails:grails-shell", {
exclude group:'org.apache.groovy', module:'groovy'
}
}
105 changes: 20 additions & 85 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ buildscript {
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion"
classpath "org.asciidoctor:asciidoctor-gradle-jvm:$asciidoctorGradleVersion"
classpath "com.github.erdi:webdriver-binaries-gradle-plugin:$webdriverBinariesPluginVersion"
classpath "io.github.gradle-nexus:publish-plugin:$gradleNexusPublishPluginVersion"
}
}
Expand All @@ -17,7 +16,6 @@ group "org.grails"
version project.projectVersion

ext {
hibernatePluginVersion = project.hibernatePluginVersion
isCiBuild = project.hasProperty("isCiBuild") || System.getenv().get("CI") as Boolean
isBuildSnapshot = project.version.endsWith("-SNAPSHOT")
isReleaseVersion = !isBuildSnapshot
Expand Down Expand Up @@ -56,7 +54,6 @@ allprojects {
ext.groovyVersion = System.getenv('CI_GROOVY_VERSION') ?: project.groovyVersion

repositories {
mavenLocal()
mavenCentral()
maven { url = 'https://repo.grails.org/grails/core' }
maven { url = 'https://oss.sonatype.org/content/repositories/snapshots' }
Expand All @@ -69,18 +66,11 @@ allprojects {
url = 'https://repository.apache.org/content/repositories/snapshots'
}
}
// mavenLocal() // do not commit uncommented, for local testing only
}
}

subprojects { Project subproject ->

ext['h2.version'] = h2Version
ext['gorm.version'] = datastoreVersion
ext['gorm.hibernate5.version'] = hibernatePluginVersion
ext['junit-jupiter.version'] = junitJupiterVersion
ext['spock.version'] = spockVersion
ext['mongodb.version'] = mongodbDriverVersion

if (project.name.startsWith("examples")) {

apply plugin: 'groovy'
Expand All @@ -93,37 +83,21 @@ subprojects { Project subproject ->

boolean usesGeb = project.name.contains('grails3-hibernate5-mongodb') || project.name.contains('grails3-mongodb') || project.name.contains('grails3-mongodb-database-per-tenant')|| project.name.contains('grails3-rxmongodb')
jamesfredley marked this conversation as resolved.
Show resolved Hide resolved

if (usesGeb) {
apply plugin:"com.github.erdi.webdriver-binaries"
}

if (project.name == "examples-test-data-service") {
apply plugin:"org.grails.grails-web"
}

configurations.configureEach {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if(details.requested.group == 'org.apache.groovy' && details.requested.name.startsWith('groovy')) {
details.useVersion(groovyVersion)
} else if (details.requested.group == 'org.mongodb' && details.requested.module.name != 'mongodb-driver-rx') {
details.useVersion(mongodbDriverVersion)
} else if (details.requested.group == 'org.springframework') {
details.useVersion(springVersion)
} else if (details.requested.group == "org.springframework.boot") {
details.useVersion(springBootVersion)
}
}
}

dependencies {
testImplementation "jakarta.annotation:jakarta.annotation-api:$jakartaAnnotationApiVersion"
implementation platform("org.grails:grails-bom:$grailsVersion")
implementation "jakarta.servlet:jakarta.servlet-api"
jamesfredley marked this conversation as resolved.
Show resolved Hide resolved
testImplementation "jakarta.annotation:jakarta.annotation-api"
testImplementation "io.micrometer:micrometer-core:latest.integration"
testImplementation "org.hibernate:hibernate-validator:$hibernateValidatorVersion"
testImplementation "org.apache.groovy:groovy-test-junit5:$groovyVersion"
testImplementation "org.spockframework:spock-core:$spockVersion", { transitive = false }
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion"
testImplementation "org.junit.platform:junit-platform-runner:$junitJupiterPlatformVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion"
testImplementation "org.hibernate:hibernate-validator"
testImplementation "org.apache.groovy:groovy-test-junit5"
testImplementation "org.spockframework:spock-core", { transitive = false }
testImplementation "org.junit.jupiter:junit-jupiter-api"
testImplementation "org.junit.platform:junit-platform-runner"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
}

tasks.withType(Test) {
Expand Down Expand Up @@ -220,56 +194,17 @@ subprojects { Project subproject ->
withSourcesJar()
}

configurations {
all {
resolutionStrategy {
force "org.apache.groovy:groovy:$groovyVersion"
force "org.apache.groovy:groovy-dateutil:$groovyVersion"
force "org.apache.groovy:groovy-xml:$groovyVersion"
force "org.apache.groovy:groovy-templates:$groovyVersion"
}
}
}

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def dependencyName = details.requested.name
if (dependencyName.startsWith('mongodb-driver') && !dependencyName.contains('-rx')) {
details.useVersion(mongodbDriverVersion)
} else if( details.requested.group == 'org.grails' &&
details.requested.name in ['grails-datastore-core',
'grails-datastore-async',
'grails-datastore-gorm',
'grails-datastore-gorm-async',
'grails-datastore-gorm-rx',
'grails-datastore-gorm-support',
'grails-datastore-gorm-tck',
'grails-datastore-gorm-test',
'grails-datastore-gorm-validation',
'grails-datastore-web']
) {
details.useVersion(datastoreVersion)
} else if (details.requested.group == 'org.mongodb' && details.requested.module.name != 'mongodb-driver-rx') {
details.useVersion(mongodbDriverVersion)
} else if(details.requested.group == 'org.springframework') {
details.useVersion(springVersion)
} else if (details.requested.group == 'org.springframework.boot') {
details.useVersion(springBootVersion)
}
}
}

dependencies {
api "org.apache.groovy:groovy:$groovyVersion"
api "org.apache.groovy:groovy-templates:$groovyVersion"

testImplementation "org.apache.groovy:groovy-json:$groovyVersion"
testImplementation "org.apache.groovy:groovy-templates:$groovyVersion"
testImplementation "org.apache.groovy:groovy-test-junit5:$groovyVersion"
testImplementation "org.spockframework:spock-core:$spockVersion", { transitive = false }
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion"
testImplementation "org.junit.platform:junit-platform-runner:$junitJupiterPlatformVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion"
api "org.apache.groovy:groovy"
api "org.apache.groovy:groovy-templates"

testImplementation "org.apache.groovy:groovy-json"
testImplementation "org.apache.groovy:groovy-templates"
testImplementation "org.apache.groovy:groovy-test-junit5"
testImplementation "org.spockframework:spock-core", { transitive = false }
testImplementation "org.junit.jupiter:junit-jupiter-api"
testImplementation "org.junit.platform:junit-platform-runner"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
}

publishing {
Expand Down
25 changes: 6 additions & 19 deletions docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,15 @@ configurations {
}
}

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.apache.groovy' && details.requested.name.startsWith('groovy')) {
details.useVersion(groovyVersion)
} else if (details.requested.group == 'org.springframework') {
details.useVersion(springVersion)
} else if (details.requested.group == "org.springframework.boot") {
details.useVersion(springBootVersion)
} else if (details.requested.group == 'org.springframework.boot') {
details.useVersion(springBootVersion)
}
}
}

dependencies {
documentation "org.fusesource.jansi:jansi:$jansiVersion"
documentation "org.apache.groovy:groovy:$groovyVersion"
documentation "org.apache.groovy:groovy-templates:$groovyVersion"
documentation "org.apache.groovy:groovy-dateutil:$groovyVersion"
documentation "com.github.javaparser:javaparser-core:$javaParserCoreVersion"
documentation "org.fusesource.jansi:jansi"
documentation "org.apache.groovy:groovy"
documentation "org.apache.groovy:groovy-templates"
documentation "org.apache.groovy:groovy-dateutil"
documentation "com.github.javaparser:javaparser-core"
for(p in coreProjects) {
documentation "org.grails:grails-datastore-$p:$datastoreVersion"
documentation "org.grails:grails-datastore-$p"
}
project.rootProject.subprojects.findAll { !it.name.contains('-rx-') }.each { subproject ->
if(subproject.name != "docs" && !subproject.name.startsWith('examples')) {
Expand Down
96 changes: 34 additions & 62 deletions examples/grails3-hibernate5-mongodb/build.gradle
Original file line number Diff line number Diff line change
@@ -1,70 +1,42 @@
plugins {
id "com.bertramlabs.asset-pipeline" version "5.0.4"
}

group "examples"

dependencies {
implementation "org.springframework.boot:spring-boot-starter-logging"

implementation project(":grails-plugin")
implementation "org.mongodb:mongodb-driver-sync"
testImplementation "org.testcontainers:mongodb:$testcontainersMongodbVersion"
implementation "org.grails.plugins:hibernate5"

implementation "org.grails:grails-core"
implementation "org.grails:grails-logging"
implementation "org.grails:grails-plugin-databinding"
implementation "org.grails:grails-plugin-i18n"
implementation "org.grails:grails-plugin-interceptors"
implementation "org.grails:grails-plugin-rest"
implementation "org.grails:grails-plugin-services"
implementation "org.grails:grails-plugin-url-mappings"
implementation "org.grails:grails-web-boot"
implementation "org.grails.plugins:gsp"
implementation "org.grails.plugins:scaffolding"
implementation "org.springframework.boot:spring-boot-autoconfigure"
implementation "org.springframework.boot:spring-boot-starter"
implementation "org.springframework.boot:spring-boot-starter-actuator"
implementation "org.springframework.boot:spring-boot-starter-logging"
implementation "org.springframework.boot:spring-boot-starter-tomcat"
implementation "jakarta.servlet:jakarta.servlet-api:$servletApiVersion"
implementation "org.grails:grails-core:$grailsVersion"
implementation "org.grails:grails-dependencies:$grailsVersion", {
exclude module:'grails-datastore-simple'
}
implementation "org.grails:grails-web-boot:$grailsVersion"
implementation "org.mongodb:mongodb-driver-sync:$mongodbDriverVersion"
implementation project(":grails-plugin")
implementation "org.grails.plugins:hibernate5:$hibernatePluginVersion"
implementation "org.hibernate:hibernate-ehcache:$hibernateCoreVersion"

runtimeOnly "com.bertramlabs.plugins:asset-pipeline-grails:$assetPipelineVersion"
runtimeOnly "com.h2database:h2:$h2Version"
runtimeOnly "org.apache.tomcat:tomcat-jdbc:$tomcatVersion"
runtimeOnly "org.grails.plugins:scaffolding:$scaffoldingVersion"
runtimeOnly "org.grails.plugins:fields:$fieldsVersion"

testImplementation "org.grails:grails-gorm-testing-support:$grailsTestingSupportVersion"
testImplementation "org.grails:grails-web-testing-support:$grailsTestingSupportVersion"
testImplementation "org.testcontainers:mongodb:$testcontainersMongodbVersion"
testImplementation "io.netty:netty-transport:$nettyVersion"
testImplementation "io.netty:netty-codec:$nettyVersion"
testImplementation "io.netty:netty-handler:$nettyVersion"
testImplementation "org.grails.plugins:geb:$gebPluginVersion", {
exclude group: 'org.gebish', module: 'geb-spock'
}
implementation "com.github.erdi:webdriver-binaries-gradle-plugin:$webdriverBinariesPluginVersion"
testImplementation("org.grails.plugins:geb:$gebPluginVersion") {
exclude group: 'org.gebish', module: 'geb-spock'
}
testImplementation "org.gebish:geb-spock:$gebVersion"

testRuntimeOnly "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion"
testRuntimeOnly "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion"
testRuntimeOnly "org.seleniumhq.selenium:selenium-safari-driver:$seleniumSafariDriverVersion"

testImplementation "org.seleniumhq.selenium:selenium-remote-driver:$seleniumVersion"
testImplementation "org.seleniumhq.selenium:selenium-api:$seleniumVersion"
testImplementation "org.seleniumhq.selenium:selenium-support:$seleniumVersion"
}

tasks.withType(Test) {
systemProperty "geb.env", System.getProperty('geb.env')
systemProperty "geb.build.reportsDir", reporting.file("geb/integrationTest")
if (!System.getenv().containsKey('CI')) {
systemProperty 'webdriver.chrome.driver', System.getProperty('webdriver.chrome.driver')
systemProperty 'webdriver.gecko.driver', System.getProperty('webdriver.gecko.driver')
} else {
systemProperty 'webdriver.chrome.driver', "${System.getenv('CHROMEWEBDRIVER')}/chromedriver"
systemProperty 'webdriver.gecko.driver', "${System.getenv('GECKOWEBDRIVER')}/geckodriver"
}
implementation "org.springframework.boot:spring-boot-starter-validation"
console "org.grails:grails-console"
runtimeOnly "com.bertramlabs.plugins:asset-pipeline-grails"
runtimeOnly "com.h2database:h2"
runtimeOnly "org.apache.tomcat:tomcat-jdbc"
runtimeOnly "org.fusesource.jansi:jansi"
integrationTestImplementation testFixtures("org.grails.plugins:geb")
testImplementation "org.grails:grails-gorm-testing-support"
testImplementation "org.grails:grails-web-testing-support"
testImplementation "org.spockframework:spock-core"
}

webdriverBinaries {
if (!System.getenv().containsKey('CI')) {
chromedriver "$chromeDriverVersion"
geckodriver "$geckodriverVersion"
}
}
//compileGroovy.groovyOptions.forkOptions.jvmArgs = ['-Xdebug','-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005']



//compileGroovy.groovyOptions.forkOptions.jvmArgs = ['-Xdebug','-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005']
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package functional.tests

import geb.spock.GebSpec
import grails.plugin.geb.ContainerGebSpec
import grails.testing.mixin.integration.Integration

@Integration(applicationClass = Application)
class AuthorControllerSpec extends GebSpec {
class AuthorControllerSpec extends ContainerGebSpec {

void "Test list authors"() {
when:"The home page is visited"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package functional.tests

import geb.spock.GebSpec
import grails.plugin.geb.ContainerGebSpec
import grails.testing.mixin.integration.Integration

@Integration(applicationClass = Application)
class BookControllerSpec extends GebSpec {
class BookControllerSpec extends ContainerGebSpec {

void "Test list books"() {
when:"The home page is visited"
Expand Down
Loading
Loading