Skip to content

Commit 22b9b3d

Browse files
authored
revert: "chore: add new interfaces for Assets (#13356)" (#13426)
This reverts commit 48963f7 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent c7c424f commit 22b9b3d

File tree

4 files changed

+19
-54
lines changed

4 files changed

+19
-54
lines changed

packages/@aws-cdk/assets/lib/fs/options.ts

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export interface CopyOptions {
1010
* A strategy for how to handle symlinks.
1111
*
1212
* @default Never
13-
* @deprecated use `followSymlinks` instead
1413
*/
1514
readonly follow?: FollowMode;
1615

packages/@aws-cdk/aws-ecr-assets/lib/image-asset.ts

+3-14
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as fs from 'fs';
22
import * as path from 'path';
33
import * as assets from '@aws-cdk/assets';
44
import * as ecr from '@aws-cdk/aws-ecr';
5-
import { Annotations, AssetStaging, FeatureFlags, FileFingerprintOptions, IgnoreMode, Stack, SymlinkFollowMode, Token } from '@aws-cdk/core';
5+
import { Annotations, FeatureFlags, IgnoreMode, Stack, Token } from '@aws-cdk/core';
66
import * as cxapi from '@aws-cdk/cx-api';
77
import { Construct } from 'constructs';
88

@@ -13,7 +13,7 @@ import { Construct as CoreConstruct } from '@aws-cdk/core';
1313
/**
1414
* Options for DockerImageAsset
1515
*/
16-
export interface DockerImageAssetOptions extends assets.FingerprintOptions, FileFingerprintOptions {
16+
export interface DockerImageAssetOptions extends assets.FingerprintOptions {
1717
/**
1818
* ECR repository name
1919
*
@@ -141,9 +141,8 @@ export class DockerImageAsset extends CoreConstruct implements assets.IAsset {
141141
// deletion of the ECR repository the app used).
142142
extraHash.version = '1.21.0';
143143

144-
const staging = new AssetStaging(this, 'Staging', {
144+
const staging = new assets.Staging(this, 'Staging', {
145145
...props,
146-
follow: props.followSymlinks ?? toSymlinkFollow(props.follow),
147146
exclude,
148147
ignoreMode,
149148
sourcePath: dir,
@@ -186,13 +185,3 @@ function validateBuildArgs(buildArgs?: { [key: string]: string }) {
186185
}
187186
}
188187
}
189-
190-
function toSymlinkFollow(follow?: assets.FollowMode): SymlinkFollowMode | undefined {
191-
switch (follow) {
192-
case undefined: return undefined;
193-
case assets.FollowMode.NEVER: return SymlinkFollowMode.NEVER;
194-
case assets.FollowMode.ALWAYS: return SymlinkFollowMode.ALWAYS;
195-
case assets.FollowMode.BLOCK_EXTERNAL: return SymlinkFollowMode.BLOCK_EXTERNAL;
196-
case assets.FollowMode.EXTERNAL: return SymlinkFollowMode.EXTERNAL;
197-
}
198-
}

packages/@aws-cdk/aws-s3-assets/lib/asset.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { toSymlinkFollow } from './compat';
1212
// eslint-disable-next-line no-duplicate-imports, import/order
1313
import { Construct as CoreConstruct } from '@aws-cdk/core';
1414

15-
export interface AssetOptions extends assets.CopyOptions, cdk.FileCopyOptions, cdk.AssetOptions {
15+
export interface AssetOptions extends assets.CopyOptions, cdk.AssetOptions {
1616
/**
1717
* A list of principals that should be able to read this asset from S3.
1818
* You can use `asset.grantRead(principal)` to grant read permissions later.
@@ -125,7 +125,7 @@ export class Asset extends CoreConstruct implements cdk.IAsset {
125125
const staging = new cdk.AssetStaging(this, 'Stage', {
126126
...props,
127127
sourcePath: path.resolve(props.path),
128-
follow: props.followSymlinks ?? toSymlinkFollow(props.follow),
128+
follow: toSymlinkFollow(props.follow),
129129
assetHash: props.assetHash ?? props.sourceHash,
130130
});
131131

packages/@aws-cdk/core/lib/fs/options.ts

+14-37
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,19 @@ export enum IgnoreMode {
5656
* context flag is set.
5757
*/
5858
DOCKER = 'docker'
59-
}
59+
};
60+
61+
/**
62+
* Obtains applied when copying directories into the staging location.
63+
*/
64+
export interface CopyOptions {
65+
/**
66+
* A strategy for how to handle symlinks.
67+
*
68+
* @default SymlinkFollowMode.NEVER
69+
*/
70+
readonly follow?: SymlinkFollowMode;
6071

61-
interface FileOptions {
6272
/**
6373
* Glob patterns to exclude from the copy.
6474
*
@@ -75,30 +85,9 @@ interface FileOptions {
7585
}
7686

7787
/**
78-
* Options applied when copying directories
79-
*/
80-
export interface CopyOptions extends FileOptions {
81-
/**
82-
* A strategy for how to handle symlinks.
83-
*
84-
* @default SymlinkFollowMode.NEVER
85-
*/
86-
readonly follow?: SymlinkFollowMode;
87-
}
88-
89-
/**
90-
* Options applied when copying directories into the staging location.
88+
* Options related to calculating source hash.
9189
*/
92-
export interface FileCopyOptions extends FileOptions {
93-
/**
94-
* A strategy for how to handle symlinks.
95-
*
96-
* @default SymlinkFollowMode.NEVER
97-
*/
98-
readonly followSymlinks?: SymlinkFollowMode;
99-
}
100-
101-
interface ExtraHashOptions {
90+
export interface FingerprintOptions extends CopyOptions {
10291
/**
10392
* Extra information to encode into the fingerprint (e.g. build instructions
10493
* and other inputs)
@@ -107,15 +96,3 @@ interface ExtraHashOptions {
10796
*/
10897
readonly extraHash?: string;
10998
}
110-
111-
/**
112-
* Options related to calculating source hash.
113-
*/
114-
export interface FingerprintOptions extends CopyOptions, ExtraHashOptions {
115-
}
116-
117-
/**
118-
* Options related to calculating source hash.
119-
*/
120-
export interface FileFingerprintOptions extends FileCopyOptions, ExtraHashOptions {
121-
}

0 commit comments

Comments
 (0)