Skip to content
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

chore: upgrade to gradle 8.5 #1153

Merged
merged 6 commits into from
Dec 19, 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
16 changes: 9 additions & 7 deletions aws-runtime/aws-config/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ kotlin {
// additional dependencies required by generated sso provider(s)
implementation(libs.smithy.kotlin.aws.json.protocols)

// atomics
implementation(libs.kotlinx.atomicfu)

// coroutines
implementation(libs.kotlinx.coroutines.core)
}
Expand All @@ -70,7 +67,7 @@ kotlin {
}

fun awsModelFile(name: String): String =
rootProject.file("codegen/sdk/aws-models/$name").relativeTo(project.buildDir).toString()
rootProject.file("codegen/sdk/aws-models/$name").relativeTo(project.layout.buildDirectory.get().asFile).toString()

codegen {
val basePackage = "aws.sdk.kotlin.runtime.auth.credentials.internal"
Expand Down Expand Up @@ -200,13 +197,17 @@ val codegenTask = tasks.named("generateSmithyProjections")
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
dependsOn(codegenTask)

// generated sts/sso credential providers have quite a few warnings
kotlinOptions.allWarningsAsErrors = false
compilerOptions {
// generated sts/sso credential providers have quite a few warnings
allWarningsAsErrors.set(false)
}
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile> {
dependsOn(codegenTask)
kotlinOptions.allWarningsAsErrors = false
compilerOptions {
allWarningsAsErrors.set(false)
}
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompileCommon> {
Expand Down Expand Up @@ -243,6 +244,7 @@ listOf("apiElements", "runtimeElements").forEach {

// suppress internal generated clients
tasks.named<DokkaTaskPartial>("dokkaHtmlPartial") {
dependsOn(codegenTask)
dokkaSourceSets.configureEach {
perPackageOption {
matchingRegex.set(""".*\.internal.*""")
Expand Down
12 changes: 9 additions & 3 deletions aws-runtime/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
*/
import aws.sdk.kotlin.gradle.dsl.configurePublishing
import aws.sdk.kotlin.gradle.kmp.*
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

description = "AWS client runtime support for generated service clients"

@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed
plugins {
alias(libs.plugins.dokka)
alias(libs.plugins.kotlinx.binary.compatibility.validator)
Expand Down Expand Up @@ -64,8 +64,14 @@ subprojects {
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile> {
compilerOptions {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ buildscript {
classpath(libs.kotlinx.atomicfu.plugin)
classpath("aws.sdk.kotlin:build-plugins") {
version {
require("0.2.9")
require("0.3.0")
}
}
}
}

plugins {
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed
alias(libs.plugins.dokka)
// ensure the correct version of KGP ends up on our buildscript classpath
// since build-plugins also has <some> version in its dependency closure
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.kotlin.jvm) apply false
}

// configures (KMP) subprojects with our own KMP conventions and some default dependencies
Expand Down
33 changes: 18 additions & 15 deletions codegen/aws-sdk-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
plugins {
kotlin("jvm")
alias(libs.plugins.kotlin.jvm)
jacoco
}

Expand Down Expand Up @@ -38,7 +45,7 @@ dependencies {
val generateSdkRuntimeVersion by tasks.registering {
// generate the version of the runtime to use as a resource.
// this keeps us from having to manually change version numbers in multiple places
val resourcesDir = "$buildDir/resources/main/aws/sdk/kotlin/codegen"
val resourcesDir = layout.buildDirectory.dir("resources/main/aws/sdk/kotlin/codegen").get()
val versionFile = file("$resourcesDir/sdk-version.txt")
val gradlePropertiesFile = rootProject.file("gradle.properties")
inputs.file(gradlePropertiesFile)
Expand All @@ -49,20 +56,16 @@ val generateSdkRuntimeVersion by tasks.registering {
}
}

val jvmTargetVersion = JavaVersion.VERSION_17.toString()

tasks.compileKotlin {
kotlinOptions.jvmTarget = jvmTargetVersion
tasks.withType<KotlinCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
}
dependsOn(generateSdkRuntimeVersion)
}

tasks.compileTestKotlin {
kotlinOptions.jvmTarget = jvmTargetVersion
}

tasks.withType<JavaCompile> {
sourceCompatibility = jvmTargetVersion
targetCompatibility = jvmTargetVersion
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
}

// Reusable license copySpec
Expand Down Expand Up @@ -94,9 +97,9 @@ tasks.test {
// Configure jacoco (code coverage) to generate an HTML report
tasks.jacocoTestReport {
reports {
xml.isEnabled = false
csv.isEnabled = false
html.destination = file("$buildDir/reports/jacoco")
xml.required.set(false)
csv.required.set(false)
html.outputLocation.set(layout.buildDirectory.dir("reports/jacoco"))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ class GradleGenerator : KotlinIntegration {
writer.write("project.ext.set(#S, #S)", "aws.sdk.id", ctx.settings.sdkId)
writer.write("")

writer.write("val kotlinVersion: String by project")

val allDependencies = delegator.dependencies.mapNotNull { it.properties["dependency"] as? KotlinDependency }.distinct()

writer
Expand Down
31 changes: 17 additions & 14 deletions codegen/smithy-aws-kotlin-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
plugins {
kotlin("jvm")
alias(libs.plugins.kotlin.jvm)
jacoco
}

Expand Down Expand Up @@ -34,19 +41,15 @@ dependencies {
testImplementation(libs.kotlinx.serialization.json)
}

val jvmTargetVersion = JavaVersion.VERSION_17.toString()

tasks.compileKotlin {
kotlinOptions.jvmTarget = jvmTargetVersion
}

tasks.compileTestKotlin {
kotlinOptions.jvmTarget = jvmTargetVersion
tasks.withType<KotlinCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
}
}

tasks.withType<JavaCompile> {
sourceCompatibility = jvmTargetVersion
targetCompatibility = jvmTargetVersion
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
}

// Reusable license copySpec
Expand Down Expand Up @@ -78,9 +81,9 @@ tasks.test {
// Configure jacoco (code coverage) to generate an HTML report
tasks.jacocoTestReport {
reports {
xml.isEnabled = false
csv.isEnabled = false
html.destination = file("$buildDir/reports/jacoco")
xml.required.set(false)
csv.required.set(false)
html.outputLocation.set(layout.buildDirectory.dir("reports/jacoco"))
}
}

Expand Down
22 changes: 17 additions & 5 deletions dokka-aws/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
plugins {
kotlin("jvm")
alias(libs.plugins.kotlin.jvm)
}

description = "Custom Dokka plugin for AWS Kotlin SDK API docs"
Expand All @@ -13,9 +20,14 @@ dependencies {
compileOnly(libs.dokka.core)
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
allWarningsAsErrors = false // FIXME Dokka bundles stdlib into the classpath, causing an unfixable warning
tasks.withType<KotlinCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
allWarningsAsErrors.set(false) // FIXME Dokka bundles stdlib into the classpath, causing an unfixable warning
}
}

tasks.withType<JavaCompile> {
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
}
7 changes: 3 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ org.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=2G
# sdk
sdkVersion=1.0.18-SNAPSHOT

# kotlin
kotlinVersion=1.9.20

# dokka config (values specified at build-time as needed)
smithyKotlinDocBaseUrl=https://sdk.amazonaws.com/kotlin/api/smithy-kotlin/api/$smithyKotlinRuntimeVersion/

# atomicfu
kotlinx.atomicfu.enableJvmIrTransformation=true
kotlinx.atomicfu.enableJvmIrTransformation=true
# FIXME - https://github.com/Kotlin/kotlinx-atomicfu/issues/274
kotlinx.atomicfu.enableNativeIrTransformation=false
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[versions]
kotlin-version = "1.9.20"
kotlin-version = "1.9.21"
dokka-version = "1.9.10"

# libs
coroutines-version = "1.7.3"
atomicfu-version = "0.22.0"
atomicfu-version = "0.23.1"

# smithy-kotlin codegen and runtime are versioned separately
smithy-kotlin-runtime-version = "1.0.4"
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
18 changes: 14 additions & 4 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -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/.
Expand All @@ -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"'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
Loading
Loading