Skip to content
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

chore(cdk-lib): migrate to jsii@5.0 / jsii-rosetta@5.0 #24425

Merged
merged 36 commits into from
Mar 22, 2023
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b95dc15
chore: migrate to jsii-compiler 4.9, enable noImplicitOverride
RomainMuller Mar 1, 2023
3a8e646
chore: migrate to jsii-compiler 4.9, enable noImplicitOverride
RomainMuller Mar 1, 2023
c508bff
revert noImplicitOverride change
RomainMuller Mar 13, 2023
14dca9b
Merge remote-tracking branch 'origin/main' into rmuller/compiler-v49-…
RomainMuller Mar 13, 2023
b279987
Use '@jsii ignore' instead of '@internal', re-introduce deleted inter…
RomainMuller Mar 13, 2023
23c69bc
undo asset staging logging change
RomainMuller Mar 13, 2023
ccde9ae
remove override keyword
RomainMuller Mar 13, 2023
9e81dff
add docstring
RomainMuller Mar 13, 2023
99d0f97
fix nullable map value signatures
RomainMuller Mar 13, 2023
5c8683c
fix nullable map value
RomainMuller Mar 13, 2023
12f0507
update THIRD_PARTY_LICENSES
RomainMuller Mar 13, 2023
2150924
silence awslint rule about unused type
RomainMuller Mar 13, 2023
2ec7f42
ignore one more unused type
RomainMuller Mar 13, 2023
2edabba
remove last noImplicitOverride
RomainMuller Mar 13, 2023
eed8bd4
allow the necessary breaking changes
RomainMuller Mar 14, 2023
40a0bcf
Merge branch 'main' into rmuller/compiler-v49-next
RomainMuller Mar 16, 2023
b66a525
chore: update jsii dependencies from v1 line
RomainMuller Mar 16, 2023
f93c14c
update THIRD_PARTY_LICENSES file
RomainMuller Mar 16, 2023
b279f89
further upgrade jsii 1.x
RomainMuller Mar 17, 2023
9bc853d
switch to jsii @ jsii-rosetta v5.0-next
RomainMuller Mar 17, 2023
86e792b
move to 5.0
RomainMuller Mar 17, 2023
a6654d7
Merge branch 'main' into rmuller/compiler-v49-next
RomainMuller Mar 17, 2023
e364acc
Merge remote-tracking branch 'origin/main' into rmuller/compiler-v49-…
RomainMuller Mar 17, 2023
52991ae
Merge remote-tracking branch 'origin/main' into rmuller/compiler-v49-…
RomainMuller Mar 17, 2023
7919d46
Merge branch 'main' into rmuller/compiler-v49-next
RomainMuller Mar 17, 2023
05fa30f
upgrade to latest build
RomainMuller Mar 20, 2023
bbea00d
Merge remote-tracking branch 'origin/main' into rmuller/compiler-v49-…
RomainMuller Mar 20, 2023
d13fa1c
remove v4.9-next dependencies
RomainMuller Mar 20, 2023
5c7924c
Merge branch 'main' into rmuller/compiler-v49-next
RomainMuller Mar 20, 2023
a19ebdf
update to GA release of @5.0.x
RomainMuller Mar 20, 2023
4306207
Merge branch 'main' into rmuller/compiler-v49-next
RomainMuller Mar 20, 2023
0d1461c
Update allowed-breaking-changes.txt
RomainMuller Mar 21, 2023
af5d28e
Merge branch 'main' into rmuller/compiler-v49-next
RomainMuller Mar 21, 2023
e96bf3e
Merge branch 'main' into rmuller/compiler-v49-next
mergify[bot] Mar 22, 2023
d348ef7
fix catch binding
RomainMuller Mar 22, 2023
61dfab0
Merge branch 'main' into rmuller/compiler-v49-next
mergify[bot] Mar 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 6 additions & 1 deletion allowed-breaking-changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,9 @@ strengthened:aws-cdk-lib.pipelines.ProduceActionOptions
# reverted a change that broke deployments for anyone using Triggers
removed:aws-cdk-lib.triggers.InvocationType
removed:aws-cdk-lib.triggers.TriggerProps.invocationType
removed:aws-cdk-lib.triggers.TriggerProps.timeout
removed:aws-cdk-lib.triggers.TriggerProps.timeout

# broken it used to return a tuple type, that was incorrectly interpreted by jsii
change-return-type:aws-cdk-lib.aws_ec2.SecurityGroup.determineRuleScope
# broken only in non-JS/TS, where that was not previously usable
strengthened:aws-cdk-lib.aws_s3_deployment.BucketDeploymentProps
7 changes: 5 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ while [[ "${1:-}" != "" ]]; do
done

export PATH=$(npm bin):$PATH
export NODE_OPTIONS="--max-old-space-size=4096 --experimental-worker ${NODE_OPTIONS:-}"
export NODE_OPTIONS="--max-old-space-size=8196 --experimental-worker ${NODE_OPTIONS:-}"

if ! [ -x "$(command -v yarn)" ]; then
echo "yarn is not installed. Install it from here- https://yarnpkg.com/en/docs/install."
Expand Down Expand Up @@ -78,9 +78,12 @@ if [ "$run_tests" == "true" ]; then
runtarget="$runtarget+test"
fi

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

echo "============================================================================================="
echo "building..."
time lerna run $bail --stream $runtarget || fail
time lerna run $bail --stream --concurrency=$concurrency $runtarget || fail

if [ "$check_compat" == "true" ]; then
/bin/bash scripts/check-api-compatibility.sh
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
"fs-extra": "^9.1.0",
"graceful-fs": "^4.2.10",
"jest-junit": "^13.2.0",
"jsii-diff": "1.77.0",
"jsii-pacmak": "1.77.0",
"jsii-reflect": "1.77.0",
"jsii-rosetta": "v4.9-next",
"jsii-diff": "1.78.1",
"jsii-pacmak": "1.78.1",
"jsii-reflect": "1.78.1",
"jsii-rosetta": "~5.0.0",
"lerna": "^4.0.0",
"patch-package": "^6.5.1",
"semver": "^6.3.0",
"standard-version": "^9.5.0",
"typescript": "~3.9.10"
"typescript": "~4.9.5"
},
"resolutions": {
"colors": "1.4.0",
Expand Down
21 changes: 11 additions & 10 deletions packages/@aws-cdk-testing/cli-integ/lib/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class AwsClients {
public async stackStatus(stackName: string): Promise<string | undefined> {
try {
return (await this.cloudFormation('describeStacks', { StackName: stackName })).Stacks?.[0].StackStatus;
} catch (e) {
} catch (e: any) {
if (isStackMissingError(e)) { return undefined; }
throw e;
}
Expand Down Expand Up @@ -113,7 +113,7 @@ export class AwsClients {
await this.s3('deleteBucket', {
Bucket: bucketName,
});
} catch (e) {
} catch (e: any) {
if (isBucketMissingError(e)) { return; }
throw e;
}
Expand All @@ -126,15 +126,16 @@ export class AwsClients {
* Create the correct client, do the call and resole the promise().
*/
async function awsCall<
A extends AWS.Service,
B extends keyof ServiceCalls<A>,
>(ctor: new (config: any) => A, config: any, call: B, request: First<ServiceCalls<A>[B]>): Promise<Second<ServiceCalls<A>[B]>> {
Svc extends AWS.Service,
Calls extends ServiceCalls<Svc>,
Call extends keyof Calls,
>(ctor: new (config: any) => Svc, config: any, call: Call, request: First<Calls[Call]>): Promise<Second<Calls[Call]>> {
const cfn = new ctor(config);
const response = cfn[call](request);
const response = ((cfn as any)[call] as any)(request);
try {
return response.promise();
} catch (e) {
const newErr = new Error(`${call}(${JSON.stringify(request)}): ${e.message}`);
} catch (e: any) {
const newErr = new Error(`${String(call)}(${JSON.stringify(request)}): ${e.message}`);
(newErr as any).code = e.code;
throw newErr;
}
Expand Down Expand Up @@ -210,7 +211,7 @@ export async function retry<A>(output: NodeJS.WritableStream, operation: string,
const ret = await block();
output.write(`💈 ${operation}: succeeded after ${i} attempts\n`);
return ret;
} catch (e) {
} catch (e: any) {
if (e.abort || Date.now() > deadline.getTime( )) {
throw new Error(`${operation}: did not succeed after ${i} attempts: ${e}`);
}
Expand Down Expand Up @@ -290,4 +291,4 @@ function chainableCredentials(region: string): AWS.Credentials | undefined {
}

return undefined;
}
}
2 changes: 1 addition & 1 deletion packages/@aws-cdk-testing/cli-integ/lib/integ-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function integTest(
output.write(`${s}\n`);
},
});
} catch (e) {
} catch (e: any) {
process.stderr.write(`[INTEG TEST::${name}] Failed: ${e}\n`);
output.write(e.message);
output.write(e.stack);
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk-testing/cli-integ/lib/shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export function rimraf(fsPath: string) {
} else {
fs.unlinkSync(fsPath);
}
} catch (e) {
} catch (e: any) {
// We will survive ENOENT
if (e.code !== 'ENOENT') { throw e; }
}
Expand All @@ -165,4 +165,4 @@ export function addToShellPath(x: string) {
}

process.env.PATH = parts.join(':');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class TestRepository {

// eslint-disable-next-line no-console
console.log('Deleted', this.repositoryName);
} catch (e) {
} catch (e: any) {
if (e.code !== 'ResourceNotFoundException') { throw e; }
// Okay
}
Expand Down Expand Up @@ -199,7 +199,7 @@ export class TestRepository {
try {
await this.codeArtifact.describeDomain({ domain: this.domain }).promise();
return true;
} catch (e) {
} catch (e: any) {
if (e.code !== 'ResourceNotFoundException') { throw e; }
return false;
}
Expand All @@ -209,7 +209,7 @@ export class TestRepository {
try {
await this.codeArtifact.describeRepository({ domain: this.domain, repository: name }).promise();
return true;
} catch (e) {
} catch (e: any) {
if (e.code !== 'ResourceNotFoundException') { throw e; }
return false;
}
Expand Down Expand Up @@ -246,7 +246,7 @@ async function retry<A>(block: () => Promise<A>) {
while (true) {
try {
return await block();
} catch (e) {
} catch (e: any) {
if (attempts-- === 0) { throw e; }
// eslint-disable-next-line no-console
console.debug(e.message);
Expand All @@ -261,7 +261,7 @@ async function retryThrottled<A>(block: () => Promise<A>) {
while (true) {
try {
return await block();
} catch (e) {
} catch (e: any) {
// eslint-disable-next-line no-console
console.debug(e.message);
if (e.code !== 'ThrottlingException') { throw e; }
Expand All @@ -279,4 +279,4 @@ export interface LoginInformation {
readonly mavenEndpoint: string;
readonly nugetEndpoint: string;
readonly pypiEndpoint: string;
}
}
2 changes: 1 addition & 1 deletion packages/@aws-cdk-testing/cli-integ/lib/with-aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async function sanityCheck(aws: AwsClients) {
try {
await aws.account();
sanityChecked = true;
} catch (e) {
} catch (e: any) {
sanityChecked = false;
throw new Error(`AWS credentials probably not configured, got error: ${e.message}`);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk-testing/cli-integ/lib/with-sam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function withSamIntegrationCdkApp<A extends TestContext & AwsContext>(blo
});
}
await block(fixture);
} catch (e) {
} catch (e: any) {
// We survive certain cases involving gopkg.in
if (errorCausedByGoPkg(e.message)) {
return;
Expand Down
8 changes: 4 additions & 4 deletions packages/@aws-cdk-testing/cli-integ/lib/xpmutex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class XpMutex {
// Acquire lock by being the one to create the file
try {
return await this.writePidFile('wx'); // Fails if the file already exists
} catch (e) {
} catch (e: any) {
if (e.code !== 'EEXIST') { throw e; }
}

Expand Down Expand Up @@ -159,7 +159,7 @@ export class XpMutex {
let contents;
try {
contents = await fs.readFile(this.fileName, { encoding: 'utf-8' });
} catch (e) {
} catch (e: any) {
if (e.code === 'ENOENT') { return undefined; }
throw e;
}
Expand Down Expand Up @@ -194,7 +194,7 @@ async function fileExists(fileName: string) {
try {
await fs.stat(fileName);
return true;
} catch (e) {
} catch (e: any) {
if (e.code === 'ENOENT') { return false; }
throw e;
}
Expand All @@ -204,7 +204,7 @@ function processExists(pid: number) {
try {
process.kill(pid, 0);
return true;
} catch (e) {
} catch {
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ integTest('deploy with role', withDefaultFixture(async (fixture) => {
});
}
await fixture.aws.iam('deleteRole', { RoleName: roleName });
} catch (e) {
} catch (e: any) {
if (e.message.indexOf('cannot be found') > -1) { return; }
throw e;
}
Expand Down
3 changes: 1 addition & 2 deletions packages/@aws-cdk/alexa-ask/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.5.2",
"jsii": "v4.9-next"
"@types/jest": "^27.5.2"
},
"dependencies": {
"@aws-cdk/core": "0.0.0",
Expand Down
7 changes: 7 additions & 0 deletions packages/@aws-cdk/assertions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
"description": "An assertion library for use with CDK Apps",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"typesVersions": {
"<=3.9": {
"*": [
".types-compat/ts3.9/*"
]
}
},
"scripts": {
"build": "cdk-build",
"watch": "cdk-watch",
Expand Down
3 changes: 1 addition & 2 deletions packages/@aws-cdk/aws-accessanalyzer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.5.2",
"jsii": "v4.9-next"
"@types/jest": "^27.5.2"
},
"dependencies": {
"@aws-cdk/core": "0.0.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/@aws-cdk/aws-amazonmq/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.5.2",
"jsii": "v4.9-next"
"@types/jest": "^27.5.2"
},
"dependencies": {
"@aws-cdk/core": "0.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ export abstract class ResourceHandler {
console.log(JSON.stringify(x, undefined, 2));
}

protected abstract async onCreate(): Promise<AmplifyJobId>;
protected abstract async onDelete(): Promise<void>;
protected abstract async onUpdate(): Promise<AmplifyJobId>;
protected abstract async isCreateComplete(): Promise<IsCompleteResponse>;
protected abstract async isDeleteComplete(): Promise<IsCompleteResponse>;
protected abstract async isUpdateComplete(): Promise<IsCompleteResponse>;
protected abstract onCreate(): Promise<AmplifyJobId>;
protected abstract onDelete(): Promise<void>;
protected abstract onUpdate(): Promise<AmplifyJobId>;
protected abstract isCreateComplete(): Promise<IsCompleteResponse>;
protected abstract isDeleteComplete(): Promise<IsCompleteResponse>;
protected abstract isUpdateComplete(): Promise<IsCompleteResponse>;
}
3 changes: 1 addition & 2 deletions packages/@aws-cdk/aws-amplify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.5.2",
"aws-sdk": "^2.1329.0",
"jsii": "v4.9-next"
"aws-sdk": "^2.1329.0"
},
"dependencies": {
"@aws-cdk/aws-codebuild": "0.0.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/@aws-cdk/aws-amplifyuibuilder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
"@types/jest": "^27.5.2",
"@types/node": "18.11.19",
"jsii": "v4.9-next"
"@types/node": "18.11.19"
},
"dependencies": {
"@aws-cdk/core": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigateway/lib/authorizers/lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ abstract class LambdaAuthorizer extends Authorizer implements IAuthorizer {
* The id of the authorizer.
* @attribute
*/
public abstract readonly authorizerId: string;
public abstract override readonly authorizerId: string;

/**
* The ARN of the authorizer to be used in permission policies, such as IAM and resource-based grants.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading