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;
|
||||
}
|
||||
var writeLine = typeof outFilename === 'function' ? outFilename : function(line) {
|
||||
var writeLine = typeof outFilename === 'function' ? outFilename :
|
||||
function(line) {
|
||||
out += line + '\n';
|
||||
}
|
||||
function include(file) {
|
||||
@ -47,7 +48,8 @@ function preprocess(inFilename, outFilename, defines) {
|
||||
}
|
||||
|
||||
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;
|
||||
while ((s = readLine()) !== null) {
|
||||
++lineNumber;
|
||||
@ -82,8 +84,8 @@ function preprocess(inFilename, outFilename, defines) {
|
||||
} else {
|
||||
if (state === 0) {
|
||||
writeLine(s);
|
||||
} else if(state === 3) {
|
||||
writeLine(s.replace(/^\/\/|^<!--|-->/g, " "));
|
||||
} else if (state === 3) {
|
||||
writeLine(s.replace(/^\/\/|^<!--|-->/g, ' '));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -96,11 +98,11 @@ exports.preprocess = preprocess;
|
||||
|
||||
/**
|
||||
* Simplifies common build steps.
|
||||
* @param setup
|
||||
* @param {object} setup
|
||||
* .defines defines for preprocessors
|
||||
* .copy array of arrays of source and destination pairs of files to copy
|
||||
* .preprocess array of arrays of source and destination pairs of files
|
||||
* run through preprocessor
|
||||
* run through preprocessor.
|
||||
*/
|
||||
function build(setup) {
|
||||
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
|
||||
require('./external/shelljs/make');
|
||||
var builder = require('./external/builder/builder.js');
|
||||
var crlfchecker = require('./external/crlfchecker/crlfchecker.js');
|
||||
|
||||
var ROOT_DIR = __dirname + '/', // absolute path to project's root
|
||||
BUILD_DIR = 'build/',
|
||||
@ -218,6 +219,8 @@ target.bundle = function() {
|
||||
bundleVersion = exec('git log --format="%h" -n 1',
|
||||
{silent: true}).output.replace('\n', '');
|
||||
|
||||
crlfchecker.checkIfCrlfIsPresent(SRC_FILES);
|
||||
|
||||
// This just preprocesses the empty pdf.js file, we don't actually want to
|
||||
// preprocess everything yet since other build targets use this file.
|
||||
builder.preprocess('pdf.js', ROOT_DIR + BUILD_TARGET,
|
||||
@ -673,15 +676,17 @@ target.lint = function() {
|
||||
echo();
|
||||
echo('### Linting JS files (this can take a while!)');
|
||||
|
||||
var LINT_FILES = 'src/*.js \
|
||||
web/*.js \
|
||||
test/*.js \
|
||||
test/unit/*.js \
|
||||
extensions/firefox/*.js \
|
||||
extensions/firefox/components/*.js \
|
||||
extensions/chrome/*.js';
|
||||
var LINT_FILES = ['src/*.js',
|
||||
'web/*.js',
|
||||
'test/*.js',
|
||||
'test/unit/*.js',
|
||||
'extensions/firefox/*.js',
|
||||
'extensions/firefox/components/*.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);
|
||||
};
|
||||
|
||||
|
@ -4100,7 +4100,7 @@ Type1Font.prototype = {
|
||||
// charstring changes size - can't cache .length in loop
|
||||
for (var i = 0; i < charstring.length; i++) {
|
||||
var command = charstring[i];
|
||||
if (command.charAt) {
|
||||
if (typeof command === 'string') {
|
||||
var cmd = map[command];
|
||||
assert(cmd, 'Unknow command: ' + command);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user