Skip to content

Commit

Permalink
Merge pull request #1 from aws/master
Browse files Browse the repository at this point in the history
Sync with master
  • Loading branch information
flemjame-at-amazon committed Jan 7, 2020
2 parents 16a1200 + 6108b91 commit 86e7ed5
Show file tree
Hide file tree
Showing 893 changed files with 31,568 additions and 8,430 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@ coverage/
cdk.context.json
.cdk.staging/
cdk.out/
*.tabl.json

# Yarn error log
yarn-error.log
2 changes: 2 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ pull_request_rules:
- -label~=(blocked|do-not-merge)
- -merged
- -closed
- author!=dependabot[bot]
- author!=dependabot-preview[bot]
- "#approved-reviews-by>=1"
- -approved-reviews-by~=author
- "#changes-requested-reviews-by=0"
Expand Down
80 changes: 73 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ and let us know if it's not up-to-date (even better, submit a PR with your corr
- [Updating all Dependencies](#updating-all-dependencies)
- [Running CLI integration tests](#running-cli-integration-tests)
- [API Compatibility Checks](#api-compatibility-checks)
- [Examples](#examples)
- [Feature Flags](#feature-flags)
- [Troubleshooting](#troubleshooting)
- [Debugging](#debugging)
Expand Down Expand Up @@ -201,7 +202,7 @@ The build process is divided into stages, so you can invoke them as needed from

- __`yarn build`__: runs the `build` and `test` commands in all modules (in topological order).
- __`yarn pack`__: packages all modules to all supported languages and produces a `dist/` directory with all the outputs
(running this script requires that you installed the [toolchains](#Toolchains) for all target languages on your
(running this script requires that you installed the [toolchains](#getting-started) for all target languages on your
system).

### Partial build tools
Expand Down Expand Up @@ -302,10 +303,17 @@ if a task fails, it will stop, and then to resume, simply run `foreach.sh` again
To reset the session (either when all tasks finished or if you wish to run a different session), run:

```console
$ rm -f ~/.foreach.*
$ scripts/foreach.sh --reset
```

This will effectively delete the state files.
If you wish to run a command only against a module's dependency closure, use:

```console
$ cd packages/my-module
$ ../scripts/foreach.sh --up COMMAND
```

This will execute `COMMAND` against `my-module` and all it's deps (in a topological order of course).

### Jetbrains support (WebStorm/IntelliJ)

Expand Down Expand Up @@ -336,7 +344,7 @@ $ ./install.sh
$ yarn build
```

If you also wish to package to all languages, make sure you have all the [toolchains](#Toolchains) and now run:
If you also wish to package to all languages, make sure you have all the [toolchains](#getting-started) and now run:

```
$ ./pack.sh
Expand Down Expand Up @@ -375,6 +383,8 @@ $ cd packages/@aws-cdk/aws-ec2
$ ../../../scripts/buildup
```

Note that `buildup` uses `foreach.sh`, which means it's resumable. If your build fails and you wish to resume, just run `buildup` again. If you wish to restart, run `buildup --restart`.

### Quick Iteration

After you've built the modules you want to work on once, use `lr watch` for each module that you are modifying.
Expand Down Expand Up @@ -518,6 +528,62 @@ this API we will not break anyone, because they weren't able to use it. The file
`allowed-breaking-changes.txt` in the root of the repo is an exclusion file that
can be used in these cases.

### Examples

Examples typed in fenced code blocks (looking like `'''ts`, but then with backticks
instead of regular quotes) will be automatically extrated, compiled and translated
to other languages when the bindings are generated.

To successfully do that, they must be compilable. The easiest way to do that is using
a *fixture*, which looks like this:

```
'''ts fixture=with-bucket
bucket.addLifecycleTransition({ ... });
'''
```

While processing the examples, the tool will look for a file called
`rosetta/with-bucket.ts-fixture` in the package directory. This file will be
treated as a regular TypeScript source file, but it must also contain the text
`/// here`, at which point the example will be inserted. The complete file must
compile properly.

Before the `/// here` marker, the fixture should import the necessary packages
and initialize the required variables.

If no fixture is specified, the fixture with the name
`rosetta/default.ts-fixture` will be used if present. `nofixture` can be used to
opt out of that behavior.

In an `@example` block, which is unfenced, the first line of the example can
contain three slashes to achieve the same effect:

```
/**
* @example
* /// fixture=with-bucket
* bucket.addLifecycleTransition({ ... });
*/
```

When including packages in your examples (even the package you're writing the
examples for), use the full package name (e.g. `import s3 =
require('@aws-cdk/aws-s3);`). The example will be compiled in an environment
where all CDK packages are available using their public names. In this way,
it's also possible to import packages that are not in the dependency set of
the current package.

For a practical example of how making sample code compilable works, see the
`aws-ec2` package.

Examples of all packages are extracted and compiled as part of the packaging
step. If you are working on getting rid of example compilation errors of a
single package, you can run `scripts/compile-samples` on the package by itself.

For now, non-compiling examples will not yet block the build, but at some point
in the future they will.

### Feature Flags

Sometimes we want to introduce new breaking behavior because we believe this is
Expand Down Expand Up @@ -550,9 +616,9 @@ The pattern is simple:
5. Under `BREAKING CHANGES` in your commit message describe this new behavior:

```
BREAKING CHANGE: template file names for new projects created through "cdk init"
will use the template artifact ID instead of the physical stack name to enable
multiple stacks to use the same name. This is enabled through the flag
BREAKING CHANGE: template file names for new projects created through "cdk init"
will use the template artifact ID instead of the physical stack name to enable
multiple stacks to use the same name. This is enabled through the flag
`@aws-cdk/core:enableStackNameDuplicates` in newly generated `cdk.json` files.
```

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copyright 2018-2020 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.
Expand Down
5 changes: 5 additions & 0 deletions allowed-breaking-changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@ incompatible-argument:@aws-cdk/aws-servicediscovery.Service.fromServiceAttribute
removed:@aws-cdk/core.ConstructNode.addReference
removed:@aws-cdk/core.ConstructNode.references
removed:@aws-cdk/core.OutgoingReference
change-return-type:@aws-cdk/aws-lambda-destinations.EventBridgeDestination.bind
change-return-type:@aws-cdk/aws-lambda-destinations.LambdaDestination.bind
change-return-type:@aws-cdk/aws-lambda-destinations.SnsDestination.bind
change-return-type:@aws-cdk/aws-lambda-destinations.SqsDestination.bind

19 changes: 14 additions & 5 deletions pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,31 @@ function lerna_scopes() {
done
}

echo "Packaging jsii modules" >&2
# Compile examples with respect to "decdk" directory, as all packages will
# be symlinked there so they can all be included.
echo "Extracting code samples" >&2
node --experimental-worker $(which jsii-rosetta) \
--compile \
--output samples.tabl.json \
--directory packages/decdk \
$(cat $TMPDIR/jsii.txt)

# Jsii packaging (all at once using jsii-pacmak)
echo "Packaging jsii modules" >&2
jsii-pacmak \
--verbose \
--outdir $distdir/ \
--rosetta-tablet samples.tabl.json \
$(cat $TMPDIR/jsii.txt)

# Non-jsii packaging, which means running 'package' in every individual
# module and rsync'ing the result to the shared dist directory.
# module
echo "Packaging non-jsii modules" >&2
lerna run $(lerna_scopes $(cat $TMPDIR/nonjsii.txt)) --sort --concurrency=1 --stream package

# Finally rsync all 'dist' directories together into a global 'dist' directory
for dir in $(find packages -name dist | grep -v node_modules | grep -v run-wrappers); do
echo "Merging ${dir} into ${distdir}"
rsync -av $dir/ ${distdir}/
echo "Merging ${dir} into ${distdir}" >&2
rsync -a $dir/ ${distdir}/
done

# Remove a JSII aggregate POM that may have snuk past
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
"devDependencies": {
"conventional-changelog-cli": "^2.0.31",
"fs-extra": "^8.1.0",
"jsii-diff": "^0.20.11",
"jsii-pacmak": "^0.20.11",
"lerna": "^3.18.4",
"typescript": "~3.7.3"
"jsii-diff": "^0.21.1",
"jsii-pacmak": "^0.21.1",
"jsii-rosetta": "^0.21.1",
"lerna": "^3.20.2",
"typescript": "~3.7.4"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/alexa-ask/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
.jsii
.LAST_BUILD
.LAST_PACKAGE
.nycrc
nyc.config.js
.nyc_output
coverage
dist
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/alexa-ask/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copyright 2018-2020 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.
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/alexa-ask/NOTICE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
AWS Cloud Development Kit (AWS CDK)
Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
10 changes: 8 additions & 2 deletions packages/@aws-cdk/alexa-ask/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@
"branches": 60,
"statements": 80
}
}
},
"collectCoverage": true,
"coverageReporters": [
"lcov",
"html",
"text-summary"
]
},
"license": "Apache-2.0",
"devDependencies": {
Expand All @@ -89,4 +95,4 @@
"node": ">= 10.3.0"
},
"stability": "experimental"
}
}
2 changes: 1 addition & 1 deletion packages/@aws-cdk/app-delivery/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ dist
.LAST_BUILD
.jsii
.nyc_output
.nycrc
nyc.config.js
tsconfig.json
*.js
*.d.ts
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/app-delivery/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copyright 2018-2020 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.
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/app-delivery/NOTICE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
AWS Cloud Development Kit (AWS CDK)
Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/app-delivery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@types/nodeunit": "^0.0.30",
"cdk-build-tools": "1.19.0",
"cdk-integ-tools": "1.19.0",
"fast-check": "^1.20.1",
"fast-check": "^1.21.0",
"nodeunit": "^0.11.3",
"pkglint": "1.19.0"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/assert/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ dist
.LAST_BUILD
.nyc_output
coverage
.nycrc
nyc.config.js
.LAST_PACKAGE
*.snk
*.snk
2 changes: 1 addition & 1 deletion packages/@aws-cdk/assert/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copyright 2018-2020 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.
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/assert/NOTICE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
AWS Cloud Development Kit (AWS CDK)
Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
38 changes: 27 additions & 11 deletions packages/@aws-cdk/assert/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,25 @@
"build+test+package": "npm run build+test && npm run package",
"build+test": "npm run build && npm test"
},
"nyc": {
"statements": 40,
"lines": 40,
"branches": 30
"jest": {
"collectCoverage": true,
"coverageReporters": [
"lcov",
"html",
"text-summary"
],
"coverageThreshold": {
"global": {
"statements": 80,
"lines": 80,
"branches": 60
}
},
"preset": "ts-jest",
"testMatch": [
"**/__tests__/**/*.ts?(x)",
"**/?(*.)+(spec|test).ts?(x)"
]
},
"author": {
"name": "Amazon Web Services",
Expand All @@ -26,18 +41,19 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@types/jest": "^24.0.23",
"@types/nodeunit": "^0.0.30",
"@types/jest": "^24.0.25",
"cdk-build-tools": "1.19.0",
"nodeunit": "^0.11.3",
"pkglint": "1.19.0"
"jest": "^24.9.0",
"pkglint": "1.19.0",
"ts-jest": "^24.2.0"
},
"dependencies": {
"@aws-cdk/cloudformation-diff": "1.19.0",
"@aws-cdk/core": "1.19.0",
"@aws-cdk/cx-api": "1.19.0",
"jest": "^24.9.0",
"source-map-support": "^0.5.16"
"@aws-cdk/cx-api": "1.19.0"
},
"peerDependencies": {
"jest": "^24.9.0"
},
"repository": {
"url": "https://github.com/aws/aws-cdk.git",
Expand Down
Loading

0 comments on commit 86e7ed5

Please sign in to comment.