Skip to content
Merged
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
5 changes: 1 addition & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

/*
*
* Copyright 2020 Netflix, Inc.
Expand All @@ -21,7 +18,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
id 'org.jetbrains.kotlin.jvm' version "2.0.21" apply false
id 'com.netflix.nebula.netflixoss' version '11.6.0'
id 'com.netflix.nebula.netflixoss' version '12.0.0'
id "org.jmailen.kotlinter" version "5.0.1"
}

Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# The Kotlin Multiplatform POM rewriter in Kotlin 2.0.21 uses a Gradle API removed in Gradle 9; this JVM-only build does not need that rewrite.
kotlin.mpp.keepMppDependenciesIntactInPoms=true
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=bd71102213493060956ec229d946beee57158dbd89d0e62b91bca0fa2c5f3531
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionSha256Sum=2ab2958f2a1e51120c326cad6f385153bb11ee93b3c216c5fccebfdfbb7ec6cb
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 2 additions & 5 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions graphql-dgs-codegen-gradle/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

/*
*
* Copyright 2020 Netflix, Inc.
Expand All @@ -22,6 +24,13 @@ plugins {

apply plugin: 'java-gradle-plugin'

// Gradle 9.4.1 exposes newer Kotlin metadata; tolerate it here to keep consumers on Kotlin 2.0.21 and detangle from the Kotlin upgrade.
tasks.withType(KotlinCompilationTask).configureEach {
compilerOptions {
freeCompilerArgs.add('-Xskip-metadata-version-check')
}
}

dependencies {
api project(':graphql-dgs-codegen-core')
compileOnly 'com.netflix.nebula:gradle-dependency-lock-plugin:15.2.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Provider
import org.gradle.api.provider.ProviderFactory
import org.gradle.api.tasks.*
import org.gradle.work.DisableCachingByDefault
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper
import java.io.File
import java.nio.file.Paths
import java.util.*
import javax.inject.Inject

@DisableCachingByDefault(because = "Generated sources may contain timestamps and are not always reproducible")
open class GenerateJavaTask
@Inject
constructor(
Expand All @@ -50,6 +52,7 @@ open class GenerateJavaTask
.asFile.absolutePath

@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE)
var schemaPaths: MutableList<Any> = mutableListOf("${project.projectDir}/src/main/resources/schema")

fun setSchemaPaths(paths: FileCollection) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class CodegenGradlePluginTest {
.withProjectDir(File("src/test/resources/test-project/"))
.withPluginClasspath()
.withArguments(
"-c",
"smoke_test_settings.gradle",
"tasks",
"--all",
).forwardOutput()
Expand All @@ -56,8 +54,6 @@ class CodegenGradlePluginTest {
.withProjectDir(File("src/test/resources/test-project/"))
.withPluginClasspath()
.withArguments(
"-c",
"smoke_test_settings.gradle",
"clean",
"copyMainSources",
).forwardOutput()
Expand All @@ -78,8 +74,6 @@ class CodegenGradlePluginTest {
.withPluginClasspath()
.withArguments(
"--stacktrace",
"-c",
"smoke_test_settings.gradle",
"clean",
"build",
).forwardOutput()
Expand All @@ -102,10 +96,7 @@ class CodegenGradlePluginTest {
.withPluginClasspath()
.withArguments(
"--stacktrace",
"-c",
"smoke_test_settings_with_default_dir.gradle",
"-b",
"build_with_default_dir.gradle",
"-PtestBuildFile=build_with_default_dir.gradle",
"clean",
"build",
).forwardOutput()
Expand All @@ -128,10 +119,7 @@ class CodegenGradlePluginTest {
.withPluginClasspath()
.withArguments(
"--stacktrace",
"-c",
"smoke_test_settings_with_default_dir.gradle",
"-b",
"build_with_default_dir.gradle",
"-PtestBuildFile=build_with_default_dir.gradle",
"clean",
"build",
).forwardOutput()
Expand All @@ -155,10 +143,7 @@ class CodegenGradlePluginTest {
.withPluginClasspath()
.withArguments(
"--stacktrace",
"-c",
"smoke_test_settings_with_default_dir.gradle",
"-b",
"build_with_default_dir.gradle",
"-PtestBuildFile=build_with_default_dir.gradle",
"clean",
"build",
).forwardOutput()
Expand All @@ -184,10 +169,7 @@ class CodegenGradlePluginTest {
.withPluginClasspath()
.withArguments(
"--stacktrace",
"-c",
"smoke_test_settings_jackson_override.gradle",
"-b",
"build_with_jackson_override.gradle",
"-PtestBuildFile=build_with_jackson_override.gradle",
"clean",
"generateJava",
).forwardOutput()
Expand All @@ -206,10 +188,7 @@ class CodegenGradlePluginTest {
.withPluginClasspath()
.withArguments(
"--stacktrace",
"-c",
"smoke_test_settings_invalid_jackson.gradle",
"-b",
"build_with_invalid_jackson_version.gradle",
"-PtestBuildFile=build_with_invalid_jackson_version.gradle",
"clean",
"generateJava",
).forwardOutput()
Expand All @@ -231,10 +210,7 @@ class CodegenGradlePluginTest {
.withPluginClasspath()
.withArguments(
"--stacktrace",
"-c",
"smoke_test_settings_jackson3.gradle",
"-b",
"build_with_jackson3.gradle",
"-PtestBuildFile=build_with_jackson3.gradle",
"clean",
"generateJava",
).forwardOutput()
Expand All @@ -257,7 +233,6 @@ class CodegenGradlePluginTest {
// generateKotlinNullableClasses is enabled so Jackson version detection (the lazy
// rootComponent classpath walk) actually runs under the configuration cache.
assertConfigurationCacheRoundTrip(
settingsFile = "smoke_test_settings_nullable.gradle",
buildFile = "build_with_nullable_classes.gradle",
)
}
Expand All @@ -272,8 +247,7 @@ class CodegenGradlePluginTest {
.withPluginClasspath()
.withArguments(
"--stacktrace",
"-c",
"smoke_test_settings_schema_paths_provider.gradle",
"-PtestBuildFile=build_with_schema_paths_provider.gradle",
"clean",
"generateJava",
).forwardOutput()
Expand All @@ -293,8 +267,7 @@ class CodegenGradlePluginTest {
.withPluginClasspath()
.withArguments(
"--stacktrace",
"-c",
"smoke_test_settings_schema_paths_filecollection.gradle",
"-PtestBuildFile=build_with_schema_paths_filecollection.gradle",
"clean",
"generateJava",
).forwardOutput()
Expand All @@ -311,7 +284,7 @@ class CodegenGradlePluginTest {
.create()
.withProjectDir(File("src/test/resources/test-project/"))
.withPluginClasspath()
.withArguments("-c", "smoke_test_settings_nested_schema_paths.gradle", "clean", "generateJava")
.withArguments("-PtestBuildFile=build_with_nested_schema_paths.gradle", "clean", "generateJava")
.build()

assertThat(result.task(":generateJava")?.outcome).isEqualTo(SUCCESS)
Expand All @@ -330,8 +303,7 @@ class CodegenGradlePluginTest {
.withPluginClasspath()
.withArguments(
"--stacktrace",
"-c",
"smoke_test_settings_schema_paths_addall.gradle",
"-PtestBuildFile=build_with_schema_paths_addall.gradle",
"clean",
"generateJava",
).forwardOutput()
Expand All @@ -344,18 +316,15 @@ class CodegenGradlePluginTest {

@Test
fun schemaPathsFileCollectionIsConfigurationCacheCompatible() {
assertConfigurationCacheRoundTrip("smoke_test_settings_schema_paths_filecollection.gradle")
assertConfigurationCacheRoundTrip("build_with_schema_paths_filecollection.gradle")
}

@Test
fun schemaPathsProviderIsConfigurationCacheCompatible() {
assertConfigurationCacheRoundTrip("smoke_test_settings_schema_paths_provider.gradle")
assertConfigurationCacheRoundTrip("build_with_schema_paths_provider.gradle")
}

private fun assertConfigurationCacheRoundTrip(
settingsFile: String,
buildFile: String? = null,
) {
private fun assertConfigurationCacheRoundTrip(buildFile: String) {
val projectDir = File("src/test/resources/test-project/")

fun run() =
Expand All @@ -364,19 +333,12 @@ class CodegenGradlePluginTest {
.withProjectDir(projectDir)
.withPluginClasspath()
.withArguments(
buildList {
add("--stacktrace")
add("--configuration-cache")
add("--configuration-cache-problems=fail")
add("-c")
add(settingsFile)
if (buildFile != null) {
add("-b")
add(buildFile)
}
add("clean")
add("generateJava")
},
"--stacktrace",
"--configuration-cache",
"--configuration-cache-problems=fail",
"-PtestBuildFile=$buildFile",
"clean",
"generateJava",
).forwardOutput()
.build()

Expand All @@ -401,15 +363,15 @@ class CodegenGradlePluginTest {
// @InputFiles after changing how schemaPaths accepts and resolves inputs.
val sourceDir = File("src/test/resources/test-project")
File(sourceDir, "build.gradle").copyTo(File(tempDir, "build.gradle"))
File(sourceDir, "smoke_test_settings.gradle").copyTo(File(tempDir, "smoke_test_settings.gradle"))
File(sourceDir, "settings.gradle").copyTo(File(tempDir, "settings.gradle"))
File(sourceDir, "src").copyRecursively(File(tempDir, "src"))

fun run(vararg tasks: String) =
GradleRunner
.create()
.withProjectDir(tempDir)
.withPluginClasspath()
.withArguments("--stacktrace", "-c", "smoke_test_settings.gradle", *tasks)
.withArguments("--stacktrace", *tasks)
.forwardOutput()
.build()

Expand Down Expand Up @@ -456,8 +418,7 @@ class CodegenGradlePluginTest {
.withPluginClasspath()
.withArguments(
"--stacktrace",
"-c",
"settings_relative_file.gradle",
"-PtestServerBuildFile=build_with_relative_file.gradle",
"clean",
":server:generateJava",
).forwardOutput()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@

rootProject.name = 'multimodule-root'
include 'server'

if (gradle.startParameter.projectProperties.containsKey('testServerBuildFile')) {
project(':server').buildFileName = gradle.startParameter.projectProperties['testServerBuildFile']
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@
*
*/

include 'smoke_test_settings.gradle'
rootProject.buildFileName = 'build_with_jackson_override.gradle'
rootProject.name = 'test-project'

if (gradle.startParameter.projectProperties.containsKey('testBuildFile')) {
rootProject.buildFileName = gradle.startParameter.projectProperties['testBuildFile']
}
Loading
Loading