|
|
@ -36,6 +36,7 @@ var config = JSON.parse(fs.readFileSync(CONFIG_FILE)); |
|
|
|
|
|
|
|
|
|
|
|
// Defined by buildnumber target.
|
|
|
|
// Defined by buildnumber target.
|
|
|
|
var BUILD_NUMBER, |
|
|
|
var BUILD_NUMBER, |
|
|
|
|
|
|
|
BUILD_COMMIT, |
|
|
|
VERSION; |
|
|
|
VERSION; |
|
|
|
|
|
|
|
|
|
|
|
var ROOT_DIR = __dirname + '/', // absolute path to project's root
|
|
|
|
var ROOT_DIR = __dirname + '/', // absolute path to project's root
|
|
|
@ -100,8 +101,7 @@ var COMMON_WEB_FILES = |
|
|
|
['web/images', |
|
|
|
['web/images', |
|
|
|
'web/debugger.js'], |
|
|
|
'web/debugger.js'], |
|
|
|
COMMON_WEB_FILES_PREPROCESS = |
|
|
|
COMMON_WEB_FILES_PREPROCESS = |
|
|
|
['web/viewer.js', |
|
|
|
['web/viewer.html'], |
|
|
|
'web/viewer.html'], |
|
|
|
|
|
|
|
COMMON_FIREFOX_FILES_PREPROCESS = |
|
|
|
COMMON_FIREFOX_FILES_PREPROCESS = |
|
|
|
[FIREFOX_CONTENT_DIR + 'PdfStreamConverter.jsm', |
|
|
|
[FIREFOX_CONTENT_DIR + 'PdfStreamConverter.jsm', |
|
|
|
FIREFOX_CONTENT_DIR + 'PdfjsContentUtils.jsm', |
|
|
|
FIREFOX_CONTENT_DIR + 'PdfjsContentUtils.jsm', |
|
|
@ -127,6 +127,13 @@ target.generic = function() { |
|
|
|
|
|
|
|
|
|
|
|
var defines = builder.merge(DEFINES, {GENERIC: true}); |
|
|
|
var defines = builder.merge(DEFINES, {GENERIC: true}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TMP_VIEWER = GENERIC_DIR + '/web/viewer.js.tmp'; |
|
|
|
|
|
|
|
cd('web/'); |
|
|
|
|
|
|
|
var viewerBundleFiles = ['app.js']; |
|
|
|
|
|
|
|
bundle('viewer.js', ROOT_DIR + TMP_VIEWER, viewerBundleFiles, |
|
|
|
|
|
|
|
'pdfjs-dist/web/viewer', defines, true); |
|
|
|
|
|
|
|
cd(ROOT_DIR); |
|
|
|
|
|
|
|
|
|
|
|
var setup = { |
|
|
|
var setup = { |
|
|
|
defines: defines, |
|
|
|
defines: defines, |
|
|
|
copy: [ |
|
|
|
copy: [ |
|
|
@ -140,6 +147,7 @@ target.generic = function() { |
|
|
|
], |
|
|
|
], |
|
|
|
preprocess: [ |
|
|
|
preprocess: [ |
|
|
|
[BUILD_TARGETS, GENERIC_DIR + BUILD_DIR], |
|
|
|
[BUILD_TARGETS, GENERIC_DIR + BUILD_DIR], |
|
|
|
|
|
|
|
[TMP_VIEWER, GENERIC_DIR + '/web/viewer.js'], |
|
|
|
[COMMON_WEB_FILES_PREPROCESS, GENERIC_DIR + '/web'] |
|
|
|
[COMMON_WEB_FILES_PREPROCESS, GENERIC_DIR + '/web'] |
|
|
|
], |
|
|
|
], |
|
|
|
preprocessCSS: [ |
|
|
|
preprocessCSS: [ |
|
|
@ -152,6 +160,7 @@ target.generic = function() { |
|
|
|
cleanupJSSource(GENERIC_DIR + '/build/pdf.js'); |
|
|
|
cleanupJSSource(GENERIC_DIR + '/build/pdf.js'); |
|
|
|
cleanupJSSource(GENERIC_DIR + '/web/viewer.js'); |
|
|
|
cleanupJSSource(GENERIC_DIR + '/web/viewer.js'); |
|
|
|
cleanupCSSSource(GENERIC_DIR + '/web/viewer.css'); |
|
|
|
cleanupCSSSource(GENERIC_DIR + '/web/viewer.css'); |
|
|
|
|
|
|
|
rm(TMP_VIEWER); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
target.components = function() { |
|
|
|
target.components = function() { |
|
|
@ -163,7 +172,18 @@ target.components = function() { |
|
|
|
mkdir('-p', COMPONENTS_DIR); |
|
|
|
mkdir('-p', COMPONENTS_DIR); |
|
|
|
mkdir('-p', COMPONENTS_DIR + 'images'); |
|
|
|
mkdir('-p', COMPONENTS_DIR + 'images'); |
|
|
|
|
|
|
|
|
|
|
|
var defines = builder.merge(DEFINES, {COMPONENTS: true}); |
|
|
|
var defines = builder.merge(DEFINES, {COMPONENTS: true, GENERIC: true}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TMP_PDF_VIEWER = COMPONENTS_DIR + 'pdf_viewer.js.tmp'; |
|
|
|
|
|
|
|
cd('web/'); |
|
|
|
|
|
|
|
var bundleFiles = [ |
|
|
|
|
|
|
|
'pdf_viewer.js', |
|
|
|
|
|
|
|
'pdf_history.js', |
|
|
|
|
|
|
|
'download_manager.js' |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
bundle('pdf_viewer.component.js', ROOT_DIR + TMP_PDF_VIEWER, bundleFiles, |
|
|
|
|
|
|
|
'pdfjs-dist/web/pdf_viewer', defines, true); |
|
|
|
|
|
|
|
cd(ROOT_DIR); |
|
|
|
|
|
|
|
|
|
|
|
var COMPONENTS_IMAGES = [ |
|
|
|
var COMPONENTS_IMAGES = [ |
|
|
|
'web/images/annotation-*.svg', |
|
|
|
'web/images/annotation-*.svg', |
|
|
@ -179,7 +199,7 @@ target.components = function() { |
|
|
|
['web/compatibility.js', COMPONENTS_DIR], |
|
|
|
['web/compatibility.js', COMPONENTS_DIR], |
|
|
|
], |
|
|
|
], |
|
|
|
preprocess: [ |
|
|
|
preprocess: [ |
|
|
|
['web/pdf_viewer.component.js', COMPONENTS_DIR + 'pdf_viewer.js'], |
|
|
|
[TMP_PDF_VIEWER, COMPONENTS_DIR + 'pdf_viewer.js'], |
|
|
|
], |
|
|
|
], |
|
|
|
preprocessCSS: [ |
|
|
|
preprocessCSS: [ |
|
|
|
['components', 'web/pdf_viewer.css', COMPONENTS_DIR + 'pdf_viewer.css'], |
|
|
|
['components', 'web/pdf_viewer.css', COMPONENTS_DIR + 'pdf_viewer.css'], |
|
|
@ -189,6 +209,7 @@ target.components = function() { |
|
|
|
|
|
|
|
|
|
|
|
cleanupJSSource(COMPONENTS_DIR + 'pdf_viewer.js'); |
|
|
|
cleanupJSSource(COMPONENTS_DIR + 'pdf_viewer.js'); |
|
|
|
cleanupCSSSource(COMPONENTS_DIR + 'pdf_viewer.css'); |
|
|
|
cleanupCSSSource(COMPONENTS_DIR + 'pdf_viewer.css'); |
|
|
|
|
|
|
|
rm(TMP_PDF_VIEWER); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
target.jsdoc = function() { |
|
|
|
target.jsdoc = function() { |
|
|
@ -479,27 +500,20 @@ target.cmaps = function () { |
|
|
|
compressCmaps(CMAP_INPUT, VIEWER_CMAP_OUTPUT, true); |
|
|
|
compressCmaps(CMAP_INPUT, VIEWER_CMAP_OUTPUT, true); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
function bundle(filename, outfilename, initFiles, amdName, defines, |
|
|
|
// make bundle
|
|
|
|
isMainFile) { |
|
|
|
// Bundles all source files into one wrapper 'pdf.js' file, in the given order.
|
|
|
|
// Reading UMD headers and building loading orders of modules. The
|
|
|
|
//
|
|
|
|
// readDependencies returns AMD module names: removing 'pdfjs' prefix and
|
|
|
|
target.bundle = function(args) { |
|
|
|
// adding '.js' extensions to the name.
|
|
|
|
args = args || {}; |
|
|
|
var umd = require('./external/umdutils/verifier.js'); |
|
|
|
var defines = args.defines || DEFINES; |
|
|
|
var files = umd.readDependencies(initFiles).loadOrder.map( |
|
|
|
|
|
|
|
function (name) { return name.replace(/^[\w\-]+\//, '') + '.js'; }); |
|
|
|
target.buildnumber(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cd(ROOT_DIR); |
|
|
|
crlfchecker.checkIfCrlfIsPresent(files); |
|
|
|
echo(); |
|
|
|
|
|
|
|
echo('### Bundling files into ' + BUILD_TARGET); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function bundle(filename, outfilename, files, distname, isMainFile) { |
|
|
|
|
|
|
|
var bundleContent = cat(files), |
|
|
|
var bundleContent = cat(files), |
|
|
|
bundleVersion = VERSION, |
|
|
|
bundleVersion = VERSION, |
|
|
|
bundleBuild = exec('git log --format="%h" -n 1', |
|
|
|
bundleBuild = BUILD_COMMIT; |
|
|
|
{silent: true}).output.replace('\n', ''); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
crlfchecker.checkIfCrlfIsPresent(files); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Prepend a newline because stripCommentHeaders only strips comments that
|
|
|
|
// Prepend a newline because stripCommentHeaders only strips comments that
|
|
|
|
// follow a line feed. The file where bundleContent is inserted already
|
|
|
|
// follow a line feed. The file where bundleContent is inserted already
|
|
|
@ -509,70 +523,76 @@ target.bundle = function(args) { |
|
|
|
// Removes AMD and CommonJS branches from UMD headers.
|
|
|
|
// Removes AMD and CommonJS branches from UMD headers.
|
|
|
|
bundleContent = stripUMDHeaders(bundleContent); |
|
|
|
bundleContent = stripUMDHeaders(bundleContent); |
|
|
|
|
|
|
|
|
|
|
|
var amdName = 'pdfjs-dist/build/' + distname.replace(/\.js$/, ''); |
|
|
|
|
|
|
|
var jsName = amdName.replace(/[\-_\.\/]\w/g, function (all) { |
|
|
|
var jsName = amdName.replace(/[\-_\.\/]\w/g, function (all) { |
|
|
|
return all[1].toUpperCase(); |
|
|
|
return all[1].toUpperCase(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// This just preprocesses the empty pdf.js file, we don't actually want to
|
|
|
|
// This just preprocesses the empty pdf.js file, we don't actually want to
|
|
|
|
// preprocess everything yet since other build targets use this file.
|
|
|
|
// preprocess everything yet since other build targets use this file.
|
|
|
|
builder.preprocess(filename, outfilename, builder.merge(defines, |
|
|
|
builder.preprocess(filename, outfilename, |
|
|
|
{BUNDLE: bundleContent, |
|
|
|
builder.merge(defines, { |
|
|
|
|
|
|
|
BUNDLE: bundleContent, |
|
|
|
BUNDLE_VERSION: bundleVersion, |
|
|
|
BUNDLE_VERSION: bundleVersion, |
|
|
|
BUNDLE_BUILD: bundleBuild, |
|
|
|
BUNDLE_BUILD: bundleBuild, |
|
|
|
BUNDLE_AMD_NAME: amdName, |
|
|
|
BUNDLE_AMD_NAME: amdName, |
|
|
|
BUNDLE_JS_NAME: jsName, |
|
|
|
BUNDLE_JS_NAME: jsName, |
|
|
|
MAIN_FILE: isMainFile})); |
|
|
|
MAIN_FILE: isMainFile |
|
|
|
|
|
|
|
})); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// make bundle
|
|
|
|
|
|
|
|
// Bundles all source files into one wrapper 'pdf.js' file, in the given order.
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
target.bundle = function(args) { |
|
|
|
|
|
|
|
args = args || {}; |
|
|
|
|
|
|
|
var defines = args.defines || DEFINES; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
target.buildnumber(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cd(ROOT_DIR); |
|
|
|
|
|
|
|
echo(); |
|
|
|
|
|
|
|
echo('### Bundling files into ' + BUILD_TARGET); |
|
|
|
|
|
|
|
|
|
|
|
if (!test('-d', BUILD_DIR)) { |
|
|
|
if (!test('-d', BUILD_DIR)) { |
|
|
|
mkdir(BUILD_DIR); |
|
|
|
mkdir(BUILD_DIR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var umd = require('./external/umdutils/verifier.js'); |
|
|
|
var mainFiles = [ |
|
|
|
var MAIN_SRC_FILES = [ |
|
|
|
'display/global.js' |
|
|
|
SRC_DIR + 'display/global.js' |
|
|
|
|
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
var WORKER_SRC_FILES = [ |
|
|
|
var workerFiles = [ |
|
|
|
SRC_DIR + 'core/worker.js' |
|
|
|
'core/worker.js' |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
var mainFileName = 'pdf.js'; |
|
|
|
var mainAMDName = 'pdfjs-dist/build/pdf'; |
|
|
|
var workerFileName = 'pdf.worker.js'; |
|
|
|
var workerAMDName = 'pdfjs-dist/build/pdf.worker'; |
|
|
|
|
|
|
|
|
|
|
|
// Extension does not need network.js file.
|
|
|
|
// Extension does not need network.js file.
|
|
|
|
if (!defines.FIREFOX && !defines.MOZCENTRAL) { |
|
|
|
if (!defines.FIREFOX && !defines.MOZCENTRAL) { |
|
|
|
WORKER_SRC_FILES.push(SRC_DIR + 'core/network.js'); |
|
|
|
workerFiles.push('core/network.js'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (defines.SINGLE_FILE) { |
|
|
|
if (defines.SINGLE_FILE) { |
|
|
|
// In singlefile mode, all of the src files will be bundled into
|
|
|
|
// In singlefile mode, all of the src files will be bundled into
|
|
|
|
// the main pdf.js output.
|
|
|
|
// the main pdf.js output.
|
|
|
|
MAIN_SRC_FILES = MAIN_SRC_FILES.concat(WORKER_SRC_FILES); |
|
|
|
mainFiles = mainFiles.concat(workerFiles); |
|
|
|
WORKER_SRC_FILES = null; // no need for worker file
|
|
|
|
workerFiles = null; // no need for worker file
|
|
|
|
mainFileName = 'pdf.combined.js'; |
|
|
|
mainAMDName = 'pdfjs-dist/build/pdf.combined'; |
|
|
|
workerFileName = null; |
|
|
|
workerAMDName = null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Reading UMD headers and building loading orders of modules. The
|
|
|
|
|
|
|
|
// readDependencies returns AMD module names: removing 'pdfjs' prefix and
|
|
|
|
|
|
|
|
// adding '.js' extensions to the name.
|
|
|
|
|
|
|
|
var mainFiles = umd.readDependencies(MAIN_SRC_FILES).loadOrder.map( |
|
|
|
|
|
|
|
function (name) { return name.replace('pdfjs/', '') + '.js'; }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var workerFiles = WORKER_SRC_FILES && |
|
|
|
|
|
|
|
umd.readDependencies(WORKER_SRC_FILES).loadOrder.map( |
|
|
|
|
|
|
|
function (name) { return name.replace('pdfjs/', '') + '.js'; }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cd(SRC_DIR); |
|
|
|
cd(SRC_DIR); |
|
|
|
|
|
|
|
|
|
|
|
bundle('pdf.js', ROOT_DIR + BUILD_TARGET, mainFiles, mainFileName, true); |
|
|
|
bundle('pdf.js', ROOT_DIR + BUILD_TARGET, mainFiles, mainAMDName, defines, |
|
|
|
|
|
|
|
true); |
|
|
|
|
|
|
|
|
|
|
|
if (workerFiles) { |
|
|
|
if (workerFiles) { |
|
|
|
var srcCopy = ROOT_DIR + BUILD_DIR + 'pdf.worker.js.temp'; |
|
|
|
var srcCopy = ROOT_DIR + BUILD_DIR + 'pdf.worker.js.temp'; |
|
|
|
cp('pdf.js', srcCopy); |
|
|
|
cp('pdf.js', srcCopy); |
|
|
|
bundle(srcCopy, ROOT_DIR + BUILD_WORKER_TARGET, workerFiles, |
|
|
|
bundle(srcCopy, ROOT_DIR + BUILD_WORKER_TARGET, workerFiles, workerAMDName, |
|
|
|
workerFileName, false); |
|
|
|
defines, false); |
|
|
|
rm(srcCopy); |
|
|
|
rm(srcCopy); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
@ -676,6 +696,13 @@ target.minified = function() { |
|
|
|
|
|
|
|
|
|
|
|
var defines = builder.merge(DEFINES, {GENERIC: true, MINIFIED: true}); |
|
|
|
var defines = builder.merge(DEFINES, {GENERIC: true, MINIFIED: true}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TMP_VIEWER = MINIFIED_DIR + '/web/viewer.js.tmp'; |
|
|
|
|
|
|
|
cd('web/'); |
|
|
|
|
|
|
|
var viewerBundleFiles = ['app.js']; |
|
|
|
|
|
|
|
bundle('viewer.js', ROOT_DIR + TMP_VIEWER, viewerBundleFiles, |
|
|
|
|
|
|
|
'pdfjs-dist/web/viewer', defines, true); |
|
|
|
|
|
|
|
cd(ROOT_DIR); |
|
|
|
|
|
|
|
|
|
|
|
var setup = { |
|
|
|
var setup = { |
|
|
|
defines: defines, |
|
|
|
defines: defines, |
|
|
|
copy: [ |
|
|
|
copy: [ |
|
|
@ -686,6 +713,7 @@ target.minified = function() { |
|
|
|
], |
|
|
|
], |
|
|
|
preprocess: [ |
|
|
|
preprocess: [ |
|
|
|
[BUILD_TARGETS, MINIFIED_DIR + BUILD_DIR], |
|
|
|
[BUILD_TARGETS, MINIFIED_DIR + BUILD_DIR], |
|
|
|
|
|
|
|
[TMP_VIEWER, MINIFIED_DIR + '/web/viewer.js'], |
|
|
|
[COMMON_WEB_FILES_PREPROCESS, MINIFIED_DIR + '/web'] |
|
|
|
[COMMON_WEB_FILES_PREPROCESS, MINIFIED_DIR + '/web'] |
|
|
|
], |
|
|
|
], |
|
|
|
preprocessCSS: [ |
|
|
|
preprocessCSS: [ |
|
|
@ -696,6 +724,7 @@ target.minified = function() { |
|
|
|
builder.build(setup); |
|
|
|
builder.build(setup); |
|
|
|
|
|
|
|
|
|
|
|
cleanupCSSSource(MINIFIED_DIR + '/web/viewer.css'); |
|
|
|
cleanupCSSSource(MINIFIED_DIR + '/web/viewer.css'); |
|
|
|
|
|
|
|
rm(TMP_VIEWER); |
|
|
|
|
|
|
|
|
|
|
|
var viewerFiles = [ |
|
|
|
var viewerFiles = [ |
|
|
|
'web/compatibility.js', |
|
|
|
'web/compatibility.js', |
|
|
@ -762,6 +791,9 @@ target.buildnumber = function() { |
|
|
|
echo('Extension build number: ' + BUILD_NUMBER); |
|
|
|
echo('Extension build number: ' + BUILD_NUMBER); |
|
|
|
|
|
|
|
|
|
|
|
VERSION = config.versionPrefix + BUILD_NUMBER; |
|
|
|
VERSION = config.versionPrefix + BUILD_NUMBER; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BUILD_COMMIT = exec('git log --format="%h" -n 1', {silent: true}). |
|
|
|
|
|
|
|
output.replace('\n', ''); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
@ -819,6 +851,14 @@ target.firefox = function() { |
|
|
|
cp('-R', FIREFOX_EXTENSION_FILES_TO_COPY, ROOT_DIR + FIREFOX_BUILD_DIR); |
|
|
|
cp('-R', FIREFOX_EXTENSION_FILES_TO_COPY, ROOT_DIR + FIREFOX_BUILD_DIR); |
|
|
|
cd(ROOT_DIR); |
|
|
|
cd(ROOT_DIR); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TMP_VIEWER = FIREFOX_BUILD_CONTENT_DIR + '/web/viewer.js.tmp'; |
|
|
|
|
|
|
|
cd('web/'); |
|
|
|
|
|
|
|
var viewerBundleFiles = ['app.js', 'firefoxcom.js']; |
|
|
|
|
|
|
|
bundle('viewer.js', ROOT_DIR + TMP_VIEWER, viewerBundleFiles, |
|
|
|
|
|
|
|
'pdfjs-dist/web/viewer', defines, true); |
|
|
|
|
|
|
|
cd(ROOT_DIR); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var setup = { |
|
|
|
var setup = { |
|
|
|
defines: defines, |
|
|
|
defines: defines, |
|
|
|
copy: [ |
|
|
|
copy: [ |
|
|
@ -829,6 +869,7 @@ target.firefox = function() { |
|
|
|
FIREFOX_BUILD_CONTENT_DIR + '/web'] |
|
|
|
FIREFOX_BUILD_CONTENT_DIR + '/web'] |
|
|
|
], |
|
|
|
], |
|
|
|
preprocess: [ |
|
|
|
preprocess: [ |
|
|
|
|
|
|
|
[TMP_VIEWER, FIREFOX_BUILD_CONTENT_DIR + '/web/viewer.js'], |
|
|
|
[COMMON_WEB_FILES_PREPROCESS, FIREFOX_BUILD_CONTENT_DIR + '/web'], |
|
|
|
[COMMON_WEB_FILES_PREPROCESS, FIREFOX_BUILD_CONTENT_DIR + '/web'], |
|
|
|
[BUILD_TARGETS, FIREFOX_BUILD_CONTENT_DIR + BUILD_DIR], |
|
|
|
[BUILD_TARGETS, FIREFOX_BUILD_CONTENT_DIR + BUILD_DIR], |
|
|
|
[COMMON_FIREFOX_FILES_PREPROCESS, FIREFOX_BUILD_CONTENT_DIR], |
|
|
|
[COMMON_FIREFOX_FILES_PREPROCESS, FIREFOX_BUILD_CONTENT_DIR], |
|
|
@ -846,6 +887,7 @@ target.firefox = function() { |
|
|
|
cleanupJSSource(FIREFOX_BUILD_DIR + 'bootstrap.js'); |
|
|
|
cleanupJSSource(FIREFOX_BUILD_DIR + 'bootstrap.js'); |
|
|
|
cleanupJSSource(FIREFOX_BUILD_CONTENT_DIR + 'PdfjsChromeUtils.jsm'); |
|
|
|
cleanupJSSource(FIREFOX_BUILD_CONTENT_DIR + 'PdfjsChromeUtils.jsm'); |
|
|
|
cleanupCSSSource(FIREFOX_BUILD_CONTENT_DIR + '/web/viewer.css'); |
|
|
|
cleanupCSSSource(FIREFOX_BUILD_CONTENT_DIR + '/web/viewer.css'); |
|
|
|
|
|
|
|
rm(TMP_VIEWER); |
|
|
|
|
|
|
|
|
|
|
|
// Remove '.DS_Store' and other hidden files
|
|
|
|
// Remove '.DS_Store' and other hidden files
|
|
|
|
find(FIREFOX_BUILD_DIR).forEach(function(file) { |
|
|
|
find(FIREFOX_BUILD_DIR).forEach(function(file) { |
|
|
@ -946,6 +988,13 @@ target.mozcentral = function() { |
|
|
|
ROOT_DIR + MOZCENTRAL_EXTENSION_DIR + '/chrome.manifest'); |
|
|
|
ROOT_DIR + MOZCENTRAL_EXTENSION_DIR + '/chrome.manifest'); |
|
|
|
cd(ROOT_DIR); |
|
|
|
cd(ROOT_DIR); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TMP_VIEWER = MOZCENTRAL_CONTENT_DIR + '/web/viewer.js.tmp'; |
|
|
|
|
|
|
|
cd('web/'); |
|
|
|
|
|
|
|
var viewerBundleFiles = ['app.js', 'firefoxcom.js']; |
|
|
|
|
|
|
|
bundle('viewer.js', ROOT_DIR + TMP_VIEWER, viewerBundleFiles, |
|
|
|
|
|
|
|
'pdfjs-dist/web/viewer', defines, true); |
|
|
|
|
|
|
|
cd(ROOT_DIR); |
|
|
|
|
|
|
|
|
|
|
|
var setup = { |
|
|
|
var setup = { |
|
|
|
defines: defines, |
|
|
|
defines: defines, |
|
|
|
copy: [ |
|
|
|
copy: [ |
|
|
@ -954,6 +1003,7 @@ target.mozcentral = function() { |
|
|
|
['extensions/firefox/tools/l10n.js', MOZCENTRAL_CONTENT_DIR + '/web'] |
|
|
|
['extensions/firefox/tools/l10n.js', MOZCENTRAL_CONTENT_DIR + '/web'] |
|
|
|
], |
|
|
|
], |
|
|
|
preprocess: [ |
|
|
|
preprocess: [ |
|
|
|
|
|
|
|
[TMP_VIEWER, MOZCENTRAL_CONTENT_DIR + '/web/viewer.js'], |
|
|
|
[COMMON_WEB_FILES_PREPROCESS, MOZCENTRAL_CONTENT_DIR + '/web'], |
|
|
|
[COMMON_WEB_FILES_PREPROCESS, MOZCENTRAL_CONTENT_DIR + '/web'], |
|
|
|
[FIREFOX_CONTENT_DIR + 'pdfjschildbootstrap.js', MOZCENTRAL_CONTENT_DIR], |
|
|
|
[FIREFOX_CONTENT_DIR + 'pdfjschildbootstrap.js', MOZCENTRAL_CONTENT_DIR], |
|
|
|
[BUILD_TARGETS, MOZCENTRAL_CONTENT_DIR + BUILD_DIR], |
|
|
|
[BUILD_TARGETS, MOZCENTRAL_CONTENT_DIR + BUILD_DIR], |
|
|
@ -973,6 +1023,7 @@ target.mozcentral = function() { |
|
|
|
cleanupJSSource(MOZCENTRAL_CONTENT_DIR + '/PdfJs.jsm'); |
|
|
|
cleanupJSSource(MOZCENTRAL_CONTENT_DIR + '/PdfJs.jsm'); |
|
|
|
cleanupJSSource(MOZCENTRAL_CONTENT_DIR + '/PdfjsChromeUtils.jsm'); |
|
|
|
cleanupJSSource(MOZCENTRAL_CONTENT_DIR + '/PdfjsChromeUtils.jsm'); |
|
|
|
cleanupCSSSource(MOZCENTRAL_CONTENT_DIR + '/web/viewer.css'); |
|
|
|
cleanupCSSSource(MOZCENTRAL_CONTENT_DIR + '/web/viewer.css'); |
|
|
|
|
|
|
|
rm(TMP_VIEWER); |
|
|
|
|
|
|
|
|
|
|
|
// Remove '.DS_Store' and other hidden files
|
|
|
|
// Remove '.DS_Store' and other hidden files
|
|
|
|
find(MOZCENTRAL_DIR).forEach(function(file) { |
|
|
|
find(MOZCENTRAL_DIR).forEach(function(file) { |
|
|
@ -1078,6 +1129,13 @@ target.chromium = function() { |
|
|
|
mkdir('-p', CHROME_BUILD_CONTENT_DIR + BUILD_DIR); |
|
|
|
mkdir('-p', CHROME_BUILD_CONTENT_DIR + BUILD_DIR); |
|
|
|
mkdir('-p', CHROME_BUILD_CONTENT_DIR + '/web'); |
|
|
|
mkdir('-p', CHROME_BUILD_CONTENT_DIR + '/web'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var TMP_VIEWER = CHROME_BUILD_CONTENT_DIR + '/web/viewer.js.tmp'; |
|
|
|
|
|
|
|
cd('web/'); |
|
|
|
|
|
|
|
var viewerBundleFiles = ['app.js', 'chromecom.js']; |
|
|
|
|
|
|
|
bundle('viewer.js', ROOT_DIR + TMP_VIEWER, viewerBundleFiles, |
|
|
|
|
|
|
|
'pdfjs-dist/web/viewer', defines, true); |
|
|
|
|
|
|
|
cd(ROOT_DIR); |
|
|
|
|
|
|
|
|
|
|
|
var setup = { |
|
|
|
var setup = { |
|
|
|
defines: defines, |
|
|
|
defines: defines, |
|
|
|
copy: [ |
|
|
|
copy: [ |
|
|
@ -1096,6 +1154,7 @@ target.chromium = function() { |
|
|
|
], |
|
|
|
], |
|
|
|
preprocess: [ |
|
|
|
preprocess: [ |
|
|
|
[BUILD_TARGETS, CHROME_BUILD_CONTENT_DIR + BUILD_DIR], |
|
|
|
[BUILD_TARGETS, CHROME_BUILD_CONTENT_DIR + BUILD_DIR], |
|
|
|
|
|
|
|
[TMP_VIEWER, CHROME_BUILD_CONTENT_DIR + '/web/viewer.js'], |
|
|
|
[COMMON_WEB_FILES_PREPROCESS, CHROME_BUILD_CONTENT_DIR + '/web'] |
|
|
|
[COMMON_WEB_FILES_PREPROCESS, CHROME_BUILD_CONTENT_DIR + '/web'] |
|
|
|
], |
|
|
|
], |
|
|
|
preprocessCSS: [ |
|
|
|
preprocessCSS: [ |
|
|
@ -1107,6 +1166,7 @@ target.chromium = function() { |
|
|
|
|
|
|
|
|
|
|
|
cleanupJSSource(CHROME_BUILD_CONTENT_DIR + '/web/viewer.js'); |
|
|
|
cleanupJSSource(CHROME_BUILD_CONTENT_DIR + '/web/viewer.js'); |
|
|
|
cleanupCSSSource(CHROME_BUILD_CONTENT_DIR + '/web/viewer.css'); |
|
|
|
cleanupCSSSource(CHROME_BUILD_CONTENT_DIR + '/web/viewer.css'); |
|
|
|
|
|
|
|
rm(TMP_VIEWER); |
|
|
|
|
|
|
|
|
|
|
|
// Update the build version number
|
|
|
|
// Update the build version number
|
|
|
|
sed('-i', /PDFJSSCRIPT_VERSION/, VERSION, |
|
|
|
sed('-i', /PDFJSSCRIPT_VERSION/, VERSION, |
|
|
@ -1508,7 +1568,7 @@ target.lint = function() { |
|
|
|
echo(); |
|
|
|
echo(); |
|
|
|
echo('### Checking UMD dependencies'); |
|
|
|
echo('### Checking UMD dependencies'); |
|
|
|
var umd = require('./external/umdutils/verifier.js'); |
|
|
|
var umd = require('./external/umdutils/verifier.js'); |
|
|
|
if (!umd.validateFiles({'pdfjs': './src'})) { |
|
|
|
if (!umd.validateFiles({'pdfjs': './src', 'pdfjs-web': './web'})) { |
|
|
|
exit(1); |
|
|
|
exit(1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|