From 86a20752349e3d76d5937b680fe7bea985a78ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Po=CC=88yho=CC=88nen?= Date: Fri, 14 Mar 2025 10:00:39 +0200 Subject: [PATCH 1/3] Update readme to describe the fork and add gradle task for Nosto internal publishing --- README.md | 14 ++++++++++++++ build.gradle | 23 +++++++++++++++++++++++ gradle.properties | 2 +- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3d1463dc..c2a01f55 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,17 @@ +# Nosto Fork of GraphQL-Java Annotations adds support for partial updates and publishToNostoRepo gradle task for internal use + +Adds support for binding to `java.util.Optional` parameters. Binding to Optional parameters allows implementing partial updates. With a partial update the mutate call can update only some of the Optional fields without needing to repeat all the existing values of an object. + +The mapping from an optional field in GraphQL schema that binds to `java.util.Optional` is the following: +1. value given to the field in GraphQL call is mapped into `java.util.Optional` of the underlying type +2. null given to the field in GraphQL call is mapped into `Optional.empty` to signal the removal of a possibly existing value of the field +3. field not included in the GraphQL call is mapped into null to signal `undefined` so any possibly existing value(s) should not be modified + +## Internal publishing to Nosto repository + +Update the version in the `gradle.properties` file and run `./gradlew publishToNostoRepo` to publish the library to the Nosto repository. + + ![logo](graphql-annotations.png?raw=true) # GraphQL-Java Annotations ![build](https://github.com/Enigmatis/graphql-java-annotations/actions/workflows/build.yml/badge.svg) diff --git a/build.gradle b/build.gradle index cc8d0e72..74069ec7 100644 --- a/build.gradle +++ b/build.gradle @@ -24,6 +24,14 @@ apply plugin: 'biz.aQute.bnd.builder' apply plugin: 'maven-publish' + +compileJava { + options.release = 11 +} +compileTestJava { + options.release = 11 +} + // custom tasks for creating source/javadoc jars tasks.register('sourcesJar', Jar) { dependsOn classes @@ -143,6 +151,20 @@ publishing { } } } + + repositories { + maven { + url 'https://repo.nos.to/content/repositories/NostoDependencies/' + credentials { + username = "$mavenUser" + password = "$mavenPassword" + } + } + } +} + +tasks.register('publishToNostoRepo') { + dependsOn 'publishMavenPublicationToMavenRepository' } afterReleaseBuild.dependsOn nexusPublishing @@ -158,6 +180,7 @@ nexusPublishing { // to publish to local maven repo skip signing: ./gradlew publishToMavenLocal -x signGraphqlJavaPublication signing { + required = { !version.endsWith("nosto") } def signingKey = System.getenv("MAVEN_CENTRAL_PGP_KEY") useInMemoryPgpKeys(signingKey, "") sign publishing.publications diff --git a/gradle.properties b/gradle.properties index 1648a9b2..f4dab5f2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,4 +5,4 @@ org.gradle.daemon=true org.gradle.parallel=true org.gradle.jvmargs=-Dfile.encoding=UTF-8 -version = 21.5 \ No newline at end of file +version = 21.5-nosto \ No newline at end of file From 69b3040582f08becdb749947a4f8a410392a877e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Po=CC=88yho=CC=88nen?= Date: Fri, 14 Mar 2025 10:20:13 +0200 Subject: [PATCH 2/3] Improved build file to require mavenUser mavenPassword only when publishing to Nosto repository --- build.gradle | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 74069ec7..e80fbf75 100644 --- a/build.gradle +++ b/build.gradle @@ -156,8 +156,8 @@ publishing { maven { url 'https://repo.nos.to/content/repositories/NostoDependencies/' credentials { - username = "$mavenUser" - password = "$mavenPassword" + username = project.hasProperty('mavenUser') ? project.mavenUser : "" + password = project.hasProperty('mavenPassword') ? project.mavenPassword : "" } } } @@ -166,6 +166,14 @@ publishing { tasks.register('publishToNostoRepo') { dependsOn 'publishMavenPublicationToMavenRepository' } +gradle.taskGraph.whenReady { taskGraph -> + if (taskGraph.hasTask(':publishToNostoRepo')) { + if (!project.hasProperty('mavenUser') || !project.hasProperty('mavenPassword')) { + throw new GradleException("mavenUser and mavenPassword must be defined for publishToNostoRepo task") + } + } +} + afterReleaseBuild.dependsOn nexusPublishing From 28cfb860caa276c581a0264d2d45f28e0d07cb57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20Po=CC=88yho=CC=88nen?= Date: Fri, 14 Mar 2025 10:33:18 +0200 Subject: [PATCH 3/3] added comment on why java11 compiler options are included --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e80fbf75..71936787 100644 --- a/build.gradle +++ b/build.gradle @@ -24,7 +24,7 @@ apply plugin: 'biz.aQute.bnd.builder' apply plugin: 'maven-publish' - +// The upstream project build releases seem to be compiled with Java 11 so keeping compatibility so that our changes can be applied to the upstream project compileJava { options.release = 11 }