Skip to content

Commit

Permalink
build: fix error in size check tests (#20808)
Browse files Browse the repository at this point in the history
Fixes an error that was being thrown in the size checking tests, because a file can't be
resolved through `angular_material/tools/angular_ivy_enabled` anymore. With these
changes the file is resolved relatively by looking for the closest `bin` directory and
constructing the path from there.

It's unclear how long the change has been failing for, because it isn't set up to break
the CI.

These changes also update the expected sizes since they were outdated.

(cherry picked from commit 5e9e41b)
  • Loading branch information
crisbeto authored and annieyw committed Oct 16, 2020
1 parent 8ad4003 commit 4d8a7c9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 18 deletions.
34 changes: 17 additions & 17 deletions goldens/size-test.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
cdk/drag-drop/all-directives: 154096
cdk/drag-drop/basic: 151353
cdk/drag-drop/all-directives: 152772
cdk/drag-drop/basic: 150132
material-experimental/mdc-chips/basic: 147607
material-experimental/mdc-form-field/advanced: 251959
material-experimental/mdc-form-field/basic: 251127
material/autocomplete/without-optgroup: 210028
material/button-toggle/standalone: 119486
material/chips/basic: 162776
material/datepicker/range-picker/without-form-field: 332500
material/expansion/without-accordion: 130701
material/form-field/advanced: 186274
material/form-field/basic: 185048
material/list/nav-list: 130611
material/menu/without-lazy-content: 212600
material/radio/without-group: 121590
material/select/basic: 258518
material/tabs/advanced: 183621
material/tabs/basic: 182818
material-experimental/mdc-form-field/advanced: 218024
material-experimental/mdc-form-field/basic: 217187
material/autocomplete/without-optgroup: 207393
material/button-toggle/standalone: 118062
material/chips/basic: 157441
material/datepicker/range-picker/without-form-field: 327358
material/expansion/without-accordion: 127950
material/form-field/advanced: 180868
material/form-field/basic: 179631
material/list/nav-list: 128605
material/menu/without-lazy-content: 208165
material/radio/without-group: 120615
material/select/basic: 253529
material/tabs/advanced: 181016
material/tabs/basic: 180213
14 changes: 13 additions & 1 deletion integration/size-test/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const {buildOptimizer} = require('@angular-devkit/build-optimizer');
const node = require('rollup-plugin-node-resolve');
const {ivyEnabled} = require('angular_material/tools/angular_ivy_enabled');
const path = require('path');
const {ivyEnabled} = require(getIvyEnabledHelperPath());

console.info(`Processing rollup bundle in ${ivyEnabled ? 'Ivy' : 'View Engine'} mode.`);

Expand Down Expand Up @@ -36,3 +37,14 @@ module.exports = {
}),
],
};

function getIvyEnabledHelperPath() {
const parts = path.normalize(__dirname).split(path.sep);
const binIndex = parts.indexOf('bin');

if (binIndex === -1) {
throw Error('Cannot resolve Ivy helper path.');
}

return path.join(parts.slice(0, binIndex).join(path.sep), 'bin/tools/angular_ivy_enabled');
}

0 comments on commit 4d8a7c9

Please sign in to comment.