Skip to content

Commit f020a5c

Browse files
committed
chore(gulp): add a task to print dart & pub versions
1 parent 530e742 commit f020a5c

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

gulpfile.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ var insert = require('gulp-insert');
3838
var uglify = require('gulp-uglify');
3939
var shouldLog = require('./tools/build/logging');
4040
var tslint = require('gulp-tslint');
41+
var dartSdk = require('./tools/build/dart');
4142

4243
require('./tools/check-environment')({
4344
requiredNpmVersion: '>=2.9.0',
@@ -103,7 +104,7 @@ function runJasmineTests(globs, done) {
103104
}
104105

105106
// Note: when DART_SDK is not found, all gulp tasks ending with `.dart` will be skipped.
106-
var DART_SDK = require('./tools/build/dartdetect')(gulp);
107+
var DART_SDK = dartSdk.detect(gulp);
107108

108109
// -----------------------
109110
// configuration
@@ -457,7 +458,12 @@ gulp.task('test.js', function(done) {
457458
});
458459

459460
gulp.task('test.dart', function(done) {
460-
runSequence('test.transpiler.unittest', 'docs/test', 'test.unit.dart/ci', sequenceComplete(done));
461+
runSequence('versions.dart', 'test.transpiler.unittest', 'docs/test', 'test.unit.dart/ci',
462+
sequenceComplete(done));
463+
});
464+
465+
gulp.task('versions.dart', function() {
466+
dartSdk.logVersion(DART_SDK);
461467
});
462468

463469
// Reuse the Travis scripts

scripts/ci/env_dart.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,5 @@ if [[ -z $ENV_SET ]]; then
9393
echo PATH=$PATH
9494
echo NGDART_BASE_DIR=$NGDART_BASE_DIR
9595
echo NGDART_SCRIPT_DIR=$NGDART_SCRIPT_DIR
96-
$DART --version 2>&1
9796

9897
fi

tools/build/dartdetect.js renamed to tools/build/dart.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
var which = require('which');
2+
var spawnSync = require('child_process').spawnSync;
23

3-
module.exports = function(gulp) {
4+
module.exports.detect = function(gulp) {
45
var DART_SDK = false;
56
try {
67
which.sync('dart');
7-
console.log('Dart SDK detected');
88
if (process.platform === 'win32') {
99
DART_SDK = {
1010
ANALYZER: 'dartanalyzer.bat',
@@ -20,6 +20,7 @@ module.exports = function(gulp) {
2020
VM: 'dart'
2121
};
2222
}
23+
console.log('Dart SDK detected:');
2324
} catch (e) {
2425
console.log('Dart SDK is not available, Dart tasks will be skipped.');
2526
var gulpTaskFn = gulp.task.bind(gulp);
@@ -35,3 +36,9 @@ module.exports = function(gulp) {
3536
}
3637
return DART_SDK;
3738
}
39+
40+
module.exports.logVersion = function(dartSdk) {
41+
console.log('DART SDK:') ;
42+
console.log('- dart: ' + spawnSync(dartSdk.VM, ['--version']).stderr.toString().replace(/\n/g, ''));
43+
console.log('- pub: ' + spawnSync(dartSdk.PUB, ['--version']).stdout.toString().replace(/\n/g, ''));
44+
}

0 commit comments

Comments
 (0)