build(gulp): create private build.tools task and use it instead of magic variable

This way when gulp prints out that it's running build/clean.tools it really means
that it's cleaning up the build directory.
This commit is contained in:
Igor Minar 2015-05-04 08:32:58 -07:00
parent bb6f59e423
commit 6b017fb388
1 changed files with 10 additions and 13 deletions

View File

@ -83,9 +83,7 @@ var CONFIG = {
// clean // clean
gulp.task('build/clean.tools', function() { gulp.task('build/clean.tools', function() {
if (rebuildTools && 'AngularBuilder' in global) {
del(path.join('dist', 'tools')); del(path.join('dist', 'tools'));
};
}); });
gulp.task('build/clean.js', clean(gulp, gulpPlugins, { gulp.task('build/clean.js', clean(gulp, gulpPlugins, {
@ -397,12 +395,10 @@ gulp.task('test.unit.tools/ci', function(done) {
}); });
gulp.task('test.unit.tools', function(done) { gulp.task('test.unit.tools', ['build/clean.tools'], function(done) {
rebuildTools = true;
function buildAndTest() { function buildAndTest() {
runSequence( runSequence(
'build.tools', '!build.tools',
'test.unit.tools/ci' 'test.unit.tools/ci'
); );
} }
@ -509,14 +505,15 @@ gulp.task('build.dart', function(done) {
}); });
var rebuildTools = false; // public task to build tools
gulp.task('build.tools', ['build/clean.tools'], function(done) {
runSequence('!build.tools', done);
});
gulp.task('build.tools', ['build/clean.tools'], function() {
if (!rebuildTools && angularBuilder.rebuildNodeTree !== throwToolsBuildMissingError) {
return;
}
var tsResult = gulp.src('tools/**/*.ts') // private task to build tools
gulp.task('!build.tools', function() {
var tsResult = gulp.src(['tools/**/*.ts'])
.pipe(sourcemaps.init()) .pipe(sourcemaps.init())
.pipe(tsc({target: 'ES5', module: 'commonjs', reporter: tsc.reporter.nullReporter()})) .pipe(tsc({target: 'ES5', module: 'commonjs', reporter: tsc.reporter.nullReporter()}))
.on('error', function(error) { .on('error', function(error) {