Merge pull request #2014 from kkujala/master
Correct gjslint warnings in make.js.
This commit is contained in:
commit
8ec1476bd6
105
make.js
105
make.js
@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
require('./external/shelljs/make');
|
||||
var builder = require('./external/builder/builder.js');
|
||||
var crlfchecker = require('./external/crlfchecker/crlfchecker.js');
|
||||
@ -92,8 +91,9 @@ target.generic = function() {
|
||||
|
||||
//
|
||||
// make web
|
||||
// Generates the website for the project, by checking out the gh-pages branch underneath
|
||||
// the build directory, and then moving the various viewer files into place.
|
||||
// Generates the website for the project, by checking out the gh-pages branch
|
||||
// underneath the build directory, and then moving the various viewer files
|
||||
// into place.
|
||||
//
|
||||
target.web = function() {
|
||||
target.generic();
|
||||
@ -113,9 +113,9 @@ target.web = function() {
|
||||
exec('git add -A');
|
||||
|
||||
echo();
|
||||
echo("Website built in " + GH_PAGES_DIR);
|
||||
echo("Don't forget to cd into " + GH_PAGES_DIR +
|
||||
" and issue 'git commit' to push changes.");
|
||||
echo('Website built in ' + GH_PAGES_DIR);
|
||||
echo('Don\'t forget to cd into ' + GH_PAGES_DIR +
|
||||
' and issue \'git commit\' to push changes.');
|
||||
};
|
||||
|
||||
//
|
||||
@ -153,7 +153,8 @@ target.locale = function() {
|
||||
}
|
||||
|
||||
mkdir('-p', EXTENSION_LOCALE_OUTPUT + '/' + locale);
|
||||
chromeManifestContent += 'locale pdf.js ' + locale + ' locale/' + locale + '/\n';
|
||||
chromeManifestContent += 'locale pdf.js ' + locale + ' locale/' +
|
||||
locale + '/\n';
|
||||
|
||||
if (test('-f', path + '/viewer.properties')) {
|
||||
var properties = cat(path + '/viewer.properties');
|
||||
@ -231,9 +232,10 @@ target.bundle = function() {
|
||||
//
|
||||
// make pagesrepo
|
||||
//
|
||||
// This target clones the gh-pages repo into the build directory. It deletes the current contents
|
||||
// of the repo, since we overwrite everything with data from the master repo. The 'make web' target
|
||||
// then uses 'git add -A' to track additions, modifications, moves, and deletions.
|
||||
// This target clones the gh-pages repo into the build directory. It deletes
|
||||
// the current contents of the repo, since we overwrite everything with data
|
||||
// from the master repo. The 'make web' target then uses 'git add -A' to track
|
||||
// additions, modifications, moves, and deletions.
|
||||
target.pagesrepo = function() {
|
||||
cd(ROOT_DIR);
|
||||
echo();
|
||||
@ -342,7 +344,8 @@ target.firefox = function() {
|
||||
mkdir('-p', FIREFOX_BUILD_CONTENT_DIR + BUILD_DIR);
|
||||
mkdir('-p', FIREFOX_BUILD_CONTENT_DIR + '/web');
|
||||
|
||||
cp(FIREFOX_CONTENT_DIR + 'PdfJs-stub.jsm', FIREFOX_BUILD_CONTENT_DIR + 'PdfJs.jsm');
|
||||
cp(FIREFOX_CONTENT_DIR + 'PdfJs-stub.jsm',
|
||||
FIREFOX_BUILD_CONTENT_DIR + 'PdfJs.jsm');
|
||||
|
||||
// Copy extension files
|
||||
cd('extensions/firefox');
|
||||
@ -368,29 +371,38 @@ target.firefox = function() {
|
||||
});
|
||||
|
||||
// Update the build version number
|
||||
sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION, FIREFOX_BUILD_DIR + '/install.rdf');
|
||||
sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION, FIREFOX_BUILD_DIR + '/update.rdf');
|
||||
sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION,
|
||||
FIREFOX_BUILD_DIR + '/install.rdf');
|
||||
sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION,
|
||||
FIREFOX_BUILD_DIR + '/update.rdf');
|
||||
|
||||
sed('-i', /PDFJSSCRIPT_STREAM_CONVERTER_ID/, FIREFOX_STREAM_CONVERTER_ID, FIREFOX_BUILD_DIR + 'components/PdfStreamConverter.js');
|
||||
sed('-i', /PDFJSSCRIPT_PREF_PREFIX/, FIREFOX_PREF_PREFIX, FIREFOX_BUILD_DIR + 'components/PdfStreamConverter.js');
|
||||
sed('-i', /PDFJSSCRIPT_MOZ_CENTRAL/, 'false', FIREFOX_BUILD_DIR + 'components/PdfStreamConverter.js');
|
||||
sed('-i', /PDFJSSCRIPT_STREAM_CONVERTER_ID/, FIREFOX_STREAM_CONVERTER_ID,
|
||||
FIREFOX_BUILD_DIR + 'components/PdfStreamConverter.js');
|
||||
sed('-i', /PDFJSSCRIPT_PREF_PREFIX/, FIREFOX_PREF_PREFIX,
|
||||
FIREFOX_BUILD_DIR + 'components/PdfStreamConverter.js');
|
||||
sed('-i', /PDFJSSCRIPT_MOZ_CENTRAL/, 'false',
|
||||
FIREFOX_BUILD_DIR + 'components/PdfStreamConverter.js');
|
||||
|
||||
// Update localized metadata
|
||||
var localizedMetadata = cat(EXTENSION_SRC_DIR + '/firefox/metadata.inc');
|
||||
sed('-i', /.*PDFJS_LOCALIZED_METADATA.*\n/, localizedMetadata, FIREFOX_BUILD_DIR + '/install.rdf');
|
||||
sed('-i', /.*PDFJS_LOCALIZED_METADATA.*\n/, localizedMetadata,
|
||||
FIREFOX_BUILD_DIR + '/install.rdf');
|
||||
var chromeManifest = cat(EXTENSION_SRC_DIR + '/firefox/chrome.manifest.inc');
|
||||
sed('-i', /.*PDFJS_SUPPORTED_LOCALES.*\n/, chromeManifest, FIREFOX_BUILD_DIR + '/chrome.manifest');
|
||||
sed('-i', /.*PDFJS_SUPPORTED_LOCALES.*\n/, chromeManifest,
|
||||
FIREFOX_BUILD_DIR + '/chrome.manifest');
|
||||
|
||||
// Create the xpi
|
||||
cd(FIREFOX_BUILD_DIR);
|
||||
exec('zip -r ' + FIREFOX_EXTENSION_NAME + ' ' + FIREFOX_EXTENSION_FILES.join(' '));
|
||||
exec('zip -r ' + FIREFOX_EXTENSION_NAME + ' ' +
|
||||
FIREFOX_EXTENSION_FILES.join(' '));
|
||||
echo('extension created: ' + FIREFOX_EXTENSION_NAME);
|
||||
cd(ROOT_DIR);
|
||||
|
||||
// Build the amo extension too (remove the updateUrl)
|
||||
cd(FIREFOX_BUILD_DIR);
|
||||
sed('-i', /.*updateURL.*\n/, '', 'install.rdf');
|
||||
exec('zip -r ' + FIREFOX_AMO_EXTENSION_NAME + ' ' + FIREFOX_EXTENSION_FILES.join(' '));
|
||||
exec('zip -r ' + FIREFOX_AMO_EXTENSION_NAME + ' ' +
|
||||
FIREFOX_EXTENSION_FILES.join(' '));
|
||||
echo('AMO extension created: ' + FIREFOX_AMO_EXTENSION_NAME);
|
||||
cd(ROOT_DIR);
|
||||
};
|
||||
@ -438,13 +450,14 @@ target.mozcentral = function() {
|
||||
mkdir('-p', MOZCENTRAL_CONTENT_DIR + BUILD_DIR);
|
||||
mkdir('-p', MOZCENTRAL_CONTENT_DIR + '/web');
|
||||
|
||||
cp(FIREFOX_CONTENT_DIR + 'PdfJs.jsm', MOZCENTRAL_CONTENT_DIR)
|
||||
cp(FIREFOX_CONTENT_DIR + 'PdfJs.jsm', MOZCENTRAL_CONTENT_DIR);
|
||||
|
||||
// Copy extension files
|
||||
cd('extensions/firefox');
|
||||
cp('-R', FIREFOX_EXTENSION_FILES_TO_COPY, ROOT_DIR + MOZCENTRAL_EXTENSION_DIR);
|
||||
cp('-R', FIREFOX_EXTENSION_FILES_TO_COPY,
|
||||
ROOT_DIR + MOZCENTRAL_EXTENSION_DIR);
|
||||
mv('-f', ROOT_DIR + MOZCENTRAL_EXTENSION_DIR + '/chrome-mozcentral.manifest',
|
||||
ROOT_DIR + MOZCENTRAL_EXTENSION_DIR + '/chrome.manifest')
|
||||
ROOT_DIR + MOZCENTRAL_EXTENSION_DIR + '/chrome.manifest');
|
||||
cd(ROOT_DIR);
|
||||
|
||||
var setup = {
|
||||
@ -469,18 +482,22 @@ target.mozcentral = function() {
|
||||
cp(DEFAULT_LOCALE_FILES, MOZCENTRAL_L10N_DIR);
|
||||
|
||||
// Update the build version number
|
||||
sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION, MOZCENTRAL_EXTENSION_DIR + 'README.mozilla');
|
||||
sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION,
|
||||
MOZCENTRAL_EXTENSION_DIR + 'README.mozilla');
|
||||
|
||||
sed('-i', /PDFJSSCRIPT_STREAM_CONVERTER_ID/, MOZCENTRAL_STREAM_CONVERTER_ID, MOZCENTRAL_EXTENSION_DIR + 'components/PdfStreamConverter.js');
|
||||
sed('-i', /PDFJSSCRIPT_PREF_PREFIX/, MOZCENTRAL_PREF_PREFIX, MOZCENTRAL_EXTENSION_DIR + 'components/PdfStreamConverter.js');
|
||||
sed('-i', /PDFJSSCRIPT_MOZ_CENTRAL/, 'true', MOZCENTRAL_EXTENSION_DIR + 'components/PdfStreamConverter.js');
|
||||
sed('-i', /PDFJSSCRIPT_STREAM_CONVERTER_ID/, MOZCENTRAL_STREAM_CONVERTER_ID,
|
||||
MOZCENTRAL_EXTENSION_DIR + 'components/PdfStreamConverter.js');
|
||||
sed('-i', /PDFJSSCRIPT_PREF_PREFIX/, MOZCENTRAL_PREF_PREFIX,
|
||||
MOZCENTRAL_EXTENSION_DIR + 'components/PdfStreamConverter.js');
|
||||
sed('-i', /PDFJSSCRIPT_MOZ_CENTRAL/, 'true',
|
||||
MOZCENTRAL_EXTENSION_DIR + 'components/PdfStreamConverter.js');
|
||||
|
||||
// List all files for mozilla-central
|
||||
cd(MOZCENTRAL_EXTENSION_DIR);
|
||||
var extensionFiles = '';
|
||||
find(FIREFOX_MC_EXTENSION_FILES).forEach(function(file){
|
||||
find(FIREFOX_MC_EXTENSION_FILES).forEach(function(file) {
|
||||
if (test('-f', file))
|
||||
extensionFiles += file+'\n';
|
||||
extensionFiles += file + '\n';
|
||||
});
|
||||
extensionFiles.to('extension-files');
|
||||
cd(ROOT_DIR);
|
||||
@ -546,7 +563,8 @@ target.chrome = function() {
|
||||
defines: defines,
|
||||
copy: [
|
||||
[COMMON_WEB_FILES, CHROME_BUILD_CONTENT_DIR + '/web'],
|
||||
[['extensions/chrome/*.json', 'extensions/chrome/*.html'], CHROME_BUILD_DIR],
|
||||
[['extensions/chrome/*.json', 'extensions/chrome/*.html'],
|
||||
CHROME_BUILD_DIR],
|
||||
[BUILD_TARGET, CHROME_BUILD_CONTENT_DIR + BUILD_TARGET],
|
||||
['external/webL10n/l10n.js', CHROME_BUILD_CONTENT_DIR + '/web']
|
||||
],
|
||||
@ -592,19 +610,20 @@ target.browsertest = function(options) {
|
||||
echo('### Running browser tests');
|
||||
|
||||
var PDF_TEST = env['PDF_TEST'] || 'test_manifest.json',
|
||||
PDF_BROWSERS = env['PDF_BROWSERS'] || 'resources/browser_manifests/browser_manifest.json';
|
||||
PDF_BROWSERS = env['PDF_BROWSERS'] ||
|
||||
'resources/browser_manifests/browser_manifest.json';
|
||||
|
||||
if (!test('-f', 'test/' + PDF_BROWSERS)) {
|
||||
echo('Browser manifest file test/' + PDF_BROWSERS + ' does not exist.');
|
||||
echo('Try copying one of the examples in test/resources/browser_manifests/');
|
||||
echo('Copy one of the examples in test/resources/browser_manifests/');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
var reftest = (options && options.noreftest) ? '' : '--reftest';
|
||||
|
||||
cd('test');
|
||||
exec(PYTHON_BIN + ' -u test.py '+reftest+' --browserManifestFile=' + PDF_BROWSERS +
|
||||
' --manifestFile=' + PDF_TEST, {async: true});
|
||||
exec(PYTHON_BIN + ' -u test.py ' + reftest + ' --browserManifestFile=' +
|
||||
PDF_BROWSERS + ' --manifestFile=' + PDF_TEST, {async: true});
|
||||
};
|
||||
|
||||
//
|
||||
@ -615,17 +634,18 @@ target.unittest = function(options, callback) {
|
||||
echo();
|
||||
echo('### Running unit tests');
|
||||
|
||||
var PDF_BROWSERS = env['PDF_BROWSERS'] || 'resources/browser_manifests/browser_manifest.json';
|
||||
var PDF_BROWSERS = env['PDF_BROWSERS'] ||
|
||||
'resources/browser_manifests/browser_manifest.json';
|
||||
|
||||
if (!test('-f', 'test/' + PDF_BROWSERS)) {
|
||||
echo('Browser manifest file test/' + PDF_BROWSERS + ' does not exist.');
|
||||
echo('Try copying one of the examples in test/resources/browser_manifests/');
|
||||
echo('Copy one of the examples in test/resources/browser_manifests/');
|
||||
exit(1);
|
||||
}
|
||||
callback = callback || function() {};
|
||||
cd('test');
|
||||
exec(PYTHON_BIN + ' -u test.py --unitTest --browserManifestFile=' + PDF_BROWSERS,
|
||||
{async: true}, callback);
|
||||
exec(PYTHON_BIN + ' -u test.py --unitTest --browserManifestFile=' +
|
||||
PDF_BROWSERS, {async: true}, callback);
|
||||
};
|
||||
|
||||
//
|
||||
@ -637,17 +657,18 @@ target.botmakeref = function() {
|
||||
echo('### Creating reference images');
|
||||
|
||||
var PDF_TEST = env['PDF_TEST'] || 'test_manifest.json',
|
||||
PDF_BROWSERS = env['PDF_BROWSERS'] || 'resources/browser_manifests/browser_manifest.json';
|
||||
PDF_BROWSERS = env['PDF_BROWSERS'] ||
|
||||
'resources/browser_manifests/browser_manifest.json';
|
||||
|
||||
if (!test('-f', 'test/' + PDF_BROWSERS)) {
|
||||
echo('Browser manifest file test/' + PDF_BROWSERS + ' does not exist.');
|
||||
echo('Try copying one of the examples in test/resources/browser_manifests/');
|
||||
echo('Copy one of the examples in test/resources/browser_manifests/');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
cd('test');
|
||||
exec(PYTHON_BIN + ' -u test.py --masterMode --noPrompts --browserManifestFile=' + PDF_BROWSERS,
|
||||
{async: true});
|
||||
exec(PYTHON_BIN + ' -u test.py --masterMode --noPrompts ' +
|
||||
'--browserManifestFile=' + PDF_BROWSERS, {async: true});
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user