Port the mozcentraldiff
target to Gulp
This commit is contained in:
parent
74854fb4cc
commit
19cc9bcded
31
gulpfile.js
31
gulpfile.js
@ -59,6 +59,7 @@ var COMMON_WEB_FILES = [
|
|||||||
'web/images/*.{png,svg,gif,cur}',
|
'web/images/*.{png,svg,gif,cur}',
|
||||||
'web/debugger.js'
|
'web/debugger.js'
|
||||||
];
|
];
|
||||||
|
var MOZCENTRAL_DIFF_FILE = 'mozcentral.diff';
|
||||||
|
|
||||||
var REPO = 'git@github.com:mozilla/pdf.js.git';
|
var REPO = 'git@github.com:mozilla/pdf.js.git';
|
||||||
var DIST_REPO_URL = 'https://github.com/mozilla/pdfjs-dist';
|
var DIST_REPO_URL = 'https://github.com/mozilla/pdfjs-dist';
|
||||||
@ -1372,6 +1373,36 @@ gulp.task('mozcentralbaseline', ['baseline'], function (done) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
gulp.task('mozcentraldiff', ['mozcentral', 'mozcentralbaseline'],
|
||||||
|
function (done) {
|
||||||
|
console.log();
|
||||||
|
console.log('### Creating mozcentral diff');
|
||||||
|
|
||||||
|
// Create the diff between the current mozcentral build and the
|
||||||
|
// baseline mozcentral build, which both exist at this point.
|
||||||
|
// The mozcentral baseline directory is a Git repository, so we
|
||||||
|
// remove all files and copy the current mozcentral build files
|
||||||
|
// into it to create the diff.
|
||||||
|
rimraf.sync(MOZCENTRAL_BASELINE_DIR + '*');
|
||||||
|
|
||||||
|
gulp.src([BUILD_DIR + 'mozcentral/**/*'])
|
||||||
|
.pipe(gulp.dest(MOZCENTRAL_BASELINE_DIR))
|
||||||
|
.on('end', function () {
|
||||||
|
spawnSync('git', ['add', '-A'], {cwd: MOZCENTRAL_BASELINE_DIR});
|
||||||
|
var diff = spawnSync('git',
|
||||||
|
['diff', '--binary', '--cached', '--unified=8'],
|
||||||
|
{cwd: MOZCENTRAL_BASELINE_DIR}).stdout;
|
||||||
|
|
||||||
|
createStringSource(MOZCENTRAL_DIFF_FILE, diff)
|
||||||
|
.pipe(gulp.dest(BUILD_DIR))
|
||||||
|
.on('end', function () {
|
||||||
|
console.log('Result diff can be found at ' + BUILD_DIR +
|
||||||
|
MOZCENTRAL_DIFF_FILE);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Getting all shelljs registered tasks and register them with gulp
|
// Getting all shelljs registered tasks and register them with gulp
|
||||||
require('./make.js');
|
require('./make.js');
|
||||||
|
|
||||||
|
29
make.js
29
make.js
@ -227,34 +227,7 @@ target.mozcentralbaseline = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
target.mozcentraldiff = function() {
|
target.mozcentraldiff = function() {
|
||||||
target.mozcentral();
|
execGulp('mozcentraldiff');
|
||||||
|
|
||||||
cd(ROOT_DIR);
|
|
||||||
|
|
||||||
echo();
|
|
||||||
echo('### Creating mozcentral diff');
|
|
||||||
|
|
||||||
var MOZCENTRAL_DIFF = BUILD_DIR + 'mozcentral.diff';
|
|
||||||
if (test('-f', MOZCENTRAL_DIFF)) {
|
|
||||||
rm(MOZCENTRAL_DIFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
var MOZCENTRAL_BASELINE_DIR = BUILD_DIR + 'mozcentral.baseline';
|
|
||||||
if (!test('-d', MOZCENTRAL_BASELINE_DIR)) {
|
|
||||||
echo('mozcentral baseline was not found');
|
|
||||||
echo('Please build one using "gulp mozcentralbaseline"');
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
cd(MOZCENTRAL_BASELINE_DIR);
|
|
||||||
exec('git reset --hard');
|
|
||||||
cd(ROOT_DIR); rm('-rf', MOZCENTRAL_BASELINE_DIR + '/*'); // trying to be safe
|
|
||||||
cd(MOZCENTRAL_BASELINE_DIR);
|
|
||||||
cp('-Rf', '../mozcentral/*', '.');
|
|
||||||
exec('git add -A');
|
|
||||||
exec('git diff --binary --cached --unified=8', {silent: true}).output.
|
|
||||||
to('../mozcentral.diff');
|
|
||||||
|
|
||||||
echo('Result diff can be found at ' + MOZCENTRAL_DIFF);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user