diff --git a/gulpfile.js b/gulpfile.js index 5d35df378e..5f8b9d7342 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -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 diff --git a/scripts/ci/env_dart.sh b/scripts/ci/env_dart.sh index 4b0e69c1a1..1f384ea1c6 100755 --- a/scripts/ci/env_dart.sh +++ b/scripts/ci/env_dart.sh @@ -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 diff --git a/tools/build/dartdetect.js b/tools/build/dart.js similarity index 67% rename from tools/build/dartdetect.js rename to tools/build/dart.js index f3d11d1b24..7fe991809e 100644 --- a/tools/build/dartdetect.js +++ b/tools/build/dart.js @@ -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, '')); +}