Skip to content

Commit

Permalink
chore: remove reliance on decdk in build system (aws#18760)
Browse files Browse the repository at this point in the history
Various pieces in the build system relied in `decdk` as a package that took a dependency on all modules. We removed `decdk` so we need to break this dependency and use `aws-cdk-lib` instead.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
Elad Ben-Israel authored and TikiTDO committed Feb 21, 2022
1 parent c32a040 commit 304fe9f
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,11 @@ async function main() {
await addDependencyToMegaPackage(path.join('@aws-cdk', 'cloudformation-include'), module.packageName, version, ['dependencies', 'peerDependencies']);
await addDependencyToMegaPackage('aws-cdk-lib', module.packageName, version, ['devDependencies']);
await addDependencyToMegaPackage('monocdk', module.packageName, version, ['devDependencies']);
await addDependencyToMegaPackage('decdk', module.packageName, version, ['dependencies']);
}
}

/**
* A few of our packages (e.g., decdk, aws-cdk-lib) require a dependency on every service package.
* A few of our packages (e.g., aws-cdk-lib) require a dependency on every service package.
* This automates adding the dependency (and peer dependency) to the package.json.
*/
async function addDependencyToMegaPackage(megaPackageName: string, packageName: string, version: string, dependencyTypes: string[]) {
Expand Down
3 changes: 1 addition & 2 deletions packages/@aws-cdk/cfnspec/build-tools/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ node ${scriptdir}/create-missing-libraries.js || {
exit 1
}

# update decdk dep list
(cd ${scriptdir}/../../../decdk && node ./deps.js || true)
# update monocdk dep list
(cd ${scriptdir}/../../../monocdk && yarn gen || true)

# append old changelog after new and replace as the last step because otherwise we will not be idempotent
Expand Down
3 changes: 1 addition & 2 deletions packages/@aws-cdk/cloudformation-include/build.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* This build file has two purposes:
* 1. It adds a dependency on each @aws-cdk/aws-xyz package with L1s to this package,
* similarly to how deps.js does for decdk.
* 1. It adds a dependency on each @aws-cdk/aws-xyz package with L1s to this package.
* 2. It generates the file cfn-types-2-classes.json that contains a mapping
* between the CloudFormation type and the fully-qualified name of the L1 class,
* used in the logic of the CfnInclude class.
Expand Down
1 change: 0 additions & 1 deletion scripts/align-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ marker=$(node -p "require('./scripts/resolve-version').marker.replace(/\./g, '\\
# Exclude a couple of specific ones that we don't care about.
package_jsons=$(find . -name package.json |\
grep -v node_modules |\
grep -v packages/decdk/test/fixture/package.json |\
grep -v .github/actions/prlinter/package.json)

if grep -l "[^0-9]${marker}" $package_jsons; then
Expand Down
6 changes: 3 additions & 3 deletions scripts/compile-samples
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# on them you can use this script for quicker feedback.
#
# This could maybe have been an 'npm run' script, but it's not self-contained
# (needs the "decdk" package to compile against and runs jsii-rosetta from the
# (needs the "aws-cdk-lib" package to compile against and runs jsii-rosetta from the
# repo root) so that didn't feel right. For now this is what we have.
set -eu
scriptdir=$(cd $(dirname $0) && pwd)
Expand All @@ -23,9 +23,9 @@ for dir in $dirs; do
# Run jsii
npm run build

# Run rosetta against decdk dir, failing on compilation errors
# Run rosetta against aws-cdk-lib dir, failing on compilation errors
node --experimental-worker $scriptdir/../node_modules/.bin/jsii-rosetta \
--directory $scriptdir/../packages/decdk \
--directory $scriptdir/../packages/aws-cdk-lib \
--compile \
--output /dev/null \
--verbose \
Expand Down
4 changes: 2 additions & 2 deletions scripts/list-deprecated-apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class StripDeprecatedPrinter {

async function main(printer) {
const typesystem = new jsiiReflect.TypeSystem();
// Decdk depends on everything, so that's a perfect directory to load as closure
await typesystem.loadNpmDependencies(path.resolve(__dirname, '..', 'packages', 'decdk'), { validate: false });
// aws-cdk-lib depends on everything, so that's a perfect directory to load as closure
await typesystem.loadNpmDependencies(path.resolve(__dirname, '..', 'packages', 'aws-cdk-lib'), { validate: false });

printer.printHeader();

Expand Down
6 changes: 3 additions & 3 deletions scripts/run-rosetta.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ fi

#----------------------------------------------------------------------

# Compile examples with respect to "decdk" directory, as all packages will
# Compile examples with respect to "aws-cdk-lib" directory, as all packages will
# be symlinked there so they can all be included.
echo "💎 Extracting code samples" >&2
time $ROSETTA extract \
--compile \
--verbose \
--cache ${rosetta_cache_file} \
--directory packages/decdk \
--directory packages/aws-cdk-lib \
${extract_opts} \
$(cat $jsii_pkgs_file)

Expand All @@ -82,7 +82,7 @@ if $infuse; then
--compile \
--verbose \
--cache ${rosetta_cache_file} \
--directory packages/decdk \
--directory packages/aws-cdk-lib \
$(cat $jsii_pkgs_file)
fi

Expand Down

0 comments on commit 304fe9f

Please sign in to comment.