build(travis): add travis log folding for verbose tasks
This commit is contained in:
parent
9fa57d06da
commit
e21bf120b9
|
@ -4,12 +4,15 @@ var spawn = require('child_process').spawn;
|
|||
var path = require('path');
|
||||
var glob = require('glob');
|
||||
var fs = require('fs');
|
||||
var travisFoldStart = require('../travis/travis-fold');
|
||||
var util = require('./util');
|
||||
var yaml = require('js-yaml');
|
||||
|
||||
module.exports = function(gulp, plugins, config) {
|
||||
return function() {
|
||||
var travisFoldEnd = travisFoldStart(`dartanalyzer-${config.use_ddc ? 'ddc' : ''}-${config.dest}`);
|
||||
var tempFile = '_analyzer.dart';
|
||||
|
||||
return util.forEachSubDirSequential(config.dest, function(dir) {
|
||||
var pubspecContents = fs.readFileSync(path.join(dir, 'pubspec.yaml'));
|
||||
var pubspec = yaml.safeLoad(pubspecContents);
|
||||
|
@ -36,7 +39,7 @@ module.exports = function(gulp, plugins, config) {
|
|||
analyze(dir, defer.makeNodeResolver());
|
||||
}
|
||||
return defer.promise;
|
||||
});
|
||||
}).then(travisFoldEnd);
|
||||
|
||||
function analyze(dirName, done, useDdc) {
|
||||
// TODO remove --package-warnings once dartanalyzer handles transitive libraries
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
var util = require('./util');
|
||||
var spawn = require('child_process').spawn;
|
||||
var path = require('path');
|
||||
var travisFoldStart = require('../travis/travis-fold');
|
||||
|
||||
|
||||
module.exports = {
|
||||
dir: pubGetDir,
|
||||
|
@ -9,15 +11,19 @@ module.exports = {
|
|||
|
||||
function pubGetDir(gulp, plugins, config) {
|
||||
return function() {
|
||||
var travisFoldEnd = travisFoldStart(`pubget-${config.dir}`);
|
||||
|
||||
return util.processToPromise(spawn(config.command, ['upgrade'], {
|
||||
stdio: 'inherit',
|
||||
cwd: config.dir
|
||||
}));
|
||||
})).then(travisFoldEnd);
|
||||
};
|
||||
};
|
||||
|
||||
function pubGetSubDir(gulp, plugins, config) {
|
||||
return function() {
|
||||
var travisFoldEnd = travisFoldStart(`pubget-${config.command}-${config.dir}`);
|
||||
|
||||
// We need to execute pubspec serially as otherwise we can get into trouble
|
||||
// with the pub cache...
|
||||
return util.forEachSubDirSequential(config.dir, function(subDir) {
|
||||
|
@ -25,6 +31,6 @@ function pubGetSubDir(gulp, plugins, config) {
|
|||
stdio: 'inherit',
|
||||
cwd: subDir
|
||||
}));
|
||||
});
|
||||
}).then(travisFoldEnd);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
module.exports = function travisFoldStart(name) {
|
||||
if (process.env.TRAVIS) console.log('travis_fold:start:' + encode(name));
|
||||
|
||||
return function travisFoldEnd() {
|
||||
if (process.env.TRAVIS) console.log('travis_fold:end:' + encode(name));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function encode(name) {
|
||||
return name.replace(/\W/g, '-').replace(/-$/, '');
|
||||
}
|
Loading…
Reference in New Issue