Skip to content

Commit 9496057

Browse files
authored
Merge branch 'main' into merge-back/2.74.0
2 parents 70e2a33 + 046d0fc commit 9496057

File tree

85 files changed

+5862
-1958
lines changed

Some content is hidden

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

85 files changed

+5862
-1958
lines changed

CONTRIBUTING.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ Most contributions only require working on a single package, usually `aws-cdk-li
9999
time, you can execute the following to build it and it's dependencies.
100100

101101
```console
102-
$ cd packages/aws-cdk-lib
103-
$ ../../scripts/buildup
102+
$ npx lerna run build --scope=aws-cdk-lib
104103
```
105104

106-
Note: The `buildup` command is resumable. If your build fails, you can fix the issue and run `buildup --resume` to
107-
resume.
105+
Note: `lerna` uses a local cache by default. If your build fails, you can fix
106+
the issue and run the command again and it will not rerun any previously
107+
successful steps.
108108

109109
At this point, you can run build and test the `aws-cdk-lib` module by running
110110

@@ -121,13 +121,19 @@ However, if you wish to build the entire repository, the following command will
121121

122122
```console
123123
cd <root of the CDK repo>
124-
scripts/foreach.sh yarn build
124+
npx lerna run build
125125
```
126-
Note: The `foreach` command is resumable by default; you must supply `-r` or `--reset` to start a new session.
127126

128127
You are now ready to start contributing to the CDK. See the [Pull Requests](#pull-requests) section on how to make your
129128
changes and submit it as a pull request.
130129

130+
If you want to run a build without using the local cache, provide the
131+
`--skip-nx-cache` flag.
132+
133+
```console
134+
$ npx lerna run build --skip-nx-cache
135+
```
136+
131137
### Pack
132138

133139
As called out in the above sections, the AWS CDK uses jsii to produce polyglot targets. This means that each CDK module

build.sh

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ runtarget="build"
66
run_tests="true"
77
check_prereqs="true"
88
check_compat="true"
9+
ci="false"
10+
scope=""
911
while [[ "${1:-}" != "" ]]; do
1012
case $1 in
1113
-h|--help)
@@ -27,6 +29,9 @@ while [[ "${1:-}" != "" ]]; do
2729
--skip-compat)
2830
check_compat="false"
2931
;;
32+
--ci)
33+
ci=true
34+
;;
3035
*)
3136
echo "Unrecognized parameter: $1"
3237
exit 1
@@ -48,6 +53,18 @@ fi
4853

4954
echo "============================================================================================="
5055
echo "installing..."
56+
version=$(node -p "require('./package.json').version")
57+
# this is super weird. If you run 'npm install' twice
58+
# and it actually performs an install, then
59+
# node-bundle test will fail with "npm ERR! maxAge must be a number".
60+
# This won't happen in most instances because if nothing changes then npm install
61+
# won't perform an install.
62+
# In the pipeline however, npm install is run once when all the versions are '0.0.0' (via ./scripts/bump-candidate.sh)
63+
# and then `align-versions` is run which updates all the versions to
64+
# (for example) `2.74.0-rc.0` and then npm install is run again here.
65+
if [ "$version" != "0.0.0" ]; then
66+
rm -rf node_modules
67+
fi
5168
yarn install --frozen-lockfile --network-timeout 1000000
5269

5370
fail() {
@@ -72,21 +89,21 @@ node ./scripts/check-yarn-lock.js
7289
BUILD_INDICATOR=".BUILD_COMPLETED"
7390
rm -rf $BUILD_INDICATOR
7491

75-
# Speed up build by reusing calculated tree hashes
76-
# On dev machine, this speeds up the TypeScript part of the build by ~30%.
77-
export MERKLE_BUILD_CACHE=$(mktemp -d)
78-
trap "rm -rf $MERKLE_BUILD_CACHE" EXIT
79-
8092
if [ "$run_tests" == "true" ]; then
81-
runtarget="$runtarget+test"
93+
runtarget="$runtarget,test"
8294
fi
8395

8496
# Limit top-level concurrency to available CPUs - 1 to limit CPU load.
8597
concurrency=$(node -p 'Math.max(1, require("os").cpus().length - 1)')
8698

99+
flags=""
100+
if [ "$ci" == "true" ]; then
101+
flags="--stream --no-progress --skip-nx-cache"
102+
fi
103+
87104
echo "============================================================================================="
88105
echo "building..."
89-
time npx lerna run $bail --stream --concurrency=$concurrency $runtarget || fail
106+
time npx lerna run $bail --concurrency=$concurrency $runtarget $flags || fail
90107

91108
if [ "$check_compat" == "true" ]; then
92109
/bin/bash scripts/check-api-compatibility.sh

buildspec-pr.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ phases:
2424
- /bin/bash ./scripts/cache-load.sh
2525
build:
2626
commands:
27-
- /bin/bash ./build.sh
27+
- /bin/bash ./build.sh --ci
2828
# After compilation, run Rosetta (using the cache if available).
2929
# This will print errors, and fail the build if there are compilation errors in any packages marked as 'strict'.
3030
- /bin/bash ./scripts/run-rosetta.sh

buildspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ phases:
3030
- codebuild-breakpoint
3131
- 'if ${BUMP_CANDIDATE:-false}; then env NODE_OPTIONS="--max-old-space-size=8196 ${NODE_OPTIONS:-}" /bin/bash ./scripts/bump-candidate.sh; fi'
3232
- /bin/bash ./scripts/align-version.sh
33-
- /bin/bash ./build.sh
33+
- /bin/bash ./build.sh --ci
3434
post_build:
3535
commands:
3636
# Short-circuit: Don't run pack if the above build failed.

lerna.json

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
11
{
2-
"lerna": "^4.0.0",
32
"npmClient": "yarn",
43
"useWorkspaces": true,
54
"packages": [
6-
"packages/*",
5+
"packages/aws-cdk-lib",
6+
"packages/cdk-cli-wrapper",
7+
"packages/cdk-assets",
8+
"packages/aws-cdk",
9+
"packages/cdk",
710
"packages/@aws-cdk/*",
11+
"packages/awslint",
812
"packages/@aws-cdk-containers/*",
913
"packages/@aws-cdk-testing/*",
1014
"packages/@aws-cdk/*/lambda-packages/*",
11-
"tools/*",
12-
"tools/@aws-cdk/*",
13-
"scripts/@aws-cdk/script-tests",
14-
"packages/individual-packages/*"
15+
"tools/@aws-cdk/cdk-build-tools",
16+
"tools/@aws-cdk/cdk-release",
17+
"tools/@aws-cdk/cfn2ts",
18+
"tools/@aws-cdk/eslint-plugin",
19+
"tools/@aws-cdk/node-bundle",
20+
"tools/@aws-cdk/pkglint",
21+
"tools/@aws-cdk/pkgtools",
22+
"tools/@aws-cdk/prlint",
23+
"tools/@aws-cdk/yarn-cling",
24+
"scripts/@aws-cdk/script-tests"
1525
],
1626
"rejectCycles": "true",
17-
"version": "0.0.0"
27+
"version": "0.0.0",
28+
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
1829
}

nx.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"extends": "@nrwl/workspace/presets/npm.json",
3+
"workspaceLayout": { },
4+
"tasksRunnerOptions": {
5+
"default": {
6+
"runner": "@nrwl/workspace/tasks-runners/default",
7+
"options": {
8+
"cacheableOperations": [
9+
"build",
10+
"test",
11+
"lint",
12+
"package",
13+
"prepare"
14+
]
15+
}
16+
}
17+
},
18+
"targetDefaults": {
19+
"build": {
20+
"implicitDependencies": ["aws-cdk-lib"],
21+
"dependsOn": ["^build"],
22+
"inputs": [
23+
"{projectRoot}/lib/!(*.d|*.generated).ts",
24+
"{projectRoot}/test/!(*.d).ts",
25+
"!{workspaceRoot}/**/tsconfig.json",
26+
"!{workspaceRoot}/**/tsconfig.json",
27+
"!{workspaceRoot}/tsconfig.base.json",
28+
"!{workspaceRoot}/**/tsconfig.tsbuildinfo"
29+
],
30+
"outputs": [
31+
"!{projectRoot}/**/*.integ.snapshot/*",
32+
"{projectRoot}/tsconfig.json",
33+
"{projectRoot}/lib/aws-custom-resource/sdk-api-metadata.json",
34+
"{projectRoot}/build-info.json",
35+
"{projectRoot}/lib/**/*.js",
36+
"{projectRoot}/lib/layer.zip",
37+
"{projectRoot}/bin/**/*.js",
38+
"{projectRoot}/lib/**/*.js.map",
39+
"{projectRoot}/lib/**/*.generated.ts",
40+
"{projectRoot}/lib/**/*.d.ts",
41+
"{projectRoot}/test/**/*.d.ts",
42+
"{projectRoot}/test/**/*.js",
43+
"{projectRoot}/.jsii",
44+
"{projectRoot}/spec/*.json",
45+
"{projectRoot}/.warnings.jsii.js"
46+
]
47+
},
48+
"test": {
49+
"dependsOn": ["build"]
50+
},
51+
},
52+
"affected": {
53+
"defaultBase": "main"
54+
},
55+
"pluginsConfig": {
56+
"@nrwl/js": {
57+
"analyzeSourceFiles": false
58+
}
59+
}
60+
}

package.json

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
"pack": "./pack.sh",
1313
"compat": "./scripts/check-api-compatibility.sh",
1414
"bump": "./bump.sh",
15-
"build-all": "tsc -b",
16-
"postinstall": "patch-package --error-on-fail"
15+
"build-all": "tsc -b"
1716
},
1817
"devDependencies": {
1918
"@types/node": "18.11.19",
@@ -28,10 +27,13 @@
2827
"jsii-pacmak": "1.78.1",
2928
"jsii-reflect": "1.78.1",
3029
"jsii-rosetta": "~5.0.0",
31-
"lerna": "^4.0.0",
30+
"lerna": "^6.6.1",
3231
"patch-package": "^6.5.1",
3332
"semver": "^6.3.0",
3433
"standard-version": "^9.5.0",
34+
"@nrwl/cli": "^15.9.1",
35+
"@nrwl/workspace": "^15.9.1",
36+
"nx": "^15.9.1",
3537
"typescript": "~4.9.5"
3638
},
3739
"resolutions": {
@@ -66,15 +68,26 @@
6668
},
6769
"workspaces": {
6870
"packages": [
69-
"packages/*",
71+
"packages/aws-cdk-lib",
72+
"packages/cdk-cli-wrapper",
73+
"packages/aws-cdk",
74+
"packages/cdk",
75+
"packages/cdk-assets",
7076
"packages/@aws-cdk/*",
77+
"packages/awslint",
7178
"packages/@aws-cdk-containers/*",
7279
"packages/@aws-cdk-testing/*",
7380
"packages/@aws-cdk/*/lambda-packages/*",
74-
"tools/*",
75-
"tools/@aws-cdk/*",
76-
"scripts/@aws-cdk/script-tests",
77-
"packages/individual-packages/*"
81+
"tools/@aws-cdk/cdk-build-tools",
82+
"tools/@aws-cdk/cdk-release",
83+
"tools/@aws-cdk/cfn2ts",
84+
"tools/@aws-cdk/eslint-plugin",
85+
"tools/@aws-cdk/node-bundle",
86+
"tools/@aws-cdk/pkglint",
87+
"tools/@aws-cdk/pkgtools",
88+
"tools/@aws-cdk/prlint",
89+
"tools/@aws-cdk/yarn-cling",
90+
"scripts/@aws-cdk/script-tests"
7891
],
7992
"nohoist": [
8093
"**/jszip",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":"31.0.0"}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"version": "31.0.0",
3+
"files": {
4+
"09b19c98d056dc3ddd9d9852de04232c8c27cdfbb4aa83797c6f9e1e118068d5": {
5+
"source": {
6+
"path": "integ-ec2-machine-image-test.template.json",
7+
"packaging": "file"
8+
},
9+
"destinations": {
10+
"current_account-current_region": {
11+
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12+
"objectKey": "09b19c98d056dc3ddd9d9852de04232c8c27cdfbb4aa83797c6f9e1e118068d5.json",
13+
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
14+
}
15+
}
16+
}
17+
},
18+
"dockerImages": {}
19+
}

0 commit comments

Comments
 (0)