Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2342c49
fix: move reference interfaces to their own submodules
rix0rrr Nov 6, 2025
c1ec13f
Fix semis
rix0rrr Nov 6, 2025
a5b4903
That made us not import `core`
rix0rrr Nov 6, 2025
bc60594
selective imports should be at service submodule level
Nov 6, 2025
6cd0707
Unused ident
rix0rrr Nov 7, 2025
37f1467
Oya le le
rix0rrr Nov 7, 2025
3920f92
Deprecation
rix0rrr Nov 7, 2025
09282a5
Account for kinesisanalyticsv2
rix0rrr Nov 7, 2025
2fa03b2
Add remapped types for use with jsii-diff
rix0rrr Nov 7, 2025
eab8c46
Integrated rmapped types and breaking changes
rix0rrr Nov 7, 2025
8d5acdf
Fix compilation error with newer version of jsii
rix0rrr Nov 7, 2025
48cb0e2
Diff submodule config
rix0rrr Nov 10, 2025
42b9a43
Update to latest jsii
rix0rrr Nov 11, 2025
a337edd
Must use export type
rix0rrr Nov 11, 2025
a4d64bf
Snappies
rix0rrr Nov 11, 2025
f5dac18
Move IEnvironmentAware to avoid another cycle
rix0rrr Nov 11, 2025
dcb6568
Merge remote-tracking branch 'origin/main' into huijbers/centralized-…
mrgrain Nov 11, 2025
32128c0
fix jsiirc
rix0rrr Nov 11, 2025
c168e68
Update snaps
rix0rrr Nov 12, 2025
c7bc292
Merge branch 'main' into huijbers/centralized-l1-interfaces
mrgrain Nov 12, 2025
c3dfc9f
remove files and comments
mrgrain Nov 12, 2025
770d5ff
fix targets
mrgrain Nov 12, 2025
177aa9a
cleanup
mrgrain Nov 12, 2025
615b17b
remove unused import
mrgrain Nov 12, 2025
b50f3ce
better snaps
mrgrain Nov 12, 2025
a601c61
import from core
mrgrain Nov 12, 2025
e3dbb5b
Move more types
rix0rrr Nov 12, 2025
f380758
Merge branch 'huijbers/centralized-l1-interfaces' of github.com:aws/a…
rix0rrr Nov 12, 2025
c32f817
Merge branch 'main' into huijbers/centralized-l1-interfaces
mergify[bot] Nov 12, 2025
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
1 change: 1 addition & 0 deletions packages/aws-cdk-lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ export * as cloud_assembly_schema from './cloud-assembly-schema';
export * as cloudformation_include from './cloudformation-include';
export * as custom_resources from './custom-resources';
export * as cx_api from './cx-api';
export * as interfaces from './interfaces';
export * as lambda_layer_awscli from './lambda-layer-awscli';
export * as lambda_layer_node_proxy_agent from './lambda-layer-node-proxy-agent';
export * as pipelines from './pipelines';
Expand Down
13 changes: 13 additions & 0 deletions packages/aws-cdk-lib/interfaces/.jsiirc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"targets": {
"java": {
"package": "software.amazon.awscdk.interfaces"
},
"dotnet": {
"namespace": "Amazon.CDK.Interfaces"
},
"python": {
"module": "aws_cdk.interfaces"
}
}
}
33 changes: 33 additions & 0 deletions packages/aws-cdk-lib/interfaces/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
CDK Resource Interfaces
=======================

This module contains resource interfaces for all AWS service resources.

These are interfaces that look like this:

```
/**
* Indicates that this resource can be referenced as a Bucket.
*/
interface IBucketRef {
/**
* A reference to a Bucket resource.
*/
readonly bucketRef: BucketReference;
}

interface BucketReference {
/**
* The BucketName of the Bucket resource.
*/
readonly bucketName: string;

/**
* The ARN of the Bucket resource.
*/
readonly bucketArn: string;
}
```

These are in a separate submodule so that they can be referenced from all other
service submodules without introducing cyclic dependencies between them.
267 changes: 267 additions & 0 deletions packages/aws-cdk-lib/interfaces/index.ts

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/aws-cdk-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@
"./custom-resources": "./custom-resources/index.js",
"./custom-resources/lib/helpers-internal": "./custom-resources/lib/helpers-internal/index.js",
"./cx-api": "./cx-api/index.js",
"./interfaces": "./interfaces/index.js",
"./lambda-layer-awscli": "./lambda-layer-awscli/index.js",
"./lambda-layer-kubectl": "./lambda-layer-kubectl/index.js",
"./lambda-layer-node-proxy-agent": "./lambda-layer-node-proxy-agent/index.js",
Expand Down
21 changes: 17 additions & 4 deletions packages/aws-cdk-lib/scripts/gen.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import * as path from 'node:path';
import * as fs from 'fs-extra';
import { generateAll, ModuleMap } from './codegen';
import submodulesGen from './submodules';
import generateServiceSubmoduleFiles from './submodules';

const awsCdkLibDir = path.join(__dirname, '..');
const pkgJsonPath = path.join(awsCdkLibDir, 'package.json');
const topLevelIndexFilePath = path.join(awsCdkLibDir, 'index.ts');
const scopeMapPath = path.join(__dirname, 'scope-map.json');

const NON_SERVICE_SUBMODULES = ['core', 'interfaces'];

main().catch(e => {
// eslint-disable-next-line no-console
console.error(e);
Expand All @@ -18,17 +20,22 @@ async function main() {
// Generate all L1s based on config in scope-map.json

const generated = (await generateAll(awsCdkLibDir, {
coreImport: '../../core',
cloudwatchImport: '../../aws-cloudwatch',
skippedServices: [],
scopeMapPath,
}));

await updateExportsAndEntryPoints(generated);
await writeScopeMap(generated);
await submodulesGen(generated, awsCdkLibDir);

for (const nss of NON_SERVICE_SUBMODULES) {
delete generated[nss];
}
await generateServiceSubmoduleFiles(generated, awsCdkLibDir);
}

/**
* Generates `scope-map.json`, which maps every `aws-cdk-lib` submodule to the AWS service prefix in that submodule
*/
async function writeScopeMap(modules: ModuleMap) {
const newScopeMap = Object.entries(modules)
.sort(([modA], [modB]) => modA.localeCompare(modB))
Expand All @@ -41,6 +48,12 @@ async function writeScopeMap(modules: ModuleMap) {
await fs.writeJson(scopeMapPath, newScopeMap, { spaces: 2 });
}

/**
* Make every module in the module map visible
*
* Read `index.ts` and `package.json#exports`, and add exports for every
* submodule that's not in there yet.
*/
async function updateExportsAndEntryPoints(modules: ModuleMap) {
const pkgJson = await fs.readJson(pkgJsonPath);

Expand Down
3 changes: 2 additions & 1 deletion packages/aws-cdk-lib/scripts/scope-map.json
Original file line number Diff line number Diff line change
Expand Up @@ -1338,5 +1338,6 @@
{
"namespace": "AWS::CloudFormation"
}
]
],
"interfaces": []
}
11 changes: 6 additions & 5 deletions packages/aws-cdk-lib/scripts/submodules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import * as fs from 'fs-extra';
import cloudformationInclude from './cloudformation-include';
import { ModuleMap, ModuleMapEntry } from '../codegen';

export default async function submodulesGen(modules: ModuleMap, outPath: string) {
/**
* Make sure that a number of expected files exist for every service submodule
*
* Non-service submodules should not be passed to this function.
*/
export default async function generateServiceSubmoduleFiles(modules: ModuleMap, outPath: string) {
for (const submodule of Object.values(modules)) {
if (submodule.name === 'core') {
continue;
}

const submodulePath = path.join(outPath, submodule.name);
await ensureSubmodule(submodule, submodulePath);
}
Expand Down
Loading
Loading