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

Grails5 update #109

Merged
merged 23 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9628b69
update to grails5, micronaut 3, groovy 3, and more
Emrichardsone Sep 20, 2023
2c4be48
Fix integration test compilation issue with example app
Sep 26, 2023
2776cce
updated dependencies, build success
Emrichardsone Sep 27, 2023
8cd1a0a
re-add compile static annotation, change signature method to specify …
Emrichardsone Oct 4, 2023
49a1f78
remove sdkman file
Emrichardsone Oct 4, 2023
c818931
remove sdkman file
Emrichardsone Oct 4, 2023
b2e8524
static checking compile errors
Emrichardsone Oct 9, 2023
05cd142
Fix compile errors
puneetbehl Oct 11, 2023
7c32876
dependency updates to run integration tests
Emrichardsone Oct 11, 2023
79f508f
Configure Gradle Enterpise & Update Java CI Workflow
puneetbehl Oct 11, 2023
40d98e3
integration test changes
Emrichardsone Oct 11, 2023
199ef3a
Merge branch 'grails5-update' of https://github.com/grails/gorm-graph…
Emrichardsone Oct 11, 2023
e0e6222
Update logback.xml
puneetbehl Oct 11, 2023
7a4ee30
Add test property `Artist.paintings` as output only
guillermocalvo Oct 23, 2023
df6745a
Update tests (error message checks)
guillermocalvo Oct 23, 2023
ca7680b
Merge branch '3.0.x' into grails5-update
guillermocalvo Nov 22, 2023
d65f482
Merge branch 'grails5-update' of github.com:grails/gorm-graphql into …
puneetbehl Nov 23, 2023
2e9bce0
Correct dependency scopes
puneetbehl Nov 23, 2023
30a0d7f
Apply Java Library Gradle Plugin
puneetbehl Nov 23, 2023
f2ab6c9
Correct more dependency scopes
guillermocalvo Nov 24, 2023
82b1787
Upgrade Gradle wrapper to version 6.9.4
guillermocalvo Nov 24, 2023
8f4de34
Clean up build scripts
guillermocalvo Nov 27, 2023
9cf375c
Add CompileStatic to ComplexOperation
puneetbehl Nov 28, 2023
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
61 changes: 23 additions & 38 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,25 @@ name: Java CI
on:
push:
branches:
- master
- '[2-9]+.[0-9]+.x'
pull_request:
branches:
- master
- '[2-9]+.[0-9]+.x'
workflow_dispatch:
inputs:
message:
description: 'Snapshot information (e.g. New Core Snapshot Tue Dec 15 00:07:18 UTC 2020 f212f54)'
required: true
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: ['8']
env:
WORKSPACE: ${{ github.workspace }}
GRADLE_OPTS: -Xmx1500m -Dfile.encoding=UTF-8
steps:
- name: Print Dispatch Information
if: github.event_name == 'workflow_dispatch'
env:
DISPATCH_INFORMATION: ${{ github.event.inputs.message }}
run: echo $DISPATCH_INFORMATION
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: ${{ matrix.java }}
- name: Run Tests
if: github.event_name == 'pull_request'
id: tests
uses: gradle/gradle-build-action@v2
with:
arguments: check -Dgeb.env=chromeHeadless
env:
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
java-version: '8'
- name: Run Build
if: github.event_name == 'push'
id: build
uses: gradle/gradle-build-action@v2
env:
Expand All @@ -53,36 +29,45 @@ jobs:
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
with:
arguments: build -Dgeb.env=chromeHeadless
- name: Publish Test Report
if: steps.build.outcome == 'failure' || steps.tests.outcome == 'failure'
uses: scacap/action-surefire-report@v1
publish:
if: github.event_name == 'push'
needs: ['build']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
report_paths: '**/build/test-results/test/TEST-*.xml'
- name: Publish to repo.grails.org
distribution: 'adopt'
java-version: '8'
- name: Publish Artifacts (repo.grails.org)
id: publish
uses: gradle/gradle-build-action@v2
if: steps.build.outcome == 'success' && github.event_name == 'push' && matrix.java == '8'
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
with:
arguments: -Dorg.gradle.internal.publish.checksums.insecure=true publish
- name: Build Docs
id: docs
if: steps.build.outcome == 'success' && github.event_name == 'push' && matrix.java == '8'
if: success()
uses: gradle/gradle-build-action@v2
with:
arguments: docs:docs
env:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
- name: Publish to Github Pages
if: steps.docs.outcome == 'success' && github.event_name == 'push' && matrix.java == '8'
uses: micronaut-projects/github-pages-deploy-action@master
if: success()
uses: micronaut-projects/github-pages-deploy-action@grails
env:
TARGET_REPOSITORY: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
BRANCH: gh-pages
FOLDER: docs/build/docs
DOC_SUB_FOLDER: hibernate
DOC_FOLDER: gh-pages
COMMIT_EMAIL: [email protected]
COMMIT_NAME: Puneet Behl
COMMIT_NAME: Puneet Behl
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
**/.gradle/
**/build
**/out
*.sdkmanrc
16 changes: 13 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ buildscript {
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion"
classpath "org.grails.plugins:views-gradle:$viewGradleVersion"
classpath "org.grails.plugins:views-json:$viewsJsonVersion"
classpath "org.grails:grails-docs:${project.ext.properties.grailsDocsVersion ?: grailsVersion}"
classpath "io.github.gradle-nexus:publish-plugin:1.1.0"
}
Expand All @@ -17,7 +19,7 @@ repositories {
version project.projectVersion

ext {
commonBuild = 'https://raw.githubusercontent.com/grails/grails-common-build/master'
commonBuild = 'https://raw.githubusercontent.com/grails/grails-common-build/v2.0.0'
}

subprojects {
Expand Down Expand Up @@ -62,13 +64,21 @@ subprojects {
}

if (isGrailsPlugin) {
apply plugin: 'groovy'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'java-library'
apply plugin: "org.grails.grails-plugin"
} else {
apply from: "${commonBuild}/common-project.gradle"
}

dependencies {
testCompile "org.codehaus.groovy:groovy-test:$groovyVersion"
implementation "com.graphql-java:graphql-java:$graphqlJavaVersion"
testImplementation "org.codehaus.groovy:groovy-test:$groovyVersion"
testImplementation "io.projectreactor:reactor-test:3.5.5"
testImplementation("org.spockframework:spock-core:$spockVersion")
implementation 'org.grails:grails-datastore-gorm:7.3.4'
}
}

Expand Down
27 changes: 17 additions & 10 deletions core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
repositories {
mavenCentral()
maven { url "https://repo.grails.org/grails/core" }
}
apply plugin: 'codenarc'

dependencies {
documentation "org.codehaus.groovy:groovy-cli-picocli:$groovyVersion"

compile "org.grails:grails-datastore-gorm:${gormVersion}"
compile "com.graphql-java:graphql-java:$graphqlJavaVersion"
compile "com.graphql-java:graphql-java-extended-scalars:$graphqlJavaScalarExtVersion"
api "org.grails:grails-datastore-gorm:${gormVersion}"
api "com.graphql-java:graphql-java:$graphqlJavaVersion"
api "com.graphql-java:graphql-java-extended-scalars:$graphqlJavaScalarExtVersion"
api 'com.github.javaparser:javaparser-core:3.25.5'
api "org.grails.plugins:views-json:2.3.2"
api 'org.javassist:javassist:3.29.2-GA'

codenarc "org.codenarc:CodeNarc:$codenarcVersion"

testCompile "org.grails:grails-datastore-gorm-hibernate5:${gormHibernateVersion}"
testCompile "org.grails:grails-datastore-gorm-mongodb:${gormMongoDbVersion}"
testCompile 'com.github.fakemongo:fongo:2.1.1'
testRuntime "com.h2database:h2:1.4.192"
testRuntime "org.apache.tomcat:tomcat-jdbc:8.5.85"
testRuntime "org.apache.tomcat.embed:tomcat-embed-logging-log4j:8.5.2"
testRuntime "org.slf4j:slf4j-api:$slf4jVersion"
testImplementation "org.grails:grails-datastore-gorm-hibernate5:${gormHibernateVersion}"
testImplementation "org.grails:grails-datastore-gorm-mongodb:${gormMongoDbVersion}"
testImplementation 'com.github.fakemongo:fongo:2.1.1'
testImplementation 'com.h2database:h2:2.2.224'
testImplementation "org.apache.tomcat:tomcat-jdbc:8.5.85"
testImplementation "org.apache.tomcat.embed:tomcat-embed-logging-log4j:8.5.2"
testImplementation "org.slf4j:slf4j-api:$slf4jVersion"
}

targetCompatibility = 1.8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class GraphQLMapping implements Describable<GraphQLMapping>, Deprecatable<GraphQ
mapping
}

private CustomOperation handleCustomOperation(CustomOperation operation, OperationType type, Closure closure) {
private CustomOperation handleCustomOperation(CustomOperation operation, OperationType type, @DelegatesTo(strategy = Closure.DELEGATE_ONLY)Closure closure) {
operation.operationType = type
withDelegate(closure, operation)
operation.validate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ import org.grails.gorm.graphql.entity.dsl.helpers.Named
* @author James Kleeh
* @since 1.0.0
*/
@Builder(builderStrategy = SimpleStrategy, prefix = '')
@CompileStatic
@Builder(builderStrategy = SimpleStrategy, prefix = '')
class GraphQLPropertyMapping implements Describable<GraphQLPropertyMapping>, Deprecatable<GraphQLPropertyMapping>, Named<GraphQLPropertyMapping>, ExecutesClosures {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ trait Arguable<T> extends ExecutesClosures {

List<CustomArgument> arguments = []

private void handleArgumentClosure(CustomArgument argument, Closure closure) {
private void handleArgumentClosure(CustomArgument argument, @DelegatesTo(strategy = Closure.DELEGATE_ONLY)Closure closure) {
withDelegate(closure, (Object)argument)
argument.validate()
arguments.add(argument)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ trait ComplexTyped<T> extends ExecutesClosures {
customInputType
}

private void handleField(Closure closure, Field field) {
private void handleField(@DelegatesTo(strategy = Closure.DELEGATE_ONLY)Closure closure, Field field) {
field.nullable(defaultNull)
withDelegate(closure, (Object)field)
handleField(field)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import groovy.transform.CompileStatic
@CompileStatic
trait ExecutesClosures {

static void withDelegate(Closure closure, Object delegate) {
static void withDelegate(@DelegatesTo(strategy = Closure.DELEGATE_ONLY)Closure closure, Object delegate) {
if (closure != null) {
closure.resolveStrategy = Closure.DELEGATE_ONLY
closure.delegate = delegate
Expand All @@ -25,3 +25,4 @@ trait ExecutesClosures {
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import org.grails.gorm.graphql.types.GraphQLTypeManager
* @author James Kleeh
* @since 1.0.0
*/

@CompileStatic
class ComplexOperation extends CustomOperation<ComplexOperation> implements ExecutesClosures {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import grails.gorm.validation.PersistentEntityValidator
import graphql.schema.DataFetcher
import graphql.schema.GraphQLType
import groovy.transform.CompileStatic
import org.grails.datastore.mapping.config.Property
import org.grails.datastore.mapping.model.MappingContext
import org.grails.datastore.mapping.model.PersistentEntity
import org.grails.datastore.mapping.model.PersistentProperty
Expand Down Expand Up @@ -63,7 +64,7 @@ class PersistentGraphQLProperty extends OrderedGraphQLProperty {
this.nullable = mapping.nullable
}
else {
this.nullable = property.mapping.mappedForm.nullable
this.nullable = ((Property) property.mapping.mappedForm).nullable
}
this.output = mapping.output
this.input = mapping.input
Expand Down
58 changes: 31 additions & 27 deletions examples/grails-docs-app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,37 +1,41 @@
dependencies {
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-plugin-url-mappings"
compile "org.grails:grails-plugin-rest"
compile "org.grails:grails-plugin-codecs"
compile "org.grails:grails-plugin-interceptors"
compile "org.grails:grails-plugin-services"
compile "org.grails:grails-plugin-datasource"
compile "org.grails:grails-plugin-databinding"
compile "org.grails:grails-web-boot"
compile "org.grails:grails-logging"
compile "org.grails.plugins:cache"
compile "org.grails.plugins:async"
compile "org.grails.plugins:events"
compile "org.grails.plugins:hibernate5"
compile "org.hibernate:hibernate-core:$hibernateCoreVersion"
compile "org.grails.plugins:views-json"
compile "org.grails.plugins:views-json-templates"
implementation "org.springframework.boot:spring-boot-starter-logging"
implementation "org.springframework.boot:spring-boot-autoconfigure"
implementation "org.grails:grails-core"
implementation "org.springframework.boot:spring-boot-starter-actuator"
implementation "org.springframework.boot:spring-boot-starter-tomcat"
implementation "org.grails:grails-plugin-url-mappings"
implementation "org.grails:grails-plugin-rest"
implementation "org.grails:grails-plugin-codecs"
implementation "org.grails:grails-plugin-interceptors"
implementation "org.grails:grails-plugin-services"
implementation "org.grails:grails-plugin-datasource"
implementation "org.grails:grails-plugin-databinding"
implementation "org.grails:grails-web-boot"
implementation "org.grails:grails-logging"
implementation "org.grails.plugins:cache"
implementation "org.grails.plugins:async"
implementation "org.grails.plugins:events"
implementation "org.grails.plugins:hibernate5"
implementation "org.hibernate:hibernate-core:$hibernateCoreVersion"
implementation "org.grails.plugins:views-json"
implementation "org.grails.plugins:views-json-templates"
implementation 'io.micronaut.rxjava2:micronaut-rxjava2-http-client:1.2.0'
console "org.grails:grails-console"
profile "org.grails.profiles:rest-api"
runtime "org.glassfish.web:el-impl:2.1.2-b03"
runtime "com.h2database:h2"
runtime "org.apache.tomcat:tomcat-jdbc"
testCompile "org.grails:grails-gorm-testing-support"
testCompile "org.grails:grails-web-testing-support"
runtimeOnly "org.glassfish.web:el-impl:2.1.2-b03"
runtimeOnly "com.h2database:h2"
runtimeOnly "org.apache.tomcat:tomcat-jdbc"
testImplementation "org.grails:grails-gorm-testing-support"
testImplementation "org.grails:grails-web-testing-support"

compile project(":grails-plugin-gorm-graphql-plugin")
implementation project(":grails-plugin-gorm-graphql-plugin")
}

bootRun {
jvmArgs('-Dspring.output.ansi.enabled=always')
sourceResources sourceSets.main
}
tasks.withType(Test) {
useJUnitPlatform()
}
10 changes: 7 additions & 3 deletions examples/grails-docs-app/grails-app/conf/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ spring:
groovy:
template:
check-template-location: false


management:
endpoints:
enabled-by-default: false
Expand Down Expand Up @@ -67,6 +69,7 @@ hibernate:
queries: false
use_second_level_cache: false
use_query_cache: false

dataSource:
pooled: true
jmxExport: true
Expand All @@ -78,15 +81,15 @@ environments:
development:
dataSource:
dbCreate: create-drop
url: jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
url: jdbc:h2:mem:devDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
test:
dataSource:
dbCreate: update
url: jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
url: jdbc:h2:mem:testDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
production:
dataSource:
dbCreate: none
url: jdbc:h2:./prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
url: jdbc:h2:./prodDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
properties:
jmxEnabled: true
initialSize: 5
Expand All @@ -105,3 +108,4 @@ environments:
testOnReturn: false
jdbcInterceptors: ConnectionState
defaultTransactionIsolation: 2 # TRANSACTION_READ_COMMITTED

Loading