Skip to content

Commit 404b556

Browse files
author
Niranjan Jayakar
authored
chore: isolate CoreConstruct imports to avoid merge conflicts (#12850)
As part of CDKv2, the construct layer in '@aws-cdk/core' is being replaced with the constructs API in the 'constructs' module. During the transition period between v1 and v2, both exist. On the `master` branch, code will include importing `Construct` from the '@aws-cdk/core' module but this will not be possible in the `v2-main` branch where this API does not exist. Any change to the same line as the import of the `Construct` symbol will cause merge conflicts. Hence, move the import into a separate line and section to avoid these conflicts. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 5664480 commit 404b556

File tree

83 files changed

+534
-67
lines changed

Some content is hidden

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

83 files changed

+534
-67
lines changed

packages/@aws-cdk/assets/lib/staging.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
import { AssetStaging, Construct } from '@aws-cdk/core';
1+
import { AssetStaging } from '@aws-cdk/core';
22
import { toSymlinkFollow } from './compat';
33
import { FingerprintOptions } from './fs/options';
44

5+
// keep this import separate from other imports to reduce chance for merge conflicts with v2-main
6+
// eslint-disable-next-line no-duplicate-imports, import/order
7+
import { Construct } from '@aws-cdk/core';
8+
59
/**
610
* Deprecated
711
* @deprecated use `core.AssetStagingProps`

packages/@aws-cdk/aws-apigateway/lib/deployment.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import * as crypto from 'crypto';
2-
import { Construct as CoreConstruct, Lazy, RemovalPolicy, Resource, CfnResource } from '@aws-cdk/core';
2+
import { Lazy, RemovalPolicy, Resource, CfnResource } from '@aws-cdk/core';
33
import { Construct } from 'constructs';
44
import { CfnDeployment } from './apigateway.generated';
55
import { Method } from './method';
66
import { IRestApi, RestApi, SpecRestApi, RestApiBase } from './restapi';
77

8+
// keep this import separate from other imports to reduce chance for merge conflicts with v2-main
9+
// eslint-disable-next-line no-duplicate-imports, import/order
10+
import { Construct as CoreConstruct } from '@aws-cdk/core';
11+
812
export interface DeploymentProps {
913
/**
1014
* The Rest API to deploy.

packages/@aws-cdk/aws-autoscaling-hooktargets/lib/lambda-hook.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@ import * as kms from '@aws-cdk/aws-kms';
33
import * as lambda from '@aws-cdk/aws-lambda';
44
import * as sns from '@aws-cdk/aws-sns';
55
import * as subs from '@aws-cdk/aws-sns-subscriptions';
6-
import { Construct } from '@aws-cdk/core';
6+
77
import { TopicHook } from './topic-hook';
88

9+
// keep this import separate from other imports to reduce chance for merge conflicts with v2-main
10+
// eslint-disable-next-line no-duplicate-imports, import/order
11+
import { Construct } from '@aws-cdk/core';
12+
913
/**
1014
* Use a Lambda Function as a hook target
1115
*

packages/@aws-cdk/aws-autoscaling/lib/lifecycle-hook-target.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
import { Construct } from '@aws-cdk/core';
1+
22
import { ILifecycleHook } from './lifecycle-hook';
33

4+
// keep this import separate from other imports to reduce chance for merge conflicts with v2-main
5+
// eslint-disable-next-line no-duplicate-imports, import/order
6+
import { Construct } from '@aws-cdk/core';
7+
48
/**
59
* Interface for autoscaling lifecycle hook targets
610
*/

packages/@aws-cdk/aws-autoscaling/lib/step-scaling-action.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
import { Construct as CoreConstruct, Duration, Lazy } from '@aws-cdk/core';
1+
import { Duration, Lazy } from '@aws-cdk/core';
22
import { Construct } from 'constructs';
33
import { IAutoScalingGroup } from './auto-scaling-group';
44
import { CfnScalingPolicy } from './autoscaling.generated';
55

6+
// keep this import separate from other imports to reduce chance for merge conflicts with v2-main
7+
// eslint-disable-next-line no-duplicate-imports, import/order
8+
import { Construct as CoreConstruct } from '@aws-cdk/core';
9+
610
/**
711
* Properties for a scaling policy
812
*/

packages/@aws-cdk/aws-autoscaling/lib/step-scaling-policy.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import { findAlarmThresholds, normalizeIntervals } from '@aws-cdk/aws-autoscaling-common';
22
import * as cloudwatch from '@aws-cdk/aws-cloudwatch';
3-
import { Construct as CoreConstruct, Duration } from '@aws-cdk/core';
3+
import { Duration } from '@aws-cdk/core';
44
import { Construct } from 'constructs';
55
import { IAutoScalingGroup } from './auto-scaling-group';
66
import { AdjustmentType, MetricAggregationType, StepScalingAction } from './step-scaling-action';
77

8+
// keep this import separate from other imports to reduce chance for merge conflicts with v2-main
9+
// eslint-disable-next-line no-duplicate-imports, import/order
10+
import { Construct as CoreConstruct } from '@aws-cdk/core';
11+
812
export interface BasicStepScalingPolicyProps {
913
/**
1014
* Metric to scale on.

packages/@aws-cdk/aws-autoscaling/lib/target-tracking-scaling-policy.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import * as cloudwatch from '@aws-cdk/aws-cloudwatch';
2-
import { Construct as CoreConstruct, Duration } from '@aws-cdk/core';
2+
import { Duration } from '@aws-cdk/core';
33
import { Construct } from 'constructs';
44
import { IAutoScalingGroup } from './auto-scaling-group';
55
import { CfnScalingPolicy } from './autoscaling.generated';
66

7+
// keep this import separate from other imports to reduce chance for merge conflicts with v2-main
8+
// eslint-disable-next-line no-duplicate-imports, import/order
9+
import { Construct as CoreConstruct } from '@aws-cdk/core';
10+
711
/**
812
* Base interface for target tracking props
913
*

packages/@aws-cdk/aws-cloudformation/test/integ.core-custom-resources.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
* - GetAtt.Attribute1: "foo"
88
* - GetAtt.Attribute2: 1234
99
*/
10-
import { App, CfnOutput, Construct, CustomResource, CustomResourceProvider, CustomResourceProviderRuntime, Stack, Token } from '@aws-cdk/core';
10+
import { App, CfnOutput, CustomResource, CustomResourceProvider, CustomResourceProviderRuntime, Stack, Token } from '@aws-cdk/core';
11+
12+
// keep this import separate from other imports to reduce chance for merge conflicts with v2-main
13+
// eslint-disable-next-line no-duplicate-imports, import/order
14+
import { Construct } from '@aws-cdk/core';
1115

1216
/* eslint-disable cdk/no-core-construct */
1317

packages/@aws-cdk/aws-cloudformation/test/integ.nested-stack.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ import * as lambda from '@aws-cdk/aws-lambda';
22
import * as sns from '@aws-cdk/aws-sns';
33
import * as sns_subscriptions from '@aws-cdk/aws-sns-subscriptions';
44
import * as sqs from '@aws-cdk/aws-sqs';
5-
import { App, CfnParameter, Construct, Stack } from '@aws-cdk/core';
5+
import { App, CfnParameter, Stack } from '@aws-cdk/core';
66
import * as cfn from '../lib';
77

8+
// keep this import separate from other imports to reduce chance for merge conflicts with v2-main
9+
// eslint-disable-next-line no-duplicate-imports, import/order
10+
import { Construct } from '@aws-cdk/core';
11+
812
/* eslint-disable cdk/no-core-construct */
913

1014
interface MyNestedStackProps {

packages/@aws-cdk/aws-cloudformation/test/integ.nested-stacks-assets.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
/// !cdk-integ pragma:ignore-assets
22
import * as path from 'path';
33
import * as lambda from '@aws-cdk/aws-lambda';
4-
import { App, Construct, Stack } from '@aws-cdk/core';
4+
import { App, Stack } from '@aws-cdk/core';
55
import * as cfn from '../lib';
66

7+
// keep this import separate from other imports to reduce chance for merge conflicts with v2-main
8+
// eslint-disable-next-line no-duplicate-imports, import/order
9+
import { Construct } from '@aws-cdk/core';
10+
711
/* eslint-disable cdk/no-core-construct */
812

913
class NestedStack extends cfn.NestedStack {

0 commit comments

Comments
 (0)