Gulp: migrate baseline target from make.js

This commit is contained in:
Tim van der Meij 2017-02-21 23:24:07 +01:00
parent da08b801a5
commit 0f4e6fdb9d
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762
2 changed files with 39 additions and 25 deletions

View File

@ -23,6 +23,7 @@ var gutil = require('gulp-util');
var rename = require('gulp-rename');
var replace = require('gulp-replace');
var mkdirp = require('mkdirp');
var path = require('path');
var rimraf = require('rimraf');
var runSequence = require('run-sequence');
var stream = require('stream');
@ -40,6 +41,7 @@ var L10N_DIR = 'l10n/';
var TEST_DIR = 'test/';
var EXTENSION_SRC_DIR = 'extensions/';
var BASELINE_DIR = BUILD_DIR + 'baseline/';
var GENERIC_DIR = BUILD_DIR + 'generic/';
var COMPONENTS_DIR = BUILD_DIR + 'components/';
var SINGLE_FILE_DIR = BUILD_DIR + 'singlefile/';
@ -956,6 +958,42 @@ gulp.task('botmakeref', function (done) {
});
});
gulp.task('baseline', function (done) {
console.log();
console.log('### Creating baseline environment');
var baselineCommit = process.env['BASELINE'];
if (!baselineCommit) {
done(new Error('Missing baseline commit. Specify the BASELINE variable.'));
return;
}
var initializeCommand = 'git fetch origin';
if (!checkDir(BASELINE_DIR)) {
mkdirp.sync(BASELINE_DIR);
initializeCommand = 'git clone ../../ .';
}
var workingDirectory = path.resolve(process.cwd(), BASELINE_DIR);
exec(initializeCommand, { cwd: workingDirectory }, function (error) {
if (error) {
done(new Error('Baseline clone/fetch failed.'));
return;
}
exec('git checkout ' + baselineCommit, { cwd: workingDirectory },
function (error) {
if (error) {
done(new Error('Baseline commit checkout failed.'));
return;
}
console.log('Baseline commit "' + baselineCommit + '" checked out.');
done();
});
});
});
gulp.task('unittestcli', function (done) {
var args = ['JASMINE_CONFIG_PATH=test/unit/clitests.json'];
var testProcess = spawn('node_modules/.bin/jasmine', args,

26
make.js
View File

@ -498,31 +498,7 @@ target.botmakeref = function() {
// Baseline operation
//
target.baseline = function() {
cd(ROOT_DIR);
echo();
echo('### Creating baseline environment');
var baselineCommit = env['BASELINE'];
if (!baselineCommit) {
echo('Baseline commit is not provided. Please specify BASELINE variable');
exit(1);
}
if (!test('-d', BUILD_DIR)) {
mkdir(BUILD_DIR);
}
var BASELINE_DIR = BUILD_DIR + 'baseline';
if (test('-d', BASELINE_DIR)) {
cd(BASELINE_DIR);
exec('git fetch origin');
} else {
cd(BUILD_DIR);
exec('git clone .. baseline');
cd(ROOT_DIR + BASELINE_DIR);
}
exec('git checkout ' + baselineCommit);
execGulp('baseline');
};
target.mozcentralbaseline = function() {