Skip to content

Commit

Permalink
fix(build): Have prepare task signal async completion
Browse files Browse the repository at this point in the history
PR google#6244 made a change to have the npm run prepare script
(automatically invoked by npm install after package installation)
not bother running the buildJavaScriptAndDeps gulp task when run
from a GitHub action (since our build action will do npm test
straight afterwards, which runs this task already).

Unfortunately, due my misunderstanding of how gulp tasks work
the revised version generated a "Did you forget to signal async
completion?" error from gulp.

Fix this by adding a done parameter and passing the provided
callback to buildJavaScriptAndDeps.  This also allows a
simplification of the the don't-run case by simply calling
done and then returning.
  • Loading branch information
cpcallen committed Aug 18, 2022
1 parent 883d78d commit c9a8b90
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/gulpfiles/build_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,12 @@ var JSCOMP_OFF = [
* needed, and we don't want to, because a tsc error would prevent
* other workflows (like lint and format) from completing.
*/
function prepare() {
function prepare(done) {
if (process.env.CI) {
return gulp.src('.'); // Do nothing.
done();
return;
}
return buildJavaScriptAndDeps();
return buildJavaScriptAndDeps(done);
}

const buildJavaScriptAndDeps = gulp.series(buildJavaScript, buildDeps);
Expand Down

0 comments on commit c9a8b90

Please sign in to comment.