jdaugherty commented on code in PR #15587: URL: https://github.com/apache/grails-core/pull/15587#discussion_r3143722815
########## gradle.properties: ########## @@ -55,6 +57,7 @@ gradleCycloneDxPluginVersion=2.4.1 # micronaut libraries not in the bom due to the potential for spring mismatches micronautPlatformVersion=4.9.2 +micronautRxjava2Version=2.9.0 Review Comment: We should use the bom ########## gradle.properties: ########## @@ -35,6 +35,8 @@ gparsVersion=1.2.1 # Keep gradle version synced with .sdkmanrc, all gradle-wrapper.properties files, # and grails-forge/grails-forge-core/src/main/java/org/grails/forge/feature/build/gradle/templates/gradleWrapperProperties.rocker.raw gradleToolingApiVersion=8.14.4 +graphqlJavaVersion=24.3 Review Comment: These versions need to be added to the bom. To fix mismatches, I have started to backport the better bom structure here: https://github.com/apache/grails-core/pull/15605 ########## grails-data-graphql/plugin/build.gradle: ########## @@ -17,37 +17,98 @@ * under the License. */ - plugins { - id "org.apache.grails.gradle.grails-plugin" - id "org.apache.grails.gradle.grails-gson" + id 'org.apache.grails.buildsrc.properties' + id 'org.apache.grails.gradle.grails-plugin' + id 'org.apache.grails.gradle.grails-gson' + id 'org.apache.grails.buildsrc.compile' + id 'org.apache.grails.buildsrc.publish' + id 'org.apache.grails.buildsrc.sbom' + id 'org.apache.grails.gradle.grails-code-style' +} + +version = projectVersion +group = 'org.apache.grails' + +ext { + gormApiDocs = true + pomTitle = 'GORM for GraphQL' + pomDescription = 'Generates a GraphQL schema based on entities in GORM' } dependencies { - api "org.apache.grails:grails-controllers" - api "org.apache.grails:grails-databinding" - api("org.apache.grails:grails-rest-transforms") { + + implementation platform(project(':grails-bom')) + + api project(':grails-data-graphql-core'), { + // api: GraphQLEntityNamingConvention, Schema, GraphQLSchema generation + } + api project(':grails-controllers'), { + // api: GraphqlController extends from grails controller infrastructure + } + api project(':grails-databinding'), { + // api: data binding for GraphQL request payloads + } + api project(':grails-rest-transforms'), { + // api: REST transforms used for JSON marshalling exclude group: 'org.apache.grails', module: 'grails-converters' } - api "org.apache.grails:grails-url-mappings" - api "org.apache.grails:grails-views-gson:$viewsJsonVersion" - api 'io.micronaut.rxjava2:micronaut-rxjava2-http-client:1.3.0' - api "javax.servlet:javax.servlet-api:$servletApiVersion" - api "io.micronaut:micronaut-http-client:$micronautVersion" - api "org.apache.grails:grails-converters:3.3.1" - api 'com.github.javaparser:javaparser-core:3.25.7' - api "com.graphql-java:graphql-java:$graphqlJavaVersion" - testImplementation "org.apache.grails:grails-testing-support-web" - testImplementation "cglib:cglib-nodep:3.3.0" - profile "org.apache.grails.profiles:web-plugin" + api project(':grails-url-mappings'), { + // api: URL mappings for /graphql endpoint + } + api project(':grails-converters'), { + // api: JSON converters used by the controller + } + api project(':grails-views-gson'), { + // api: GSON view rendering for GraphQL responses + } + api 'com.github.javaparser:javaparser-core', { + // api: parsing of GORM entity sources for schema introspection + } + api "com.graphql-java:graphql-java:$graphqlJavaVersion", { + // api: GraphQL execution and schema types + } + api 'jakarta.servlet:jakarta.servlet-api', { + // api: HttpServletRequest/Response in GraphqlController + } + api "io.micronaut:micronaut-http-client:$micronautHttpClientVersion", { + // api: HTTP client used by integration tests / playground Review Comment: If its used by tests we shouldn't export this; one of the original changes if Grails 7 was the removal of test dependencies from the production classpath ########## grails-data-graphql/plugin/build.gradle: ########## @@ -17,37 +17,98 @@ * under the License. */ - plugins { - id "org.apache.grails.gradle.grails-plugin" - id "org.apache.grails.gradle.grails-gson" + id 'org.apache.grails.buildsrc.properties' + id 'org.apache.grails.gradle.grails-plugin' + id 'org.apache.grails.gradle.grails-gson' + id 'org.apache.grails.buildsrc.compile' + id 'org.apache.grails.buildsrc.publish' + id 'org.apache.grails.buildsrc.sbom' + id 'org.apache.grails.gradle.grails-code-style' +} + +version = projectVersion +group = 'org.apache.grails' + +ext { + gormApiDocs = true + pomTitle = 'GORM for GraphQL' + pomDescription = 'Generates a GraphQL schema based on entities in GORM' } dependencies { - api "org.apache.grails:grails-controllers" - api "org.apache.grails:grails-databinding" - api("org.apache.grails:grails-rest-transforms") { + + implementation platform(project(':grails-bom')) + + api project(':grails-data-graphql-core'), { + // api: GraphQLEntityNamingConvention, Schema, GraphQLSchema generation + } + api project(':grails-controllers'), { + // api: GraphqlController extends from grails controller infrastructure + } + api project(':grails-databinding'), { + // api: data binding for GraphQL request payloads + } + api project(':grails-rest-transforms'), { + // api: REST transforms used for JSON marshalling exclude group: 'org.apache.grails', module: 'grails-converters' } - api "org.apache.grails:grails-url-mappings" - api "org.apache.grails:grails-views-gson:$viewsJsonVersion" - api 'io.micronaut.rxjava2:micronaut-rxjava2-http-client:1.3.0' - api "javax.servlet:javax.servlet-api:$servletApiVersion" - api "io.micronaut:micronaut-http-client:$micronautVersion" - api "org.apache.grails:grails-converters:3.3.1" - api 'com.github.javaparser:javaparser-core:3.25.7' - api "com.graphql-java:graphql-java:$graphqlJavaVersion" - testImplementation "org.apache.grails:grails-testing-support-web" - testImplementation "cglib:cglib-nodep:3.3.0" - profile "org.apache.grails.profiles:web-plugin" + api project(':grails-url-mappings'), { + // api: URL mappings for /graphql endpoint + } + api project(':grails-converters'), { + // api: JSON converters used by the controller + } + api project(':grails-views-gson'), { + // api: GSON view rendering for GraphQL responses + } + api 'com.github.javaparser:javaparser-core', { + // api: parsing of GORM entity sources for schema introspection + } + api "com.graphql-java:graphql-java:$graphqlJavaVersion", { Review Comment: Once the bom change is made, we should change these to use versions from the bom ########## grails-test-examples/graphql/grails-docs-app/build.gradle: ########## @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ +plugins { + id 'org.apache.grails.buildsrc.properties' + id 'org.apache.grails.buildsrc.compile' +} + +version = projectVersion +group = 'examples' + +apply plugin: 'groovy' +apply plugin: 'org.apache.grails.gradle.grails-web' +apply plugin: 'org.apache.grails.gradle.grails-gson' + +dependencies { + implementation platform(project(':grails-bom')) + + implementation 'org.springframework.boot:spring-boot-starter-logging' + implementation 'org.springframework.boot:spring-boot-autoconfigure' + implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'org.springframework.boot:spring-boot-starter-tomcat' + + implementation 'org.apache.grails:grails-core' + implementation 'org.apache.grails:grails-url-mappings' + implementation 'org.apache.grails:grails-rest-transforms' + implementation 'org.apache.grails:grails-codecs' + implementation 'org.apache.grails:grails-interceptors' + implementation 'org.apache.grails:grails-services' + implementation 'org.apache.grails:grails-datasource' + implementation 'org.apache.grails:grails-databinding' + implementation 'org.apache.grails:grails-web-boot' + implementation 'org.apache.grails:grails-logging' + implementation 'org.apache.grails:grails-cache' + implementation 'org.apache.grails:grails-async' + implementation 'org.apache.grails:grails-events' + implementation 'org.apache.grails:grails-data-hibernate5' + implementation 'org.apache.grails:grails-views-gson' + implementation 'org.apache.grails:grails-data-mongodb-gson-templates' + + implementation "org.hibernate:hibernate-core-jakarta:$hibernate5Version" + implementation "io.micronaut.rxjava2:micronaut-rxjava2-http-client:$micronautRxjava2Version" + // JSON mapper for the micronaut HTTP client used by the GraphQLSpec trait. + implementation "io.micronaut.serde:micronaut-serde-jackson:$micronautSerdeJacksonVersion" + + implementation project(':grails-data-graphql') + + console 'org.apache.grails:grails-console' + profile 'org.apache.grails.profiles:rest-api' + + runtimeOnly 'com.h2database:h2' + runtimeOnly 'org.apache.tomcat:tomcat-jdbc' + + testImplementation 'org.apache.grails:grails-testing-support-datamapping' + testImplementation 'org.apache.grails:grails-testing-support-web' +} + +bootRun { + jvmArgs('-Dspring.output.ansi.enabled=always') + sourceResources sourceSets.main Review Comment: we shouldn't need to define this, the whole bootrun block can be removed ########## grails-test-examples/graphql/spring-boot-app/build.gradle: ########## @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ + +// Standalone Spring Boot demo that embeds GORM-GraphQL without a full +// Grails application; exercises the schema generator core library directly. + +plugins { + id 'groovy' + id 'org.apache.grails.buildsrc.properties' + id 'org.springframework.boot' + id 'org.apache.grails.buildsrc.compile' +} + +version = projectVersion +group = 'examples' + +dependencies { + + implementation platform(project(':grails-bom')) + + implementation 'org.springframework.boot:spring-boot-starter' + implementation 'org.springframework.boot:spring-boot-starter-web' + + // GORM + Hibernate 5 (Jakarta variant), configured via GORM's Spring Boot auto-config + // (registers HibernateDatastore, dataSource, transactionManager as Spring beans). + implementation project(':grails-data-hibernate5-spring-boot') Review Comment: We should never use project references (other than the bom) in test apps ########## grails-data-graphql/plugin/build.gradle: ########## @@ -17,37 +17,98 @@ * under the License. */ - plugins { - id "org.apache.grails.gradle.grails-plugin" - id "org.apache.grails.gradle.grails-gson" + id 'org.apache.grails.buildsrc.properties' + id 'org.apache.grails.gradle.grails-plugin' + id 'org.apache.grails.gradle.grails-gson' + id 'org.apache.grails.buildsrc.compile' + id 'org.apache.grails.buildsrc.publish' + id 'org.apache.grails.buildsrc.sbom' + id 'org.apache.grails.gradle.grails-code-style' +} + +version = projectVersion +group = 'org.apache.grails' + +ext { + gormApiDocs = true + pomTitle = 'GORM for GraphQL' + pomDescription = 'Generates a GraphQL schema based on entities in GORM' } dependencies { - api "org.apache.grails:grails-controllers" - api "org.apache.grails:grails-databinding" - api("org.apache.grails:grails-rest-transforms") { + + implementation platform(project(':grails-bom')) + + api project(':grails-data-graphql-core'), { + // api: GraphQLEntityNamingConvention, Schema, GraphQLSchema generation + } + api project(':grails-controllers'), { + // api: GraphqlController extends from grails controller infrastructure + } + api project(':grails-databinding'), { + // api: data binding for GraphQL request payloads + } + api project(':grails-rest-transforms'), { + // api: REST transforms used for JSON marshalling exclude group: 'org.apache.grails', module: 'grails-converters' } - api "org.apache.grails:grails-url-mappings" - api "org.apache.grails:grails-views-gson:$viewsJsonVersion" - api 'io.micronaut.rxjava2:micronaut-rxjava2-http-client:1.3.0' - api "javax.servlet:javax.servlet-api:$servletApiVersion" - api "io.micronaut:micronaut-http-client:$micronautVersion" - api "org.apache.grails:grails-converters:3.3.1" - api 'com.github.javaparser:javaparser-core:3.25.7' - api "com.graphql-java:graphql-java:$graphqlJavaVersion" - testImplementation "org.apache.grails:grails-testing-support-web" - testImplementation "cglib:cglib-nodep:3.3.0" - profile "org.apache.grails.profiles:web-plugin" + api project(':grails-url-mappings'), { + // api: URL mappings for /graphql endpoint + } + api project(':grails-converters'), { + // api: JSON converters used by the controller + } + api project(':grails-views-gson'), { + // api: GSON view rendering for GraphQL responses + } + api 'com.github.javaparser:javaparser-core', { + // api: parsing of GORM entity sources for schema introspection + } + api "com.graphql-java:graphql-java:$graphqlJavaVersion", { + // api: GraphQL execution and schema types + } + api 'jakarta.servlet:jakarta.servlet-api', { + // api: HttpServletRequest/Response in GraphqlController + } + api "io.micronaut:micronaut-http-client:$micronautHttpClientVersion", { + // api: HTTP client used by integration tests / playground + } + api "io.micronaut.rxjava2:micronaut-rxjava2-http-client:$micronautRxjava2Version", { + // api: RxJava2 variant of micronaut-http-client used by integration tests Review Comment: We probably should switch to rxjava2 since micronaut is not guaranteed in a grails app any longer ########## grails-data-graphql/plugin/build.gradle: ########## @@ -17,37 +17,98 @@ * under the License. */ - plugins { - id "org.apache.grails.gradle.grails-plugin" - id "org.apache.grails.gradle.grails-gson" + id 'org.apache.grails.buildsrc.properties' + id 'org.apache.grails.gradle.grails-plugin' + id 'org.apache.grails.gradle.grails-gson' + id 'org.apache.grails.buildsrc.compile' + id 'org.apache.grails.buildsrc.publish' + id 'org.apache.grails.buildsrc.sbom' + id 'org.apache.grails.gradle.grails-code-style' +} + +version = projectVersion +group = 'org.apache.grails' + +ext { + gormApiDocs = true + pomTitle = 'GORM for GraphQL' + pomDescription = 'Generates a GraphQL schema based on entities in GORM' } dependencies { - api "org.apache.grails:grails-controllers" - api "org.apache.grails:grails-databinding" - api("org.apache.grails:grails-rest-transforms") { + + implementation platform(project(':grails-bom')) + + api project(':grails-data-graphql-core'), { + // api: GraphQLEntityNamingConvention, Schema, GraphQLSchema generation + } + api project(':grails-controllers'), { + // api: GraphqlController extends from grails controller infrastructure + } + api project(':grails-databinding'), { + // api: data binding for GraphQL request payloads + } + api project(':grails-rest-transforms'), { + // api: REST transforms used for JSON marshalling exclude group: 'org.apache.grails', module: 'grails-converters' } - api "org.apache.grails:grails-url-mappings" - api "org.apache.grails:grails-views-gson:$viewsJsonVersion" - api 'io.micronaut.rxjava2:micronaut-rxjava2-http-client:1.3.0' - api "javax.servlet:javax.servlet-api:$servletApiVersion" - api "io.micronaut:micronaut-http-client:$micronautVersion" - api "org.apache.grails:grails-converters:3.3.1" - api 'com.github.javaparser:javaparser-core:3.25.7' - api "com.graphql-java:graphql-java:$graphqlJavaVersion" - testImplementation "org.apache.grails:grails-testing-support-web" - testImplementation "cglib:cglib-nodep:3.3.0" - profile "org.apache.grails.profiles:web-plugin" + api project(':grails-url-mappings'), { + // api: URL mappings for /graphql endpoint + } + api project(':grails-converters'), { + // api: JSON converters used by the controller + } + api project(':grails-views-gson'), { + // api: GSON view rendering for GraphQL responses + } + api 'com.github.javaparser:javaparser-core', { + // api: parsing of GORM entity sources for schema introspection + } + api "com.graphql-java:graphql-java:$graphqlJavaVersion", { + // api: GraphQL execution and schema types + } + api 'jakarta.servlet:jakarta.servlet-api', { + // api: HttpServletRequest/Response in GraphqlController + } + api "io.micronaut:micronaut-http-client:$micronautHttpClientVersion", { + // api: HTTP client used by integration tests / playground + } + api "io.micronaut.rxjava2:micronaut-rxjava2-http-client:$micronautRxjava2Version", { + // api: RxJava2 variant of micronaut-http-client used by integration tests + } - api project(":gorm-graphql") + testImplementation project(':grails-testing-support-web') + // Spock 2.3 on Groovy 4 / JDK 17 uses net.bytebuddy for class mocking; + // cglib-nodep no longer works on JDK 17+. + testImplementation 'net.bytebuddy:byte-buddy' + testImplementation 'org.spockframework:spock-core' } compileGsonViews { - packageName = "gorm-graphql" + packageName = 'gorm-graphql' +} + +// compileGsonViews writes compiled GSON view classes into build/gson-classes/main, +// which the Groovy plugin treats as part of the main source-set output. Without an +// explicit dependency the groovydoc task implicitly consumes that output, which +// Gradle 8.x rejects as an undeclared task input. +tasks.named('groovydoc').configure { + dependsOn tasks.named('compileGsonViews') } -tasks.withType(Test) { +def disabledTasks = ['bootRun', 'bootTestRun'] Review Comment: why are these tasks disabled? ########## grails-data-graphql/core/src/test/groovy/org/grails/gorm/graphql/entity/property/impl/HibernatePersistentGraphQLPropertySpec.groovy: ########## @@ -359,8 +359,11 @@ class HibernatePersistentGraphQLPropertySpec extends HibernateSpec { 'order8' | 8 //specified via mapping 'order0' | 0 //specified as 0 'orderNeg' | -21 //specified as -10 - 'orderNullc' | 6 //not specified, gorm supplied - 'orderNulld' | 7 //not specified, gorm supplied + // Grails 7: GORM no longer auto-supplies a constraint order for properties Review Comment: @jamesfredley is this comment correct? we didn't make an ordering change in Grails 7 ########## grails-data-graphql/plugin/grails-app/controllers/org/grails/gorm/graphql/plugin/GraphqlController.groovy: ########## @@ -96,14 +96,22 @@ class GraphqlController { def browser() { if (grailsGraphQLConfiguration.enabled && grailsGraphQLConfiguration.browser) { if (resolvedBrowserHtml == null) { + InputStream resource = this.class.classLoader.getResourceAsStream('graphiql.html') + if (resource == null) { + // The bundled GraphiQL assets (graphiql.html/css/js) were removed Review Comment: Wasn't this basically a console to help test? ########## grails-data-graphql/plugin/src/main/groovy/org/grails/gorm/graphql/plugin/GormGraphqlGrailsPlugin.groovy: ########## @@ -38,65 +38,73 @@ import org.grails.gorm.graphql.types.DefaultGraphQLTypeManager class GormGraphqlGrailsPlugin extends Plugin { - def grailsVersion = "4.0.0 > *" - def title = "Gorm GraphQL" - def author = "James Kleeh" - def authorEmail = "[email protected]" + def grailsVersion = '7.1.0 > *' + def title = 'Gorm GraphQL' + def author = 'James Kleeh' + def authorEmail = '[email protected]' def profiles = ['web'] - def documentation = "https://grails.github.io/grails-data-graphql/3.0.x/hibernate/guide/index.html" - def license = "APACHE" - def developers = [ [ name: "Puneet Behl", email: "[email protected]" ]] - def issueManagement = [ system: "GitHub", url: "https://github.com/apache/grails-core/issues" ] - def scm = [ url: "https://github.com/apache/grails-core/" ] + def documentation = 'https://grails.github.io/grails-data-graphql/3.0.x/hibernate/guide/index.html' Review Comment: This is wrong now ########## grails-data-graphql/README.md: ########## @@ -14,15 +14,48 @@ See the License for the specific language governing permissions and limitations under the License. --> -# Gorm GraphQL +# GORM for GraphQL -This project has not been updated for Grails 7 yet and is not included in the build. +An automatic GraphQL schema generator for [GORM](https://grails.apache.org/docs/latest/grails-data/). -## An automatic GraphQL schema generator for GORM +This project is part of the main Grails monorepo build. The published modules +are wired into the root `settings.gradle`: -Current documentation https://grails.github.io/grails-data-graphql/3.0.x/hibernate/guide/index.html +| Module | Gradle path | Maven coordinates | +| --------------- | ---------------------------- | ------------------------------------------------- | +| Core schema lib | `:grails-data-graphql-core` | `org.apache.grails.data:grails-data-graphql-core` | +| Grails plugin | `:grails-data-graphql` | `org.apache.grails:grails-data-graphql` | +| Reference guide | `:grails-data-graphql-docs` | (not published) | Review Comment: We should fix the referenced publish location ########## grails-data-graphql/plugin/build.gradle: ########## @@ -17,37 +17,98 @@ * under the License. */ - plugins { - id "org.apache.grails.gradle.grails-plugin" - id "org.apache.grails.gradle.grails-gson" + id 'org.apache.grails.buildsrc.properties' + id 'org.apache.grails.gradle.grails-plugin' + id 'org.apache.grails.gradle.grails-gson' + id 'org.apache.grails.buildsrc.compile' + id 'org.apache.grails.buildsrc.publish' + id 'org.apache.grails.buildsrc.sbom' + id 'org.apache.grails.gradle.grails-code-style' +} + +version = projectVersion +group = 'org.apache.grails' + +ext { + gormApiDocs = true + pomTitle = 'GORM for GraphQL' + pomDescription = 'Generates a GraphQL schema based on entities in GORM' } dependencies { - api "org.apache.grails:grails-controllers" - api "org.apache.grails:grails-databinding" - api("org.apache.grails:grails-rest-transforms") { + + implementation platform(project(':grails-bom')) + + api project(':grails-data-graphql-core'), { + // api: GraphQLEntityNamingConvention, Schema, GraphQLSchema generation + } + api project(':grails-controllers'), { + // api: GraphqlController extends from grails controller infrastructure + } + api project(':grails-databinding'), { + // api: data binding for GraphQL request payloads + } + api project(':grails-rest-transforms'), { + // api: REST transforms used for JSON marshalling exclude group: 'org.apache.grails', module: 'grails-converters' } - api "org.apache.grails:grails-url-mappings" - api "org.apache.grails:grails-views-gson:$viewsJsonVersion" - api 'io.micronaut.rxjava2:micronaut-rxjava2-http-client:1.3.0' - api "javax.servlet:javax.servlet-api:$servletApiVersion" - api "io.micronaut:micronaut-http-client:$micronautVersion" - api "org.apache.grails:grails-converters:3.3.1" - api 'com.github.javaparser:javaparser-core:3.25.7' - api "com.graphql-java:graphql-java:$graphqlJavaVersion" - testImplementation "org.apache.grails:grails-testing-support-web" - testImplementation "cglib:cglib-nodep:3.3.0" - profile "org.apache.grails.profiles:web-plugin" + api project(':grails-url-mappings'), { + // api: URL mappings for /graphql endpoint + } + api project(':grails-converters'), { + // api: JSON converters used by the controller + } + api project(':grails-views-gson'), { + // api: GSON view rendering for GraphQL responses + } + api 'com.github.javaparser:javaparser-core', { + // api: parsing of GORM entity sources for schema introspection + } + api "com.graphql-java:graphql-java:$graphqlJavaVersion", { + // api: GraphQL execution and schema types + } + api 'jakarta.servlet:jakarta.servlet-api', { + // api: HttpServletRequest/Response in GraphqlController + } + api "io.micronaut:micronaut-http-client:$micronautHttpClientVersion", { + // api: HTTP client used by integration tests / playground + } + api "io.micronaut.rxjava2:micronaut-rxjava2-http-client:$micronautRxjava2Version", { + // api: RxJava2 variant of micronaut-http-client used by integration tests + } - api project(":gorm-graphql") + testImplementation project(':grails-testing-support-web') + // Spock 2.3 on Groovy 4 / JDK 17 uses net.bytebuddy for class mocking; + // cglib-nodep no longer works on JDK 17+. Review Comment: lets remove the 'this is bridge' comment ########## grails-data-graphql/plugin/src/test/groovy/gorm/graphql/GraphqlControllerSpec.groovy: ########## @@ -213,8 +213,11 @@ class GraphqlControllerSpec extends Specification implements ControllerUnitTest< controller.browser() then: - !response.text.empty - response.contentType == "text/html;charset=utf-8" + // The bundled graphiql.html was removed from this plugin (commit a9b9fa2598 + // "Remove graphql html, css and js"). Without the classpath resource the + // controller returns 404; downstream apps that supply their own + // graphiql.html will continue to get a 200 with the rendered page. Review Comment: I would be interested to know if the PR contributor thinks we should continue to ship one ########## grails-test-examples/graphql/spring-boot-app/build.gradle: ########## @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ + +// Standalone Spring Boot demo that embeds GORM-GraphQL without a full +// Grails application; exercises the schema generator core library directly. + +plugins { + id 'groovy' Review Comment: For the other test projects, they were using the legacy apply syntax, lets make them all consistent and use this syntax instead? ########## grails-data-graphql/plugin/src/main/groovy/org/grails/gorm/graphql/plugin/GormGraphqlGrailsPlugin.groovy: ########## @@ -38,65 +38,73 @@ import org.grails.gorm.graphql.types.DefaultGraphQLTypeManager class GormGraphqlGrailsPlugin extends Plugin { - def grailsVersion = "4.0.0 > *" - def title = "Gorm GraphQL" - def author = "James Kleeh" - def authorEmail = "[email protected]" + def grailsVersion = '7.1.0 > *' + def title = 'Gorm GraphQL' + def author = 'James Kleeh' Review Comment: We agreed to remove authors in a prior vote. Any additional authors should be added to the publish gradle and we should remove them from here ########## grails-data-graphql/plugin/src/main/groovy/org/grails/gorm/graphql/plugin/GrailsGraphQLConfiguration.groovy: ########## @@ -22,16 +22,30 @@ package org.grails.gorm.graphql.plugin import grails.config.Config import grails.core.GrailsApplication import groovy.transform.CompileStatic -import org.grails.plugins.databinding.DataBindingGrailsPlugin import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.context.properties.ConfigurationProperties -import javax.annotation.PostConstruct +import jakarta.annotation.PostConstruct @CompileStatic @ConfigurationProperties(prefix = 'grails.gorm.graphql') class GrailsGraphQLConfiguration { + // Kept in sync with AbstractDataBindingGrailsPlugin.DEFAULT_DATE_FORMATS in Grails 7.1.0. + // Inlined to avoid coupling to a class whose location has shifted between Grails + // releases (was DataBindingGrailsPlugin in 6.x). Review Comment: I thought @matrei added back that plugin, we should reference it here instead if duplicating ########## grails-test-examples/graphql/grails-test-app/src/integration-test/groovy/grails/test/app/PostIntegrationSpec.groovy: ########## @@ -31,7 +31,7 @@ import java.text.SimpleDateFormat @Stepwise class PostIntegrationSpec extends Specification implements GraphQLSpec { - @Shared SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX") + @Shared SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX") Review Comment: This seems like a regression ########## grails-test-examples/graphql/grails-multi-datastore-app/build.gradle: ########## @@ -0,0 +1,85 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ +plugins { + id 'org.apache.grails.buildsrc.properties' + id 'org.apache.grails.buildsrc.compile' +} + +version = projectVersion +group = 'examples' + +apply plugin: 'groovy' +apply plugin: 'org.apache.grails.gradle.grails-web' +apply plugin: 'org.apache.grails.gradle.grails-gson' + +dependencies { + implementation platform(project(':grails-bom')) + + implementation 'org.springframework.boot:spring-boot-starter-logging' + implementation 'org.springframework.boot:spring-boot-autoconfigure' + implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'org.springframework.boot:spring-boot-starter-tomcat' + + implementation 'org.apache.grails:grails-core' + implementation 'org.apache.grails:grails-url-mappings' + implementation 'org.apache.grails:grails-rest-transforms' + implementation 'org.apache.grails:grails-codecs' + implementation 'org.apache.grails:grails-interceptors' + implementation 'org.apache.grails:grails-services' + implementation 'org.apache.grails:grails-datasource' + implementation 'org.apache.grails:grails-databinding' + implementation 'org.apache.grails:grails-web-boot' + implementation 'org.apache.grails:grails-logging' + implementation 'org.apache.grails:grails-cache' + implementation 'org.apache.grails:grails-async' + implementation 'org.apache.grails:grails-data-hibernate5' + implementation 'org.apache.grails:grails-data-mongodb' + implementation 'org.apache.grails:grails-views-gson' + implementation 'org.apache.grails:grails-data-mongodb-gson-templates' + + implementation "org.hibernate:hibernate-core-jakarta:$hibernate5Version" + implementation "com.graphql-java:graphql-java:$graphqlJavaVersion" + implementation "io.micronaut.rxjava2:micronaut-rxjava2-http-client:$micronautRxjava2Version" + // JSON mapper for the micronaut HTTP client used by the GraphQLSpec trait. + implementation "io.micronaut.serde:micronaut-serde-jackson:$micronautSerdeJacksonVersion" + + implementation 'com.h2database:h2' + implementation 'org.apache.tomcat:tomcat-jdbc' + + implementation project(':grails-data-graphql') + + console 'org.apache.grails:grails-console' + profile 'org.apache.grails.profiles:rest-api' + + compileOnly 'org.apache.grails:grails-testing-support-datamapping' + compileOnly 'org.apache.grails:grails-testing-support-web' + + testImplementation 'org.apache.grails:grails-testing-support-datamapping' + testImplementation 'org.apache.grails:grails-testing-support-web' +} + +bootRun { Review Comment: remove the bootrun block ########## grails-test-examples/graphql/grails-test-app/build.gradle: ########## @@ -0,0 +1,82 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ +plugins { + id 'org.apache.grails.buildsrc.properties' + id 'org.apache.grails.buildsrc.compile' +} + +version = projectVersion +group = 'examples' + +apply plugin: 'groovy' +apply plugin: 'org.apache.grails.gradle.grails-web' +apply plugin: 'org.apache.grails.gradle.grails-gson' + +dependencies { + implementation platform(project(':grails-bom')) + + implementation 'org.springframework.boot:spring-boot-starter-logging' + implementation 'org.springframework.boot:spring-boot-autoconfigure' + implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'org.springframework.boot:spring-boot-starter-tomcat' + + implementation 'org.apache.grails:grails-core' + implementation 'org.apache.grails:grails-url-mappings' + implementation 'org.apache.grails:grails-rest-transforms' + implementation 'org.apache.grails:grails-codecs' + implementation 'org.apache.grails:grails-interceptors' + implementation 'org.apache.grails:grails-services' + implementation 'org.apache.grails:grails-datasource' + implementation 'org.apache.grails:grails-databinding' + implementation 'org.apache.grails:grails-web-boot' + implementation 'org.apache.grails:grails-logging' + implementation 'org.apache.grails:grails-cache' + implementation 'org.apache.grails:grails-async' + implementation 'org.apache.grails:grails-events' + implementation 'org.apache.grails:grails-data-hibernate5' + implementation 'org.apache.grails:grails-views-gson' + implementation 'org.apache.grails:grails-data-mongodb-gson-templates' + + implementation "org.hibernate:hibernate-core-jakarta:$hibernate5Version" + implementation "com.graphql-java:graphql-java:$graphqlJavaVersion" + implementation "io.micronaut.rxjava2:micronaut-rxjava2-http-client:$micronautRxjava2Version" + // JSON mapper for the micronaut HTTP client used by the GraphQLSpec trait. + implementation "io.micronaut.serde:micronaut-serde-jackson:$micronautSerdeJacksonVersion" + + implementation project(':grails-data-graphql') + + console 'org.apache.grails:grails-console' + profile 'org.apache.grails.profiles:rest-api' + + runtimeOnly 'com.h2database:h2' + runtimeOnly 'org.apache.tomcat:tomcat-jdbc' + + testImplementation 'org.apache.grails:grails-testing-support-datamapping' + testImplementation 'org.apache.grails:grails-testing-support-web' +} + +bootRun { + jvmArgs('-Dspring.output.ansi.enabled=always') Review Comment: remove bootrun ########## grails-data-graphql/plugin/build.gradle: ########## @@ -17,37 +17,98 @@ * under the License. */ - plugins { - id "org.apache.grails.gradle.grails-plugin" - id "org.apache.grails.gradle.grails-gson" + id 'org.apache.grails.buildsrc.properties' + id 'org.apache.grails.gradle.grails-plugin' + id 'org.apache.grails.gradle.grails-gson' + id 'org.apache.grails.buildsrc.compile' + id 'org.apache.grails.buildsrc.publish' + id 'org.apache.grails.buildsrc.sbom' + id 'org.apache.grails.gradle.grails-code-style' +} + +version = projectVersion +group = 'org.apache.grails' + +ext { + gormApiDocs = true + pomTitle = 'GORM for GraphQL' + pomDescription = 'Generates a GraphQL schema based on entities in GORM' } dependencies { - api "org.apache.grails:grails-controllers" - api "org.apache.grails:grails-databinding" - api("org.apache.grails:grails-rest-transforms") { + + implementation platform(project(':grails-bom')) + + api project(':grails-data-graphql-core'), { + // api: GraphQLEntityNamingConvention, Schema, GraphQLSchema generation + } + api project(':grails-controllers'), { + // api: GraphqlController extends from grails controller infrastructure + } + api project(':grails-databinding'), { + // api: data binding for GraphQL request payloads + } + api project(':grails-rest-transforms'), { + // api: REST transforms used for JSON marshalling exclude group: 'org.apache.grails', module: 'grails-converters' } - api "org.apache.grails:grails-url-mappings" - api "org.apache.grails:grails-views-gson:$viewsJsonVersion" - api 'io.micronaut.rxjava2:micronaut-rxjava2-http-client:1.3.0' - api "javax.servlet:javax.servlet-api:$servletApiVersion" - api "io.micronaut:micronaut-http-client:$micronautVersion" - api "org.apache.grails:grails-converters:3.3.1" - api 'com.github.javaparser:javaparser-core:3.25.7' - api "com.graphql-java:graphql-java:$graphqlJavaVersion" - testImplementation "org.apache.grails:grails-testing-support-web" - testImplementation "cglib:cglib-nodep:3.3.0" - profile "org.apache.grails.profiles:web-plugin" + api project(':grails-url-mappings'), { + // api: URL mappings for /graphql endpoint + } + api project(':grails-converters'), { + // api: JSON converters used by the controller + } + api project(':grails-views-gson'), { + // api: GSON view rendering for GraphQL responses + } + api 'com.github.javaparser:javaparser-core', { + // api: parsing of GORM entity sources for schema introspection + } + api "com.graphql-java:graphql-java:$graphqlJavaVersion", { + // api: GraphQL execution and schema types + } + api 'jakarta.servlet:jakarta.servlet-api', { + // api: HttpServletRequest/Response in GraphqlController + } + api "io.micronaut:micronaut-http-client:$micronautHttpClientVersion", { + // api: HTTP client used by integration tests / playground + } + api "io.micronaut.rxjava2:micronaut-rxjava2-http-client:$micronautRxjava2Version", { + // api: RxJava2 variant of micronaut-http-client used by integration tests + } - api project(":gorm-graphql") + testImplementation project(':grails-testing-support-web') + // Spock 2.3 on Groovy 4 / JDK 17 uses net.bytebuddy for class mocking; + // cglib-nodep no longer works on JDK 17+. + testImplementation 'net.bytebuddy:byte-buddy' + testImplementation 'org.spockframework:spock-core' } compileGsonViews { - packageName = "gorm-graphql" + packageName = 'gorm-graphql' +} + +// compileGsonViews writes compiled GSON view classes into build/gson-classes/main, +// which the Groovy plugin treats as part of the main source-set output. Without an +// explicit dependency the groovydoc task implicitly consumes that output, which +// Gradle 8.x rejects as an undeclared task input. +tasks.named('groovydoc').configure { + dependsOn tasks.named('compileGsonViews') } -tasks.withType(Test) { +def disabledTasks = ['bootRun', 'bootTestRun'] +disabledTasks.each { taskName -> + tasks.named(taskName) { + enabled = false + } +} + +apply { + from rootProject.layout.projectDirectory.file('gradle/docs-config.gradle') + from rootProject.layout.projectDirectory.file('gradle/grails-extension-gradle-config.gradle') +} + +tasks.withType(Test).configureEach { Review Comment: This should be removed and we include the test config gradle file instead ########## grails-test-examples/graphql/grails-docs-app/build.gradle: ########## @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ +plugins { + id 'org.apache.grails.buildsrc.properties' + id 'org.apache.grails.buildsrc.compile' +} + +version = projectVersion +group = 'examples' + +apply plugin: 'groovy' +apply plugin: 'org.apache.grails.gradle.grails-web' +apply plugin: 'org.apache.grails.gradle.grails-gson' + +dependencies { + implementation platform(project(':grails-bom')) + + implementation 'org.springframework.boot:spring-boot-starter-logging' + implementation 'org.springframework.boot:spring-boot-autoconfigure' + implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'org.springframework.boot:spring-boot-starter-tomcat' + + implementation 'org.apache.grails:grails-core' + implementation 'org.apache.grails:grails-url-mappings' + implementation 'org.apache.grails:grails-rest-transforms' + implementation 'org.apache.grails:grails-codecs' + implementation 'org.apache.grails:grails-interceptors' + implementation 'org.apache.grails:grails-services' + implementation 'org.apache.grails:grails-datasource' + implementation 'org.apache.grails:grails-databinding' + implementation 'org.apache.grails:grails-web-boot' + implementation 'org.apache.grails:grails-logging' + implementation 'org.apache.grails:grails-cache' + implementation 'org.apache.grails:grails-async' + implementation 'org.apache.grails:grails-events' + implementation 'org.apache.grails:grails-data-hibernate5' + implementation 'org.apache.grails:grails-views-gson' + implementation 'org.apache.grails:grails-data-mongodb-gson-templates' + + implementation "org.hibernate:hibernate-core-jakarta:$hibernate5Version" + implementation "io.micronaut.rxjava2:micronaut-rxjava2-http-client:$micronautRxjava2Version" + // JSON mapper for the micronaut HTTP client used by the GraphQLSpec trait. + implementation "io.micronaut.serde:micronaut-serde-jackson:$micronautSerdeJacksonVersion" + + implementation project(':grails-data-graphql') + + console 'org.apache.grails:grails-console' + profile 'org.apache.grails.profiles:rest-api' + + runtimeOnly 'com.h2database:h2' + runtimeOnly 'org.apache.tomcat:tomcat-jdbc' + + testImplementation 'org.apache.grails:grails-testing-support-datamapping' + testImplementation 'org.apache.grails:grails-testing-support-web' +} + +bootRun { + jvmArgs('-Dspring.output.ansi.enabled=always') Review Comment: I think the jvm arg can be removed ########## grails-test-examples/graphql/grails-tenant-app/build.gradle: ########## @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ +plugins { + id 'org.apache.grails.buildsrc.properties' + id 'org.apache.grails.buildsrc.compile' +} + +version = projectVersion +group = 'examples' + +apply plugin: 'groovy' +apply plugin: 'org.apache.grails.gradle.grails-web' +apply plugin: 'org.apache.grails.gradle.grails-gson' + +dependencies { + implementation platform(project(':grails-bom')) + + implementation 'org.springframework.boot:spring-boot-starter-logging' + implementation 'org.springframework.boot:spring-boot-autoconfigure' + implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'org.springframework.boot:spring-boot-starter-tomcat' + + implementation 'org.apache.grails:grails-core' + implementation 'org.apache.grails:grails-url-mappings' + implementation 'org.apache.grails:grails-rest-transforms' + implementation 'org.apache.grails:grails-codecs' + implementation 'org.apache.grails:grails-interceptors' + implementation 'org.apache.grails:grails-services' + implementation 'org.apache.grails:grails-datasource' + implementation 'org.apache.grails:grails-databinding' + implementation 'org.apache.grails:grails-web-boot' + implementation 'org.apache.grails:grails-logging' + implementation 'org.apache.grails:grails-cache' + implementation 'org.apache.grails:grails-async' + implementation 'org.apache.grails:grails-events' + implementation 'org.apache.grails:grails-data-hibernate5' + implementation 'org.apache.grails:grails-views-gson' + implementation 'org.apache.grails:grails-data-mongodb-gson-templates' + + implementation "org.hibernate:hibernate-core-jakarta:$hibernate5Version" + implementation "io.micronaut.rxjava2:micronaut-rxjava2-http-client:$micronautRxjava2Version" + // JSON mapper for the micronaut HTTP client used by the GraphQLSpec trait. + implementation "io.micronaut.serde:micronaut-serde-jackson:$micronautSerdeJacksonVersion" + + implementation project(':grails-data-graphql') + + console 'org.apache.grails:grails-console' + profile 'org.apache.grails.profiles:rest-api' + + runtimeOnly 'com.h2database:h2' + runtimeOnly 'org.apache.tomcat:tomcat-jdbc' + + testImplementation 'org.apache.grails:grails-testing-support-datamapping' + testImplementation 'org.apache.grails:grails-testing-support-web' +} + +bootRun { + jvmArgs('-Dspring.output.ansi.enabled=always') Review Comment: Remove the bootRun block -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
