Skip to content

feat: protocol test codegen project + service clients #1058

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 3, 2020
Merged
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jspm_packages
*.tgz
.yarn-integrity

.vscode/launch.json

lerna-debug.log
package-lock.json

Expand All @@ -30,3 +32,7 @@ codegen/sdk-codegen/smithy-build.json
.gradle
*/out/
*/*/out/

protocol_tests/*/coverage
protocol_tests/*/dist
protocol_tests/*/types
5 changes: 5 additions & 0 deletions buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ phases:
nodejs: 10
build:
commands:
# Fake credentials for protocol tests to get past signing.
- export AWS_ACCESS_KEY_ID=foo
- export AWS_SECRET_ACCESS_KEY=bar
- echo Building...
- yarn --frozen-lockfile
# Run the actual tests.
- echo Executing unit tests
- yarn test:all
- echo Executing functional test
- yarn test:functional
post_build:
commands:
# Handle code coverage.
- ./node_modules/.bin/codecov -f coverage/*.json -t 26989a8c-a2e9-4e6f-844a-35a741240b60
39 changes: 39 additions & 0 deletions codegen/protocol-test-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

import software.amazon.smithy.gradle.tasks.SmithyBuild

plugins {
id("software.amazon.smithy") version "0.4.3"
}

dependencies {
implementation("software.amazon.smithy:smithy-aws-protocol-tests:0.9.8")
compile(project(":smithy-aws-typescript-codegen"))
}

// This project doesn't produce a JAR.
tasks["jar"].enabled = false

// Run the SmithyBuild task manually since this project needs the built JAR
// from smithy-aws-typescript-codegen.
tasks["smithyBuildJar"].enabled = false

tasks.create<SmithyBuild>("buildSdk") {
addRuntimeClasspath = true
}

// Run the `buildSdk` automatically.
tasks["build"].finalizedBy(tasks["buildSdk"])
105 changes: 105 additions & 0 deletions codegen/protocol-test-codegen/smithy-build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"version": "1.0",
"projections": {
"aws-ec2": {
"transforms": [
{"name": "includeServices", "args": ["aws.protocols.tests.ec2#AwsEc2"]}
],
"plugins": {
"typescript-codegen": {
"package": "@aws-sdk/protocol-tests-aws-ec2",
"packageVersion": "1.0.0-alpha.1",
"packageJson": {
"author": {
"name": "AWS SDK for JavaScript Team",
"url": "https://aws.amazon.com/javascript/"
},
"license": "Apache-2.0"
},
"protocol": "aws.ec2",
"private": true
}
}
},
"aws-json": {
"transforms": [
{"name": "includeServices", "args": ["aws.protocols.tests.json#JsonProtocol"]}
],
"plugins": {
"typescript-codegen": {
"package": "@aws-sdk/protocol-tests-aws-json",
"packageVersion": "1.0.0-alpha.1",
"packageJson": {
"author": {
"name": "AWS SDK for JavaScript Team",
"url": "https://aws.amazon.com/javascript/"
},
"license": "Apache-2.0"
},
"protocol": "aws.json-1.1",
"private": true
}
}
},
"aws-query": {
"transforms": [
{"name": "includeServices", "args": ["aws.protocols.tests.query#AwsQuery"]}
],
"plugins": {
"typescript-codegen": {
"package": "@aws-sdk/protocol-tests-aws-query",
"packageVersion": "1.0.0-alpha.1",
"packageJson": {
"author": {
"name": "AWS SDK for JavaScript Team",
"url": "https://aws.amazon.com/javascript/"
},
"license": "Apache-2.0"
},
"protocol": "aws.query",
"private": true
}
}
},
"aws-restjson": {
"transforms": [
{"name": "includeServices", "args": ["aws.protocols.tests.restjson#RestJson"]}
],
"plugins": {
"typescript-codegen": {
"package": "@aws-sdk/protocol-tests-aws-restjson",
"packageVersion": "1.0.0-alpha.1",
"packageJson": {
"author": {
"name": "AWS SDK for JavaScript Team",
"url": "https://aws.amazon.com/javascript/"
},
"license": "Apache-2.0"
},
"protocol": "aws.rest-json-1.1",
"private": true
}
}
},
"aws-restxml": {
"transforms": [
{"name": "includeServices", "args": ["aws.protocols.tests.restxml#RestXml"]}
],
"plugins": {
"typescript-codegen": {
"package": "@aws-sdk/protocol-tests-aws-restxml",
"packageVersion": "1.0.0-alpha.1",
"packageJson": {
"author": {
"name": "AWS SDK for JavaScript Team",
"url": "https://aws.amazon.com/javascript/"
},
"license": "Apache-2.0"
},
"protocol": "aws.rest-xml",
"private": true
}
}
}
}
}
9 changes: 1 addition & 8 deletions codegen/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,4 @@
rootProject.name = "codegen"
include(":smithy-aws-typescript-codegen")
include(":sdk-codegen")

// TODO: remove once smithy-gradle-plugin:0.4.0 is published.
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
}
}
include(":protocol-test-codegen")
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const base = require("./jest.config.base.js");

module.exports = {
...base,
projects: ["<rootDir>/packages/*/jest.config.js"],
projects: ["<rootDir>/protocol_tests/*/jest.config.js", "<rootDir>/packages/*/jest.config.js"],
testPathIgnorePatterns: ["/node_modules/", "<rootDir>/clients/client-.*"],
coveragePathIgnorePatterns: [
"/node_modules/",
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
"clear-build-cache": "rimraf ./packages/*/build/* ./clients/*/*/build/*",
"clear-build-info": "rimraf ./packages/*/*.tsbuildinfo ./clients/*/*/*.tsbuildinfo",
"build:crypto-dependencies": "lerna run --scope '@aws-sdk/types' --scope '@aws-sdk/util-utf8-browser' --scope '@aws-sdk/util-locate-window' --scope '@aws-sdk/hash-node' --include-dependencies pretest",
"build:protocols": "yarn build:crypto-dependencies && lerna run --scope '@aws-sdk/protocol-tests-*' --include-dependencies pretest",
"build:smithy-client": "yarn build:crypto-dependencies && lerna run --scope '@aws-sdk/client-rds-data' --include-dependencies pretest",
"build:all": "yarn build:crypto-dependencies && lerna run pretest --include-dependencies --include-dependents",
"pretest:all": "yarn build:all",
"test:all": "jest --coverage --passWithNoTests && lerna run test --scope @aws-sdk/stream-collector-browser --scope @aws-sdk/hash-blob-browser",
"test:functional": "jest --config tests/functional/jest.config.js --passWithNoTests",
"test:integration": "cucumber-js"
"test:integration": "cucumber-js",
"test:protocols": "yarn build:protocols && lerna run test --scope '@aws-sdk/protocol-tests-*'"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -53,7 +55,8 @@
"workspaces": {
"packages": [
"packages/*",
"clients/*"
"clients/*",
"protocol_tests/*"
],
"nohoist": [
"**/karma*",
Expand Down
Loading