Skip to content

Commit 92d921e

Browse files
authored
Merge branch 'main' into main
2 parents fbac6ab + 892f924 commit 92d921e

27 files changed

Lines changed: 648 additions & 399 deletions

File tree

.github/pull_request_template.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
### What behavior changes?
2+
Describe the observable difference in behavior before and after this change.
3+
4+
### Why is this change needed?
5+
Explain the motivation: bug, feature request, refactor, performance, etc.
6+
7+
### How was this validated?
8+
List tests added, benchmarks run, or manual verification performed.
9+
10+
### What should reviewers focus on?
11+
Point reviewers to the files or sections that contain the interesting logic.
12+
13+
### Additional Links
14+
Related issues, design docs, or prior art.
15+
16+
---
17+
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

.github/workflows/ci.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,72 @@ on:
99
permissions:
1010
pull-requests: write
1111

12+
concurrency:
13+
group: ci-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
1216
jobs:
17+
format:
18+
runs-on: ubuntu-latest
19+
name: Auto-format
20+
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
21+
steps:
22+
- uses: actions/checkout@v6
23+
with:
24+
ref: ${{ github.head_ref }}
25+
token: ${{ secrets.PR_TOKEN }}
26+
27+
- name: Check if last commit is from bot
28+
id: check-bot
29+
run: |
30+
LAST_AUTHOR=$(git log -1 --format='%an')
31+
if [ "$LAST_AUTHOR" = "github-actions[bot]" ]; then
32+
echo "skip=true" >> "$GITHUB_OUTPUT"
33+
else
34+
echo "skip=false" >> "$GITHUB_OUTPUT"
35+
fi
36+
37+
- name: Set up JDK 21
38+
if: steps.check-bot.outputs.skip != 'true'
39+
uses: actions/setup-java@v5
40+
with:
41+
java-version: 21
42+
distribution: 'corretto'
43+
44+
- name: Cache compiled buildscripts
45+
if: steps.check-bot.outputs.skip != 'true'
46+
uses: actions/cache@v5
47+
with:
48+
key: ${{ runner.os }}-gradle-${{ hashFiles('buildSrc/**/*.kts') }}
49+
path: |
50+
./buildSrc/build
51+
52+
- name: Setup Gradle
53+
if: steps.check-bot.outputs.skip != 'true'
54+
uses: gradle/actions/setup-gradle@v6
55+
with:
56+
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
57+
gradle-home-cache-includes: |
58+
caches
59+
60+
- name: Run spotlessApply
61+
if: steps.check-bot.outputs.skip != 'true'
62+
run: ./gradlew spotlessApply
63+
64+
- name: Commit formatting changes
65+
if: steps.check-bot.outputs.skip != 'true'
66+
run: |
67+
if [ -n "$(git status --porcelain)" ]; then
68+
git config user.name "github-actions[bot]"
69+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
70+
git add -A
71+
git commit -m "Auto-format: apply spotless formatting"
72+
git push
73+
fi
74+
1375
build:
76+
needs: [format]
77+
if: always() && !cancelled()
1478
runs-on: ${{ matrix.os }}
1579
name: Java ${{ matrix.java }} ${{ matrix.os }}
1680
strategy:

aws/client/aws-client-awsjson/src/main/java/software/amazon/smithy/java/aws/client/awsjson/AwsJsonProtocol.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,6 @@ private EventDecoderFactory<AwsEventFrame> getEventDecoderFactory(ApiOperation<?
141141
private static DataStream bodyDataStream(HttpResponse response) {
142142
var contentType = response.headers().contentType();
143143
var contentLength = response.headers().contentLength();
144-
return DataStream.withMetadata(response.body(), contentType, contentLength, null);
144+
return DataStream.withMetadata(response.body(), contentType, contentLength == null ? -1 : contentLength);
145145
}
146146
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package software.amazon.smithy.java.client.http;
7+
8+
import java.net.http.HttpRequest;
9+
import java.nio.ByteBuffer;
10+
import java.util.concurrent.Flow;
11+
import software.amazon.smithy.java.io.datastream.DataStream;
12+
13+
/**
14+
* Adapts a Smithy {@link DataStream} to the JDK HttpClient's {@link HttpRequest.BodyPublisher} contract.
15+
*/
16+
final class DataStreamBodyPublisher implements HttpRequest.BodyPublisher {
17+
private final DataStream dataStream;
18+
19+
DataStreamBodyPublisher(DataStream dataStream) {
20+
this.dataStream = dataStream;
21+
}
22+
23+
@Override
24+
public long contentLength() {
25+
return dataStream.contentLength();
26+
}
27+
28+
@Override
29+
public void subscribe(Flow.Subscriber<? super ByteBuffer> subscriber) {
30+
dataStream.subscribe(subscriber);
31+
}
32+
}

client/client-http/src/main/java/software/amazon/smithy/java/client/http/JavaHttpClientReplayableByteBufferPublisher.java

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

client/client-http/src/main/java/software/amazon/smithy/java/client/http/JavaHttpClientSmallBodySubscriber.java

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

0 commit comments

Comments
 (0)