diff --git a/.brazil.json b/.brazil.json index 3e55e57a..0a4b9769 100644 --- a/.brazil.json +++ b/.brazil.json @@ -1,13 +1,8 @@ { "dependencies": { - "org.jetbrains.kotlin:kotlin-stdlib-common:1.9.*": "KotlinStdlibCommon-1.9.x", - "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.*": "KotlinStdlibJdk8-1.9.x", - "org.jetbrains.kotlin:kotlin-stdlib:1.9.*": "KotlinStdlib-1.9.x", - "org.jetbrains.kotlinx:atomicfu-jvm:0.23.1": "AtomicfuJvm-0.23.1", - "org.jetbrains.kotlinx:atomicfu:0.23.1": "Atomicfu-0.23.1", - "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.7.*": "KotlinxCoroutinesCoreJvm-1.7.x", - "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.*": "KotlinxCoroutinesCore-1.7.x", - "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.7.*": "KotlinxCoroutinesJdk8-1.7.x", + "org.jetbrains.kotlin:kotlin-stdlib:2.0.*": "KotlinStdlib-2.x", + "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.*": "KotlinxCoroutinesCoreJvm-1.x", + "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.*": "KotlinxCoroutinesJdk8-1.x", "software.amazon.awssdk.crt:aws-crt:0.*": "Aws-crt-java-1.0.x" }, "packageHandlingRules": { @@ -21,13 +16,6 @@ "aws.sdk.kotlin.crt:aws-crt-kotlin-android" ], "resolvesConflictDependencies": { - "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.7.*": [ - "KotlinStdlibCommon-1.9.x", - "KotlinStdlibJdk8-1.9.x" - ], - "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.7.*": [ - "KotlinStdlibJdk8-1.9.x" - ] } } } diff --git a/.editorconfig b/.editorconfig index ab5c775c..3dbc6d83 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,7 +1,10 @@ [*.{kt,kts}] +ktlint_code_style = intellij_idea + # ktlint rules to disable ktlint_standard_no-wildcard-imports = disabled ktlint_standard_filename = disabled +ktlint_standard_backing-property-naming = disabled # enable trailing commas per JetBrains recommendation # (https://kotlinlang.org/docs/coding-conventions.html#trailing-commas) diff --git a/.github/workflows/artifact-size-metrics.yml b/.github/workflows/artifact-size-metrics.yml new file mode 100644 index 00000000..3097b819 --- /dev/null +++ b/.github/workflows/artifact-size-metrics.yml @@ -0,0 +1,106 @@ +name: Artifact Size Metrics +on: + pull_request: + types: [ opened, synchronize, reopened, labeled, unlabeled ] + branches: [ main ] + release: + types: [published] + +permissions: + id-token: write + contents: read + pull-requests: write + +jobs: + release-metrics: + if: github.event_name == 'release' + runs-on: ubuntu-latest + steps: + - name: Checkout Sources + uses: actions/checkout@v4 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }} + aws-region: us-west-2 + - name: Generate Artifact Size Metrics + run: ./gradlew artifactSizeMetrics + - name: Save Artifact Size Metrics + run: ./gradlew saveArtifactSizeMetrics -Prelease=${{ github.event.release.tag_name }} + - name: Put Artifact Size Metrics in CloudWatch + run: ./gradlew putArtifactSizeMetricsInCloudWatch -Prelease=${{ github.event.release.tag_name }} + size-check: + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + steps: + - name: Checkout Sources + uses: actions/checkout@v4 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }} + aws-region: us-west-2 + - name: Generate Artifact Size Metrics + run: ./gradlew artifactSizeMetrics + - name: Analyze Artifact Size Metrics + run: ./gradlew analyzeArtifactSizeMetrics + - name: Show Results + uses: actions/github-script@v7 + with: + script: | + const getComments = + `query { + repository(owner:"${context.repo.owner}", name:"${context.repo.repo}"){ + pullRequest(number: ${context.issue.number}) { + id + comments(last:100) { + nodes { + id + body + author { + login + } + isMinimized + } + } + } + } + }` + + const response = await github.graphql(getComments) + const comments = response.repository.pullRequest.comments.nodes + + const mutations = comments + .filter(comment => comment.author.login == 'github-actions' && !comment.isMinimized && comment.body.startsWith('Affected Artifacts')) + .map(comment => + github.graphql( + `mutation { + minimizeComment(input:{subjectId:"${comment.id}", classifier:OUTDATED}){ + clientMutationId + } + }` + ) + ) + await Promise.all(mutations) + + const fs = require('node:fs') + const comment = fs.readFileSync('build/reports/metrics/artifact-analysis.md', 'utf8') + + const writeComment = + `mutation { + addComment(input:{body:"""${comment}""", subjectId:"${response.repository.pullRequest.id}"}){ + clientMutationId + } + }` + + await github.graphql(writeComment) + + - name: Evaluate + if: ${{ !contains(github.event.pull_request.labels.*.name, 'acknowledge-artifact-size-increase') }} + run: | + cd build/reports/metrics + cat has-significant-change.txt | grep false || { + echo An artifact increased in size by more than allowed or a new artifact was created. + echo If this is expected please add the 'acknowledge-artifact-size-increase' label to this pull request. + exit 1 + } diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml new file mode 100644 index 00000000..69fb0c98 --- /dev/null +++ b/.github/workflows/dependabot.yml @@ -0,0 +1,17 @@ +name: Dependabot Dependency Submission + +on: + push: + branches: [ main ] + +permissions: + contents: write + +jobs: + dependency-submission: + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v4 + - name: Generate and submit dependency graph + uses: gradle/actions/dependency-submission@v3 diff --git a/.gitignore b/.gitignore index 185f74e5..01338eef 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ build/ *.iml .idea/ local.properties +*.klib \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2742ff7b..4b396189 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,38 @@ # Changelog +## [0.8.10] - 10/16/2024 + +### Miscellaneous +* Upgrade to Kotlin 2.0.21 +* Upgrade aws-crt-java to 0.31.3 + +## [0.8.9] - 09/18/2024 + +### Miscellaneous +* Upgrade to kotlinx.coroutines 1.9.0 + +## [0.8.8] - 08/06/2024 + +### Miscellaneous +* Upgrade to Kotlin 2.0.10 +* Upgrade to aws-crt-java 0.30.5 + +## [0.8.7] - 07/25/2024 + +### Miscellaneous +* Upgrade to Kotlin 2.0.0 + +## [0.8.6] - 06/28/2024 + +### Miscellaneous +* Upgrade to aws-crt-java v0.29.25 +* Upgrade to ktlint v1.3.0 + +## [0.8.5] - 02/09/2024 + +### Features +* Add SIGV4_S3EXPRESS signing algorithm and AwsSigningConfig.toBuilder function + ## [0.8.4] - 01/10/2024 ### Features diff --git a/aws-crt-kotlin/api/android/aws-crt-kotlin.api b/aws-crt-kotlin/api/android/aws-crt-kotlin.api index 9d47988d..31ea9616 100644 --- a/aws-crt-kotlin/api/android/aws-crt-kotlin.api +++ b/aws-crt-kotlin/api/android/aws-crt-kotlin.api @@ -322,6 +322,7 @@ public final class aws/sdk/kotlin/crt/auth/signing/AwsSigner { public final class aws/sdk/kotlin/crt/auth/signing/AwsSigningAlgorithm : java/lang/Enum { public static final field SIGV4 Laws/sdk/kotlin/crt/auth/signing/AwsSigningAlgorithm; public static final field SIGV4_ASYMMETRIC Laws/sdk/kotlin/crt/auth/signing/AwsSigningAlgorithm; + public static final field SIGV4_S3EXPRESS Laws/sdk/kotlin/crt/auth/signing/AwsSigningAlgorithm; public static fun getEntries ()Lkotlin/enums/EnumEntries; public final fun getValue ()I public static fun valueOf (Ljava/lang/String;)Laws/sdk/kotlin/crt/auth/signing/AwsSigningAlgorithm; @@ -345,6 +346,7 @@ public final class aws/sdk/kotlin/crt/auth/signing/AwsSigningConfig { public final fun getSignedBodyHeader ()Laws/sdk/kotlin/crt/auth/signing/AwsSignedBodyHeaderType; public final fun getSignedBodyValue ()Ljava/lang/String; public final fun getUseDoubleUriEncode ()Z + public final fun toBuilder ()Laws/sdk/kotlin/crt/auth/signing/AwsSigningConfig$Builder; } public final class aws/sdk/kotlin/crt/auth/signing/AwsSigningConfig$Builder { diff --git a/aws-crt-kotlin/api/aws-crt-kotlin.api b/aws-crt-kotlin/api/aws-crt-kotlin.api index 9d47988d..ee4724c0 100644 --- a/aws-crt-kotlin/api/aws-crt-kotlin.api +++ b/aws-crt-kotlin/api/aws-crt-kotlin.api @@ -322,6 +322,7 @@ public final class aws/sdk/kotlin/crt/auth/signing/AwsSigner { public final class aws/sdk/kotlin/crt/auth/signing/AwsSigningAlgorithm : java/lang/Enum { public static final field SIGV4 Laws/sdk/kotlin/crt/auth/signing/AwsSigningAlgorithm; public static final field SIGV4_ASYMMETRIC Laws/sdk/kotlin/crt/auth/signing/AwsSigningAlgorithm; + public static final field SIGV4_S3EXPRESS Laws/sdk/kotlin/crt/auth/signing/AwsSigningAlgorithm; public static fun getEntries ()Lkotlin/enums/EnumEntries; public final fun getValue ()I public static fun valueOf (Ljava/lang/String;)Laws/sdk/kotlin/crt/auth/signing/AwsSigningAlgorithm; @@ -345,6 +346,7 @@ public final class aws/sdk/kotlin/crt/auth/signing/AwsSigningConfig { public final fun getSignedBodyHeader ()Laws/sdk/kotlin/crt/auth/signing/AwsSignedBodyHeaderType; public final fun getSignedBodyValue ()Ljava/lang/String; public final fun getUseDoubleUriEncode ()Z + public final fun toBuilder ()Laws/sdk/kotlin/crt/auth/signing/AwsSigningConfig$Builder; } public final class aws/sdk/kotlin/crt/auth/signing/AwsSigningConfig$Builder { @@ -505,6 +507,7 @@ public final class aws/sdk/kotlin/crt/http/HttpClientConnectionManagerOptionsBui public final class aws/sdk/kotlin/crt/http/HttpException : aws/sdk/kotlin/crt/CrtRuntimeException { public fun (I)V + public fun getErrorCode ()I } public final class aws/sdk/kotlin/crt/http/HttpHeader { diff --git a/aws-crt-kotlin/api/jvm/aws-crt-kotlin.api b/aws-crt-kotlin/api/jvm/aws-crt-kotlin.api index 9d47988d..31ea9616 100644 --- a/aws-crt-kotlin/api/jvm/aws-crt-kotlin.api +++ b/aws-crt-kotlin/api/jvm/aws-crt-kotlin.api @@ -322,6 +322,7 @@ public final class aws/sdk/kotlin/crt/auth/signing/AwsSigner { public final class aws/sdk/kotlin/crt/auth/signing/AwsSigningAlgorithm : java/lang/Enum { public static final field SIGV4 Laws/sdk/kotlin/crt/auth/signing/AwsSigningAlgorithm; public static final field SIGV4_ASYMMETRIC Laws/sdk/kotlin/crt/auth/signing/AwsSigningAlgorithm; + public static final field SIGV4_S3EXPRESS Laws/sdk/kotlin/crt/auth/signing/AwsSigningAlgorithm; public static fun getEntries ()Lkotlin/enums/EnumEntries; public final fun getValue ()I public static fun valueOf (Ljava/lang/String;)Laws/sdk/kotlin/crt/auth/signing/AwsSigningAlgorithm; @@ -345,6 +346,7 @@ public final class aws/sdk/kotlin/crt/auth/signing/AwsSigningConfig { public final fun getSignedBodyHeader ()Laws/sdk/kotlin/crt/auth/signing/AwsSignedBodyHeaderType; public final fun getSignedBodyValue ()Ljava/lang/String; public final fun getUseDoubleUriEncode ()Z + public final fun toBuilder ()Laws/sdk/kotlin/crt/auth/signing/AwsSigningConfig$Builder; } public final class aws/sdk/kotlin/crt/auth/signing/AwsSigningConfig$Builder { diff --git a/aws-crt-kotlin/build.gradle.kts b/aws-crt-kotlin/build.gradle.kts index 599177e6..8992e056 100644 --- a/aws-crt-kotlin/build.gradle.kts +++ b/aws-crt-kotlin/build.gradle.kts @@ -199,7 +199,9 @@ kotlin { } tasks.withType().configureEach { - if (!HostManager.hostIsMac) { return@configureEach } + if (!HostManager.hostIsMac) { + return@configureEach + } dependsOn("bootIosSimulatorDevice") finalizedBy("shutdownIosSimulatorDevice") diff --git a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/CachedCredentialsProvider.kt b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/CachedCredentialsProvider.kt index 3501733b..bbf1c678 100644 --- a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/CachedCredentialsProvider.kt +++ b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/CachedCredentialsProvider.kt @@ -18,7 +18,11 @@ package aws.sdk.kotlin.crt.auth.credentials * @return the newly-constructed credentials provider */ public expect class CachedCredentialsProvider internal constructor(builder: CachedCredentialsProviderBuilder) : CredentialsProvider { - public companion object + public companion object { } + + override fun close() + override suspend fun getCredentials(): Credentials + override suspend fun waitForShutdown() } public class CachedCredentialsProviderBuilder { @@ -43,5 +47,4 @@ public class CachedCredentialsProviderBuilder { /** * Construct a new credentials provider using a builder */ -public fun CachedCredentialsProvider.Companion.build(block: CachedCredentialsProviderBuilder.() -> Unit): - CachedCredentialsProvider = CachedCredentialsProviderBuilder().apply(block).build() +public fun CachedCredentialsProvider.Companion.build(block: CachedCredentialsProviderBuilder.() -> Unit): CachedCredentialsProvider = CachedCredentialsProviderBuilder().apply(block).build() diff --git a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/CredentialsProvider.kt b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/CredentialsProvider.kt index 7efa1683..5951a131 100644 --- a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/CredentialsProvider.kt +++ b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/CredentialsProvider.kt @@ -11,7 +11,9 @@ import aws.sdk.kotlin.crt.Closeable /** * Represents a producer/source of AWS credentials */ -public interface CredentialsProvider : Closeable, AsyncShutdown { +public interface CredentialsProvider : + Closeable, + AsyncShutdown { /** * Request credentials from the provider diff --git a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/DefaultChainCredentialsProvider.kt b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/DefaultChainCredentialsProvider.kt index 62e33ff3..d71a9d93 100644 --- a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/DefaultChainCredentialsProvider.kt +++ b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/DefaultChainCredentialsProvider.kt @@ -22,10 +22,13 @@ import aws.sdk.kotlin.crt.io.ClientBootstrap * * @return the newly-constructed credentials provider */ -public expect class DefaultChainCredentialsProvider internal constructor(builder: DefaultChainCredentialsProviderBuilder) : - CredentialsProvider { +public expect class DefaultChainCredentialsProvider internal constructor(builder: DefaultChainCredentialsProviderBuilder) : CredentialsProvider { - public companion object + public companion object { } + + override fun close() + override suspend fun getCredentials(): Credentials + override suspend fun waitForShutdown() } public class DefaultChainCredentialsProviderBuilder { @@ -40,5 +43,4 @@ public class DefaultChainCredentialsProviderBuilder { /** * Construct a new credentials provider using a builder */ -public fun DefaultChainCredentialsProvider.Companion.build(block: DefaultChainCredentialsProviderBuilder.() -> Unit): - DefaultChainCredentialsProvider = DefaultChainCredentialsProviderBuilder().apply(block).build() +public fun DefaultChainCredentialsProvider.Companion.build(block: DefaultChainCredentialsProviderBuilder.() -> Unit): DefaultChainCredentialsProvider = DefaultChainCredentialsProviderBuilder().apply(block).build() diff --git a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/EcsCredentialsProvider.kt b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/EcsCredentialsProvider.kt index 5c92f807..bb5d591f 100644 --- a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/EcsCredentialsProvider.kt +++ b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/EcsCredentialsProvider.kt @@ -12,8 +12,14 @@ import aws.sdk.kotlin.crt.io.TlsContext * A credentials provider that sources credentials from an ECS environment. */ public expect class EcsCredentialsProvider -internal constructor(builder: EcsCredentialsProviderBuilder) : CredentialsProvider { - public companion object +internal constructor( + builder: EcsCredentialsProviderBuilder, +) : CredentialsProvider { + public companion object { } + + override fun close() + override suspend fun getCredentials(): Credentials + override suspend fun waitForShutdown() } public class EcsCredentialsProviderBuilder { @@ -50,5 +56,4 @@ public class EcsCredentialsProviderBuilder { /** * Construct a new ECS credentials provider using a builder. */ -public fun EcsCredentialsProvider.Companion.build(block: EcsCredentialsProviderBuilder.() -> Unit): - EcsCredentialsProvider = EcsCredentialsProviderBuilder().apply(block).build() +public fun EcsCredentialsProvider.Companion.build(block: EcsCredentialsProviderBuilder.() -> Unit): EcsCredentialsProvider = EcsCredentialsProviderBuilder().apply(block).build() diff --git a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/ProfileCredentialsProvider.kt b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/ProfileCredentialsProvider.kt index 1bb7e04f..dabb67dd 100644 --- a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/ProfileCredentialsProvider.kt +++ b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/ProfileCredentialsProvider.kt @@ -12,8 +12,14 @@ import aws.sdk.kotlin.crt.io.TlsContext * A credentials provider that uses profile files. */ public expect class ProfileCredentialsProvider -internal constructor(builder: ProfileCredentialsProviderBuilder) : CredentialsProvider { - public companion object +internal constructor( + builder: ProfileCredentialsProviderBuilder, +) : CredentialsProvider { + public companion object { } + + override fun close() + override suspend fun getCredentials(): Credentials + override suspend fun waitForShutdown() } public class ProfileCredentialsProviderBuilder { @@ -50,5 +56,4 @@ public class ProfileCredentialsProviderBuilder { /** * Construct a new credentials provider using a builder. */ -public fun ProfileCredentialsProvider.Companion.build(block: ProfileCredentialsProviderBuilder.() -> Unit): - ProfileCredentialsProvider = ProfileCredentialsProviderBuilder().apply(block).build() +public fun ProfileCredentialsProvider.Companion.build(block: ProfileCredentialsProviderBuilder.() -> Unit): ProfileCredentialsProvider = ProfileCredentialsProviderBuilder().apply(block).build() diff --git a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/StaticCredentialsProvider.kt b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/StaticCredentialsProvider.kt index b4fa248d..f9ca35ba 100644 --- a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/StaticCredentialsProvider.kt +++ b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/StaticCredentialsProvider.kt @@ -9,7 +9,11 @@ package aws.sdk.kotlin.crt.auth.credentials * A credentials provider for a fixed set of credentials */ public expect class StaticCredentialsProvider internal constructor(builder: StaticCredentialsProviderBuilder) : CredentialsProvider { - public companion object + public companion object { } + + override fun close() + override suspend fun getCredentials(): Credentials + override suspend fun waitForShutdown() } public class StaticCredentialsProviderBuilder { @@ -28,8 +32,7 @@ public class StaticCredentialsProviderBuilder { /** * Construct a new credentials provider using a builder */ -public fun StaticCredentialsProvider.Companion.build(block: StaticCredentialsProviderBuilder.() -> Unit): - StaticCredentialsProvider = StaticCredentialsProviderBuilder().apply(block).build() +public fun StaticCredentialsProvider.Companion.build(block: StaticCredentialsProviderBuilder.() -> Unit): StaticCredentialsProvider = StaticCredentialsProviderBuilder().apply(block).build() /** * Create provider from a set of credentials diff --git a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/StsAssumeRoleCredentialsProvider.kt b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/StsAssumeRoleCredentialsProvider.kt index 953e6093..ae948896 100644 --- a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/StsAssumeRoleCredentialsProvider.kt +++ b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/StsAssumeRoleCredentialsProvider.kt @@ -12,8 +12,14 @@ import aws.sdk.kotlin.crt.io.TlsContext * Provides credentials from STS by assuming a role */ public expect class StsAssumeRoleCredentialsProvider -internal constructor(builder: StsAssumeRoleCredentialsProviderBuilder) : CredentialsProvider { - public companion object +internal constructor( + builder: StsAssumeRoleCredentialsProviderBuilder, +) : CredentialsProvider { + public companion object { } + + override fun close() + override suspend fun getCredentials(): Credentials + override suspend fun waitForShutdown() } public class StsAssumeRoleCredentialsProviderBuilder { @@ -53,5 +59,4 @@ public class StsAssumeRoleCredentialsProviderBuilder { /** * Construct a new credentials provider using a builder. */ -public fun StsAssumeRoleCredentialsProvider.Companion.build(block: StsAssumeRoleCredentialsProviderBuilder.() -> Unit): - StsAssumeRoleCredentialsProvider = StsAssumeRoleCredentialsProviderBuilder().apply(block).build() +public fun StsAssumeRoleCredentialsProvider.Companion.build(block: StsAssumeRoleCredentialsProviderBuilder.() -> Unit): StsAssumeRoleCredentialsProvider = StsAssumeRoleCredentialsProviderBuilder().apply(block).build() diff --git a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/StsWebIdentityCredentialsProvider.kt b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/StsWebIdentityCredentialsProvider.kt index f8b77841..2f7740a6 100644 --- a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/StsWebIdentityCredentialsProvider.kt +++ b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/StsWebIdentityCredentialsProvider.kt @@ -13,8 +13,14 @@ import aws.sdk.kotlin.crt.io.TlsContext * authenticated in a mobile or web application with a web identity provider. */ public expect class StsWebIdentityCredentialsProvider -internal constructor(builder: StsWebIdentityCredentialsProviderBuilder) : CredentialsProvider { - public companion object +internal constructor( + builder: StsWebIdentityCredentialsProviderBuilder, +) : CredentialsProvider { + public companion object { } + + override fun close() + override suspend fun getCredentials(): Credentials + override suspend fun waitForShutdown() } public class StsWebIdentityCredentialsProviderBuilder { @@ -34,5 +40,4 @@ public class StsWebIdentityCredentialsProviderBuilder { /** * Construct a new credentials provider using a builder. */ -public fun StsWebIdentityCredentialsProvider.Companion.build(block: StsWebIdentityCredentialsProviderBuilder.() -> Unit): - StsWebIdentityCredentialsProvider = StsWebIdentityCredentialsProviderBuilder().apply(block).build() +public fun StsWebIdentityCredentialsProvider.Companion.build(block: StsWebIdentityCredentialsProviderBuilder.() -> Unit): StsWebIdentityCredentialsProvider = StsWebIdentityCredentialsProviderBuilder().apply(block).build() diff --git a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/X509CredentialsProvider.kt b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/X509CredentialsProvider.kt index 65ab2afb..64cb4c4f 100644 --- a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/X509CredentialsProvider.kt +++ b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/credentials/X509CredentialsProvider.kt @@ -15,7 +15,11 @@ import aws.sdk.kotlin.crt.io.TlsContext * @return the newly-constructed credentials provider */ public expect class X509CredentialsProvider internal constructor(builder: X509CredentialsProviderBuilder) : CredentialsProvider { - public companion object + public companion object { } + + override fun close() + override suspend fun getCredentials(): Credentials + override suspend fun waitForShutdown() } public class X509CredentialsProviderBuilder { @@ -60,5 +64,4 @@ public class X509CredentialsProviderBuilder { /** * Construct a new credentials provider using a builder */ -public fun X509CredentialsProvider.Companion.build(block: X509CredentialsProviderBuilder.() -> Unit): - X509CredentialsProvider = X509CredentialsProviderBuilder().apply(block).build() +public fun X509CredentialsProvider.Companion.build(block: X509CredentialsProviderBuilder.() -> Unit): X509CredentialsProvider = X509CredentialsProviderBuilder().apply(block).build() diff --git a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/signing/AwsSigningConfig.kt b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/signing/AwsSigningConfig.kt index 731d2436..ffb0050b 100644 --- a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/signing/AwsSigningConfig.kt +++ b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/auth/signing/AwsSigningConfig.kt @@ -12,6 +12,7 @@ import aws.sdk.kotlin.crt.auth.credentials.CredentialsProvider public enum class AwsSigningAlgorithm(public val value: Int) { SIGV4(0), SIGV4_ASYMMETRIC(1), + SIGV4_S3EXPRESS(2), } public enum class AwsSignatureType(public val value: Int) { @@ -176,4 +177,21 @@ public class AwsSigningConfig(builder: Builder) { public fun build(): AwsSigningConfig = AwsSigningConfig(this) } + + public fun toBuilder(): Builder = Builder().apply { + region = this@AwsSigningConfig.region + service = this@AwsSigningConfig.service + date = this@AwsSigningConfig.date + algorithm = this@AwsSigningConfig.algorithm + shouldSignHeader = this@AwsSigningConfig.shouldSignHeader + signatureType = this@AwsSigningConfig.signatureType + useDoubleUriEncode = this@AwsSigningConfig.useDoubleUriEncode + normalizeUriPath = this@AwsSigningConfig.normalizeUriPath + omitSessionToken = this@AwsSigningConfig.omitSessionToken + signedBodyValue = this@AwsSigningConfig.signedBodyValue + signedBodyHeader = this@AwsSigningConfig.signedBodyHeader + credentials = this@AwsSigningConfig.credentials + credentialsProvider = this@AwsSigningConfig.credentialsProvider + expirationInSeconds = this@AwsSigningConfig.expirationInSeconds + } } diff --git a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/http/HttpClientConnectionManager.kt b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/http/HttpClientConnectionManager.kt index 59576a7f..4bafa0e6 100644 --- a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/http/HttpClientConnectionManager.kt +++ b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/http/HttpClientConnectionManager.kt @@ -34,4 +34,7 @@ public expect class HttpClientConnectionManager(options: HttpClientConnectionMan * @param conn Connection to release */ public fun releaseConnection(conn: HttpClientConnection) + + override fun close() + override suspend fun waitForShutdown() } diff --git a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/io/ClientBootstrap.kt b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/io/ClientBootstrap.kt index 4983bf76..e0c18745 100644 --- a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/io/ClientBootstrap.kt +++ b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/io/ClientBootstrap.kt @@ -12,4 +12,9 @@ import aws.sdk.kotlin.crt.Closeable * This class wraps the aws_client_bootstrap from aws-c-io to provide * a client context for all protocol stacks in the AWS Common Runtime. */ -public expect class ClientBootstrap(elg: EventLoopGroup, hr: HostResolver) : Closeable, AsyncShutdown +public expect class ClientBootstrap(elg: EventLoopGroup, hr: HostResolver) : + Closeable, + AsyncShutdown { + override suspend fun waitForShutdown() + override fun close() +} diff --git a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/io/EventLoopGroup.kt b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/io/EventLoopGroup.kt index 1062159f..1984f074 100644 --- a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/io/EventLoopGroup.kt +++ b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/io/EventLoopGroup.kt @@ -16,4 +16,9 @@ import aws.sdk.kotlin.crt.Closeable * Otherwise, maxThreads will be the number of event loops in the group. * @throws [aws.sdk.kotlin.crt.CrtRuntimeException] If the system is unable to allocate space for a native event loop group */ -public expect class EventLoopGroup(maxThreads: Int = 1) : Closeable, AsyncShutdown +public expect class EventLoopGroup(maxThreads: Int = 1) : + Closeable, + AsyncShutdown { + override fun close() + override suspend fun waitForShutdown() +} diff --git a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/io/HostResolver.kt b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/io/HostResolver.kt index b60e8c39..ab93a204 100644 --- a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/io/HostResolver.kt +++ b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/io/HostResolver.kt @@ -10,6 +10,10 @@ import aws.sdk.kotlin.crt.Closeable internal const val DEFAULT_MAX_ENTRIES = 8 -public expect class HostResolver(elg: EventLoopGroup, maxEntries: Int) : Closeable, AsyncShutdown { +public expect class HostResolver(elg: EventLoopGroup, maxEntries: Int) : + Closeable, + AsyncShutdown { public constructor(elg: EventLoopGroup) + override fun close() + override suspend fun waitForShutdown() } diff --git a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/io/TlsContext.kt b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/io/TlsContext.kt index d28b69de..03905359 100644 --- a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/io/TlsContext.kt +++ b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/io/TlsContext.kt @@ -13,6 +13,7 @@ import aws.sdk.kotlin.crt.Closeable */ public expect class TlsContext(options: TlsContextOptions? = null) : Closeable { public companion object {} + override fun close() } /** diff --git a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/util/CaseInsensitiveMap.kt b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/util/CaseInsensitiveMap.kt index 93ad428c..eea723c2 100644 --- a/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/util/CaseInsensitiveMap.kt +++ b/aws-crt-kotlin/common/src/aws/sdk/kotlin/crt/util/CaseInsensitiveMap.kt @@ -18,7 +18,7 @@ private fun String.toInsensitive(): CaseInsensitiveString = /** * Map of case-insensitive [String] to [Value] */ -internal class CaseInsensitiveMap() : MutableMap { +internal class CaseInsensitiveMap : MutableMap { private val impl: MutableMap = mutableMapOf() override val size: Int diff --git a/aws-crt-kotlin/common/test/aws/sdk/kotlin/crt/auth/credentials/CredentialsProviderTest.kt b/aws-crt-kotlin/common/test/aws/sdk/kotlin/crt/auth/credentials/CredentialsProviderTest.kt index 02af907e..c54cf9b8 100644 --- a/aws-crt-kotlin/common/test/aws/sdk/kotlin/crt/auth/credentials/CredentialsProviderTest.kt +++ b/aws-crt-kotlin/common/test/aws/sdk/kotlin/crt/auth/credentials/CredentialsProviderTest.kt @@ -14,9 +14,9 @@ import kotlin.test.Ignore import kotlin.test.Test import kotlin.test.assertEquals -class CredentialsProviderTest : CrtTest() { - private val EXPECTED_CREDENTIALS = Credentials("access_key_id", "secret_access_key", "session_token") +private val EXPECTED_CREDENTIALS = Credentials("access_key_id", "secret_access_key", "session_token") +class CredentialsProviderTest : CrtTest() { @Ignore // FIXME Enable when Kotlin/Native implementation is complete @Test fun testStaticProvider() = runTest { diff --git a/aws-crt-kotlin/common/test/aws/sdk/kotlin/crt/auth/signing/SigningTest.kt b/aws-crt-kotlin/common/test/aws/sdk/kotlin/crt/auth/signing/SigningTest.kt index 6589c962..64ebb774 100644 --- a/aws-crt-kotlin/common/test/aws/sdk/kotlin/crt/auth/signing/SigningTest.kt +++ b/aws-crt-kotlin/common/test/aws/sdk/kotlin/crt/auth/signing/SigningTest.kt @@ -12,14 +12,14 @@ import aws.sdk.kotlin.crt.io.Uri import kotlinx.coroutines.test.runTest import kotlin.test.* -// ported over from crt-java -class SigningTest : CrtTest() { - private val TEST_ACCESS_KEY_ID: String = "AKIDEXAMPLE" - private val TEST_SECRET_ACCESS_KEY: String = "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY" +private val TEST_ACCESS_KEY_ID: String = "AKIDEXAMPLE" +private val TEST_SECRET_ACCESS_KEY: String = "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY" - // 2015-08-30T12:36:00Z - private val TEST_DATE_EPOCH_MILLI: Long = 1440938160000 +// 2015-08-30T12:36:00Z +private val TEST_DATE_EPOCH_MILLI: Long = 1440938160000 +// ported over from crt-java +class SigningTest : CrtTest() { private fun createSimpleRequest(url: String, method: String, path: String, body: String? = null): HttpRequest = HttpRequest.build { this.method = method this.encodedPath = path diff --git a/aws-crt-kotlin/common/test/aws/sdk/kotlin/crt/http/HttpClientTest.kt b/aws-crt-kotlin/common/test/aws/sdk/kotlin/crt/http/HttpClientTest.kt index d50fb97c..d3f02795 100644 --- a/aws-crt-kotlin/common/test/aws/sdk/kotlin/crt/http/HttpClientTest.kt +++ b/aws-crt-kotlin/common/test/aws/sdk/kotlin/crt/http/HttpClientTest.kt @@ -116,7 +116,9 @@ data class HttpTestResponse(val statusCode: Int, val headers: Headers, val body: if (body != null) { if (other.body == null) return false if (!body.contentEquals(other.body)) return false - } else if (other.body != null) return false + } else if (other.body != null) { + return false + } return true } diff --git a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/CRT.kt b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/CRT.kt index 243ec3fa..899409ec 100644 --- a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/CRT.kt +++ b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/CRT.kt @@ -18,7 +18,9 @@ public actual object CRT { private val initializerMu = Mutex() // protects `initialized` public actual fun initRuntime(block: Config.() -> Unit) { - if (initialized) { return } + if (initialized) { + return + } runBlocking { initializerMu.withLock { diff --git a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/CrtExceptionUtil.kt b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/CrtExceptionUtil.kt index 9fc6951b..bf337cee 100644 --- a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/CrtExceptionUtil.kt +++ b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/CrtExceptionUtil.kt @@ -6,8 +6,7 @@ package aws.sdk.kotlin.crt import software.amazon.awssdk.crt.CrtRuntimeException as CrtRuntimeExceptionJni -private class CrtJniExceptionWrapper(wrapped: CrtRuntimeExceptionJni) : - CrtRuntimeException(wrapped.message, wrapped, wrapped.errorCode) +private class CrtJniExceptionWrapper(wrapped: CrtRuntimeExceptionJni) : CrtRuntimeException(wrapped.message, wrapped, wrapped.errorCode) /** * Wrap any CRT JNI call exception that happens in [block] into an instance of the kotlin equivalent diff --git a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/CachedCredentialsProviderJVM.kt b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/CachedCredentialsProviderJVM.kt index ae349bc9..334f7ee6 100644 --- a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/CachedCredentialsProviderJVM.kt +++ b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/CachedCredentialsProviderJVM.kt @@ -10,7 +10,8 @@ import software.amazon.awssdk.crt.auth.credentials.CachedCredentialsProvider as import software.amazon.awssdk.crt.auth.credentials.CredentialsProvider as CredentialsProviderJni public actual class CachedCredentialsProvider internal actual constructor(builder: CachedCredentialsProviderBuilder) : - CredentialsProvider, JniCredentialsProvider() { + JniCredentialsProvider(), + CredentialsProvider { public actual companion object {} override val jniCredentials: CredentialsProviderJni = diff --git a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/DefaultChainCredentialsProviderJVM.kt b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/DefaultChainCredentialsProviderJVM.kt index 5b72665a..54442999 100644 --- a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/DefaultChainCredentialsProviderJVM.kt +++ b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/DefaultChainCredentialsProviderJVM.kt @@ -9,7 +9,8 @@ import software.amazon.awssdk.crt.auth.credentials.CredentialsProvider as Creden import software.amazon.awssdk.crt.auth.credentials.DefaultChainCredentialsProvider as DefaultChainCredentialsProviderJni public actual class DefaultChainCredentialsProvider internal actual constructor(builder: DefaultChainCredentialsProviderBuilder) : - CredentialsProvider, JniCredentialsProvider() { + JniCredentialsProvider(), + CredentialsProvider { public actual companion object {} override val jniCredentials: CredentialsProviderJni = diff --git a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/EcsCredentialsProviderJVM.kt b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/EcsCredentialsProviderJVM.kt index 919b2d24..d8d19a72 100644 --- a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/EcsCredentialsProviderJVM.kt +++ b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/EcsCredentialsProviderJVM.kt @@ -9,8 +9,10 @@ import software.amazon.awssdk.crt.auth.credentials.CredentialsProvider as Creden import software.amazon.awssdk.crt.auth.credentials.EcsCredentialsProvider as EcsCredentialsProviderJni public actual class EcsCredentialsProvider -internal actual constructor(builder: EcsCredentialsProviderBuilder) : - CredentialsProvider, JniCredentialsProvider() { +internal actual constructor( + builder: EcsCredentialsProviderBuilder, +) : JniCredentialsProvider(), + CredentialsProvider { public actual companion object {} override val jniCredentials: CredentialsProviderJni = diff --git a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/JniCredentialsProvider.kt b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/JniCredentialsProvider.kt index e4960482..e7fec750 100644 --- a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/JniCredentialsProvider.kt +++ b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/JniCredentialsProvider.kt @@ -13,7 +13,10 @@ import software.amazon.awssdk.crt.auth.credentials.CredentialsProvider as Creden /** * Base class for proxying JNI credentials providers */ -public abstract class JniCredentialsProvider : CredentialsProvider, Closeable, AsyncShutdown { +public abstract class JniCredentialsProvider : + CredentialsProvider, + Closeable, + AsyncShutdown { internal abstract val jniCredentials: CredentialsProviderJni override suspend fun getCredentials(): Credentials { diff --git a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/ProfileCredentialsProviderJVM.kt b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/ProfileCredentialsProviderJVM.kt index dce6a0a4..dacabea9 100644 --- a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/ProfileCredentialsProviderJVM.kt +++ b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/ProfileCredentialsProviderJVM.kt @@ -9,8 +9,10 @@ import software.amazon.awssdk.crt.auth.credentials.CredentialsProvider as Creden import software.amazon.awssdk.crt.auth.credentials.ProfileCredentialsProvider as ProfileCredentialsProviderJni public actual class ProfileCredentialsProvider -internal actual constructor(builder: ProfileCredentialsProviderBuilder) : - CredentialsProvider, JniCredentialsProvider() { +internal actual constructor( + builder: ProfileCredentialsProviderBuilder, +) : JniCredentialsProvider(), + CredentialsProvider { public actual companion object {} override val jniCredentials: CredentialsProviderJni = diff --git a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/StaticCredentialsProviderJVM.kt b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/StaticCredentialsProviderJVM.kt index 882be5ac..61c6d239 100644 --- a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/StaticCredentialsProviderJVM.kt +++ b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/StaticCredentialsProviderJVM.kt @@ -10,7 +10,8 @@ import software.amazon.awssdk.crt.auth.credentials.StaticCredentialsProvider as * A credentials provider for a fixed set of credentials */ public actual class StaticCredentialsProvider internal actual constructor(builder: StaticCredentialsProviderBuilder) : - JniCredentialsProvider(), CredentialsProvider { + JniCredentialsProvider(), + CredentialsProvider { public actual companion object {} override val jniCredentials = StaticCredentialsProviderJni.StaticCredentialsProviderBuilder().apply { diff --git a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/StsAssumeRoleCredentialsProviderJVM.kt b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/StsAssumeRoleCredentialsProviderJVM.kt index 431dde6a..6b7402b4 100644 --- a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/StsAssumeRoleCredentialsProviderJVM.kt +++ b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/StsAssumeRoleCredentialsProviderJVM.kt @@ -19,8 +19,10 @@ import software.amazon.awssdk.crt.auth.credentials.StsCredentialsProvider as Sts private const val DEFAULT_DURATION_SECONDS = 3600 public actual class StsAssumeRoleCredentialsProvider -internal actual constructor(builder: StsAssumeRoleCredentialsProviderBuilder) : - CredentialsProvider, JniCredentialsProvider() { +internal actual constructor( + builder: StsAssumeRoleCredentialsProviderBuilder, +) : JniCredentialsProvider(), + CredentialsProvider { public actual companion object {} override val jniCredentials: CredentialsProviderJni = diff --git a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/StsWebIdentityCredentialsProviderJVM.kt b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/StsWebIdentityCredentialsProviderJVM.kt index 5b261ada..a02657db 100644 --- a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/StsWebIdentityCredentialsProviderJVM.kt +++ b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/StsWebIdentityCredentialsProviderJVM.kt @@ -9,8 +9,10 @@ import software.amazon.awssdk.crt.auth.credentials.CredentialsProvider as Creden import software.amazon.awssdk.crt.auth.credentials.StsWebIdentityCredentialsProvider as StsWebIdentityCredentialsProviderJni public actual class StsWebIdentityCredentialsProvider -internal actual constructor(builder: StsWebIdentityCredentialsProviderBuilder) : - CredentialsProvider, JniCredentialsProvider() { +internal actual constructor( + builder: StsWebIdentityCredentialsProviderBuilder, +) : JniCredentialsProvider(), + CredentialsProvider { public actual companion object {} override val jniCredentials: CredentialsProviderJni = diff --git a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/X509CredentialsProviderJVM.kt b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/X509CredentialsProviderJVM.kt index b4555c16..0c22d867 100644 --- a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/X509CredentialsProviderJVM.kt +++ b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/auth/credentials/X509CredentialsProviderJVM.kt @@ -9,7 +9,8 @@ import software.amazon.awssdk.crt.auth.credentials.CredentialsProvider as Creden import software.amazon.awssdk.crt.auth.credentials.X509CredentialsProvider as X509CredentialsProviderJni public actual class X509CredentialsProvider internal actual constructor(builder: X509CredentialsProviderBuilder) : - CredentialsProvider, JniCredentialsProvider() { + JniCredentialsProvider(), + CredentialsProvider { public actual companion object {} diff --git a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/http/HttpClientConnectionManagerJVM.kt b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/http/HttpClientConnectionManagerJVM.kt index ca12819d..54d57f25 100644 --- a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/http/HttpClientConnectionManagerJVM.kt +++ b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/http/HttpClientConnectionManagerJVM.kt @@ -20,7 +20,8 @@ import software.amazon.awssdk.crt.io.SocketOptions as SocketOptionsJni public actual class HttpClientConnectionManager actual constructor( public actual val options: HttpClientConnectionManagerOptions, -) : Closeable, AsyncShutdown { +) : Closeable, + AsyncShutdown { private val jniManager = HttpClientConnectionManagerJni.create(options.into()) @@ -52,11 +53,11 @@ public actual class HttpClientConnectionManager actual constructor( jniManager.releaseConnection(ktConn.jniConn) } - override fun close() { + actual override fun close() { jniManager.close() } - override suspend fun waitForShutdown() { + actual override suspend fun waitForShutdown() { jniManager.shutdownCompleteFuture.await() } } diff --git a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/io/ClientBootstrapJVM.kt b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/io/ClientBootstrapJVM.kt index 18c6f120..1199b38b 100644 --- a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/io/ClientBootstrapJVM.kt +++ b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/io/ClientBootstrapJVM.kt @@ -15,11 +15,11 @@ public actual class ClientBootstrap actual constructor(elg: EventLoopGroup, hr: AsyncShutdown { internal val jniBootstrap = ClientBootstrapJni(elg.jniElg, hr.jniHr) - override fun close() { + actual override fun close() { jniBootstrap.close() } - override suspend fun waitForShutdown() { + actual override suspend fun waitForShutdown() { jniBootstrap.shutdownCompleteFuture.await() } } diff --git a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/io/EventLoopGroupJVM.kt b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/io/EventLoopGroupJVM.kt index bb199632..a9b8ea00 100644 --- a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/io/EventLoopGroupJVM.kt +++ b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/io/EventLoopGroupJVM.kt @@ -18,17 +18,19 @@ import software.amazon.awssdk.crt.io.EventLoopGroup as EventLoopGroupJni * Otherwise, maxThreads will be the number of event loops in the group. * @throws [aws.sdk.kotlin.crt.CrtRuntimeException] If the system is unable to allocate space for a native event loop group */ -public actual class EventLoopGroup actual constructor(maxThreads: Int) : Closeable, AsyncShutdown { +public actual class EventLoopGroup actual constructor(maxThreads: Int) : + Closeable, + AsyncShutdown { internal val jniElg = EventLoopGroupJni(maxThreads) /** * Close this ELG */ - override fun close() { + actual override fun close() { jniElg.close() } - override suspend fun waitForShutdown() { + actual override suspend fun waitForShutdown() { jniElg.shutdownCompleteFuture.await() } } diff --git a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/io/HostResolverJVM.kt b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/io/HostResolverJVM.kt index 1a7feded..559f6a87 100644 --- a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/io/HostResolverJVM.kt +++ b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/io/HostResolverJVM.kt @@ -16,11 +16,11 @@ public actual class HostResolver actual constructor(elg: EventLoopGroup, maxEntr public actual constructor(elg: EventLoopGroup) : this(elg, DEFAULT_MAX_ENTRIES) - override fun close() { + actual override fun close() { jniHr.close() } - override suspend fun waitForShutdown() { + actual override suspend fun waitForShutdown() { // TODO jni HostResolver is missing a shutdown complete future... } } diff --git a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/io/TlsContextJVM.kt b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/io/TlsContextJVM.kt index 8eb4e311..1c3d5cb1 100644 --- a/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/io/TlsContextJVM.kt +++ b/aws-crt-kotlin/jvm/src/aws/sdk/kotlin/crt/io/TlsContextJVM.kt @@ -17,7 +17,7 @@ public actual class TlsContext actual constructor(options: TlsContextOptions?) : public actual companion object { } - override fun close() { + actual override fun close() { jniCtx.close() } } diff --git a/aws-crt-kotlin/jvm/test/aws/sdk/kotlin/crt/auth/credentials/ProfileCredentialsProviderTest.kt b/aws-crt-kotlin/jvm/test/aws/sdk/kotlin/crt/auth/credentials/ProfileCredentialsProviderTest.kt index 3db7b701..64eb9f0b 100644 --- a/aws-crt-kotlin/jvm/test/aws/sdk/kotlin/crt/auth/credentials/ProfileCredentialsProviderTest.kt +++ b/aws-crt-kotlin/jvm/test/aws/sdk/kotlin/crt/auth/credentials/ProfileCredentialsProviderTest.kt @@ -19,6 +19,7 @@ class ProfileCredentialsProviderTest { @Test fun `it should create a provider for a valid profile`() = runBlocking { + val configPath = Files.createTempFile("ProfileCredentialsProviderTest_config", "") val credsPath = Files.createTempFile("ProfileCredentialsProviderTest_creds", "") credsPath.toFile().writeText( """ @@ -30,6 +31,7 @@ class ProfileCredentialsProviderTest { try { val provider = ProfileCredentialsProvider.build { + configFileName = configPath.toString() credentialsFileName = credsPath.toString() } val actual = provider.getCredentials() diff --git a/aws-crt-kotlin/jvm/test/aws/sdk/kotlin/crt/http/HttpRequestResponseTest.kt b/aws-crt-kotlin/jvm/test/aws/sdk/kotlin/crt/http/HttpRequestResponseTest.kt index fd1065cc..d2404c80 100644 --- a/aws-crt-kotlin/jvm/test/aws/sdk/kotlin/crt/http/HttpRequestResponseTest.kt +++ b/aws-crt-kotlin/jvm/test/aws/sdk/kotlin/crt/http/HttpRequestResponseTest.kt @@ -17,11 +17,11 @@ import org.mockserver.model.HttpRequest.request import org.mockserver.model.HttpResponse.response import kotlin.test.* +private val TEST_DOC_LINE = "This is a sample to prove that http downloads and uploads work." +private val TEST_DOC_SHA256 = "c7fdb5314b9742467b16bd5ea2f8012190b5e2c44a005f7984f89aab58219534" + @TestInstance(TestInstance.Lifecycle.PER_CLASS) class HttpRequestResponseTest : HttpClientTest() { - private val TEST_DOC_LINE = - "This is a sample to prove that http downloads and uploads work. It doesn't really matter what's in here, we mainly just need to verify the downloads and uploads work." - private val TEST_DOC_SHA256 = "c7fdb5314b9742467b16bd5ea2f8012190b5e2c44a005f7984f89aab58219534" lateinit var mockServer: MockServerClient lateinit var url: String diff --git a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/Allocator.kt b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/Allocator.kt index 19f65243..1a04f40f 100644 --- a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/Allocator.kt +++ b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/Allocator.kt @@ -12,7 +12,9 @@ internal object Allocator { } @OptIn(ExperimentalForeignApi::class) -internal class AwsAllocator : NativeFreeablePlacement, CValuesRef() { +internal class AwsAllocator : + CValuesRef(), + NativeFreeablePlacement { internal val allocator: CPointer = s_crt_kotlin_allocator ?: throw CrtRuntimeException("CRT allocator is not initialized, ensure CRT.initRuntime() was called.") diff --git a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/CRTNative.kt b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/CRTNative.kt index 633c8255..2ec4d3c5 100644 --- a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/CRTNative.kt +++ b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/CRTNative.kt @@ -23,7 +23,9 @@ public actual object CRT { */ public actual fun initRuntime(block: Config.() -> Unit): Unit = runBlocking { initializerMu.withLock { - if (initialized) { return@runBlocking } + if (initialized) { + return@runBlocking + } val config = Config().apply(block) diff --git a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/Logging.kt b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/Logging.kt index b6a08f7d..69ba4c51 100644 --- a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/Logging.kt +++ b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/Logging.kt @@ -17,7 +17,9 @@ internal object Logging { private val initializerMu = Mutex() // protects `initialized` internal fun initialize(config: Config) { - if (initialized) { return } + if (initialized) { + return + } runBlocking { initializerMu.withLock { diff --git a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/CachedCredentialsProviderNative.kt b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/CachedCredentialsProviderNative.kt index 8e20b5b8..67b7cdda 100644 --- a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/CachedCredentialsProviderNative.kt +++ b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/CachedCredentialsProviderNative.kt @@ -5,19 +5,18 @@ package aws.sdk.kotlin.crt.auth.credentials -public actual class CachedCredentialsProvider internal actual constructor(builder: CachedCredentialsProviderBuilder) : - CredentialsProvider { +public actual class CachedCredentialsProvider internal actual constructor(builder: CachedCredentialsProviderBuilder) : CredentialsProvider { public actual companion object {} - override suspend fun getCredentials(): Credentials { + actual override suspend fun getCredentials(): Credentials { TODO("Not yet implemented") } - override fun close() { + actual override fun close() { TODO("Not yet implemented") } - override suspend fun waitForShutdown() { + actual override suspend fun waitForShutdown() { TODO("Not yet implemented") } } diff --git a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/DefaultChainCredentialsProviderNative.kt b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/DefaultChainCredentialsProviderNative.kt index b6ed9eea..c192bc45 100644 --- a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/DefaultChainCredentialsProviderNative.kt +++ b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/DefaultChainCredentialsProviderNative.kt @@ -5,19 +5,18 @@ package aws.sdk.kotlin.crt.auth.credentials -public actual class DefaultChainCredentialsProvider internal actual constructor(builder: DefaultChainCredentialsProviderBuilder) : - CredentialsProvider { +public actual class DefaultChainCredentialsProvider internal actual constructor(builder: DefaultChainCredentialsProviderBuilder) : CredentialsProvider { public actual companion object {} - override suspend fun getCredentials(): Credentials { + actual override suspend fun getCredentials(): Credentials { TODO("Not yet implemented") } - override fun close() { + actual override fun close() { TODO("Not yet implemented") } - override suspend fun waitForShutdown() { + actual override suspend fun waitForShutdown() { TODO("Not yet implemented") } } diff --git a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/EcsCredentialsProviderNative.kt b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/EcsCredentialsProviderNative.kt index 81cc45ae..940271c4 100644 --- a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/EcsCredentialsProviderNative.kt +++ b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/EcsCredentialsProviderNative.kt @@ -6,19 +6,20 @@ package aws.sdk.kotlin.crt.auth.credentials public actual class EcsCredentialsProvider -internal actual constructor(builder: EcsCredentialsProviderBuilder) : - CredentialsProvider { +internal actual constructor( + builder: EcsCredentialsProviderBuilder, +) : CredentialsProvider { public actual companion object {} - override suspend fun getCredentials(): Credentials { + actual override suspend fun getCredentials(): Credentials { TODO("Not yet implemented") } - override fun close() { + actual override fun close() { TODO("Not yet implemented") } - override suspend fun waitForShutdown() { + actual override suspend fun waitForShutdown() { TODO("Not yet implemented") } } diff --git a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/ProfileCredentialsProviderNative.kt b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/ProfileCredentialsProviderNative.kt index d681bb97..9ab83da7 100644 --- a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/ProfileCredentialsProviderNative.kt +++ b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/ProfileCredentialsProviderNative.kt @@ -6,19 +6,20 @@ package aws.sdk.kotlin.crt.auth.credentials public actual class ProfileCredentialsProvider -internal actual constructor(builder: ProfileCredentialsProviderBuilder) : - CredentialsProvider { +internal actual constructor( + builder: ProfileCredentialsProviderBuilder, +) : CredentialsProvider { public actual companion object {} - override suspend fun getCredentials(): Credentials { + actual override suspend fun getCredentials(): Credentials { TODO("Not yet implemented") } - override fun close() { + actual override fun close() { TODO("Not yet implemented") } - override suspend fun waitForShutdown() { + actual override suspend fun waitForShutdown() { TODO("Not yet implemented") } } diff --git a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/StaticCredentialsProviderNative.kt b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/StaticCredentialsProviderNative.kt index 9d99dd8c..b1d40c39 100644 --- a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/StaticCredentialsProviderNative.kt +++ b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/StaticCredentialsProviderNative.kt @@ -12,7 +12,7 @@ public actual class StaticCredentialsProvider internal actual constructor(builde private val credentials = Credentials(builder.accessKeyId!!, builder.secretAccessKey!!, builder.sessionToken) public actual companion object {} - override suspend fun getCredentials(): Credentials = credentials - override fun close() { } - override suspend fun waitForShutdown() { } + actual override suspend fun getCredentials(): Credentials = credentials + actual override fun close() { } + actual override suspend fun waitForShutdown() { } } diff --git a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/StsAssumeRoleCredentialsProviderNative.kt b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/StsAssumeRoleCredentialsProviderNative.kt index 14d113e6..ebff80dd 100644 --- a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/StsAssumeRoleCredentialsProviderNative.kt +++ b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/StsAssumeRoleCredentialsProviderNative.kt @@ -6,19 +6,20 @@ package aws.sdk.kotlin.crt.auth.credentials public actual class StsAssumeRoleCredentialsProvider -internal actual constructor(builder: StsAssumeRoleCredentialsProviderBuilder) : - CredentialsProvider { +internal actual constructor( + builder: StsAssumeRoleCredentialsProviderBuilder, +) : CredentialsProvider { public actual companion object {} - override suspend fun getCredentials(): Credentials { + actual override suspend fun getCredentials(): Credentials { TODO("Not yet implemented") } - override fun close() { + actual override fun close() { TODO("Not yet implemented") } - override suspend fun waitForShutdown() { + actual override suspend fun waitForShutdown() { TODO("Not yet implemented") } } diff --git a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/StsWebIdentityCredentialsProviderNative.kt b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/StsWebIdentityCredentialsProviderNative.kt index 817043de..2465c451 100644 --- a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/StsWebIdentityCredentialsProviderNative.kt +++ b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/StsWebIdentityCredentialsProviderNative.kt @@ -6,19 +6,20 @@ package aws.sdk.kotlin.crt.auth.credentials public actual class StsWebIdentityCredentialsProvider -internal actual constructor(builder: StsWebIdentityCredentialsProviderBuilder) : - CredentialsProvider { +internal actual constructor( + builder: StsWebIdentityCredentialsProviderBuilder, +) : CredentialsProvider { public actual companion object {} - override suspend fun getCredentials(): Credentials { + actual override suspend fun getCredentials(): Credentials { TODO("Not yet implemented") } - override fun close() { + actual override fun close() { TODO("Not yet implemented") } - override suspend fun waitForShutdown() { + actual override suspend fun waitForShutdown() { TODO("Not yet implemented") } } diff --git a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/X509CredentialsProviderNative.kt b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/X509CredentialsProviderNative.kt index 77e52921..9939db16 100644 --- a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/X509CredentialsProviderNative.kt +++ b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/credentials/X509CredentialsProviderNative.kt @@ -5,20 +5,19 @@ package aws.sdk.kotlin.crt.auth.credentials -public actual class X509CredentialsProvider internal actual constructor(builder: X509CredentialsProviderBuilder) : - CredentialsProvider { +public actual class X509CredentialsProvider internal actual constructor(builder: X509CredentialsProviderBuilder) : CredentialsProvider { public actual companion object {} - override suspend fun getCredentials(): Credentials { + actual override suspend fun getCredentials(): Credentials { TODO("Not yet implemented") } - override fun close() { + actual override fun close() { TODO("Not yet implemented") } - override suspend fun waitForShutdown() { + actual override suspend fun waitForShutdown() { TODO("Not yet implemented") } } diff --git a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/signing/AwsSignerNative.kt b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/signing/AwsSignerNative.kt index 8260602b..03040c4b 100644 --- a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/signing/AwsSignerNative.kt +++ b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/auth/signing/AwsSignerNative.kt @@ -166,6 +166,7 @@ private fun CPointer.getSignature(): ByteArray { private fun AwsSigningAlgorithm.toNativeSigningAlgorithm(): aws_signing_algorithm = when (this) { AwsSigningAlgorithm.SIGV4 -> aws_signing_algorithm.AWS_SIGNING_ALGORITHM_V4 AwsSigningAlgorithm.SIGV4_ASYMMETRIC -> aws_signing_algorithm.AWS_SIGNING_ALGORITHM_V4_ASYMMETRIC + AwsSigningAlgorithm.SIGV4_S3EXPRESS -> aws_signing_algorithm.AWS_SIGNING_ALGORITHM_V4_S3EXPRESS } private fun AwsSignatureType.toNativeSignatureType(): aws_signature_type = when (this) { @@ -220,7 +221,9 @@ private fun AwsSigningConfig.toNativeSigningConfig(): CPointer Boolean private fun nativeShouldSignHeaderFn(headerName: CPointer?, userData: COpaquePointer?): Boolean { checkNotNull(headerName) { "aws_should_sign_header_fn expected non-null header name" } - if (userData == null) { return true } + if (userData == null) { + return true + } val kShouldSignHeaderFn = userData.asStableRef().get() val kHeaderName = headerName.pointed.toKString() diff --git a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/http/HttpClientConnectionManagerNative.kt b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/http/HttpClientConnectionManagerNative.kt index f56ebb59..b4b84daa 100644 --- a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/http/HttpClientConnectionManagerNative.kt +++ b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/http/HttpClientConnectionManagerNative.kt @@ -23,7 +23,8 @@ import kotlin.coroutines.suspendCoroutine public actual class HttpClientConnectionManager actual constructor( public actual val options: HttpClientConnectionManagerOptions, -) : Closeable, AsyncShutdown { +) : Closeable, + AsyncShutdown { public actual val managerMetrics: HttpManagerMetrics get() = memScoped { val metrics = alloc() @@ -146,11 +147,11 @@ public actual class HttpClientConnectionManager actual constructor( ) { "aws_http_connection_manager_release_connection()" } } - override suspend fun waitForShutdown() { + actual override suspend fun waitForShutdown() { shutdownComplete.receiveCatching().getOrNull() } - override fun close() { + actual override fun close() { aws_http_connection_manager_release(manager) } } diff --git a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/http/HttpClientConnectionNative.kt b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/http/HttpClientConnectionNative.kt index ac2b8d66..e36615e9 100644 --- a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/http/HttpClientConnectionNative.kt +++ b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/http/HttpClientConnectionNative.kt @@ -21,7 +21,9 @@ import platform.posix.size_t internal class HttpClientConnectionNative( private val manager: HttpClientConnectionManager, override val ptr: CPointer, -) : Closeable, HttpClientConnection, NativeHandle { +) : Closeable, + HttpClientConnection, + NativeHandle { override val id: String = ptr.rawValue.toString() override fun makeRequest(httpReq: HttpRequest, handler: HttpStreamResponseHandler): HttpStream { diff --git a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/http/HttpStreamNative.kt b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/http/HttpStreamNative.kt index 549921c9..897da883 100644 --- a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/http/HttpStreamNative.kt +++ b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/http/HttpStreamNative.kt @@ -18,7 +18,8 @@ import kotlin.coroutines.suspendCoroutine internal class HttpStreamNative( override val ptr: CPointer, -) : HttpStream, NativeHandle { +) : HttpStream, + NativeHandle { override val responseStatusCode: Int get() { @@ -78,7 +79,7 @@ internal class HttpStreamNative( } if (isFinalChunk) { - val chunkOpts = cValue() { + val chunkOpts = cValue { chunk_data_size = 0.convert() } diff --git a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/io/ClientBootstrapNative.kt b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/io/ClientBootstrapNative.kt index 8af99a63..fdd3e576 100644 --- a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/io/ClientBootstrapNative.kt +++ b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/io/ClientBootstrapNative.kt @@ -19,7 +19,9 @@ import libcrt.aws_client_bootstrap_release public actual class ClientBootstrap actual constructor( elg: EventLoopGroup, hr: HostResolver, -) : NativeHandle, Closeable, AsyncShutdown { +) : NativeHandle, + Closeable, + AsyncShutdown { private val shutdownCompleteChannel = shutdownChannel() private val channelStableRef = StableRef.create(shutdownCompleteChannel) override val ptr: CPointer @@ -37,11 +39,11 @@ public actual class ClientBootstrap actual constructor( } } - override suspend fun waitForShutdown() { + actual override suspend fun waitForShutdown() { shutdownCompleteChannel.receive() } - override fun close() { + actual override fun close() { aws_client_bootstrap_release(ptr) } } diff --git a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/io/EventLoopGroupNative.kt b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/io/EventLoopGroupNative.kt index 89d33383..86a79ff6 100644 --- a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/io/EventLoopGroupNative.kt +++ b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/io/EventLoopGroupNative.kt @@ -21,7 +21,10 @@ import libcrt.* * @throws [aws.sdk.kotlin.crt.CrtRuntimeException] If the system is unable to allocate space for a native event loop group */ @OptIn(ExperimentalForeignApi::class) -public actual class EventLoopGroup actual constructor(maxThreads: Int) : NativeHandle, Closeable, AsyncShutdown { +public actual class EventLoopGroup actual constructor(maxThreads: Int) : + NativeHandle, + Closeable, + AsyncShutdown { override val ptr: CPointer @@ -39,11 +42,11 @@ public actual class EventLoopGroup actual constructor(maxThreads: Int) : NativeH } } - override suspend fun waitForShutdown() { + actual override suspend fun waitForShutdown() { shutdownCompleteChannel.receive() } - override fun close() { + actual override fun close() { aws_event_loop_group_release(ptr) } } diff --git a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/io/HostResolverNative.kt b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/io/HostResolverNative.kt index 305c98a7..aa40c0de 100644 --- a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/io/HostResolverNative.kt +++ b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/io/HostResolverNative.kt @@ -13,7 +13,10 @@ import kotlinx.cinterop.* import libcrt.* @OptIn(ExperimentalForeignApi::class) -public actual class HostResolver actual constructor(elg: EventLoopGroup, maxEntries: Int) : NativeHandle, Closeable, AsyncShutdown { +public actual class HostResolver actual constructor(elg: EventLoopGroup, maxEntries: Int) : + NativeHandle, + Closeable, + AsyncShutdown { public actual constructor(elg: EventLoopGroup) : this(elg, DEFAULT_MAX_ENTRIES) override val ptr: CPointer @@ -40,11 +43,11 @@ public actual class HostResolver actual constructor(elg: EventLoopGroup, maxEntr } } - override suspend fun waitForShutdown() { + actual override suspend fun waitForShutdown() { shutdownCompleteChannel.receive() } - override fun close() { + actual override fun close() { aws_host_resolver_release(ptr) } } diff --git a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/io/TlsContextNative.kt b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/io/TlsContextNative.kt index 00a660cd..d5c60b43 100644 --- a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/io/TlsContextNative.kt +++ b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/io/TlsContextNative.kt @@ -14,7 +14,9 @@ import aws.sdk.kotlin.crt.util.toAwsString import kotlinx.cinterop.* import libcrt.* -public actual class TlsContext actual constructor(options: TlsContextOptions?) : NativeHandle, Closeable { +public actual class TlsContext actual constructor(options: TlsContextOptions?) : + NativeHandle, + Closeable { private val tlsCtxOpts: aws_tls_ctx_options = Allocator.Default.alloc() public actual companion object {} @@ -105,7 +107,7 @@ public actual class TlsContext actual constructor(options: TlsContextOptions?) : } } - override fun close() { + actual override fun close() { aws_tls_ctx_release(ptr) aws_tls_ctx_options_clean_up(tlsCtxOpts.ptr) Allocator.Default.free(tlsCtxOpts.rawPtr) diff --git a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/util/hashing/CrcNative.kt b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/util/hashing/CrcNative.kt index 6d36a7a5..fd671e39 100644 --- a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/util/hashing/CrcNative.kt +++ b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/util/hashing/CrcNative.kt @@ -44,9 +44,13 @@ internal class Crc(val checksumFn: AwsChecksumsCrcFunction) : HashFunction { */ public class Crc32 : HashFunction { private val crc32 = Crc(::aws_checksums_crc32) - override fun update(input: ByteArray, offset: Int, length: Int) { crc32.update(input, offset, length) } + override fun update(input: ByteArray, offset: Int, length: Int) { + crc32.update(input, offset, length) + } override fun digest(): ByteArray = crc32.digest() - override fun reset() { crc32.reset() } + override fun reset() { + crc32.reset() + } } /** @@ -54,7 +58,11 @@ public class Crc32 : HashFunction { */ public class Crc32c : HashFunction { private val crc32c = Crc(::aws_checksums_crc32c) - override fun update(input: ByteArray, offset: Int, length: Int) { crc32c.update(input, offset, length) } + override fun update(input: ByteArray, offset: Int, length: Int) { + crc32c.update(input, offset, length) + } override fun digest(): ByteArray = crc32c.digest() - override fun reset() { crc32c.reset() } + override fun reset() { + crc32c.reset() + } } diff --git a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/util/hashing/ShaNative.kt b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/util/hashing/ShaNative.kt index 9f85f934..c8db8f9e 100644 --- a/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/util/hashing/ShaNative.kt +++ b/aws-crt-kotlin/native/src/aws/sdk/kotlin/crt/util/hashing/ShaNative.kt @@ -19,9 +19,13 @@ internal typealias InitializeHashFn = ( */ public class Sha1 : HashFunction { private val sha1 = Sha(::aws_sha1_new) - override fun update(input: ByteArray, offset: Int, length: Int) { sha1.update(input, offset, length) } + override fun update(input: ByteArray, offset: Int, length: Int) { + sha1.update(input, offset, length) + } override fun digest(): ByteArray = sha1.digest() - override fun reset() { sha1.reset() } + override fun reset() { + sha1.reset() + } } /** @@ -29,9 +33,13 @@ public class Sha1 : HashFunction { */ public class Sha256 : HashFunction { private val sha256 = Sha(::aws_sha256_new) - override fun update(input: ByteArray, offset: Int, length: Int) { sha256.update(input, offset, length) } + override fun update(input: ByteArray, offset: Int, length: Int) { + sha256.update(input, offset, length) + } override fun digest(): ByteArray = sha256.digest() - override fun reset() { sha256.reset() } + override fun reset() { + sha256.reset() + } } internal class Sha(val initializeFn: InitializeHashFn) : HashFunction { diff --git a/build.gradle.kts b/build.gradle.kts index b99a0406..2079c168 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,6 +23,14 @@ buildscript { plugins { id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2" alias(libs.plugins.kotlin.multiplatform) apply false + alias(libs.plugins.aws.kotlin.repo.tools.kmp) + alias(libs.plugins.aws.kotlin.repo.tools.artifactsizemetrics) +} + +artifactSizeMetrics { + artifactPrefixes = setOf(":aws-crt-kotlin") + significantChangeThresholdPercentage = 5.0 + projectRepositoryName = "aws-crt-kotlin" } allprojects { @@ -30,6 +38,9 @@ allprojects { mavenLocal() mavenCentral() } + + // Enables running `./gradlew allDeps` to get a comprehensive list of dependencies for every subproject + tasks.register("allDeps") { } } subprojects { diff --git a/crt/aws-c-auth b/crt/aws-c-auth index 0d2aa00a..48d647bf 160000 --- a/crt/aws-c-auth +++ b/crt/aws-c-auth @@ -1 +1 @@ -Subproject commit 0d2aa00ae70c699fcb14d0338c1b07a58b9eb24b +Subproject commit 48d647bf43f8872e4dc5ec6343b0c5974195fbdd diff --git a/crt/aws-c-cal b/crt/aws-c-cal index 314fc555..2cb1d2ea 160000 --- a/crt/aws-c-cal +++ b/crt/aws-c-cal @@ -1 +1 @@ -Subproject commit 314fc555846ac7bf2cc68a117c99a6af26f7043e +Subproject commit 2cb1d2eac925e2dbc45025eb89af82bd790c23a0 diff --git a/crt/aws-c-common b/crt/aws-c-common index 42119c5a..faa6c0f0 160000 --- a/crt/aws-c-common +++ b/crt/aws-c-common @@ -1 +1 @@ -Subproject commit 42119c5a1c191f397e3ad770cd900104e050ee34 +Subproject commit faa6c0f00802fc861e7252404f65fb1e0617ca8e diff --git a/crt/aws-c-compression b/crt/aws-c-compression index ea1d421a..f36d0167 160000 --- a/crt/aws-c-compression +++ b/crt/aws-c-compression @@ -1 +1 @@ -Subproject commit ea1d421a421ad83a540309a94c38d50b6a5d836b +Subproject commit f36d01672d61e49d96a777870d456f66fa391cd4 diff --git a/crt/aws-c-http b/crt/aws-c-http index 98ec73ad..ffa68051 160000 --- a/crt/aws-c-http +++ b/crt/aws-c-http @@ -1 +1 @@ -Subproject commit 98ec73ad0c18b78ba08d40b4e60d97abf794f24d +Subproject commit ffa68051dc3ef5a81181451b9779a7f3a26202a6 diff --git a/crt/aws-c-io b/crt/aws-c-io index 5afc9443..e3637404 160000 --- a/crt/aws-c-io +++ b/crt/aws-c-io @@ -1 +1 @@ -Subproject commit 5afc94435cc0c0b3dc33279dd62552ea15bbea0c +Subproject commit e36374047beadc72a0eb6df14ce3cbc822a789a3 diff --git a/crt/aws-c-mqtt b/crt/aws-c-mqtt index 74da9cad..77d6f00e 160000 --- a/crt/aws-c-mqtt +++ b/crt/aws-c-mqtt @@ -1 +1 @@ -Subproject commit 74da9cadfa9dfd2179479fdc445617f5da3261ba +Subproject commit 77d6f00e89b10e3263d8a17576ec8e91c45b4606 diff --git a/crt/aws-c-sdkutils b/crt/aws-c-sdkutils index 638fdd65..4658412a 160000 --- a/crt/aws-c-sdkutils +++ b/crt/aws-c-sdkutils @@ -1 +1 @@ -Subproject commit 638fdd6548df85c599f82db7ea70fd9e44917ef5 +Subproject commit 4658412a61ad5749db92a8d1e0717cb5e76ada1c diff --git a/crt/aws-checksums b/crt/aws-checksums index aac442a2..ce04ab00 160000 --- a/crt/aws-checksums +++ b/crt/aws-checksums @@ -1 +1 @@ -Subproject commit aac442a2dbbb5e72d0a3eca8313cf65e7e1cac2f +Subproject commit ce04ab00b3ecc41912f478bfedca39f8e1919d6b diff --git a/crt/aws-lc b/crt/aws-lc index 6d9a7675..81283801 160000 --- a/crt/aws-lc +++ b/crt/aws-lc @@ -1 +1 @@ -Subproject commit 6d9a7675d1f7c2f159b76e4ade309220d54d96f4 +Subproject commit 81283801a7efc1076ab91c2ccc3616b3d6f00828 diff --git a/crt/s2n b/crt/s2n index d9169425..9cd117f3 160000 --- a/crt/s2n +++ b/crt/s2n @@ -1 +1 @@ -Subproject commit d9169425b7db7aa28c52a6efb8c087c68d1dbd16 +Subproject commit 9cd117f3d9a94912d5e8f2a61ffbfd31f11d2946 diff --git a/gradle.properties b/gradle.properties index 50fa165a..7de9f368 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ kotlin.daemon.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=1G # aws-crt-kotlin -sdkVersion=0.8.5-SNAPSHOT +sdkVersion=0.8.11-SNAPSHOT # publishing publishGroupName=aws.sdk.kotlin.crt \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7c560d7b..3e9d285b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,11 +1,11 @@ [versions] -kotlin-version = "1.9.22" +kotlin-version = "2.0.21" -aws-kotlin-repo-tools-version = "0.4.0" +aws-kotlin-repo-tools-version = "0.4.13" # libs -crt-java-version = "0.29.6" -coroutines-version = "1.7.3" +crt-java-version = "0.31.3" +coroutines-version = "1.9.0" # testing junit-version = "5.10.1" @@ -43,4 +43,5 @@ mockserver-netty = { module = "org.mock-server:mockserver-netty", version.ref = [plugins] kotlin-multiplatform = {id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin-version" } -aws-kotlin-repo-tools-kmp = { id = "aws.sdk.kotlin.gradle.kmp", version.ref = "aws-kotlin-repo-tools-version" } \ No newline at end of file +aws-kotlin-repo-tools-kmp = { id = "aws.sdk.kotlin.gradle.kmp", version.ref = "aws-kotlin-repo-tools-version" } +aws-kotlin-repo-tools-artifactsizemetrics = { id = "aws.sdk.kotlin.gradle.artifactsizemetrics", version.ref = "aws-kotlin-repo-tools-version" } diff --git a/settings.gradle.kts b/settings.gradle.kts index 8168f850..a4303b91 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -4,6 +4,7 @@ */ pluginManagement { repositories { + mavenLocal() mavenCentral() gradlePluginPortal() maven {