Skip to content
Open
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
34 changes: 34 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Java CI

on:
push:
branches:
- '**'
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches:
- '**'

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: '21'
- uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build with Gradle
run: ./gradlew clean build
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ It uses a ~~H2 in-memory database~~ sqlite database (for easy local test without

# Getting started

You'll need Java 11 installed.
You'll need Java 21 installed.

./gradlew bootRun

Expand Down
40 changes: 20 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
plugins {
id 'org.springframework.boot' version '2.6.3'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'org.springframework.boot' version '3.2.5'
id 'io.spring.dependency-management' version '1.1.4'
id 'java'
id "com.netflix.dgs.codegen" version "5.0.6"
id "com.diffplug.spotless" version "6.2.1"
id "com.netflix.dgs.codegen" version "6.0.3"
id "com.diffplug.spotless" version "6.25.0"
}

version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
targetCompatibility = '11'
sourceCompatibility = '21'
targetCompatibility = '21'
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.

spotless {
java {
target project.fileTree(project.rootDir) {
include '**/*.java'
exclude 'build/generated/**/*.*', 'build/generated-examples/**/*.*'
include 'src/**/*.java'
}
Comment on lines 15 to 17

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📝 Info: Spotless no longer formats sources outside src/

Narrowing the target from **/*.java (minus build/generated) to src/**/*.java fixes the Gradle 8 implicit-dependency failure, but it also silently stops checking any Java outside src/ (e.g. buildSrc or future module directories). Given the repo currently only has src/, this is fine today; if modules are added later the formatting gate will quietly not cover them.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines 15 to 17

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📝 Info: Spotless no longer excludes generated sources but now scans only src

Narrowing the target to src/**/*.java drops the explicit build/generated* excludes, which is fine today because DGS codegen writes into build/generated. If codegen output is ever configured under src/ (a common generateJava customization), spotless would start formatting/failing on generated files; keeping an explicit exclude alongside the narrowed include would be more robust.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Codegen writes to build/generated (the plugin default, unchanged here), so src/**/*.java can't pick it up today; re-adding a build/generated* exclude alongside the narrowed include would be dead config unless someone relocates codegen output under src/.

googleJavaFormat()
}
Expand All @@ -35,25 +34,25 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-hateoas'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2'
implementation 'com.netflix.graphql.dgs:graphql-dgs-spring-boot-starter:4.9.21'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.3'
implementation 'com.netflix.graphql.dgs:graphql-dgs-spring-boot-starter:8.5.3'
implementation 'org.flywaydb:flyway-core'
implementation 'io.jsonwebtoken:jjwt-api:0.11.2'
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.2',
'io.jsonwebtoken:jjwt-jackson:0.11.2'
implementation 'joda-time:joda-time:2.10.13'
implementation 'org.xerial:sqlite-jdbc:3.36.0.3'
implementation 'io.jsonwebtoken:jjwt-api:0.12.5'
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.12.5',
'io.jsonwebtoken:jjwt-jackson:0.12.5'
implementation 'joda-time:joda-time:2.12.7'
implementation 'org.xerial:sqlite-jdbc:3.45.3.0'

compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'

testImplementation 'io.rest-assured:rest-assured:4.5.1'
testImplementation 'io.rest-assured:json-path:4.5.1'
testImplementation 'io.rest-assured:xml-path:4.5.1'
testImplementation 'io.rest-assured:spring-mock-mvc:4.5.1'
testImplementation 'io.rest-assured:rest-assured:5.4.0'
testImplementation 'io.rest-assured:json-path:5.4.0'
testImplementation 'io.rest-assured:xml-path:5.4.0'
testImplementation 'io.rest-assured:spring-mock-mvc:5.4.0'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter-test:2.2.2'
testImplementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter-test:3.0.3'
}

tasks.named('test') {
Expand All @@ -69,4 +68,5 @@ tasks.named('clean') {
tasks.named('generateJava') {
schemaPaths = ["${projectDir}/src/main/resources/schema"] // List of directories containing schema files
packageName = 'io.spring.graphql' // The package name to use to generate sources
typeMapping = ["PageInfo": "graphql.relay.PageInfo"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📝 Info: Codegen typeMapping to graphql.relay.PageInfo relies on schema compatibility

Mapping the schema's PageInfo to graphql.relay.PageInfo (build.gradle:71) avoids touching the data fetchers, but it hard-couples generated *Connection builders to graphql-java's relay class. If the GraphQL schema's PageInfo ever grows fields beyond hasNextPage/hasPreviousPage/startCursor/endCursor, codegen will silently produce a type that cannot express them. Worth a comment in build.gradle so a future schema change doesn't produce a confusing failure.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📝 Info: PageInfo type mapping keeps the relay type but couples codegen to graphql-java internals

typeMapping = ["PageInfo": "graphql.relay.PageInfo"] prevents DGS codegen 6 from generating its own types.PageInfo, which keeps ArticleDatafetcher/CommentDatafetcher (which construct graphql.relay.DefaultPageInfo, see src/main/java/io/spring/graphql/ArticleDatafetcher.java:359-361) compiling unchanged. The trade-off is that the generated *Connection builders now depend on a graphql-java relay class whose shape (e.g. cursor accessors) is outside the schema's control; a future graphql-java bump could break codegen again. Migrating the data fetchers to the generated type would be the more durable fix.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Agreed that migrating the data fetchers to the generated types.PageInfo is the more durable fix; keeping it out of this PR to hold the migration to minimal behavioral change, since the fetchers build graphql.relay.DefaultPageInfo from cursor pagers in several places.

}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading