Gulp: migrate baseline
target from make.js
This commit is contained in:
parent
da08b801a5
commit
0f4e6fdb9d
38
gulpfile.js
38
gulpfile.js
@ -23,6 +23,7 @@ var gutil = require('gulp-util');
|
|||||||
var rename = require('gulp-rename');
|
var rename = require('gulp-rename');
|
||||||
var replace = require('gulp-replace');
|
var replace = require('gulp-replace');
|
||||||
var mkdirp = require('mkdirp');
|
var mkdirp = require('mkdirp');
|
||||||
|
var path = require('path');
|
||||||
var rimraf = require('rimraf');
|
var rimraf = require('rimraf');
|
||||||
var runSequence = require('run-sequence');
|
var runSequence = require('run-sequence');
|
||||||
var stream = require('stream');
|
var stream = require('stream');
|
||||||
@ -40,6 +41,7 @@ var L10N_DIR = 'l10n/';
|
|||||||
var TEST_DIR = 'test/';
|
var TEST_DIR = 'test/';
|
||||||
var EXTENSION_SRC_DIR = 'extensions/';
|
var EXTENSION_SRC_DIR = 'extensions/';
|
||||||
|
|
||||||
|
var BASELINE_DIR = BUILD_DIR + 'baseline/';
|
||||||
var GENERIC_DIR = BUILD_DIR + 'generic/';
|
var GENERIC_DIR = BUILD_DIR + 'generic/';
|
||||||
var COMPONENTS_DIR = BUILD_DIR + 'components/';
|
var COMPONENTS_DIR = BUILD_DIR + 'components/';
|
||||||
var SINGLE_FILE_DIR = BUILD_DIR + 'singlefile/';
|
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) {
|
gulp.task('unittestcli', function (done) {
|
||||||
var args = ['JASMINE_CONFIG_PATH=test/unit/clitests.json'];
|
var args = ['JASMINE_CONFIG_PATH=test/unit/clitests.json'];
|
||||||
var testProcess = spawn('node_modules/.bin/jasmine', args,
|
var testProcess = spawn('node_modules/.bin/jasmine', args,
|
||||||
|
26
make.js
26
make.js
@ -498,31 +498,7 @@ target.botmakeref = function() {
|
|||||||
// Baseline operation
|
// Baseline operation
|
||||||
//
|
//
|
||||||
target.baseline = function() {
|
target.baseline = function() {
|
||||||
cd(ROOT_DIR);
|
execGulp('baseline');
|
||||||
|
|
||||||
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);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
target.mozcentralbaseline = function() {
|
target.mozcentralbaseline = function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user