-
Notifications
You must be signed in to change notification settings - Fork 3.4k
build: make the build output deterministic and reproducible #11570
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Caretaker: this PR should be synced on its own. It should be a complete no-op, but on the off chance that something does break, we'll know it's from this and not another PR. |
bc4cbf9
to
944994b
Compare
.pipe(utils.cssToNgConstant('material.core', '$MD_THEME_CSS')); | ||
var paths = config.themeBaseFiles; | ||
config.componentPaths.forEach(component => paths.push(path.join(component, '*-theme.scss'))); | ||
paths.push(config.themeCore); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes the issue where some apps had a white background instead of light gray in the presubmits.
It looks like the module builds of the CSS (closure or js) are injecting tons of extra theme template styles into component CSS like This PR tried to ignore the module based builds, but it's clear that I need to go through there and make some tweaks + verify. |
944994b
to
08a92c0
Compare
Duplicate CSS in module-based builds has been resolved. This is ready for presubmit again. |
- passing globs to `gulp.src` can cause ordering to not be preserved. this is because `gulp.src` is async - gulp-concat tries to preserve the order passed into `gulp.src`. if the globbing is too vague, then there isn't enough info for ordering - more statically defining the paths like this isn't ideal but it is acceptable atm since we aren't adding new components - fix docs menu unwanted left margin - remove commented out icon styles - add JSDoc/Closure types - remove unneeded parameter passed to util.buildModule() - remove unneeded parameter passed to util.buildJs() Fixes #11502
08a92c0
to
e4bff89
Compare
PR Checklist
Please check that your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Consecutive builds, without any changes, result in bundle content with different ordering. This is even true in a single build where the
dist/angular-material.js
isn't identical to thedist/docs/angular-material.js
. This makes comparing releases harder and it makes syncing into g3 more time consuming.gulp.src
can cause ordering to not be preserved.this is because
gulp.src
is asyncgulp.src
.if the globbing is too vague, then there isn't enough info for ordering
Issue Number:
Fixes #11502
What is the new behavior?
All of the build output (JS, SCSS, CSS) should be identical if the build is run multiple times without any changes to the code.
Does this PR introduce a breaking change?
Other information
I looked at sorting the file paths manually or using
gulp-sort
but neither solution was flexible enough to order some of our internal dependencies properly. This approach seems to work fine w/o addinggulp-order
, but if problems pop up in the future, that is another package that might help.Note that the root cause of this lies in the intersection of
gulp.src
in Gulp core andgulp-concat
. This is a well established problem that the Gulp team has mostly decided to punt into user land or third party packages so that they can maintain speed and not need to support crazy levels of customization.