Skip to content

Commit

Permalink
chore(gulp): add a task to print dart & pub versions
Browse files Browse the repository at this point in the history
  • Loading branch information
vicb committed Jul 1, 2015
1 parent 530e742 commit f020a5c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
10 changes: 8 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion scripts/ci/env_dart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 9 additions & 2 deletions tools/build/dartdetect.js → tools/build/dart.js
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -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);
Expand All @@ -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, ''));
}

0 comments on commit f020a5c

Please sign in to comment.