Skip to content
Open
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
8 changes: 0 additions & 8 deletions aws-runtime/aws-config/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -203,18 +203,10 @@ NOTE: We need the following tasks to depend on codegen for gradle caching/up-to-
*/
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
dependsOn(tasks.generateSmithyProjections)

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

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

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompileCommon> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public class ImdsCredentialsProvider(
private suspend fun loadProfile() = try {
client.value.get(CREDENTIALS_BASE_PATH)
} catch (ex: EC2MetadataError) {
if (ex.statusCode == HttpStatusCode.NotFound.value) {
if (ex.status == HttpStatusCode.NotFound) {
coroutineContext.info<ImdsCredentialsProvider> {
"Received 404 from IMDS when loading profile information. Hint: This instance may not have an " +
"IAM role associated."
Expand All @@ -142,7 +142,7 @@ public class ImdsCredentialsProvider(
}

private suspend fun useCachedCredentials(ex: Exception): Credentials? = when {
ex is IOException || ex is EC2MetadataError && ex.statusCode == HttpStatusCode.InternalServerError.value -> {
ex is IOException || ex is EC2MetadataError && ex.status == HttpStatusCode.InternalServerError -> {
mu.withLock {
previousCredentials?.apply { nextRefresh = clock.now() + DEFAULT_CREDENTIALS_REFRESH_SECONDS.seconds }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,4 @@ public fun AccountIdEndpointMode.toBusinessMetric(): BusinessMetric = when (this
AccountIdEndpointMode.PREFERRED -> SmithyBusinessMetric.ACCOUNT_ID_MODE_PREFERRED
AccountIdEndpointMode.DISABLED -> SmithyBusinessMetric.ACCOUNT_ID_MODE_DISABLED
AccountIdEndpointMode.REQUIRED -> SmithyBusinessMetric.ACCOUNT_ID_MODE_REQUIRED
else -> throw IllegalStateException("Unexpected AccountIdEndpointMode value: ${this::class.simpleName}")
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ internal class TokenMiddleware(
return try {
when (call.response.status) {
HttpStatusCode.OK -> {
val ttl = call.response.headers[X_AWS_EC2_METADATA_TOKEN_TTL_SECONDS]?.toLong() ?: throw EC2MetadataError(200, "No TTL provided in IMDS response")
val token = call.response.body.readAll() ?: throw EC2MetadataError(200, "No token provided in IMDS response")
val ttl = call.response.headers[X_AWS_EC2_METADATA_TOKEN_TTL_SECONDS]?.toLong() ?: throw EC2MetadataError(call.response.status, "No TTL provided in IMDS response")
val token = call.response.body.readAll() ?: throw EC2MetadataError(call.response.status, "No token provided in IMDS response")
val expires = clock.now() + ttl.seconds
Token(token, expires)
}
Expand All @@ -76,7 +76,7 @@ internal class TokenMiddleware(
HttpStatusCode.Forbidden -> "Request forbidden: IMDS is disabled or the caller has insufficient permissions."
else -> "Failed to retrieve IMDS token"
}
throw EC2MetadataError(call.response.status.value, message)
throw EC2MetadataError(call.response.status, message)
}
}
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class ImdsClientTest {
client.get("/latest/metadata")
}

assertEquals(HttpStatusCode.Forbidden.value, ex.statusCode)
assertEquals(HttpStatusCode.Forbidden, ex.status)
connection.assertRequests()
}

Expand Down
7 changes: 4 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
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.tasks.KotlinCompile

buildscript {
// NOTE: buildscript classpath for the root project is the parent classloader for the subprojects, we
Expand Down Expand Up @@ -38,9 +39,9 @@ val testJavaVersion = typedProp<String>("test.java.version")?.let {
}

allprojects {
if (rootProject.typedProp<Boolean>("kotlinWarningsAsErrors") == true) {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions.allWarningsAsErrors = true
tasks.withType<KotlinCompile> {
compilerOptions {
allWarningsAsErrors = true
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ internal fun String.toEndpointUrlConfigNames(): EndpointUrlConfigNames = Endpoin
// for our client names
// e.g. sdkId "Elasticsearch Service" -> client name "ElasticsearchClient", prop "aws.endpointUrlElasticsearch"
private object JvmSystemPropertySuffix : StringTransformer {
override fun transform(id: String): String =
id.toPascalCase().removeSuffix("Service")
override fun transform(input: String): String =
input.toPascalCase().removeSuffix("Service")
}
1 change: 0 additions & 1 deletion dokka-aws/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ tasks.withType<KotlinCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
freeCompilerArgs.add("-Xjdk-release=1.8")
allWarningsAsErrors.set(false) // FIXME Dokka bundles stdlib into the classpath, causing an unfixable warning
}
}

Expand Down
6 changes: 6 additions & 0 deletions hll/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ subprojects {
optinAnnotations.forEach(languageSettings::optIn)
}

named("commonMain") {
dependencies {
api(project(":aws-runtime:aws-core")) // for InternalSdkApi annotation
}
}

named("commonTest") {
dependencies {
implementation(libraries.kotest.assertions.core)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ tasks.withType<KotlinCompile> {
dependsOn(generateSdkVersionFile)
dependsOn(generateKotlinVersionFile)
dependsOn(generateSmithyKotlinVersionFile)
compilerOptions {
allWarningsAsErrors = false // FIXME Re-enable warnings as errors SDK-KT-787
}
}

tasks.withType<Test> {
Expand Down
2 changes: 1 addition & 1 deletion services/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ subprojects {

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions {
allWarningsAsErrors.set(false) // FIXME Tons of errors occur in generated code
allWarningsAsErrors.set(false) // FIXME Tons of errors occur in generated code. Can we work around errors from deprecated service fields / APIs?
jvmTarget.set(JvmTarget.JVM_1_8) // fixes outgoing variant metadata: https://github.com/smithy-lang/smithy-kotlin/issues/258
freeCompilerArgs.add("-Xjdk-release=1.8")
}
Expand Down
1 change: 0 additions & 1 deletion tests/codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ subprojects {

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
dependsOn(tasks.generateSmithyProjections)
compilerOptions.allWarningsAsErrors = false
}

tasks.generateSmithyProjections {
Expand Down
Loading