chore: adds Windows support for build

Closes 
This commit is contained in:
Marc Laval 2014-10-27 17:32:55 +01:00 committed by Misko Hevery
parent 87b0d3fcc5
commit e1c84e02f8
2 changed files with 6 additions and 3 deletions
gulpfile.js
tools/transpiler

@ -103,7 +103,8 @@ gulp.task('modules/build.dart/pubspec', function(done) {
.pipe(through2.obj(function(file, enc, done) { .pipe(through2.obj(function(file, enc, done) {
if (file.previousContents.toString() !== file.contents.toString()) { if (file.previousContents.toString() !== file.contents.toString()) {
console.log(file.path + ' changed, calling pub get'); console.log(file.path + ' changed, calling pub get');
var stream = spawn('pub', ['get'], { var pubCmd = (process.platform === "win32" ? "pub.bat" : "pub");
var stream = spawn(pubCmd, ['get'], {
stdio: [process.stdin, process.stdout, process.stderr], stdio: [process.stdin, process.stdout, process.stderr],
cwd: path.dirname(file.path) cwd: path.dirname(file.path)
}); });
@ -186,7 +187,8 @@ gulp.task('analyze/dartanalyzer', function(done) {
})); }));
function analyze(dirName, done) { function analyze(dirName, done) {
var stream = spawn('dartanalyzer', ['--fatal-warnings', tempFile], { var dartanalyzerCmd = (process.platform === "win32" ? "dartanalyzer.bat" : "dartanalyzer");
var stream = spawn(dartanalyzerCmd, ['--fatal-warnings', tempFile], {
// inherit stdin and stderr, but filter stdout // inherit stdin and stderr, but filter stdout
stdio: [process.stdin, 'pipe', process.stderr], stdio: [process.stdin, 'pipe', process.stderr],
cwd: dirName cwd: dirName

@ -61,8 +61,9 @@ function loadModule(filepath, transpile) {
} }
if (transpile) { if (transpile) {
var moduleName = filepath var moduleName = path.normalize(filepath)
.replace(__dirname, 'transpiler') .replace(__dirname, 'transpiler')
.replace(/\\/g, '/')
.replace(/\.\w*$/, ''); .replace(/\.\w*$/, '');
data = (new traceur.NodeCompiler( data = (new traceur.NodeCompiler(
extend(SELF_COMPILE_OPTIONS, { moduleName: moduleName } ) extend(SELF_COMPILE_OPTIONS, { moduleName: moduleName } )