Skip to content

Commit ac721b2

Browse files
sadiredd-svphani-srikarkneekey23Adireddy
authored
merge(smithy-swift): Swift-client-runtime branch into master branch (#65)
* add: migrate clientruntime mvp work * build fixes * add: unit tests for networking part of clientruntime and related changes in source code * fix: minor test setup fixes * delete: mqtt protocol related drafts * fix: moving data extensions from tests to main target * feat: add unit tests for Request/Response Encoding/Decoding * add: XMLContainer tests to improve codecov * fix: rename request/response protocol methods to encode/decode; minor nits * Swift client runtime circleci setup (#25) chore: add swiftLint and codecov tooling to swift ClientRuntime * feat(codegen): adding swift protocol generation and tests * feat(codegen): adding swift protocol generation and tests * style(codegen): fixed ktlint issues * test: fix tests to separate out pieces of protocol * style(codegen): fix ktlint errors one last time i hope * feat: add package manifest file generator * feat: tools support to test code generated sdk builds * fix: linting fixes * fix: use exec task instead of custom task for building generated sdk; minor formatting * fix: replace 'command' with 'which' * feat: use macos image for swift CI/CD workflow * fix: minor yml error * fix: generate xcodeproject before building clientruntime * fix: add swiftlint job * fix: xcode scheme as generated by SPM * fix: swiftlint job working directory change * fix: using new cache key * fix: move swiftVersion to swiftSettings * fix: dependecies available as pods and swift packages have empty package type * feat(client-runtime): add formatted dates * fix: epoch spelling correction * fix: add test for approach2 using coding keys * fix: using a generic AWSDate in place of multiple structs for each formatted date * fix: remove unrelated comment * fix: change wrapped date to let constant AWSDate * fix: DateFormatterProtocol related changes * fix: minor syntax change for loop * add: http bindings draft * fix: revert encodeForOperationName approach * fix: replace HttpSerialize With HttpRequestBinding, Let Encoders handle HttpRequest encoding * fix: using HttpFeature for serialization provider dependency; updated tests * fix: linting clientruntime * fix: kotlin linting fixes * fix: formatting * fix: refactor getSanitizedName method, remove Default prefix from client name * fix: fixing minor errors discovered in compile time * feat: add timestamp format handling for headers/query items * fix: add unit tests covering timestamp and enum cases * fix: kt linting * fix: remove explicit type declarations for path and httpmethod swift objects * fix: add query literals and default dateEncodingStrategy * feat: add RequestTestBase * feat: add request test base * feat: add tests for request test base * fix:(crt) move smithy unit test utility functions to a separate target * fix(crt): remove mock http client setup * fix: minor style changes * fix: remove AWSDate custom type: to be handled using custom Encodable/Decodable implementations * fix: remove custom AWSDates from Timestamp shape codegen * fix: linting changes only * fix: minor argument optional type fix * fix: add todo for structure geenrator error generation * feat(smithy-swift): add Request Unit test generators * feat(swift-codegen):add http protocol request unit test generator * fix: kt linting fixes only * fix: unit test for package manifest to include testTarget * feat(codegen): encodable conformance (#51) * fix compiler errors * saving progress * saving work down to 150 compiler errors * adding default input and output shapes for every operation for sdk evolution * protocol conformance in separate files now for models * started encode generation * saving progress * saving encode implementation progress * fixed a buttload of things and encode implementation is now working properly * one more bug fix taking us down to 89 compiler errors * feat(codegen): encodes types correctly * style(codegen): fix ktlint errors * fix(codegen): all tests pass * style(codegen): fix ktlint errors * fix(codegen): address PR Comments * fix(codegen): address PR comments, refactor encoding now that traits are back * fix(codegen): several fixes * fix(codegen): fix a lot of unit test compile errors * fix(codegen): fix remaining unit test compile errors and fix some encoding bugs 25 out of 43 tests passing now * fix(codegen): refactor http request bidning to include encoding * fix(codegen): down to 8 failing unit tests * fix(codegen): down to 4 failing unit tests * fix(codegen): down to 1 failing unit test which is idempotency * fix(codegen): some clean up and style changes * fix(codegen): small cleanup comment change * fix(codegen): undo change previously made in error * feat(codegen): Decodable Implementation & Recursive Shapes (#56) * fix(codegen): fixed generation of recursive shapes mostly and started decode implementation * feat(codegen): handle recursive shapes and unions * feat(codegen): add union handling * feat(codegen): decodes primitives, structs, and recursive members correctly, maps and collections still unhandled * feat(codegen): decodes collections of timestamps now * feat(codegen): decodes collections of everything no bugs and began work on maps * feat(codegen): maps and nested maps working now * feat(codegen): fixed one date compiler error * feat(codegen): all tests passing and all edge cases handled * fix(codegen): some clean up * style(codegen): fix lint issues * feat: add response test generation and init from HttpResponse * fix: add response test generation tests * fix: minor linting issue * fix: minor refactoring of variable/function names * fix: work on recursive shapes * fix: compiler error fixes after merge and unit tests are running now * fix: ShapeValueGenerator should return nil for null value in maps * fix: deserialize http payloads working now * fix: fix for initializer bug * fix: fix number 2 * fix: timestamp decoding fix * fix: timestamp issues fixed * fix: fix deserialization of lists * fix: base64 encoded header and dateEncodingStrategy for Encoder * fix: fixed query issue with timestamps * style(codegen): fix lint issues * fix: code review changes * fix: refactor http bindings protocol, client runtime Box type, stylistic changes, etc * fix: removing duplication of protocol conformance from box type * fix: refactoring http bindings protocol to move var declaration to a more needed spot Co-authored-by: phani-srikar <[email protected]> Co-authored-by: Phani Srikar Edupuganti <[email protected]> * fix(swift-crt): rename Operation error to Service Error * feat: Add error shape deserialization * feat: add errors unit test generation * fix: documentation comments update * fix: compile error for generated code; equality for ClientErrors * fix: structure members names to always have lowercased first letter * fix: modify coding keys to handle member name changes for a structure * fix: remove commented code * fix: Render Codable COnformance for Union Shapes * feat: add tests for union encode/decode generators * fix: minor nits * Fix ShapeValueGenerator for recursive shapes * Recursive shapes * styling code * Recursive shapes response generator unit test added * revert hardcoded absolute path * Recursive shapes unit added to ShapeValueGeneratorTest.kt * styling for unit test file * comments added in ShapeValueGenerator * feat(smithy-swift): Big Number Support * feat: reverting the path changes * styling: with ktlintFormat * feat: changed the import from BigNumber to Numerics * feat: changed the import from Numerics to ComplexModule * feat: BigNumber and BigDecimal are mapped to signed Int64 and Complex<Double> of Swift respectively * feat: used the bigdecimal datatype in kotlin for node.value and added unit test * styling: with ktlintFormat * feat(clientruntime): Refactor Client Runtime to use CRT Bindings (#63) * feat(clientruntime): started import of crt bindings as a dependency * feat(clientruntime): changes to spm set up * fix(clientruntime): fix changes and remove url session files * feat(clientruntime): updated with crt wrapper now * fix: remove warnings * feat(clientruntime): saving integ test progress * fix: saving progress and finally making requests to crt bindings that work * fix: sdk compile issues from refactoring changes * fix: fix unit tests * fix: address PR comments from Aaron, mostly add TODOs and documentation * fix: changed name of asyncrequest to be sdkhttprequest and fixed one bug all tests still passing * fix: ImportDeclarationsTest fixed * feat: temporary placeholder for smithy's bigInteger is [UInt8] in Smithy * fix: ImportDeclarationsTest and SymbolProviderTest are fixed * fix: retrieving dependencies needed for package.swift from distinctDependencies array * fix: ktlintFormat fix * feat: extracting all values from distinctDependencies array which gets loaded from SwiftDependency.kt * fix: ktlintFormat corrected * fix: cleaned up commented code * Changed config.yml to clone aws-crt-swift repo in circleci * config.yml change with git clone early * config.yml in different way * clone before Generate XCodeProject * git clone aws-crt-swift repo during pre_start_ios_simulator step * config.yml: create dir, cd, clone and cd- * config.yml change to clone the futures-implementation branch of aws-crt-swift repo * added submodule update in config.yml * edited the submodule init --recursive after cd into aws-crt-swift * submodule with git clone * removed -project from xcodebuild and removed swift package generate-xcodeproj * edited destination and changed xcodebuild command * xcode version change * fix: swift isses * xcodebuild test command change * fix unit test * linting fixes * fix: address linting violations * fix build issue resulting from linter autocorrect * fix: fix the unit test bug again * fix headers bug again * fix path so it works in generated code build * add clone of crt to build smithy swift step * removed smithy-kotlin repo * fix: path for aws-crt-swift fixed * cloning the aws-crt-swift repo from master * cloning the aws-crt-swift repo from master for unit test as well * moved the content of smithy-swift to root and deleted smithy-swift directory * fix in config.yml * ktlintFormat fixed manually * fix: Build ClientRuntime path issue * reverted Build ClientRuntime path * fix: deleting the xcode cache * submodule init as a separate step * deleting the derivedData before cloning aws-crt-swift * deleted ClientRuntime.xcodeproj * fix: imports in smithy-swift * reverted to old clone config.yml * imports fixed for ktlint * ktlint fix in smithy-swift-codegen Co-authored-by: phani-srikar <[email protected]> Co-authored-by: Nicki Stone <[email protected]> Co-authored-by: phani-srikar <[email protected]> Co-authored-by: Nicki Stone <[email protected]> Co-authored-by: Adireddy <[email protected]>
1 parent 20aeca3 commit ac721b2

File tree

355 files changed

+21308
-9000
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

355 files changed

+21308
-9000
lines changed

.circleci/config.yml

Lines changed: 85 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -84,91 +84,97 @@ commands:
8484
destination: Reports
8585
path: build/reports/tests/test/
8686

87+
pre_start_ios_simulator:
88+
description: >-
89+
Pre-start iOS Simulator, as the build may fail if it takes too long to start up during that step
90+
steps:
91+
- run:
92+
name: Pre-start iOS Simulator
93+
command: |
94+
bash CircleciScripts/pre_start_iOS_simulator.sh
95+
8796
jobs:
88-
build:
97+
build_and_unittest_swift_client_runtime:
98+
macos:
99+
xcode: "12.1.0"
100+
steps:
101+
- checkout
102+
- pre_start_ios_simulator
103+
- run:
104+
name: Clone aws-crt-swift
105+
command: |
106+
rm -rf ~/Library/Developer/Xcode/DerivedData
107+
mkdir -p ~/Projects/Amplify/SwiftSDK/
108+
cd ~/Projects/Amplify/SwiftSDK/
109+
git clone --recursive [email protected]:awslabs/aws-crt-swift.git
110+
cd -
111+
- run:
112+
name: Build ClientRuntime
113+
working_directory: ~/project/ClientRuntime
114+
command: |
115+
xcodebuild -scheme ClientRuntime-Package -destination "${destination}"
116+
- run:
117+
name: Unit Test ClientRuntime
118+
working_directory: ~/project/ClientRuntime
119+
command: |
120+
xcodebuild test -enableCodeCoverage YES -scheme ClientRuntime-Package -destination "${destination}"
121+
bash <(curl -s https://codecov.io/bash)
122+
- run:
123+
name: Install swiftlint
124+
command: |
125+
HOMEBREW_NO_AUTO_UPDATE=1 brew install swiftlint
126+
- run:
127+
name: Lint ClientRuntime
128+
working_directory: ~/project/ClientRuntime
129+
command: |
130+
swiftlint
131+
132+
build_smithy_swift:
133+
macos:
134+
xcode: "12.1.0"
89135
environment:
90136
# Configure the JVM and Gradle to avoid OOM errors
91137
_JAVA_OPTIONS: "-Xmx3g"
92138
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.workers.max=2"
93-
docker:
94-
- image: circleci/openjdk:8
95139
steps:
96140
- checkout
97141
- with_cache:
142+
cache_key: "macOSv2"
98143
steps:
99144
- run:
100-
name: Build Smithy Kotlin
101-
working_directory: ~/project/smithy-kotlin
102-
command: ./gradlew build -x test -x jvmTest
103-
- persist_to_workspace:
104-
root: .
105-
paths:
106-
- smithy-kotlin/build
107-
- smithy-kotlin/*/build
108-
- smithy-kotlin/client-runtime/*/build
145+
name: Clone aws-crt-swift
146+
command: |
147+
rm -rf ~/Library/Developer/Xcode/DerivedData
148+
mkdir -p ~/Projects/Amplify/SwiftSDK/
149+
cd ~/Projects/Amplify/SwiftSDK/
150+
git clone --recursive [email protected]:awslabs/aws-crt-swift.git
151+
cd -
109152
- run:
110153
name: Build Smithy Swift
111-
working_directory: ~/project/smithy-swift
154+
working_directory: ~/project
112155
command: ./gradlew build -x test
113156
- persist_to_workspace:
114157
root: .
115158
paths:
116-
- smithy-swift/build
117-
- smithy-swift/*/build
118-
test_smithy_kotlin:
119-
environment:
120-
# Configure the JVM and Gradle to avoid OOM errors
121-
_JAVA_OPTIONS: "-Xmx3g"
122-
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.workers.max=2"
123-
docker:
124-
- image: circleci/openjdk:8
125-
steps:
126-
- checkout
127-
- attach_workspace:
128-
at: .
129-
- with_cache:
130-
steps:
131-
- run:
132-
working_directory: ~/project/smithy-kotlin
133-
name: Run tests
134-
command: |
135-
./gradlew test
136-
- collect_test_results:
137-
test_results_path: ""
138-
reports_path: ""
159+
- ./build
160+
- ./*/build
139161

140-
lint_smithy_kotlin:
141-
# Remove if parallelism is not desired
142-
environment:
143-
# Configure the JVM and Gradle to avoid OOM errors
144-
_JAVA_OPTIONS: "-Xmx3g"
145-
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.workers.max=2"
146-
docker:
147-
- image: circleci/openjdk:8
148-
steps:
149-
- checkout
150-
- attach_workspace:
151-
at: .
152-
- run:
153-
working_directory: ~/project/smithy-kotlin
154-
name: Run ktlint
155-
command: |
156-
./gradlew ktlint
157162
test_smithy_swift:
163+
macos:
164+
xcode: "12.1.0"
158165
environment:
159166
# Configure the JVM and Gradle to avoid OOM errors
160167
_JAVA_OPTIONS: "-Xmx3g"
161168
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.workers.max=2"
162-
docker:
163-
- image: circleci/openjdk:8
164169
steps:
165170
- checkout
166171
- attach_workspace:
167172
at: .
168173
- with_cache:
174+
cache_key: "macOSv2"
169175
steps:
170176
- run:
171-
working_directory: ~/project/smithy-swift
177+
working_directory: ~/project
172178
name: Run tests
173179
command: |
174180
./gradlew test
@@ -177,33 +183,44 @@ jobs:
177183
reports_path: ""
178184

179185
lint_smithy_swift:
180-
# Remove if parallelism is not desired
186+
macos:
187+
xcode: "12.1.0"
181188
environment:
182189
# Configure the JVM and Gradle to avoid OOM errors
183190
_JAVA_OPTIONS: "-Xmx3g"
184191
GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.workers.max=2"
185-
docker:
186-
- image: circleci/openjdk:8
187192
steps:
188193
- checkout
189194
- attach_workspace:
190195
at: .
191196
- run:
192-
working_directory: ~/project/smithy-swift
197+
working_directory: ~/project
193198
name: Run ktlint
194199
command: |
195200
./gradlew ktlint
196-
201+
197202
workflows:
198203
version: 2
199-
workflow:
204+
205+
build_and_test_smithy_swift:
200206
jobs:
201-
- build
202-
- test_smithy_kotlin:
207+
- build_and_unittest_swift_client_runtime:
208+
filters:
209+
branches:
210+
only:
211+
- swift-client-runtime
212+
- build_smithy_swift:
203213
requires:
204-
- build
205-
- lint_smithy_kotlin
214+
- build_and_unittest_swift_client_runtime
215+
filters:
216+
branches:
217+
only:
218+
- swift-client-runtime
206219
- test_smithy_swift:
207220
requires:
208-
- build
209-
- lint_smithy_swift
221+
- build_smithy_swift
222+
filters:
223+
branches:
224+
only:
225+
- swift-client-runtime
226+
- lint_smithy_swift
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Create simulator if needed
2+
test_device_id=$( xcrun simctl list devices | grep "circleci-test-device" | sed 's/ *circleci-test-device *(//' | sed 's/).*//' )
3+
4+
if [[ -z $test_device_id ]] ; then
5+
echo "Creating test device"
6+
7+
# Get the most recent available runtime
8+
runtime=$( xcrun simctl list runtimes iOS | sed 's/iOS //' | sort -h | tail -1 | sed 's/.* - //' | tr -d '[:space:]' )
9+
echo "Runtime: '${runtime}'"
10+
11+
# Get the last alphabetical device (probably something in the iPhone X family, as of 2019-05-31)
12+
devicetype=$( xcrun simctl list devicetypes iPhone | sort | tail -1 | sed 's/.*(//' | sed 's/).*//' | tr -d '[:space:]' )
13+
echo "Device type: '${devicetype}'"
14+
15+
test_device_id=$( xcrun simctl create "circleci-test-device" "${devicetype}" "${runtime}" | tr -d '[:space:]' )
16+
fi
17+
18+
echo "test_device_id: ${test_device_id}"
19+
echo "export test_device_id='$test_device_id'" >> $BASH_ENV
20+
21+
# Boot sim if needed
22+
xcrun simctl list devices ${test_device_id} | grep -q Booted
23+
if [[ $? -eq 1 ]] ; then
24+
echo "Booting ${test_device_id}"
25+
xcrun simctl boot ${test_device_id}
26+
fi
27+
28+
# destinationspecifier for xcodebuild commands
29+
destination="id=${test_device_id}"
30+
echo "destination: ${destination}"
31+
echo "export destination='$destination'" >> $BASH_ENV
32+

ClientRuntime/.build/manifest.db

188 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"object": {"artifacts": [], "dependencies": [{"basedOn": null, "packageRef": {"identity": "aws-crt-swift", "kind": "local", "name": "AwsCrt", "path": "/Users/sadiredd/Documents/aws-crt-swift"}, "state": {"name": "local"}, "subpath": "aws-crt-swift"}]}, "version": 4}

ClientRuntime/.swiftlint.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
excluded:
2+
- Tests
3+
4+
analyzer_rules:
5+
- unused_import
6+
- unused_declaration
7+
8+
disabled_rules:
9+
- trailing_whitespace
10+
- todo
11+
- identifier_name
12+
- compiler_protocol_init
13+
- function_parameter_count
14+
- multiple_closures_with_trailing_closure
15+
- cyclomatic_complexity
16+
- file_length
17+
- syntactic_sugar
18+
19+
opt_in_rules:
20+
- empty_count
21+
22+
# configurable rules can be customized from this configuration file
23+
force_cast: warning
24+
closing_brace: error
25+
colon:
26+
severity: error
27+
comma: error
28+
empty_count: warning
29+
empty_enum_arguments: error
30+
function_body_length:
31+
warning: 100
32+
error: 150
33+
identifier_name:
34+
excluded:
35+
- id
36+
- of
37+
- or
38+
line_length:
39+
warning: 120
40+
error: 160
41+
opening_brace: error
42+
return_arrow_whitespace: error
43+
statement_position:
44+
severity: error
45+
todo: warning
46+
trailing_semicolon: error

ClientRuntime/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)