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 #84

Merged
merged 4 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
29 changes: 13 additions & 16 deletions aws-crt-kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
* SPDX-License-Identifier: Apache-2.0
*/
import aws.sdk.kotlin.gradle.dsl.configurePublishing
import aws.sdk.kotlin.gradle.kmp.IDEA_ACTIVE
import aws.sdk.kotlin.gradle.kmp.configureKmpTargets

plugins {
kotlin("multiplatform")
alias(libs.plugins.kotlin.multiplatform)
}

val sdkVersion: String by project
Expand All @@ -17,9 +18,6 @@ description = "Kotlin Multiplatform bindings for AWS SDK Common Runtime"
// See: https://kotlinlang.org/docs/reference/opt-in-requirements.html#opting-in-to-using-api
val optinAnnotations = listOf("kotlin.RequiresOptIn")

val ideaActive = System.getProperty("idea.active") == "true"
extra["ideaActive"] = ideaActive

// KMP configuration from build plugin
configureKmpTargets()

Expand All @@ -44,7 +42,7 @@ kotlin {
// See:
// * https://kotlinlang.org/docs/mpp-share-on-platforms.html#share-code-in-libraries
// * https://kotlinlang.org/docs/mpp-set-up-targets.html#distinguish-several-targets-for-one-platform
if (!ideaActive) {
if (!IDEA_ACTIVE) {

// NOTE: We don't actually need the Android plugin. All of the Android specifics are handled in aws-crt-java,
// we just need a variant with a different dependency set + some distinguishing attributes.
Expand All @@ -69,42 +67,41 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(kotlin("stdlib-common"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
implementation(libs.kotlin.stdlib)
implementation(libs.kotlinx.coroutines.core)
}
}

val jvmMain by getting {
dependencies {
val crtJavaVersion: String by project
implementation("software.amazon.awssdk.crt:aws-crt:$crtJavaVersion")
implementation(libs.crt.java)

// FIXME - temporary integration with CompletableFuture while we work out a POC on the jvm target
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$coroutinesVersion")
implementation(libs.kotlinx.coroutines.jdk8)
}
}

val jvmTest by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-debug:$coroutinesVersion")
implementation("org.mock-server:mockserver-netty:$mockServerVersion")
implementation(libs.kotlinx.coroutines.debug)
implementation(libs.mockserver.netty)
}
}

if (!ideaActive) {
if (!IDEA_ACTIVE) {
val androidMain by getting {
// re-use the jvm (desktop) sourceSet. We only really care about declaring a variant with a different set
// of runtime dependencies
kotlin.srcDir("jvm/src")
dependsOn(commonMain)
dependencies {
val crtJavaVersion: String by project
// we need symbols we can resolve during compilation but at runtime (i.e. on device) we depend on the Android dependency
compileOnly("software.amazon.awssdk.crt:aws-crt:$crtJavaVersion")
compileOnly(libs.crt.java)
val crtJavaVersion = libs.versions.crt.java.version.get()
implementation("software.amazon.awssdk.crt:aws-crt-android:$crtJavaVersion@aar")

// FIXME - temporary integration with CompletableFuture while we work out a POC on the jvm target
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$coroutinesVersion")
implementation(libs.kotlinx.coroutines.jdk8)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import aws.sdk.kotlin.crt.runSuspendTest
import aws.sdk.kotlin.crt.use
import kotlinx.coroutines.withTimeout
import kotlin.test.*
import kotlin.time.ExperimentalTime
import kotlin.time.measureTime

class HttpClientConnectionTest : CrtTest() {
Expand Down
4 changes: 4 additions & 0 deletions aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/CRTNative.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
package aws.sdk.kotlin.crt

public actual object CRT {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package aws.sdk.kotlin.crt.auth.credentials


public actual class CachedCredentialsProvider internal actual constructor(builder: CachedCredentialsProviderBuilder) :
CredentialsProvider {
public actual companion object {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ public actual class DefaultChainCredentialsProvider internal actual constructor(
override suspend fun waitForShutdown() {
TODO("Not yet implemented")
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ internal actual constructor(builder: EcsCredentialsProviderBuilder) :
override suspend fun waitForShutdown() {
TODO("Not yet implemented")
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ public actual class StaticCredentialsProvider internal actual constructor(builde
override suspend fun waitForShutdown() {
TODO("Not yet implemented")
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,4 @@ public actual object AwsSigner {
): AwsSigningResult {
TODO("Not yet implemented")
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@ public actual class HttpClientConnectionManager actual constructor(
override fun close() {
TODO("Not yet implemented")
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ public actual class EventLoopGroup actual constructor(maxThreads: Int) : Closeab
override fun close() {
TODO("Not yet implemented")
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ public actual object Digest {
public actual fun sha256(buffer: ByteArray): ByteArray {
TODO("Not yet implemented")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

package aws.sdk.kotlin.crt


import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.runBlocking
import kotlin.coroutines.CoroutineContext

actual fun <T> runSuspendTest(context: CoroutineContext, block: suspend CoroutineScope.() -> T): T {
Expand Down
19 changes: 18 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import aws.sdk.kotlin.gradle.dsl.configureLinting
import aws.sdk.kotlin.gradle.dsl.configureNexus
import aws.sdk.kotlin.gradle.util.typedProp
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

buildscript {
repositories {
mavenCentral()
Expand All @@ -16,14 +18,15 @@ buildscript {
// only need to include it here, imports in subprojects will work automagically
classpath("aws.sdk.kotlin:build-plugins") {
version {
require("0.2.8")
require("0.3.0")
}
}
}
}

plugins {
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2"
alias(libs.plugins.kotlin.multiplatform) apply false
}

allprojects {
Expand All @@ -33,6 +36,20 @@ allprojects {
}
}

subprojects {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
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")
}
}
}

if (project.typedProp<Boolean>("kotlinWarningsAsErrors") == true) {
allprojects {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
Expand Down
13 changes: 6 additions & 7 deletions elasticurl/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
*/

plugins {
kotlin("multiplatform")
alias(libs.plugins.kotlin.multiplatform)
application
}

kotlin {
jvm {
withJava()
val jvmJar by tasks.getting(org.gradle.jvm.tasks.Jar::class) {
doFirst {
manifest {
Expand All @@ -33,21 +32,21 @@ kotlin {
val kotlinxCliVersion: String by project
val coroutinesVersion: String by project

implementation(kotlin("stdlib-common"))
implementation("org.jetbrains.kotlinx:kotlinx-cli:$kotlinxCliVersion")
implementation(libs.kotlin.stdlib)
implementation(libs.kotlinx.cli)
implementation(project(":aws-crt-kotlin"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
implementation(libs.kotlinx.coroutines.core)
}
}

val jvmMain by getting {
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib")
implementation(libs.kotlin.stdlib)
}
}
}
}

application {
mainClassName = "ApplicationKt"
mainClass = "ApplicationKt"
}
21 changes: 3 additions & 18 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
kotlin.code.style=official
kotlin.mpp.stability.nowarn=true

# gradle
org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=1G

# aws-crt-kotlin
sdkVersion=0.8.3-SNAPSHOT

# kotlin
kotlinVersion=1.9.20
coroutinesVersion=1.7.3

# testing/utility
ktlintVersion=1.0.1
kotestVersion=5.8.0
mockServerVersion=5.15.0

# elasticurl only
kotlinxCliVersion=0.3.6

# JVM
crtJavaVersion=0.28.7

# publishing
publishGroupName=aws.sdk.kotlin.crt

# gradle
org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=1G
40 changes: 40 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[versions]
kotlin-version = "1.9.21"

# libs
crt-java-version = "0.29.1"
coroutines-version = "1.7.3"

# testing
junit-version = "5.10.1"
kotest-version = "5.8.0"
mock-server-version = "5.15.0"
# fixme - remove in favor of clikt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a task in the backlog in addition to this comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not a public dependency, only consumed in the elasticurl example/test application. This was more a reminder that it was deprecated and is basically unmaintained at this point

kotlinx-cli-version = "0.3.6"


[libraries]
crt-java = { module = "software.amazon.awssdk.crt:aws-crt", version.ref = "crt-java-version" }

kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin-version"}
kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin-version"}
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin-version" }
kotlin-test-junit5 = { module = "org.jetbrains.kotlin:kotlin-test-junit5", version.ref = "kotlin-version" }


kotlinx-coroutines-debug = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-debug", version.ref = "coroutines-version" }
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines-version" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines-version" }
kotlinx-coroutines-jdk8 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8", version.ref = "coroutines-version" }
kotlinx-cli = { module = "org.jetbrains.kotlinx:kotlinx-cli", version.ref = "kotlinx-cli-version" }

junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-version" }
junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit-version" }

kotest-assertions-core = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest-version" }
kotest-assertions-core-jvm = { module = "io.kotest:kotest-assertions-core-jvm", version.ref = "kotest-version" }

mockserver-netty = { module = "org.mock-server:mockserver-netty", version.ref = "mock-server-version" }

[plugins]
kotlin-multiplatform = {id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin-version" }
72 changes: 0 additions & 72 deletions gradle/publish.gradle

This file was deleted.

Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Loading
Loading