Skip to content

Commit 2413081

Browse files
committed
Merge branch 'main' of github.com:smithy-lang/smithy-kotlin into configure-executorService
2 parents abb8946 + 6ca2837 commit 2413081

File tree

21 files changed

+285
-119
lines changed

21 files changed

+285
-119
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"id": "08deb04f-bc93-4d3c-aa2f-d46b2dcce775",
3+
"type": "feature",
4+
"description": "Support enums and int enums as event headers"
5+
}

.github/workflows/artifact-size-metrics.yml

Lines changed: 0 additions & 86 deletions
This file was deleted.

.github/workflows/continuous-integration.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,15 @@ jobs:
9090
WorkflowSucceeded:${{ job.status == 'success' && '1' || '0' }}:Count
9191
WorkflowDuration:${{ steps.end.outputs.duration }}:Seconds
9292
93-
# macos-14 build and test for targets: jvm, macoArm64, iosSimulatorArm64, watchosSimulatorArm65, tvosSimulatorArm64
94-
# macos-13 build and test for targets: jvm, macoX64, iosX64, tvosX64, watchosX64
93+
# macOS ARM images build and test for targets: jvm, macosArm64, iosSimulatorArm64, watchosSimulatorArm65, tvosSimulatorArm64
94+
# macos x64 images build and test for targets: jvm, macosX64, iosX64, tvosX64, watchosX64
9595
macos:
9696
strategy:
9797
fail-fast: false
9898
matrix:
99-
os: [macos-14, macos-13]
99+
os:
100+
- macos-15-large # x64
101+
- macos-15-xlarge # ARM
100102
runs-on: ${{ matrix.os }}
101103
steps:
102104
- name: Checkout sources
@@ -111,6 +113,17 @@ jobs:
111113
working-directory: ./smithy-kotlin
112114
shell: bash
113115
run: |
116+
# Bump memory profile for Kotlin daemon
117+
cat gradle.properties \
118+
| sed -r 's/-Xmx[0-9]+G/-Xmx6G/g' \
119+
| sed -r 's/-XX:MaxMetaspaceSize=[0-9]+G/-XX:MaxMetaspaceSize=2G/g' \
120+
> gradle.properties2
121+
mv gradle.properties2 gradle.properties
122+
123+
echo "Modified gradle.properties:"
124+
cat gradle.properties
125+
echo ""
126+
114127
# FIXME K2. Re-enable warnings as errors after this warning is removed: https://youtrack.jetbrains.com/issue/KT-68532
115128
# echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties
116129
./gradlew apiCheck
@@ -369,7 +382,7 @@ jobs:
369382
run: |
370383
# TODO - JVM only
371384
cd $GITHUB_WORKSPACE/smithy-kotlin
372-
./gradlew --parallel -Paws.kotlin.native=false publishToMavenLocal
385+
./gradlew -Paws.kotlin.native=false publishToMavenLocal
373386
SMITHY_KOTLIN_RUNTIME_VERSION=$(grep sdkVersion= gradle.properties | cut -d = -f 2)
374387
SMITHY_KOTLIN_CODEGEN_VERSION=$(grep codegenVersion= gradle.properties | cut -d = -f 2)
375388
cd $GITHUB_WORKSPACE/aws-sdk-kotlin
@@ -380,7 +393,7 @@ jobs:
380393
# smithy-kotlin should be
381394
sed -i "s/smithy-kotlin-runtime-version = .*$/smithy-kotlin-runtime-version = \"$SMITHY_KOTLIN_RUNTIME_VERSION\"/" gradle/libs.versions.toml
382395
sed -i "s/smithy-kotlin-codegen-version = .*$/smithy-kotlin-codegen-version = \"$SMITHY_KOTLIN_CODEGEN_VERSION\"/" gradle/libs.versions.toml
383-
./gradlew --parallel -Paws.kotlin.native=false publishToMavenLocal
396+
./gradlew -Paws.kotlin.native=false publishToMavenLocal
384397
./gradlew -Paws.kotlin.native=false test jvmTest
385398
./gradlew -Paws.kotlin.native=false testAllProtocols
386399
- name: Calculate duration
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Pull request metrics
2+
on:
3+
pull_request:
4+
5+
jobs:
6+
artifact-size-metrics:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout repository
10+
uses: actions/checkout@v4
11+
12+
- name: Configure Gradle
13+
uses: awslabs/aws-kotlin-repo-tools/.github/actions/configure-gradle@main
14+
15+
- name: Build
16+
shell: bash
17+
run: |
18+
./gradlew build --parallel
19+
./gradlew publishAllPublicationsToTestLocalRepository --parallel
20+
21+
- name: Calculate metrics
22+
uses: awslabs/aws-kotlin-repo-tools/.github/actions/artifact-size-metrics/calculate-and-upload@main
23+
with:
24+
upload: 'false'
25+
release_metrics: 'false'
26+
27+
- name: Configure credentials
28+
uses: aws-actions/configure-aws-credentials@v4
29+
with:
30+
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }}
31+
aws-region: us-west-2
32+
33+
- name: Process metrics
34+
uses: awslabs/aws-kotlin-repo-tools/.github/actions/artifact-size-metrics/download-and-process@main
35+
with:
36+
download: 'false'
37+
38+
permissions:
39+
id-token: write
40+
contents: read
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release metrics
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
7+
jobs:
8+
artifact-size-metrics:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v4
13+
14+
- name: Configure Gradle
15+
uses: awslabs/aws-kotlin-repo-tools/.github/actions/configure-gradle@main
16+
17+
- name: Build
18+
shell: bash
19+
run: |
20+
./gradlew build --parallel
21+
./gradlew publishAllPublicationsToTestLocalRepository --parallel
22+
23+
- name: Configure credentials
24+
uses: aws-actions/configure-aws-credentials@v4
25+
with:
26+
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }}
27+
aws-region: us-west-2
28+
29+
- name: Calculate and upload metrics
30+
uses: awslabs/aws-kotlin-repo-tools/.github/actions/artifact-size-metrics/calculate-and-upload@main
31+
with:
32+
upload: 'true'
33+
release_metrics: 'true'
34+
35+
permissions:
36+
id-token: write
37+
contents: read

.github/workflows/stale_issue.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
cleanup:
1212
name: Stale issue job
1313
runs-on: ubuntu-latest
14+
if: github.repository == 'smithy-lang/smithy-kotlin'
1415
steps:
1516
- uses: aws-actions/stale-issue-cleanup@v4
1617
with:
@@ -54,4 +55,4 @@ jobs:
5455
repo-token: ${{ secrets.GITHUB_TOKEN }}
5556
loglevel: DEBUG
5657
# Set dry-run to true to not perform label or close actions.
57-
#dry-run: true
58+
#dry-run: true

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## [1.5.15] - 10/17/2025
4+
5+
### Fixes
6+
* fix: code-generate structure members more safely to avoid conflicts with package names
7+
38
## [1.5.14] - 10/03/2025
49

510
### Features

build.gradle.kts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,12 @@ buildscript {
4141
plugins {
4242
`dokka-convention`
4343
alias(libs.plugins.kotlinx.binary.compatibility.validator)
44-
alias(libs.plugins.aws.kotlin.repo.tools.artifactsizemetrics)
4544
// ensure the correct version of KGP ends up on our buildscript classpath
4645
// since build-plugins also has <some> version in its dependency closure
4746
id(libs.plugins.kotlin.multiplatform.get().pluginId) apply false
4847
id(libs.plugins.kotlin.jvm.get().pluginId) apply false
4948
}
5049

51-
artifactSizeMetrics {
52-
artifactPrefixes = setOf(":runtime")
53-
significantChangeThresholdPercentage = 5.0
54-
projectRepositoryName = "smithy-kotlin"
55-
}
56-
5750
val testJavaVersion = typedProp<String>("test.java.version")?.let {
5851
JavaLanguageVersion.of(it)
5952
}?.also {

builder.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414
"build_dir": "target/build",
1515
"build_steps": [
16-
"{gradlew} assemble --parallel"
16+
"{gradlew} assemble"
1717
],
1818
"post_build_steps": [
1919
"{gradlew} publishToMavenLocal"

codegen/smithy-aws-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/aws/protocols/eventstream/EventStreamParserGenerator.kt

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class EventStreamParserGenerator(
147147
val target = ctx.model.expectShape(hdrBinding.target)
148148
val targetSymbol = ctx.symbolProvider.toSymbol(target)
149149

150-
// :test(boolean, byte, short, integer, long, blob, string, timestamp))
150+
// :test(boolean, byte, short, integer, long, blob, string, timestamp, enum, int enum))
151151
val conversionFn = when (target.type) {
152152
ShapeType.BOOLEAN -> RuntimeTypes.AwsEventStream.expectBool
153153
ShapeType.BYTE -> RuntimeTypes.AwsEventStream.expectByte
@@ -157,6 +157,8 @@ class EventStreamParserGenerator(
157157
ShapeType.BLOB -> RuntimeTypes.AwsEventStream.expectByteArray
158158
ShapeType.STRING -> RuntimeTypes.AwsEventStream.expectString
159159
ShapeType.TIMESTAMP -> RuntimeTypes.AwsEventStream.expectTimestamp
160+
ShapeType.ENUM -> RuntimeTypes.AwsEventStream.expectEnumValue
161+
ShapeType.INT_ENUM -> RuntimeTypes.AwsEventStream.expectIntEnumValue
160162
else -> throw CodegenException("unsupported eventHeader shape: member=$hdrBinding; targetShape=$target")
161163
}
162164

@@ -165,7 +167,24 @@ class EventStreamParserGenerator(
165167
} else {
166168
""
167169
}
168-
writer.write("eb.#L = message.headers.find { it.name == #S }?.value?.#T()$defaultValuePostfix", hdrBinding.defaultName(), hdrBinding.memberName, conversionFn)
170+
171+
when (target.type) {
172+
ShapeType.ENUM, ShapeType.INT_ENUM ->
173+
writer.write(
174+
"eb.#L = message.headers.find { it.name == #S }?.value?.#T(#T::fromValue)$defaultValuePostfix",
175+
hdrBinding.defaultName(),
176+
hdrBinding.memberName,
177+
conversionFn,
178+
targetSymbol,
179+
)
180+
else ->
181+
writer.write(
182+
"eb.#L = message.headers.find { it.name == #S }?.value?.#T()$defaultValuePostfix",
183+
hdrBinding.defaultName(),
184+
hdrBinding.memberName,
185+
conversionFn,
186+
)
187+
}
169188
}
170189

171190
if (eventPayloadBinding != null) {

0 commit comments

Comments
 (0)