build(gulp): fix concurrency and caching issues in test.unit.js and test.unit.dart tasks
previously there was a chance of race conditions that could sporadically fail the build. additionally runing a task via gulp.start or runSequence always reruns its dependencies, which meant that we were blowing away the build.tools build and rebuilding everything from scratch even during the interactive/watch mode. This meant that the build pipeline cache was destroyed on every change and we never got the benefit of incremental compilation
This commit is contained in:
parent
1d0078415f
commit
705d3aacff
79
gulpfile.js
79
gulpfile.js
|
@ -102,10 +102,16 @@ gulp.task('build/clean.docs', clean(gulp, gulpPlugins, {
|
||||||
// ------------
|
// ------------
|
||||||
// transpile
|
// transpile
|
||||||
|
|
||||||
gulp.task('build/tree.dart', ['build.tools'], function() {
|
gulp.task('build/tree.dart', ['build/clean.dart', 'build.tools'], function(done) {
|
||||||
|
runSequence('!build/tree.dart', done);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
gulp.task('!build/tree.dart', function() {
|
||||||
return angularBuilder.rebuildDartTree();
|
return angularBuilder.rebuildDartTree();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// ------------
|
// ------------
|
||||||
// pubspec
|
// pubspec
|
||||||
|
|
||||||
|
@ -322,40 +328,67 @@ function getBrowsersFromCLI() {
|
||||||
return [args.browsers?args.browsers:'DartiumWithWebPlatform']
|
return [args.browsers?args.browsers:'DartiumWithWebPlatform']
|
||||||
}
|
}
|
||||||
|
|
||||||
gulp.task('test.unit.js', ['build/clean.js', 'broccoli.js.dev'], function (neverDone) {
|
|
||||||
|
|
||||||
function buildAndTest() {
|
gulp.task('test.unit.js', ['build.js.dev'], function (neverDone) {
|
||||||
|
|
||||||
|
runSequence(
|
||||||
|
'!test.unit.js/karma-server',
|
||||||
|
'!test.unit.js/karma-run',
|
||||||
|
'check-format'
|
||||||
|
);
|
||||||
|
|
||||||
|
gulp.watch('modules/**', function() {
|
||||||
runSequence(
|
runSequence(
|
||||||
'broccoli.js.dev',
|
'!broccoli.js.dev',
|
||||||
'test.unit.js/karma-run'
|
'!test.unit.js/karma-run',
|
||||||
|
'check-format'
|
||||||
);
|
);
|
||||||
}
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
gulp.task('!test.unit.js/karma-server', function() {
|
||||||
karma.server.start({configFile: __dirname + '/karma-js.conf.js'});
|
karma.server.start({configFile: __dirname + '/karma-js.conf.js'});
|
||||||
|
|
||||||
gulp.watch('modules/**', buildAndTest);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('test.unit.js/karma-run', function (done) {
|
|
||||||
karma.runner.run({configFile: __dirname + '/karma-js.conf.js'}, done);
|
gulp.task('!test.unit.js/karma-run', function(done) {
|
||||||
|
karma.runner.run({configFile: __dirname + '/karma-js.conf.js'}, function(exitCode) {
|
||||||
|
// ignore exitCode, we don't want to fail the build in the interactive (non-ci) mode
|
||||||
|
// karma will print all test failures
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
gulp.task('test.unit.dart', ['build/tree.dart'], function (done) {
|
gulp.task('test.unit.dart', ['build/tree.dart'], function (done) {
|
||||||
function buildAndTest() {
|
|
||||||
|
runSequence(
|
||||||
|
'!test.unit.dart/karma-server',
|
||||||
|
'!test.unit.dart/karma-run'
|
||||||
|
);
|
||||||
|
|
||||||
|
gulp.watch('modules/angular2/**', function() {
|
||||||
runSequence(
|
runSequence(
|
||||||
'build/tree.dart',
|
'!build/tree.dart',
|
||||||
'test.unit.dart/karma-run'
|
'!test.unit.dart/karma-run'
|
||||||
);
|
);
|
||||||
}
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('!test.unit.dart/karma-run', function (done) {
|
||||||
|
karma.runner.run({configFile: __dirname + '/karma-dart.conf.js'}, function(exitCode) {
|
||||||
|
// ignore exitCode, we don't want to fail the build in the interactive (non-ci) mode
|
||||||
|
// karma will print all test failures
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
gulp.task('!test.unit.dart/karma-server', function() {
|
||||||
karma.server.start({configFile: __dirname + '/karma-dart.conf.js'});
|
karma.server.start({configFile: __dirname + '/karma-dart.conf.js'});
|
||||||
|
|
||||||
gulp.watch('modules/angular2/**', buildAndTest);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('test.unit.dart/karma-run', function (done) {
|
|
||||||
karma.runner.run({configFile: __dirname + '/karma-dart.conf.js'}, done);
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('test.unit.js/ci', function (done) {
|
gulp.task('test.unit.js/ci', function (done) {
|
||||||
karma.server.start({configFile: __dirname + '/karma-js.conf.js',
|
karma.server.start({configFile: __dirname + '/karma-js.conf.js',
|
||||||
|
@ -538,12 +571,16 @@ gulp.task('!build.tools', function() {
|
||||||
return mergedStream;
|
return mergedStream;
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('broccoli.js.dev', ['build.tools'], function() {
|
gulp.task('broccoli.js.dev', ['build.tools'], function(done) {
|
||||||
|
runSequence('!broccoli.js.dev', done);
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('!broccoli.js.dev', function() {
|
||||||
return angularBuilder.rebuildBrowserDevTree();
|
return angularBuilder.rebuildBrowserDevTree();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
gulp.task('build.js.dev', function(done) {
|
gulp.task('build.js.dev', ['build/clean.js'], function(done) {
|
||||||
runSequence(
|
runSequence(
|
||||||
'broccoli.js.dev',
|
'broccoli.js.dev',
|
||||||
'build/checkCircularDependencies',
|
'build/checkCircularDependencies',
|
||||||
|
|
Loading…
Reference in New Issue