Skip to content
Snippets Groups Projects
Commit 705d3aac authored by Igor Minar's avatar Igor Minar
Browse files

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
parent 1d007841
No related merge requests found
......@@ -102,10 +102,16 @@ gulp.task('build/clean.docs', clean(gulp, gulpPlugins, {
// ------------
// 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();
});
// ------------
// pubspec
......@@ -322,41 +328,68 @@ function getBrowsersFromCLI() {
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(
'broccoli.js.dev',
'test.unit.js/karma-run'
'!broccoli.js.dev',
'!test.unit.js/karma-run',
'check-format'
);
}
});
});
karma.server.start({configFile: __dirname + '/karma-js.conf.js'});
gulp.watch('modules/**', buildAndTest);
gulp.task('!test.unit.js/karma-server', function() {
karma.server.start({configFile: __dirname + '/karma-js.conf.js'});
});
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) {
function buildAndTest() {
runSequence(
'!test.unit.dart/karma-server',
'!test.unit.dart/karma-run'
);
gulp.watch('modules/angular2/**', function() {
runSequence(
'build/tree.dart',
'test.unit.dart/karma-run'
'!build/tree.dart',
'!test.unit.dart/karma-run'
);
}
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'}, 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-run', function (done) {
karma.runner.run({configFile: __dirname + '/karma-dart.conf.js'}, done);
gulp.task('!test.unit.dart/karma-server', function() {
karma.server.start({configFile: __dirname + '/karma-dart.conf.js'});
});
gulp.task('test.unit.js/ci', function (done) {
karma.server.start({configFile: __dirname + '/karma-js.conf.js',
singleRun: true, reporters: ['dots'], browsers: getBrowsersFromCLI()}, done);
......@@ -538,12 +571,16 @@ gulp.task('!build.tools', function() {
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();
});
gulp.task('build.js.dev', function(done) {
gulp.task('build.js.dev', ['build/clean.js'], function(done) {
runSequence(
'broccoli.js.dev',
'build/checkCircularDependencies',
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment