Skip to content

build: update to gradle8 #1726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 27, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ tasks {
jacoco {
toolVersion = libs.versions.jacoco.get()
}
jacocoTestReport {
dependsOn(test)
}
jar {
manifest {
attributes["Built-By"] = "Expedia Group"
Expand Down Expand Up @@ -129,7 +132,6 @@ tasks {

test {
useJUnitPlatform()
finalizedBy(jacocoTestReport)
}
}

Expand Down
5 changes: 2 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[versions]
# TODO gradle 8 upgrade -> android-plugin v8 requires gradle 8
android-plugin = "8.0.0-alpha11"
android-plugin = "8.0.2"
classgraph = "4.8.160"
dataloader = "3.2.0"
federation = "3.0.1"
Expand Down Expand Up @@ -49,7 +48,7 @@ jacoco = "0.8.10"
# klint gradle plugin breaks with 0.46.x+
ktlint-core = "0.45.2"
ktlint-plugin = "10.3.0"
maven-plugin-development = "0.4.1"
maven-plugin-development = "0.4.2"
nexus-publish-plugin = "1.3.0"
plugin-publish = "1.2.0"

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +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.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
11 changes: 6 additions & 5 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ done
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"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

Expand Down Expand Up @@ -144,15 +141,15 @@ 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
# 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
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# 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"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
49 changes: 21 additions & 28 deletions plugins/graphql-kotlin-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,54 +28,47 @@ java {
}

gradlePlugin {
website.set("https://opensource.expediagroup.com/graphql-kotlin/docs/")
vcsUrl.set("https://github.com/ExpediaGroup/graphql-kotlin")
plugins {
register("graphQLPlugin") {
id = "com.expediagroup.graphql"
displayName = "GraphQL Kotlin Gradle Plugin"
description = "Gradle Plugin that can generate type-safe GraphQL Kotlin client and GraphQL schema in SDL format using reflections"
implementationClass = "com.expediagroup.graphql.plugin.gradle.GraphQLGradlePlugin"
tags.set(listOf("graphql", "kotlin", "graphql-client", "schema-generator", "sdl"))
}
}
}

pluginBundle {
website = "https://opensource.expediagroup.com/graphql-kotlin/docs/"
vcsUrl = "https://github.com/ExpediaGroup/graphql-kotlin"
tags = listOf("graphql", "kotlin", "graphql-client", "schema-generator", "sdl")
val generateDefaultVersion by tasks.registering {
val fileName = "PluginVersion.kt"
val defaultVersionFile = File("$buildDir/generated/src/com/expediagroup/graphql/plugin/gradle", fileName)

inputs.property(fileName, project.version)
outputs.dir(defaultVersionFile.parent)

doFirst {
defaultVersionFile.parentFile.mkdirs()
defaultVersionFile.writeText(
"""
package com.expediagroup.graphql.plugin.gradle
internal const val DEFAULT_PLUGIN_VERSION = "${project.version}"

""".trimIndent()
)
}
}

sourceSets {
main {
java {
srcDir("$buildDir/generated/src")
srcDir(generateDefaultVersion)
}
}
}

tasks {
val generateDefaultVersion by registering {
val fileName = "PluginVersion.kt"
val defaultVersionFile = File("$buildDir/generated/src/com/expediagroup/graphql/plugin/gradle", fileName)

inputs.property(fileName, project.version)
outputs.file(defaultVersionFile)

doFirst {
defaultVersionFile.parentFile.mkdirs()
defaultVersionFile.writeText(
"""
package com.expediagroup.graphql.plugin.gradle
internal const val DEFAULT_PLUGIN_VERSION = "${project.version}"

""".trimIndent()
)
}
}

compileKotlin {
dependsOn(generateDefaultVersion)
}

publishPlugins {
doFirst {
System.setProperty("gradle.publish.key", System.getenv("PLUGIN_PORTAL_KEY"))
Expand Down
2 changes: 2 additions & 0 deletions plugins/schema/graphql-kotlin-sdl-generator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ testing {

tasks {
jacocoTestReport {
dependsOn(testing.suites.named("integrationTest"))
// we need to explicitly add integrationTest coverage info
executionData.setFrom(fileTree(buildDir).include("/jacoco/*.exec"))
}
jacocoTestCoverageVerification {
dependsOn(testing.suites.named("integrationTest"))
// we need to explicitly add integrationTest coverage info
executionData.setFrom(fileTree(buildDir).include("/jacoco/*.exec"))
violationRules {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ testing {

tasks {
jacocoTestReport {
dependsOn(testing.suites.named("integrationTest"))
// we need to explicitly add integrationTest coverage info
executionData.setFrom(fileTree(buildDir).include("/jacoco/*.exec"))
}
jacocoTestCoverageVerification {
dependsOn(testing.suites.named("integrationTest"))
// we need to explicitly add integrationTest coverage info
executionData.setFrom(fileTree(buildDir).include("/jacoco/*.exec"))
violationRules {
Expand Down