Skip to content

Commit

Permalink
chore(release): 2.173.3 (#32663)
Browse files Browse the repository at this point in the history
See CHANGELOG

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
mergify[bot] authored Dec 26, 2024
2 parents 3055717 + 2e198d4 commit 00db01f
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.v2.alpha.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.173.3-alpha.0](https://github.com/aws/aws-cdk/compare/v2.173.2-alpha.0...v2.173.3-alpha.0) (2024-12-26)

## [2.173.2-alpha.0](https://github.com/aws/aws-cdk/compare/v2.173.1-alpha.0...v2.173.2-alpha.0) (2024-12-17)

## [2.173.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.173.0-alpha.0...v2.173.1-alpha.0) (2024-12-14)
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.173.3](https://github.com/aws/aws-cdk/compare/v2.173.2...v2.173.3) (2024-12-26)


### Bug Fixes

* **aspects:** "localAspects is not iterable" error ([#32647](https://github.com/aws/aws-cdk/issues/32647)) ([8948ecb](https://github.com/aws/aws-cdk/commit/8948ecb22627ef57498e68fb721b0598aaa530ee)), closes [#32470](https://github.com/aws/aws-cdk/issues/32470)

## [2.173.2](https://github.com/aws/aws-cdk/compare/v2.173.1...v2.173.2) (2024-12-17)


Expand Down
22 changes: 18 additions & 4 deletions packages/aws-cdk-lib/core/lib/private/synthesis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { CloudAssembly } from '../../../cx-api';
import * as cxapi from '../../../cx-api';
import { Annotations } from '../annotations';
import { App } from '../app';
import { AspectApplication, Aspects } from '../aspect';
import { AspectApplication, AspectPriority, Aspects } from '../aspect';
import { FileSystem } from '../fs';
import { Stack } from '../stack';
import { ISynthesisSession } from '../stack-synthesizers/types';
Expand Down Expand Up @@ -228,7 +228,7 @@ function invokeAspects(root: IConstruct) {
const node = construct.node;
const aspects = Aspects.of(construct);

let localAspects = aspects.applied;
let localAspects = getAspectApplications(construct);
const allAspectsHere = sortAspectsByPriority(inheritedAspects, localAspects);

const nodeAspectsCount = aspects.all.length;
Expand Down Expand Up @@ -290,11 +290,10 @@ function invokeAspectsV2(root: IConstruct) {

function recurse(construct: IConstruct, inheritedAspects: AspectApplication[]): boolean {
const node = construct.node;
const aspects = Aspects.of(construct);

let didSomething = false;

let localAspects = aspects.applied;
let localAspects = getAspectApplications(construct);
const allAspectsHere = sortAspectsByPriority(inheritedAspects, localAspects);

for (const aspectApplication of allAspectsHere) {
Expand Down Expand Up @@ -354,6 +353,21 @@ function sortAspectsByPriority(inheritedAspects: AspectApplication[], localAspec
return allAspects;
}

/**
* Helper function to get aspect applications.
* If `Aspects.applied` is available, it is used; otherwise, create AspectApplications from `Aspects.all`.
*/
function getAspectApplications(node: IConstruct): AspectApplication[] {
const aspects = Aspects.of(node);
if (aspects.applied !== undefined) {
return aspects.applied;
}

// Fallback: Create AspectApplications from `aspects.all`
const typedAspects = aspects as Aspects;
return typedAspects.all.map(aspect => new AspectApplication(node, aspect, AspectPriority.DEFAULT));
}

/**
* Find all stacks and add Metadata Resources to all of them
*
Expand Down
20 changes: 20 additions & 0 deletions packages/aws-cdk-lib/core/test/aspect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,4 +309,24 @@ describe('aspect', () => {
}
}
}

test.each([
{ stabilization: true },
{ stabilization: false },
])('Error is not thrown if Aspects.applied does not exist (stabilization: $stabilization)', ({ stabilization }) => {
const app = new App({ context: { '@aws-cdk/core:aspectStabilization': stabilization } });
const root = new Stack(app, 'My-Stack');

Aspects.of(root).add(new Tag('AspectA', 'Visited'));

// "Monkey patching" - Override `applied` to simulate its absence
Object.defineProperty(Aspects.prototype, 'applied', {
value: undefined,
configurable: true,
});

expect(() => {
app.synth();
}).not.toThrow();
});
});
4 changes: 2 additions & 2 deletions version.v2.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "2.173.2",
"alphaVersion": "2.173.2-alpha.0"
"version": "2.173.3",
"alphaVersion": "2.173.3-alpha.0"
}

0 comments on commit 00db01f

Please sign in to comment.