chore: use SDK dartfmt

This commit is contained in:
Kevin Moore 2015-05-08 19:23:49 -07:00
parent 229e770a1d
commit 98e7a38e50
2 changed files with 10 additions and 12 deletions

View File

@ -9,6 +9,7 @@ var gulp = require('gulp');
var gulpPlugins = require('gulp-load-plugins')(); var gulpPlugins = require('gulp-load-plugins')();
var sass = require('gulp-sass'); var sass = require('gulp-sass');
var shell = require('gulp-shell'); var shell = require('gulp-shell');
var spawn = require('child_process').spawn;
var runSequence = require('run-sequence'); var runSequence = require('run-sequence');
var madge = require('madge'); var madge = require('madge');
var merge = require('merge'); var merge = require('merge');
@ -25,7 +26,6 @@ var pubbuild = require('./tools/build/pubbuild');
var dartanalyzer = require('./tools/build/dartanalyzer'); var dartanalyzer = require('./tools/build/dartanalyzer');
var jsserve = require('./tools/build/jsserve'); var jsserve = require('./tools/build/jsserve');
var pubserve = require('./tools/build/pubserve'); var pubserve = require('./tools/build/pubserve');
var rundartpackage = require('./tools/build/rundartpackage');
var file2moduleName = require('./tools/build/file2modulename'); var file2moduleName = require('./tools/build/file2modulename');
var karma = require('karma'); var karma = require('karma');
var minimist = require('minimist'); var minimist = require('minimist');
@ -104,10 +104,6 @@ var CONFIG = {
}, },
dart: 'dist/dart', dart: 'dist/dart',
docs: 'dist/docs' docs: 'dist/docs'
},
formatDart: {
packageName: 'dart_style',
args: ['dart_style:format', '-w', 'dist/dart']
} }
}; };
@ -176,11 +172,11 @@ gulp.task('build/pubbuild.dart', pubbuild(gulp, gulpPlugins, {
// ------------ // ------------
// formatting // formatting
gulp.task('build/format.dart', rundartpackage(gulp, gulpPlugins, { gulp.task('build/format.dart', function() {
pub: DART_SDK.PUB, return util.processToPromise(spawn(DART_SDK.DARTFMT, ['-w', CONFIG.dest.dart], {
packageName: CONFIG.formatDart.packageName, stdio: 'inherit'
args: CONFIG.formatDart.args }));
})); });
function doCheckFormat() { function doCheckFormat() {
return gulp.src(['Brocfile*.js', 'modules/**/*.ts', 'tools/**/*.ts', '!**/typings/**/*.d.ts', return gulp.src(['Brocfile*.js', 'modules/**/*.ts', 'tools/**/*.ts', '!**/typings/**/*.d.ts',

View File

@ -8,12 +8,14 @@ module.exports = function(gulp) {
if (process.platform === 'win32') { if (process.platform === 'win32') {
DART_SDK = { DART_SDK = {
PUB: 'pub.bat', PUB: 'pub.bat',
ANALYZER: 'dartanalyzer.bat' ANALYZER: 'dartanalyzer.bat',
DARTFMT: 'dartfmt.bat'
}; };
} else { } else {
DART_SDK = { DART_SDK = {
PUB: 'pub', PUB: 'pub',
ANALYZER: 'dartanalyzer' ANALYZER: 'dartanalyzer',
DARTFMT: 'dartfmt'
}; };
} }
} catch (e) { } catch (e) {