chore(gulp): add a task to print dart & pub versions
This commit is contained in:
parent
530e742628
commit
f020a5cdea
10
gulpfile.js
10
gulpfile.js
|
@ -38,6 +38,7 @@ var insert = require('gulp-insert');
|
||||||
var uglify = require('gulp-uglify');
|
var uglify = require('gulp-uglify');
|
||||||
var shouldLog = require('./tools/build/logging');
|
var shouldLog = require('./tools/build/logging');
|
||||||
var tslint = require('gulp-tslint');
|
var tslint = require('gulp-tslint');
|
||||||
|
var dartSdk = require('./tools/build/dart');
|
||||||
|
|
||||||
require('./tools/check-environment')({
|
require('./tools/check-environment')({
|
||||||
requiredNpmVersion: '>=2.9.0',
|
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.
|
// 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
|
// configuration
|
||||||
|
@ -457,7 +458,12 @@ gulp.task('test.js', function(done) {
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('test.dart', 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
|
// Reuse the Travis scripts
|
||||||
|
|
|
@ -93,6 +93,5 @@ if [[ -z $ENV_SET ]]; then
|
||||||
echo PATH=$PATH
|
echo PATH=$PATH
|
||||||
echo NGDART_BASE_DIR=$NGDART_BASE_DIR
|
echo NGDART_BASE_DIR=$NGDART_BASE_DIR
|
||||||
echo NGDART_SCRIPT_DIR=$NGDART_SCRIPT_DIR
|
echo NGDART_SCRIPT_DIR=$NGDART_SCRIPT_DIR
|
||||||
$DART --version 2>&1
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
var which = require('which');
|
var which = require('which');
|
||||||
|
var spawnSync = require('child_process').spawnSync;
|
||||||
|
|
||||||
module.exports = function(gulp) {
|
module.exports.detect = function(gulp) {
|
||||||
var DART_SDK = false;
|
var DART_SDK = false;
|
||||||
try {
|
try {
|
||||||
which.sync('dart');
|
which.sync('dart');
|
||||||
console.log('Dart SDK detected');
|
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
DART_SDK = {
|
DART_SDK = {
|
||||||
ANALYZER: 'dartanalyzer.bat',
|
ANALYZER: 'dartanalyzer.bat',
|
||||||
|
@ -20,6 +20,7 @@ module.exports = function(gulp) {
|
||||||
VM: 'dart'
|
VM: 'dart'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
console.log('Dart SDK detected:');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Dart SDK is not available, Dart tasks will be skipped.');
|
console.log('Dart SDK is not available, Dart tasks will be skipped.');
|
||||||
var gulpTaskFn = gulp.task.bind(gulp);
|
var gulpTaskFn = gulp.task.bind(gulp);
|
||||||
|
@ -35,3 +36,9 @@ module.exports = function(gulp) {
|
||||||
}
|
}
|
||||||
return DART_SDK;
|
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, ''));
|
||||||
|
}
|
Loading…
Reference in New Issue