Skip to content

Commit 5997e2b

Browse files
authored
chore: fix warnings (#499)
1 parent 4b0a539 commit 5997e2b

File tree

18 files changed

+89
-13
lines changed

18 files changed

+89
-13
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
run: |
3535
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')"
3636
chmod a+x builder.pyz
37+
echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties
3738
./builder.pyz build -p ${{ env.PACKAGE_NAME }}
3839
3940
macos-compat:
@@ -53,6 +54,7 @@ jobs:
5354
run: |
5455
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')"
5556
chmod a+x builder.pyz
57+
echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties
5658
./builder.pyz build -p ${{ env.PACKAGE_NAME }}
5759
5860
windows-compat:
@@ -82,4 +84,5 @@ jobs:
8284
run: |
8385
python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')"
8486
chmod a+x builder
87+
echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties
8588
./builder build -p ${{ env.PACKAGE_NAME }} --spec downstream

benchmarks/serde-benchmarks/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ platforms.forEach { platform ->
2727
apply(from = rootProject.file("gradle/${platform}.gradle"))
2828
}
2929

30-
val experimentalAnnotations = listOf("kotlin.RequiresOptIn", "aws.smithy.kotlin.runtime.util.InternalApi")
30+
val optinAnnotations = listOf("kotlin.RequiresOptIn", "aws.smithy.kotlin.runtime.util.InternalApi")
3131

3232
kotlin {
3333
sourceSets {
@@ -39,7 +39,7 @@ kotlin {
3939
kotlin.srcDir("$platform/$srcDir")
4040
resources.srcDir("$platform/${resourcesPrefix}resources")
4141
languageSettings.progressiveMode = true
42-
experimentalAnnotations.forEach { languageSettings.optIn(it) }
42+
optinAnnotations.forEach { languageSettings.optIn(it) }
4343
}
4444

4545
val kotlinxBenchmarkVersion: String by project

build.gradle.kts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
* SPDX-License-Identifier: Apache-2.0.
44
*/
5+
import java.util.Properties
6+
57
buildscript {
68
repositories {
79
mavenCentral()
@@ -29,7 +31,25 @@ allprojects {
2931
}
3032
}
3133

32-
if (project.properties["kotlinWarningsAsErrors"]?.toString()?.toBoolean() == true) {
34+
val localProperties: Map<String, Any> by lazy {
35+
val props = Properties()
36+
37+
listOf(
38+
File(rootProject.projectDir, "local.properties"), // Project-specific local properties
39+
File(rootProject.projectDir.parent, "local.properties"), // Workspace-specific local properties
40+
File(System.getProperty("user.home"), ".sdkdev/local.properties"), // User-specific local properties
41+
)
42+
.filter(File::exists)
43+
.map(File::inputStream)
44+
.forEach(props::load)
45+
46+
props.mapKeys { (k, _) -> k.toString() }
47+
}
48+
49+
fun Project.prop(name: String): Any? =
50+
this.properties[name] ?: localProperties[name]
51+
52+
if (project.prop("kotlinWarningsAsErrors")?.toString()?.toBoolean() == true) {
3353
subprojects {
3454
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
3555
kotlinOptions.allWarningsAsErrors = true

runtime/build.gradle.kts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ val platforms = listOf("common", "jvm", "android")
1313

1414
// Allow subprojects to use internal API's
1515
// See: https://kotlinlang.org/docs/reference/opt-in-requirements.html#opting-in-to-using-api
16-
val experimentalAnnotations = listOf("kotlin.RequiresOptIn", "aws.smithy.kotlin.runtime.util.InternalApi")
16+
val optinAnnotations = listOf("kotlin.RequiresOptIn")
1717

1818
fun projectNeedsPlatform(project: Project, platform: String ): Boolean {
1919
val files = project.projectDir.listFiles()
@@ -77,7 +77,7 @@ subprojects {
7777
kotlin.srcDir("$platform/$srcDir")
7878
resources.srcDir("$platform/${resourcesPrefix}resources")
7979
languageSettings.progressiveMode = true
80-
experimentalAnnotations.forEach { languageSettings.optIn(it) }
80+
optinAnnotations.forEach { languageSettings.optIn(it) }
8181
}
8282
}
8383
}
@@ -106,4 +106,3 @@ task<org.jetbrains.kotlin.gradle.testing.internal.KotlinTestReport>("rootAllTest
106106
}
107107
}
108108
}
109-

runtime/io/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,9 @@ kotlin {
3434
implementation("io.ktor:ktor-utils:$ktorVersion")
3535
}
3636
}
37+
38+
all {
39+
languageSettings.optIn("aws.smithy.kotlin.runtime.util.InternalApi")
40+
}
3741
}
3842
}

runtime/logging/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,9 @@ kotlin {
1818
implementation("io.github.microutils:kotlin-logging:$kotlinLoggingVersion")
1919
}
2020
}
21+
22+
all {
23+
languageSettings.optIn("aws.smithy.kotlin.runtime.util.InternalApi")
24+
}
2125
}
2226
}

runtime/protocol/http-client-engines/http-client-engine-ktor/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,9 @@ kotlin {
2020
implementation(project(":runtime:logging"))
2121
}
2222
}
23+
24+
all {
25+
languageSettings.optIn("aws.smithy.kotlin.runtime.util.InternalApi")
26+
}
2327
}
2428
}

runtime/protocol/http-test/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,9 @@ kotlin {
3131
api("io.ktor:ktor-server-cio:$ktorVersion")
3232
}
3333
}
34+
35+
all {
36+
languageSettings.optIn("aws.smithy.kotlin.runtime.util.InternalApi")
37+
}
3438
}
3539
}

runtime/protocol/http/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,9 @@ kotlin {
3232
implementation(project(":runtime:testing"))
3333
}
3434
}
35+
36+
all {
37+
languageSettings.optIn("aws.smithy.kotlin.runtime.util.InternalApi")
38+
}
3539
}
3640
}

runtime/runtime-core/build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,9 @@ kotlin {
3636
implementation("com.charleskorn.kaml:kaml:$kamlVersion")
3737
}
3838
}
39+
40+
all {
41+
languageSettings.optIn("aws.smithy.kotlin.runtime.util.InternalApi")
42+
}
3943
}
4044
}

0 commit comments

Comments
 (0)