Skip to content

Commit

Permalink
chore(cdk-build-tools): print build times for all packages (#10681)
Browse files Browse the repository at this point in the history
Print the build times for all packages, irrespective of their success or
failure.

The motivation is to gather package build times and their contribution
to the total build time of the repo.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
Niranjan Jayakar authored Oct 5, 2020
1 parent 7bb5cf4 commit 3da6420
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tools/cdk-build-tools/bin/cdk-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as yargs from 'yargs';
import { compileCurrentPackage } from '../lib/compile';
import { lintCurrentPackage } from '../lib/lint';
import { shell } from '../lib/os';
import { cdkBuildOptions, CompilerOverrides } from '../lib/package-info';
import { cdkBuildOptions, currentPackageJson, CompilerOverrides } from '../lib/package-info';
import { Timers } from '../lib/timer';

async function main() {
Expand Down Expand Up @@ -54,12 +54,12 @@ async function main() {
const timers = new Timers();
const buildTimer = timers.start('Total time');

main().then(() => {
buildTimer.end();
}).catch(e => {
buildTimer.end();
main().catch(e => {
process.stderr.write(`${e.toString()}\n`);
process.stderr.write(`Build failed. ${timers.display()}\n`);
process.stderr.write('Build failed.');
process.stderr.write('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n');
process.exit(1);
}).finally(() => {
buildTimer.end();
process.stdout.write(`Build times for ${currentPackageJson().name}: ${timers.display()}\n`);
});

0 comments on commit 3da6420

Please sign in to comment.