Creates 'lib' for the 'dist' build target.
This commit is contained in:
parent
e7cc07cc11
commit
39e8ad24f7
41
gulpfile.js
41
gulpfile.js
@ -22,6 +22,7 @@ var gulp = require('gulp');
|
|||||||
var gutil = require('gulp-util');
|
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 transform = require('gulp-transform');
|
||||||
var mkdirp = require('mkdirp');
|
var mkdirp = require('mkdirp');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var rimraf = require('rimraf');
|
var rimraf = require('rimraf');
|
||||||
@ -924,9 +925,45 @@ gulp.task('jsdoc', function (done) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
gulp.task('lib', ['buildnumber'], function () {
|
||||||
|
function preprocess(content) {
|
||||||
|
content = preprocessor2.preprocessPDFJSCode(ctx, content);
|
||||||
|
var removeCjsSrc =
|
||||||
|
/^(var\s+\w+\s*=\s*require\('.*?)(?:\/src)(\/[^']*'\);)$/gm;
|
||||||
|
content = content.replace(removeCjsSrc, function (all, prefix, suffix) {
|
||||||
|
return prefix + suffix;
|
||||||
|
});
|
||||||
|
return licenseHeader + content;
|
||||||
|
}
|
||||||
|
var versionInfo = getVersionJSON();
|
||||||
|
var ctx = {
|
||||||
|
rootPath: __dirname,
|
||||||
|
saveComments: false,
|
||||||
|
defines: builder.merge(DEFINES, {
|
||||||
|
GENERIC: true,
|
||||||
|
BUNDLE_VERSION: versionInfo.version,
|
||||||
|
BUNDLE_BUILD: versionInfo.commit
|
||||||
|
})
|
||||||
|
};
|
||||||
|
var licenseHeader = fs.readFileSync('./src/license_header.js').toString();
|
||||||
|
var preprocessor2 = require('./external/builder/preprocessor2.js');
|
||||||
|
|
||||||
|
return merge([
|
||||||
|
gulp.src([
|
||||||
|
'src/{core,display}/*.js',
|
||||||
|
'src/shared/{compatibility,util}.js',
|
||||||
|
'src/{pdf,pdf.worker}.js',
|
||||||
|
], {base: 'src/'}),
|
||||||
|
gulp.src(['web/*.js', '!web/viewer.js'], {base: '.'}),
|
||||||
|
gulp.src('test/unit/*.js', {base: '.'}),
|
||||||
|
]).pipe(transform(preprocess))
|
||||||
|
.pipe(gulp.dest('build/lib/'));
|
||||||
|
});
|
||||||
|
|
||||||
gulp.task('web-pre', ['generic', 'extension', 'jsdoc']);
|
gulp.task('web-pre', ['generic', 'extension', 'jsdoc']);
|
||||||
|
|
||||||
gulp.task('dist-pre', ['generic', 'singlefile', 'components', 'minified']);
|
gulp.task('dist-pre',
|
||||||
|
['generic', 'singlefile', 'components', 'lib', 'minified']);
|
||||||
|
|
||||||
gulp.task('publish', ['generic'], function (done) {
|
gulp.task('publish', ['generic'], function (done) {
|
||||||
var version = JSON.parse(
|
var version = JSON.parse(
|
||||||
@ -1020,7 +1057,7 @@ gulp.task('baseline', function (done) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('unittestcli', function (done) {
|
gulp.task('unittestcli', ['lib'], 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,
|
||||||
{stdio: 'inherit'});
|
{stdio: 'inherit'});
|
||||||
|
3
make.js
3
make.js
@ -42,6 +42,7 @@ var ROOT_DIR = __dirname + '/', // absolute path to project's root
|
|||||||
DIST_DIR = BUILD_DIR + 'dist/',
|
DIST_DIR = BUILD_DIR + 'dist/',
|
||||||
SINGLE_FILE_DIR = BUILD_DIR + 'singlefile/',
|
SINGLE_FILE_DIR = BUILD_DIR + 'singlefile/',
|
||||||
COMPONENTS_DIR = BUILD_DIR + 'components/',
|
COMPONENTS_DIR = BUILD_DIR + 'components/',
|
||||||
|
LIB_DIR = BUILD_DIR + 'lib/',
|
||||||
REPO = 'git@github.com:mozilla/pdf.js.git';
|
REPO = 'git@github.com:mozilla/pdf.js.git';
|
||||||
|
|
||||||
function getCurrentVersion() {
|
function getCurrentVersion() {
|
||||||
@ -186,6 +187,8 @@ target.dist = function() {
|
|||||||
COMPONENTS_DIR + '*',
|
COMPONENTS_DIR + '*',
|
||||||
], DIST_DIR + 'web/');
|
], DIST_DIR + 'web/');
|
||||||
|
|
||||||
|
cp('-R', LIB_DIR, DIST_DIR + 'lib/');
|
||||||
|
|
||||||
echo();
|
echo();
|
||||||
echo('### Rebuilding manifests');
|
echo('### Rebuilding manifests');
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
"gulp-rename": "^1.2.2",
|
"gulp-rename": "^1.2.2",
|
||||||
"gulp-replace": "^0.5.4",
|
"gulp-replace": "^0.5.4",
|
||||||
|
"gulp-transform": "^1.1.0",
|
||||||
"gulp-util": "^3.0.7",
|
"gulp-util": "^3.0.7",
|
||||||
"gulp-zip": "^3.2.0",
|
"gulp-zip": "^3.2.0",
|
||||||
"jasmine": "^2.5.2",
|
"jasmine": "^2.5.2",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"spec_dir": "test/unit",
|
"spec_dir": "build/lib/test/unit",
|
||||||
"spec_files": [
|
"spec_files": [
|
||||||
"annotation_spec.js",
|
"annotation_spec.js",
|
||||||
"bidi_spec.js",
|
"bidi_spec.js",
|
||||||
|
Loading…
Reference in New Issue
Block a user