-
Notifications
You must be signed in to change notification settings - Fork 39
fix silent (!) build failure when several source filepaths cannot be found #276
fix silent (!) build failure when several source filepaths cannot be found #276
Conversation
The 'analyze' phase of the build process completes when all source files are analyzed (scanned). A source file is analized when all its dependencies are resolved or rejected. When the sources stream is complete, _all_ pending source file promises need to be rejected--not only the first one. If some of the deferred dependencies remain pending, the analysis of the toplevel source file never continues after 'await this._cache.dependencyGraph.whenReady(resolvedUrl);'. That leads of a premature end of the analysis phase (without any errors).
Should there also be a test for a broken file path in a lazy import added as well? I believe the lazy import caused silent failure even if there was only 1 broken path, not needing 2 before it happened. |
It would be a good idea to investigate if Polymer/polymer-cli#904 would be fixed by the same change. I have not done that (and that's why there is no test case for lazy imports). Would you like to contribute? Here is how:
|
Tested locally and seems to be fixed. Created a PR for a commit adding the |
add a test case to verify that this PR also fixes the issue https://github.com/Polymer/polymer-cli/issues/904
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
@jsilvermist nice! I've just added your test case to the PR. But now it looks like the Google CLA bot wants you to write here a comment explicitly stating that you do accept the CLA for this repo. |
Nah I've signed the CLA don't worry, it's just how the google bot acts if anyone adds a commit from a different author to a PR. |
Hi I have a build that is silently failing with a specific set of incorrect links
This configuration caused Polymer Build to fail silently. When I applied the fix in this PR the build fail correctly and echos the messages from Analyzer to the console. The sooner this PR can be merged and released the better. This bug means the build process can fail without any indication of the problem. |
@@ -249,7 +249,6 @@ export class BuildAnalyzer { | |||
if (this.config.isSource(filePath)) { | |||
const err = new Error(`Not found: ${filePath}`); | |||
this.loader.rejectDeferredFile(filePath, err); | |||
return; |
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 early return is unintuitive. It seems dangerous to not process the remaining errors or close the dependencies steam. I also don't see how the test should show more errors with this addition. Does the modified test fail without this change?
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.
I think the change removes the early return.
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.
Right, so I shouldn't do reviews on my phone on the subway :)
Thanks for the PR @vlukashov! And thanks for the correction on the review @keithbloom :) |
This PR ensures that the
scan()
method gets completed for every source file in the project. Currently, the scan method gets started but would never get completed if there is more than one missing source file dependency in dependencies tree.A
scan()
of source file gets completed when all dependencies of that file are known (resolved or rejected). That's why when the project's sources stream is completed it's important to ensure all deferred source get rejected--not only the first one.If some of the deferred dependencies remain pending, the analysis of the toplevel source file never continues after
await this._cache.dependencyGraph.whenReady(resolvedUrl);
.This PR fixes https://github.com/Polymer/polymer-cli/issues/936, https://github.com/Polymer/polymer-cli/issues/904 and https://github.com/Polymer/polymer-build/issues/251.
It might be also related to https://github.com/Polymer/polymer-build/issues/272.