Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
3022f36cfe
14
external/builder/builder.js
vendored
14
external/builder/builder.js
vendored
@ -27,7 +27,8 @@ function preprocess(inFilename, outFilename, defines) {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var writeLine = typeof outFilename === 'function' ? outFilename : function(line) {
|
var writeLine = typeof outFilename === 'function' ? outFilename :
|
||||||
|
function(line) {
|
||||||
out += line + '\n';
|
out += line + '\n';
|
||||||
}
|
}
|
||||||
function include(file) {
|
function include(file) {
|
||||||
@ -47,7 +48,8 @@ function preprocess(inFilename, outFilename, defines) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var s, state = 0, stack = [];
|
var s, state = 0, stack = [];
|
||||||
var control = /^(?:\/\/|<!--)\s*#(if|else|endif|expand|include)(?:\s+(.*?)(?:-->)?$)?/;
|
var control =
|
||||||
|
/^(?:\/\/|<!--)\s*#(if|else|endif|expand|include)(?:\s+(.*?)(?:-->)?$)?/;
|
||||||
var lineNumber = 0;
|
var lineNumber = 0;
|
||||||
while ((s = readLine()) !== null) {
|
while ((s = readLine()) !== null) {
|
||||||
++lineNumber;
|
++lineNumber;
|
||||||
@ -82,8 +84,8 @@ function preprocess(inFilename, outFilename, defines) {
|
|||||||
} else {
|
} else {
|
||||||
if (state === 0) {
|
if (state === 0) {
|
||||||
writeLine(s);
|
writeLine(s);
|
||||||
} else if(state === 3) {
|
} else if (state === 3) {
|
||||||
writeLine(s.replace(/^\/\/|^<!--|-->/g, " "));
|
writeLine(s.replace(/^\/\/|^<!--|-->/g, ' '));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,11 +98,11 @@ exports.preprocess = preprocess;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Simplifies common build steps.
|
* Simplifies common build steps.
|
||||||
* @param setup
|
* @param {object} setup
|
||||||
* .defines defines for preprocessors
|
* .defines defines for preprocessors
|
||||||
* .copy array of arrays of source and destination pairs of files to copy
|
* .copy array of arrays of source and destination pairs of files to copy
|
||||||
* .preprocess array of arrays of source and destination pairs of files
|
* .preprocess array of arrays of source and destination pairs of files
|
||||||
* run through preprocessor
|
* run through preprocessor.
|
||||||
*/
|
*/
|
||||||
function build(setup) {
|
function build(setup) {
|
||||||
var defines = setup.defines;
|
var defines = setup.defines;
|
||||||
|
25
external/crlfchecker/crlfchecker.js
vendored
Normal file
25
external/crlfchecker/crlfchecker.js
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||||
|
|
||||||
|
function checkIfCrlfIsPresent(files) {
|
||||||
|
var failed = [];
|
||||||
|
|
||||||
|
(ls(files)).forEach(function checkCrlf(file) {
|
||||||
|
if ((cat(file)).match(/.*\r.*/)) {
|
||||||
|
failed.push(file);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (failed.length) {
|
||||||
|
var errorMessage =
|
||||||
|
'Please remove carriage return\'s from\n' + failed.join('\n') + '\n' +
|
||||||
|
'Also check your setting for: git config core.autocrlf.';
|
||||||
|
|
||||||
|
echo();
|
||||||
|
echo(errorMessage);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.checkIfCrlfIsPresent = checkIfCrlfIsPresent;
|
||||||
|
|
22
make.js
22
make.js
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
require('./external/shelljs/make');
|
require('./external/shelljs/make');
|
||||||
var builder = require('./external/builder/builder.js');
|
var builder = require('./external/builder/builder.js');
|
||||||
|
var crlfchecker = require('./external/crlfchecker/crlfchecker.js');
|
||||||
|
|
||||||
var ROOT_DIR = __dirname + '/', // absolute path to project's root
|
var ROOT_DIR = __dirname + '/', // absolute path to project's root
|
||||||
BUILD_DIR = 'build/',
|
BUILD_DIR = 'build/',
|
||||||
@ -218,6 +219,8 @@ target.bundle = function() {
|
|||||||
bundleVersion = exec('git log --format="%h" -n 1',
|
bundleVersion = exec('git log --format="%h" -n 1',
|
||||||
{silent: true}).output.replace('\n', '');
|
{silent: true}).output.replace('\n', '');
|
||||||
|
|
||||||
|
crlfchecker.checkIfCrlfIsPresent(SRC_FILES);
|
||||||
|
|
||||||
// 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('pdf.js', ROOT_DIR + BUILD_TARGET,
|
builder.preprocess('pdf.js', ROOT_DIR + BUILD_TARGET,
|
||||||
@ -673,15 +676,17 @@ target.lint = function() {
|
|||||||
echo();
|
echo();
|
||||||
echo('### Linting JS files (this can take a while!)');
|
echo('### Linting JS files (this can take a while!)');
|
||||||
|
|
||||||
var LINT_FILES = 'src/*.js \
|
var LINT_FILES = ['src/*.js',
|
||||||
web/*.js \
|
'web/*.js',
|
||||||
test/*.js \
|
'test/*.js',
|
||||||
test/unit/*.js \
|
'test/unit/*.js',
|
||||||
extensions/firefox/*.js \
|
'extensions/firefox/*.js',
|
||||||
extensions/firefox/components/*.js \
|
'extensions/firefox/components/*.js',
|
||||||
extensions/chrome/*.js';
|
'extensions/chrome/*.js'];
|
||||||
|
|
||||||
exec('gjslint --nojsdoc ' + LINT_FILES);
|
exec('gjslint --nojsdoc ' + LINT_FILES.join(' '));
|
||||||
|
|
||||||
|
crlfchecker.checkIfCrlfIsPresent(LINT_FILES);
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -694,3 +699,4 @@ target.clean = function() {
|
|||||||
|
|
||||||
rm('-rf', BUILD_DIR);
|
rm('-rf', BUILD_DIR);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4100,7 +4100,7 @@ Type1Font.prototype = {
|
|||||||
// charstring changes size - can't cache .length in loop
|
// charstring changes size - can't cache .length in loop
|
||||||
for (var i = 0; i < charstring.length; i++) {
|
for (var i = 0; i < charstring.length; i++) {
|
||||||
var command = charstring[i];
|
var command = charstring[i];
|
||||||
if (command.charAt) {
|
if (typeof command === 'string') {
|
||||||
var cmd = map[command];
|
var cmd = map[command];
|
||||||
assert(cmd, 'Unknow command: ' + command);
|
assert(cmd, 'Unknow command: ' + command);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user