chore(gulp): add a task to print dart & pub versions

This commit is contained in:
Victor Berchet 2015-06-17 13:24:59 +02:00
parent 530e742628
commit f020a5cdea
3 changed files with 17 additions and 5 deletions

View File

@ -38,6 +38,7 @@ var insert = require('gulp-insert');
var uglify = require('gulp-uglify');
var shouldLog = require('./tools/build/logging');
var tslint = require('gulp-tslint');
var dartSdk = require('./tools/build/dart');
require('./tools/check-environment')({
requiredNpmVersion: '>=2.9.0',
@ -103,7 +104,7 @@ function runJasmineTests(globs, done) {
}
// Note: when DART_SDK is not found, all gulp tasks ending with `.dart` will be skipped.
var DART_SDK = require('./tools/build/dartdetect')(gulp);
var DART_SDK = dartSdk.detect(gulp);
// -----------------------
// configuration
@ -457,7 +458,12 @@ gulp.task('test.js', function(done) {
});
gulp.task('test.dart', function(done) {
runSequence('test.transpiler.unittest', 'docs/test', 'test.unit.dart/ci', sequenceComplete(done));
runSequence('versions.dart', 'test.transpiler.unittest', 'docs/test', 'test.unit.dart/ci',
sequenceComplete(done));
});
gulp.task('versions.dart', function() {
dartSdk.logVersion(DART_SDK);
});
// Reuse the Travis scripts

View File

@ -93,6 +93,5 @@ if [[ -z $ENV_SET ]]; then
echo PATH=$PATH
echo NGDART_BASE_DIR=$NGDART_BASE_DIR
echo NGDART_SCRIPT_DIR=$NGDART_SCRIPT_DIR
$DART --version 2>&1
fi

View File

@ -1,10 +1,10 @@
var which = require('which');
var spawnSync = require('child_process').spawnSync;
module.exports = function(gulp) {
module.exports.detect = function(gulp) {
var DART_SDK = false;
try {
which.sync('dart');
console.log('Dart SDK detected');
if (process.platform === 'win32') {
DART_SDK = {
ANALYZER: 'dartanalyzer.bat',
@ -20,6 +20,7 @@ module.exports = function(gulp) {
VM: 'dart'
};
}
console.log('Dart SDK detected:');
} catch (e) {
console.log('Dart SDK is not available, Dart tasks will be skipped.');
var gulpTaskFn = gulp.task.bind(gulp);
@ -35,3 +36,9 @@ module.exports = function(gulp) {
}
return DART_SDK;
}
module.exports.logVersion = function(dartSdk) {
console.log('DART SDK:') ;
console.log('- dart: ' + spawnSync(dartSdk.VM, ['--version']).stderr.toString().replace(/\n/g, ''));
console.log('- pub: ' + spawnSync(dartSdk.PUB, ['--version']).stdout.toString().replace(/\n/g, ''));
}