diff --git a/bee.fetched.test/build.gradle.kts b/bee.fetched.test/build.gradle.kts index b035832..29d5936 100644 --- a/bee.fetched.test/build.gradle.kts +++ b/bee.fetched.test/build.gradle.kts @@ -1,10 +1,5 @@ import com.netflix.graphql.dgs.codegen.gradle.GenerateJavaTask -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) @@ -12,14 +7,15 @@ plugins { alias(libs.plugins.spring.boot) alias(libs.plugins.spring.dependencymanagement) alias(libs.plugins.kotlin.jpa) + // ksp plugin must be placed before kapt + // https://github.com/google/ksp/issues/1445#issuecomment-1763422067 + alias(libs.plugins.ksp) alias(libs.plugins.kotlin.kapt) alias(libs.plugins.dgs.codegen) alias(libs.plugins.kotlin.allopen) alias(libs.plugins.kotlin.noarg) java - alias(libs.plugins.ksp) id("bee.generative") - } allprojects { @@ -156,4 +152,4 @@ tasks.getByName("jar") { tasks.bootRun { jvmArgs = listOf("-Dspring.output.ansi.enabled=ALWAYS") -} +} \ No newline at end of file diff --git a/bee.fetched.test/gradle/wrapper/gradle-wrapper.jar b/bee.fetched.test/gradle/wrapper/gradle-wrapper.jar index 249e583..943f0cb 100644 Binary files a/bee.fetched.test/gradle/wrapper/gradle-wrapper.jar and b/bee.fetched.test/gradle/wrapper/gradle-wrapper.jar differ diff --git a/bee.fetched.test/gradle/wrapper/gradle-wrapper.properties b/bee.fetched.test/gradle/wrapper/gradle-wrapper.properties index 070cb70..744c64d 100644 --- a/bee.fetched.test/gradle/wrapper/gradle-wrapper.properties +++ b/bee.fetched.test/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/bee.fetched.test/gradlew b/bee.fetched.test/gradlew index c53aefa..65dcd68 100644 --- a/bee.fetched.test/gradlew +++ b/bee.fetched.test/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,10 +32,10 @@ # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: # * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». # # Important for patching: # @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -205,6 +209,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/bee.fetched.test/gradlew.bat b/bee.fetched.test/gradlew.bat index 107acd3..93e3f59 100644 --- a/bee.fetched.test/gradlew.bat +++ b/bee.fetched.test/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/bee.fetched.test/src/main/kotlin/com/beeproduced/bee/fetched/application/configuration/SecurityConfig.kt b/bee.fetched.test/src/main/kotlin/com/beeproduced/bee/fetched/application/configuration/SecurityConfig.kt index 63a9ff3..4b12da8 100644 --- a/bee.fetched.test/src/main/kotlin/com/beeproduced/bee/fetched/application/configuration/SecurityConfig.kt +++ b/bee.fetched.test/src/main/kotlin/com/beeproduced/bee/fetched/application/configuration/SecurityConfig.kt @@ -7,6 +7,8 @@ import org.springframework.core.env.Environment import org.springframework.security.config.annotation.web.builders.HttpSecurity import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity import org.springframework.security.web.SecurityFilterChain +import org.springframework.security.web.servlet.util.matcher.MvcRequestMatcher +import org.springframework.web.servlet.handler.HandlerMappingIntrospector /** * @@ -23,7 +25,8 @@ class SecurityConfig( @Throws(Exception::class) @Bean - fun filterChain(http: HttpSecurity): SecurityFilterChain { + fun filterChain(http: HttpSecurity, introspector: HandlerMappingIntrospector): SecurityFilterChain { + val mvcMatcherBuilder = MvcRequestMatcher.Builder(introspector) // Disable csrf // See: https://github.com/graphql-java-kickstart/graphql-spring-boot/issues/184 http @@ -34,13 +37,13 @@ class SecurityConfig( .authorizeHttpRequests { authorize -> var auth = authorize .requestMatchers( - "/graphql", - "/graphiql", - "/schema.json", - "/subscriptions", - "/actuator/**", - "/graphiql/**", - "/h2-console" + mvcMatcherBuilder.pattern("/graphql"), + mvcMatcherBuilder.pattern("/graphiql"), + mvcMatcherBuilder.pattern("/schema.json"), + mvcMatcherBuilder.pattern("/subscriptions"), + mvcMatcherBuilder.pattern("/actuator/**"), + mvcMatcherBuilder.pattern("/graphiql/**"), + mvcMatcherBuilder.pattern("/h2-console") ) .permitAll() if (env.activeProfiles.contains("dev")) { diff --git a/bee.fetched.test/src/test/kotlin/com/beeproduced/bee/fetched/test/BeeFetchedTest.kt b/bee.fetched.test/src/test/kotlin/com/beeproduced/bee/fetched/test/BeeFetchedTest.kt index a933b37..735ba6b 100644 --- a/bee.fetched.test/src/test/kotlin/com/beeproduced/bee/fetched/test/BeeFetchedTest.kt +++ b/bee.fetched.test/src/test/kotlin/com/beeproduced/bee/fetched/test/BeeFetchedTest.kt @@ -34,7 +34,7 @@ class BeeFetchedTest { fun `query singular id dataloader (foo)`() { val query = GraphQLQueryRequest( FooGraphQLQuery(), - FooProjectionRoot() + projection(::FooProjectionRoot) .waldoId() .waldo().select { waldo() @@ -55,7 +55,7 @@ class BeeFetchedTest { fun `query plural ids dataloader (bar)`() { val query = GraphQLQueryRequest( BarGraphQLQuery(), - BarProjectionRoot() + projection(::BarProjectionRoot) .waldoIds() .waldos().select { waldo() @@ -76,7 +76,7 @@ class BeeFetchedTest { fun `query singular nullable id dataloader (qux)`() { val query = GraphQLQueryRequest( QuxGraphQLQuery(), - QuxProjectionRoot() + projection(::QuxProjectionRoot) .waldoId() .waldo().select { waldo() @@ -97,7 +97,7 @@ class BeeFetchedTest { fun `query plural nullable ids dataloader (quux)`() { val query = GraphQLQueryRequest( QuuxGraphQLQuery(), - QuuxProjectionRoot() + projection(::QuuxProjectionRoot) .waldoIds() .waldos().select { waldo() @@ -118,7 +118,7 @@ class BeeFetchedTest { fun `query singular unrelated id dataloader (corge)`() { val query = GraphQLQueryRequest( CorgeGraphQLQuery(), - CorgeProjectionRoot() + projection(::CorgeProjectionRoot) .corgeToWaldoId() .waldo().select { waldo() @@ -139,7 +139,7 @@ class BeeFetchedTest { fun `query singular id internal type dataloader (grault)`() { val query = GraphQLQueryRequest( GraultGraphQLQuery(), - GraultProjectionRoot() + projection(::GraultProjectionRoot) .waldo().select { waldo() } @@ -159,7 +159,7 @@ class BeeFetchedTest { fun `query singular nullable id internal type dataloader (fred)`() { val query = GraphQLQueryRequest( FredGraphQLQuery(), - FredProjectionRoot() + projection(::FredProjectionRoot) .waldo().select { waldo() } @@ -179,7 +179,7 @@ class BeeFetchedTest { fun `query plural nullable ids internal type dataloader (xyzzy)`() { val query = GraphQLQueryRequest( XyzzyGraphQLQuery(), - XyzzyProjectionRoot() + projection(::XyzzyProjectionRoot) .waldos().select { waldo() } @@ -199,7 +199,7 @@ class BeeFetchedTest { fun `query plural ids internal type dataloader (plugh)`() { val query = GraphQLQueryRequest( PlughGraphQLQuery(), - PlughProjectionRoot() + projection(::PlughProjectionRoot) .waldos().select { waldo() } @@ -219,7 +219,7 @@ class BeeFetchedTest { fun `query not generated dataloader (garply)`() { val query = GraphQLQueryRequest( GarplyGraphQLQuery(), - GarplyProjectionRoot() + projection(::GarplyProjectionRoot) .waldo().select { waldo() } @@ -241,7 +241,7 @@ class BeeFetchedTest { fun `query unsafe singular id dataloader (alpha)`() { val query = GraphQLQueryRequest( AlphaGraphQLQuery(), - AlphaProjectionRoot() + projection(::AlphaProjectionRoot) .zuluId() .zulu().select { zulu() @@ -262,7 +262,7 @@ class BeeFetchedTest { fun `query unsafe plural ids dataloader (bravo)`() { val query = GraphQLQueryRequest( BravoGraphQLQuery(), - BravoProjectionRoot() + projection(::BravoProjectionRoot) .zuluIds() .zulus().select { zulu() @@ -283,7 +283,7 @@ class BeeFetchedTest { fun `query unsafe singular nullable id dataloader (charlie)`() { val query = GraphQLQueryRequest( CharlieGraphQLQuery(), - CharlieProjectionRoot() + projection(::CharlieProjectionRoot) .zuluId() .zulu().select { zulu() @@ -304,7 +304,7 @@ class BeeFetchedTest { fun `query unsafe plural nullable ids dataloader (delta)`() { val query = GraphQLQueryRequest( DeltaGraphQLQuery(), - DeltaProjectionRoot() + projection(::DeltaProjectionRoot) .zuluIds() .zulus().select { zulu() @@ -325,7 +325,7 @@ class BeeFetchedTest { fun `query unsafe singular unrelated id dataloader (echo)`() { val query = GraphQLQueryRequest( EchoGraphQLQuery(), - EchoProjectionRoot() + projection(::EchoProjectionRoot) .echoToZuluId() .zulu().select { zulu() @@ -346,7 +346,7 @@ class BeeFetchedTest { fun `query unsafe singular id internal type dataloader (foxtrot)`() { val query = GraphQLQueryRequest( FoxtrotGraphQLQuery(), - FoxtrotProjectionRoot() + projection(::FoxtrotProjectionRoot) .zulu().select { zulu() } @@ -366,7 +366,7 @@ class BeeFetchedTest { fun `query unsafe singular nullable id internal type dataloader (golf)`() { val query = GraphQLQueryRequest( GolfGraphQLQuery(), - GolfProjectionRoot() + projection(::GolfProjectionRoot) .zulu().select { zulu() } @@ -386,7 +386,7 @@ class BeeFetchedTest { fun `query unsafe plural ids internal type dataloader (hotel)`() { val query = GraphQLQueryRequest( HotelGraphQLQuery(), - HotelProjectionRoot() + projection(::HotelProjectionRoot) .zulus().select { zulu() } @@ -406,7 +406,7 @@ class BeeFetchedTest { fun `query unsafe plural nullable ids internal type dataloader (india)`() { val query = GraphQLQueryRequest( IndiaGraphQLQuery(), - IndiaProjectionRoot() + projection(::IndiaProjectionRoot) .zulus().select { zulu() } @@ -426,7 +426,7 @@ class BeeFetchedTest { fun `query unsafe not generated dataloader (juliet)`() { val query = GraphQLQueryRequest( JulietGraphQLQuery(), - JulietProjectionRoot() + projection(::JulietProjectionRoot) .zulu().select { zulu() } @@ -443,6 +443,12 @@ class BeeFetchedTest { } inline fun > N.select(selection: N.() -> Unit): P { - selection() + this.selection() return this.parent() +} + +// Workaround as Kotlin does not support Java diamond operator +// https://netflix.github.io/dgs/generating-code-from-schema/#client-api-v2 +inline fun > projection(constructor: ()->R): R { + return constructor() } \ No newline at end of file diff --git a/bee.fetched/build.gradle.kts b/bee.fetched/build.gradle.kts index a15637e..f02e33c 100644 --- a/bee.fetched/build.gradle.kts +++ b/bee.fetched/build.gradle.kts @@ -1,10 +1,5 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") plugins { alias(libs.plugins.kotlin.jvm) java diff --git a/bee.fetched/gradle/wrapper/gradle-wrapper.properties b/bee.fetched/gradle/wrapper/gradle-wrapper.properties index 62f495d..3fa8f86 100644 --- a/bee.fetched/gradle/wrapper/gradle-wrapper.properties +++ b/bee.fetched/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/bee.generative/build.gradle.kts b/bee.generative/build.gradle.kts index ff4db50..541db8b 100644 --- a/bee.generative/build.gradle.kts +++ b/bee.generative/build.gradle.kts @@ -1,18 +1,10 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") plugins { alias(libs.plugins.kotlin.jvm) java `java-gradle-plugin` `kotlin-dsl` - // TODO: Fix versioning? - // https://youtrack.jetbrains.com/issue/KT-54238 - id("org.jetbrains.kotlin.plugin.sam.with.receiver") version("1.8.0") } group = "com.beeproduced" diff --git a/bee.generative/src/main/kotlin/com/beeproduced/bee/generative/BeeGenerativePlugin.kt b/bee.generative/src/main/kotlin/com/beeproduced/bee/generative/BeeGenerativePlugin.kt index ecc4a00..70fa6f8 100644 --- a/bee.generative/src/main/kotlin/com/beeproduced/bee/generative/BeeGenerativePlugin.kt +++ b/bee.generative/src/main/kotlin/com/beeproduced/bee/generative/BeeGenerativePlugin.kt @@ -27,7 +27,7 @@ open class BeeGenerativePluginExtension { } open class BeeDependencies(private val dependencies: DependencyHandler) { - operator fun invoke(dependencyNotation: String): Pair { + operator fun invoke(dependencyNotation: String): Pair { val main = dependencies.add("implementation", dependencyNotation) val processor = dependencies.add("ksp", dependencyNotation, closureOf { val capabilityNotation = if (version != null) { diff --git a/example/application/build.gradle.kts b/example/application/build.gradle.kts index fbc362d..67004cb 100644 --- a/example/application/build.gradle.kts +++ b/example/application/build.gradle.kts @@ -1,10 +1,5 @@ import com.netflix.graphql.dgs.codegen.gradle.GenerateJavaTask -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) @@ -12,12 +7,14 @@ plugins { alias(libs.plugins.spring.boot) alias(libs.plugins.spring.dependencymanagement) alias(libs.plugins.kotlin.jpa) + // ksp plugin must be placed before kapt + // https://github.com/google/ksp/issues/1445#issuecomment-1763422067 + alias(libs.plugins.ksp) alias(libs.plugins.kotlin.kapt) alias(libs.plugins.dgs.codegen) alias(libs.plugins.kotlin.allopen) alias(libs.plugins.kotlin.noarg) java - alias(libs.plugins.ksp) id("bee.generative") } diff --git a/example/application/gradle/wrapper/gradle-wrapper.jar b/example/application/gradle/wrapper/gradle-wrapper.jar index 249e583..943f0cb 100644 Binary files a/example/application/gradle/wrapper/gradle-wrapper.jar and b/example/application/gradle/wrapper/gradle-wrapper.jar differ diff --git a/example/application/gradle/wrapper/gradle-wrapper.properties b/example/application/gradle/wrapper/gradle-wrapper.properties index 070cb70..744c64d 100644 --- a/example/application/gradle/wrapper/gradle-wrapper.properties +++ b/example/application/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/example/application/gradlew b/example/application/gradlew index c53aefa..65dcd68 100644 --- a/example/application/gradlew +++ b/example/application/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,10 +32,10 @@ # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: # * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». # # Important for patching: # @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -205,6 +209,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/example/application/gradlew.bat b/example/application/gradlew.bat index 107acd3..93e3f59 100644 --- a/example/application/gradlew.bat +++ b/example/application/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/example/application/src/main/kotlin/com/beeproduced/example/application/configuration/SecurityConfig.kt b/example/application/src/main/kotlin/com/beeproduced/example/application/configuration/SecurityConfig.kt index 63a9ff3..b087dbb 100644 --- a/example/application/src/main/kotlin/com/beeproduced/example/application/configuration/SecurityConfig.kt +++ b/example/application/src/main/kotlin/com/beeproduced/example/application/configuration/SecurityConfig.kt @@ -7,6 +7,8 @@ import org.springframework.core.env.Environment import org.springframework.security.config.annotation.web.builders.HttpSecurity import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity import org.springframework.security.web.SecurityFilterChain +import org.springframework.security.web.servlet.util.matcher.MvcRequestMatcher +import org.springframework.web.servlet.handler.HandlerMappingIntrospector /** * @@ -18,12 +20,13 @@ import org.springframework.security.web.SecurityFilterChain @Configuration @EnableWebSecurity class SecurityConfig( - private val env: Environment + private val env: Environment, ) { @Throws(Exception::class) @Bean - fun filterChain(http: HttpSecurity): SecurityFilterChain { + fun filterChain(http: HttpSecurity, introspector: HandlerMappingIntrospector): SecurityFilterChain { + val mvcMatcherBuilder = MvcRequestMatcher.Builder(introspector) // Disable csrf // See: https://github.com/graphql-java-kickstart/graphql-spring-boot/issues/184 http @@ -34,13 +37,13 @@ class SecurityConfig( .authorizeHttpRequests { authorize -> var auth = authorize .requestMatchers( - "/graphql", - "/graphiql", - "/schema.json", - "/subscriptions", - "/actuator/**", - "/graphiql/**", - "/h2-console" + mvcMatcherBuilder.pattern("/graphql"), + mvcMatcherBuilder.pattern("/graphiql"), + mvcMatcherBuilder.pattern("/schema.json"), + mvcMatcherBuilder.pattern("/subscriptions"), + mvcMatcherBuilder.pattern("/actuator/**"), + mvcMatcherBuilder.pattern("/graphiql/**"), + mvcMatcherBuilder.pattern("/h2-console") ) .permitAll() if (env.activeProfiles.contains("dev")) { diff --git a/example/service.media/build.gradle.kts b/example/service.media/build.gradle.kts index d26a5a8..b4d1732 100644 --- a/example/service.media/build.gradle.kts +++ b/example/service.media/build.gradle.kts @@ -1,8 +1,4 @@ -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") + plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) diff --git a/example/service.media/entities/build.gradle.kts b/example/service.media/entities/build.gradle.kts index 186b14b..35e7c1c 100644 --- a/example/service.media/entities/build.gradle.kts +++ b/example/service.media/entities/build.gradle.kts @@ -1,8 +1,4 @@ -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") + plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.jpa) diff --git a/example/service.media/events/build.gradle.kts b/example/service.media/events/build.gradle.kts index 231ee73..b5c3437 100644 --- a/example/service.media/events/build.gradle.kts +++ b/example/service.media/events/build.gradle.kts @@ -1,8 +1,4 @@ -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") + plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.serialization) diff --git a/example/service.organisation/build.gradle.kts b/example/service.organisation/build.gradle.kts index 6751395..e2ad50c 100644 --- a/example/service.organisation/build.gradle.kts +++ b/example/service.organisation/build.gradle.kts @@ -1,8 +1,4 @@ -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") + plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) diff --git a/example/service.organisation/entities/build.gradle.kts b/example/service.organisation/entities/build.gradle.kts index d63feef..4f9459c 100644 --- a/example/service.organisation/entities/build.gradle.kts +++ b/example/service.organisation/entities/build.gradle.kts @@ -1,8 +1,4 @@ -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") + plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.jpa) diff --git a/example/service.organisation/events/build.gradle.kts b/example/service.organisation/events/build.gradle.kts index 6708ab6..9ad8bf7 100644 --- a/example/service.organisation/events/build.gradle.kts +++ b/example/service.organisation/events/build.gradle.kts @@ -1,8 +1,4 @@ -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") + plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.serialization) diff --git a/example/utils/build.gradle.kts b/example/utils/build.gradle.kts index 278fbfc..b0b750a 100644 --- a/example/utils/build.gradle.kts +++ b/example/utils/build.gradle.kts @@ -1,8 +1,4 @@ -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") + plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.spring) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 07e69d6..87f59c9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,29 +1,29 @@ [versions] bee-built = "0.2.0-SNAPSHOT" -springboot-base = "3.0.2" -springboot-dependencymanagement = "1.1.0" -kotlin-base = "1.8.0" -kotlin-jvm = "1.8.0" -dgs = "6.0.1" -spring-security = "6.0.2" +springboot-base = "3.1.4" +springboot-dependencymanagement = "1.1.3" +kotlin-base = "1.9.10" +kotlin-jvm = "1.9.10" +dgs = "7.6.0" +spring-security = "6.1.4" mapstruct = "1.5.3.Final" junit = "5.8.1" kotlinter = "3.13.0" -dgs-codegen = "5.6.9" +dgs-codegen = "6.0.2" jackson-module-kotlin = "2.13.4" h2 = "2.1.214" konform = "0.4.0" -michael-result = "1.1.16" +michael-result = "1.1.18" jdsl = "2.2.0.RELEASE" aspectjrt = "1.9.19" jakarta-persistence-api = "3.1.0" -hibernate-core = "6.1.6.Final" +hibernate-core = "6.2.9.Final" caffeine = "3.1.2" springmockk = "4.0.2" datafaker = "1.14.0" jakarta-mail-api = "2.0.1" jakarta-mail = "2.0.1" -ksp-base = "1.8.0-1.0.9" +ksp-base = "1.9.10-1.0.13" [libraries] spring-boot-starter-test = { group = "org.springframework.boot", name = "spring-boot-starter-test", version.ref = "springboot-base" } @@ -84,5 +84,5 @@ kotlin-jpa = { id = "org.jetbrains.kotlin.plugin.jpa", version.ref = "kotlin-bas spring-boot = { id = "org.springframework.boot", version.ref = "springboot-base" } spring-dependencymanagement = { id = "io.spring.dependency-management", version.ref = "springboot-dependencymanagement" } kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin-base" } -dgs-codegen = { id = "com.netflix.dgs.codegen", version = "5.6.9" } +dgs-codegen = { id = "com.netflix.dgs.codegen", version.ref = "dgs-codegen" } ksp = { id = "com.google.devtools.ksp", version.ref = "ksp-base"} \ No newline at end of file diff --git a/lib.data/build.gradle.kts b/lib.data/build.gradle.kts index 642a1c3..326347d 100644 --- a/lib.data/build.gradle.kts +++ b/lib.data/build.gradle.kts @@ -1,10 +1,5 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.jpa) diff --git a/lib.data/gradle/wrapper/gradle-wrapper.jar b/lib.data/gradle/wrapper/gradle-wrapper.jar index 249e583..943f0cb 100644 Binary files a/lib.data/gradle/wrapper/gradle-wrapper.jar and b/lib.data/gradle/wrapper/gradle-wrapper.jar differ diff --git a/lib.data/gradle/wrapper/gradle-wrapper.properties b/lib.data/gradle/wrapper/gradle-wrapper.properties index 070cb70..744c64d 100644 --- a/lib.data/gradle/wrapper/gradle-wrapper.properties +++ b/lib.data/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/lib.data/gradlew b/lib.data/gradlew index a69d9cb..65dcd68 100644 --- a/lib.data/gradlew +++ b/lib.data/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac diff --git a/lib.data/gradlew.bat b/lib.data/gradlew.bat index f127cfd..93e3f59 100644 --- a/lib.data/gradlew.bat +++ b/lib.data/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/lib.events/build.gradle.kts b/lib.events/build.gradle.kts index 69267b4..b7936c8 100644 --- a/lib.events/build.gradle.kts +++ b/lib.events/build.gradle.kts @@ -1,8 +1,4 @@ -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") + plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.spring.boot).apply(false) diff --git a/lib.events/gradle/wrapper/gradle-wrapper.properties b/lib.events/gradle/wrapper/gradle-wrapper.properties index 62f495d..3fa8f86 100644 --- a/lib.events/gradle/wrapper/gradle-wrapper.properties +++ b/lib.events/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/lib.result/build.gradle.kts b/lib.result/build.gradle.kts index 825b573..fe0b021 100644 --- a/lib.result/build.gradle.kts +++ b/lib.result/build.gradle.kts @@ -1,8 +1,4 @@ -/* -The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable. -Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required. - */ -@Suppress("DSL_SCOPE_VIOLATION") + plugins { alias(libs.plugins.kotlin.jvm) java diff --git a/lib.result/gradle/wrapper/gradle-wrapper.properties b/lib.result/gradle/wrapper/gradle-wrapper.properties index 62f495d..3fa8f86 100644 --- a/lib.result/gradle/wrapper/gradle-wrapper.properties +++ b/lib.result/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME