From 74854fb4cc1da34cde161557ef0ff7e8b4ef3b0a Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Thu, 27 Apr 2017 21:42:07 +0200 Subject: [PATCH] Port the `mozcentralbaseline` target to Gulp The baseline fix is dead code since three years, so we can safely remove it. --- gulpfile.js | 25 +++++++++++++++++++++++++ make.js | 34 +--------------------------------- 2 files changed, 26 insertions(+), 33 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 1edd8d963..93971be38 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -43,6 +43,7 @@ var TEST_DIR = 'test/'; var EXTENSION_SRC_DIR = 'extensions/'; var BASELINE_DIR = BUILD_DIR + 'baseline/'; +var MOZCENTRAL_BASELINE_DIR = BUILD_DIR + 'mozcentral.baseline/'; var GENERIC_DIR = BUILD_DIR + 'generic/'; var COMPONENTS_DIR = BUILD_DIR + 'components/'; var SINGLE_FILE_DIR = BUILD_DIR + 'singlefile/'; @@ -1347,6 +1348,30 @@ gulp.task('dist-repo-git', ['dist-repo-prepare'], function () { gulp.task('dist', ['dist-repo-git']); +gulp.task('mozcentralbaseline', ['baseline'], function (done) { + console.log(); + console.log('### Creating mozcentral baseline environment'); + + // Create a mozcentral build. + rimraf.sync(BASELINE_DIR + BUILD_DIR); + spawnSync('gulp', ['mozcentral', '--cwd', BASELINE_DIR], {env: process.env}); + + // Copy the mozcentral build to the mozcentral baseline directory. + rimraf.sync(MOZCENTRAL_BASELINE_DIR); + mkdirp.sync(MOZCENTRAL_BASELINE_DIR); + + gulp.src([BASELINE_DIR + BUILD_DIR + 'mozcentral/**/*']) + .pipe(gulp.dest(MOZCENTRAL_BASELINE_DIR)) + .on('end', function () { + // Commit the mozcentral baseline. + spawnSync('git', ['init'], {cwd: MOZCENTRAL_BASELINE_DIR}); + spawnSync('git', ['add', '.'], {cwd: MOZCENTRAL_BASELINE_DIR}); + spawnSync('git', ['commit', '-m', 'mozcentral baseline'], + {cwd: MOZCENTRAL_BASELINE_DIR}); + done(); + }); +}); + // Getting all shelljs registered tasks and register them with gulp require('./make.js'); diff --git a/make.js b/make.js index c4f1679ba..7030aa8fc 100644 --- a/make.js +++ b/make.js @@ -223,39 +223,7 @@ target.baseline = function() { }; target.mozcentralbaseline = function() { - target.baseline(); - - cd(ROOT_DIR); - - echo(); - echo('### Creating mozcentral baseline environment'); - - var BASELINE_DIR = BUILD_DIR + 'baseline'; - var MOZCENTRAL_BASELINE_DIR = BUILD_DIR + 'mozcentral.baseline'; - if (test('-d', MOZCENTRAL_BASELINE_DIR)) { - rm('-rf', MOZCENTRAL_BASELINE_DIR); - } - - cd(BASELINE_DIR); - if (test('-d', 'build')) { - rm('-rf', 'build'); - } - exec('node make mozcentral'); - - cd(ROOT_DIR); - mkdir(MOZCENTRAL_BASELINE_DIR); - cp('-Rf', BASELINE_DIR + '/build/mozcentral/*', MOZCENTRAL_BASELINE_DIR); - // fixing baseline - if (test('-f', MOZCENTRAL_BASELINE_DIR + - '/browser/extensions/pdfjs/PdfStreamConverter.js')) { - rm(MOZCENTRAL_BASELINE_DIR + - '/browser/extensions/pdfjs/PdfStreamConverter.js'); - } - - cd(MOZCENTRAL_BASELINE_DIR); - exec('git init'); - exec('git add .'); - exec('git commit -m "mozcentral baseline"'); + execGulp('mozcentralbaseline'); }; target.mozcentraldiff = function() {