Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 1341 lines (1138 sloc) 39.124 kb
0e948f1 Kalervo Kujala Add mode setting and strict to make.js
kkujala authored
1 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
5cf0d8f Yury Delendik Enforces maxlen for jshint
yurydelendik authored
3 /* Copyright 2012 Mozilla Foundation
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
c4eab85 Jon Buckley Issue #2008 - Fix lint errors for make.js
jbuck authored
17 /* jshint node:true */
5cf0d8f Yury Delendik Enforces maxlen for jshint
yurydelendik authored
18 /* globals cat, cd, cp, echo, env, exec, exit, find, ls, mkdir, mv, process, rm,
19 sed, target, test */
0e948f1 Kalervo Kujala Add mode setting and strict to make.js
kkujala authored
20
21 'use strict';
22
f6ba384 Artur Adib Using ShellJS
arturadib authored
23 require('./external/shelljs/make');
e0a6b23 Brendan Dahl Move builder/preprocessor into its own file.
brendandahl authored
24 var builder = require('./external/builder/builder.js');
2ffd3ae Kalervo Kujala Create crlfchecker module and use it in make.js.
kkujala authored
25 var crlfchecker = require('./external/crlfchecker/crlfchecker.js');
cb68adb Yury Delendik Replacing gjslint with jshint; fixing jshint for windows
yurydelendik authored
26 var path = require('path');
f6ba384 Artur Adib Using ShellJS
arturadib authored
27
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
28 var ROOT_DIR = __dirname + '/', // absolute path to project's root
f6ba384 Artur Adib Using ShellJS
arturadib authored
29 BUILD_DIR = 'build/',
ef423ef Mack Duan Implement progressive loading of PDFs
mduan authored
30 SRC_DIR = 'src/',
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
31 BUILD_TARGET = BUILD_DIR + 'pdf.js',
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
32 BUILD_WORKER_TARGET = BUILD_DIR + 'pdf.worker.js',
33 BUILD_TARGETS = [BUILD_TARGET, BUILD_WORKER_TARGET],
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
34 FIREFOX_BUILD_DIR = BUILD_DIR + '/firefox/',
4a4f570 Andreas Bovens adjusted paths in make.js to reflect chromium instead of chrome
andreasbovens authored
35 CHROME_BUILD_DIR = BUILD_DIR + '/chromium/',
c79acf5 Brendan Dahl Fix the B2G viewer and enable bot preview.
brendandahl authored
36 B2G_BUILD_DIR = BUILD_DIR + '/b2g/',
f6ba384 Artur Adib Using ShellJS
arturadib authored
37 EXTENSION_SRC_DIR = 'extensions/',
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
38 LOCALE_SRC_DIR = 'l10n/',
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
39 GH_PAGES_DIR = BUILD_DIR + 'gh-pages/',
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
40 GENERIC_DIR = BUILD_DIR + 'generic/',
2b298a7 Yury Delendik Adds make minified command
yurydelendik authored
41 MINIFIED_DIR = BUILD_DIR + 'minified/',
f6ba384 Artur Adib Using ShellJS
arturadib authored
42 REPO = 'git@github.com:mozilla/pdf.js.git',
4bee4c6 Brendan Dahl Use different id's for moz central and extension.
brendandahl authored
43 MOZCENTRAL_PREF_PREFIX = 'pdfjs',
44 FIREFOX_PREF_PREFIX = 'extensions.uriloader@pdf.js',
45 MOZCENTRAL_STREAM_CONVERTER_ID = 'd0c5195d-e798-49d4-b1d3-9324328b2291',
46 FIREFOX_STREAM_CONVERTER_ID = '6457a96b-2d68-439a-bcfa-44465fbcdbb1';
f6ba384 Artur Adib Using ShellJS
arturadib authored
47
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
48 var DEFINES = {
49 PRODUCTION: true,
50 // The main build targets:
51 GENERIC: false,
52 FIREFOX: false,
53 MOZCENTRAL: false,
54 B2G: false,
1838ec0 Greg Jordan Add a singlefile target to build one concatenated file
gjuggler authored
55 CHROME: false,
2b298a7 Yury Delendik Adds make minified command
yurydelendik authored
56 MINIFIED: false,
1838ec0 Greg Jordan Add a singlefile target to build one concatenated file
gjuggler authored
57 SINGLE_FILE: false
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
58 };
59
f6ba384 Artur Adib Using ShellJS
arturadib authored
60 //
61 // make all
62 //
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
63 target.all = function() {
f6ba384 Artur Adib Using ShellJS
arturadib authored
64 // Don't do anything by default
65 echo('Please specify a target. Available targets:');
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
66 for (var t in target) {
67 if (t !== 'all') {
68 echo(' ' + t);
69 }
70 }
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
71 };
f6ba384 Artur Adib Using ShellJS
arturadib authored
72
73
5cf0d8f Yury Delendik Enforces maxlen for jshint
yurydelendik authored
74 ////////////////////////////////////////////////////////////////////////////////
f6ba384 Artur Adib Using ShellJS
arturadib authored
75 //
76 // Production stuff
77 //
78
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
79 // Files that need to be included in every build.
2c1eae5 Brendan Dahl Remove trailing whitespace.
brendandahl authored
80 var COMMON_WEB_FILES =
2ab481a Yury Delendik Removes foreign for Firefox CSS prefixes
yurydelendik authored
81 ['web/images',
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
82 'web/debugger.js'],
83 COMMON_WEB_FILES_PREPROCESS =
84 ['web/viewer.js',
85 'web/viewer.html'];
86
87 //
88 // make generic
89 // Builds the generic production viewer that should be compatible with most
90 // modern HTML5 browsers.
91 //
92 target.generic = function() {
e1a50ed Mack Duan Fix node make extension for building chrome
mduan authored
93 target.bundle({});
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
94 target.locale();
95
96 cd(ROOT_DIR);
97 echo();
98 echo('### Creating generic viewer');
99
100 rm('-rf', GENERIC_DIR);
101 mkdir('-p', GENERIC_DIR);
102 mkdir('-p', GENERIC_DIR + BUILD_DIR);
103 mkdir('-p', GENERIC_DIR + '/web');
1d8f6cf Yury Delendik Updates make.js for cmaps and make binary cmaps by default
yurydelendik authored
104 mkdir('-p', GENERIC_DIR + '/web/cmaps');
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
105
e0a6b23 Brendan Dahl Move builder/preprocessor into its own file.
brendandahl authored
106 var defines = builder.merge(DEFINES, {GENERIC: true});
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
107
108 var setup = {
109 defines: defines,
110 copy: [
111 [COMMON_WEB_FILES, GENERIC_DIR + '/web'],
112 ['external/webL10n/l10n.js', GENERIC_DIR + '/web'],
2ab481a Yury Delendik Removes foreign for Firefox CSS prefixes
yurydelendik authored
113 ['web/viewer.css', GENERIC_DIR + '/web'],
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
114 ['web/compatibility.js', GENERIC_DIR + '/web'],
115 ['web/compressed.tracemonkey-pldi-09.pdf', GENERIC_DIR + '/web'],
1d8f6cf Yury Delendik Updates make.js for cmaps and make binary cmaps by default
yurydelendik authored
116 ['external/bcmaps/*', GENERIC_DIR + '/web/cmaps/'],
e5247e4 Yury Delendik Updates webL10n; using viewer.properties as is
yurydelendik authored
117 ['web/locale', GENERIC_DIR + '/web']
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
118 ],
119 preprocess: [
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
120 [BUILD_TARGETS, GENERIC_DIR + BUILD_DIR],
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
121 [COMMON_WEB_FILES_PREPROCESS, GENERIC_DIR + '/web']
122 ]
123 };
e0a6b23 Brendan Dahl Move builder/preprocessor into its own file.
brendandahl authored
124 builder.build(setup);
83b6eae Vivin Paliath pr #3356
vivin authored
125
126 cleanupJSSource(GENERIC_DIR + '/web/viewer.js');
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
127 };
128
f6ba384 Artur Adib Using ShellJS
arturadib authored
129 //
130 // make web
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
131 // Generates the website for the project, by checking out the gh-pages branch
132 // underneath the build directory, and then moving the various viewer files
133 // into place.
f6ba384 Artur Adib Using ShellJS
arturadib authored
134 //
135 target.web = function() {
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
136 target.generic();
f6ba384 Artur Adib Using ShellJS
arturadib authored
137 target.extension();
c79acf5 Brendan Dahl Fix the B2G viewer and enable bot preview.
brendandahl authored
138 target.b2g();
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
139
f6ba384 Artur Adib Using ShellJS
arturadib authored
140 echo();
141 echo('### Creating web site');
142
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
143 if (test('-d', GH_PAGES_DIR)) {
790f608 Artur Adib remove target.pagesrepo, commit here (not bot)
arturadib authored
144 rm('-rf', GH_PAGES_DIR);
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
145 }
790f608 Artur Adib remove target.pagesrepo, commit here (not bot)
arturadib authored
146
147 mkdir('-p', GH_PAGES_DIR + '/web');
148 mkdir('-p', GH_PAGES_DIR + '/web/images');
149 mkdir('-p', GH_PAGES_DIR + BUILD_DIR);
150 mkdir('-p', GH_PAGES_DIR + EXTENSION_SRC_DIR + '/firefox');
79c57dc Yury Delendik Fixes 'make web' after chromium directory remaning
yurydelendik authored
151 mkdir('-p', GH_PAGES_DIR + EXTENSION_SRC_DIR + '/chromium');
c79acf5 Brendan Dahl Fix the B2G viewer and enable bot preview.
brendandahl authored
152 mkdir('-p', GH_PAGES_DIR + EXTENSION_SRC_DIR + '/b2g');
790f608 Artur Adib remove target.pagesrepo, commit here (not bot)
arturadib authored
153
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
154 cp('-R', GENERIC_DIR + '/*', GH_PAGES_DIR);
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
155 cp(FIREFOX_BUILD_DIR + '/*.xpi', FIREFOX_BUILD_DIR + '/*.rdf',
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
156 GH_PAGES_DIR + EXTENSION_SRC_DIR + 'firefox/');
b96152b Jakob Miland Support for building .crx file (re-visited)
saebekassebil authored
157 cp(CHROME_BUILD_DIR + '/*.crx', FIREFOX_BUILD_DIR + '/*.rdf',
4a4f570 Andreas Bovens adjusted paths in make.js to reflect chromium instead of chrome
andreasbovens authored
158 GH_PAGES_DIR + EXTENSION_SRC_DIR + 'chromium/');
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
159 cp('web/index.html.template', GH_PAGES_DIR + '/index.html');
10f37f7 Yury Delendik PDF.js features testing
yurydelendik authored
160 cp('-R', 'test/features', GH_PAGES_DIR);
c79acf5 Brendan Dahl Fix the B2G viewer and enable bot preview.
brendandahl authored
161 cp('-R', B2G_BUILD_DIR, GH_PAGES_DIR + EXTENSION_SRC_DIR + 'b2g/');
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
162
f6ba384 Artur Adib Using ShellJS
arturadib authored
163 cd(GH_PAGES_DIR);
790f608 Artur Adib remove target.pagesrepo, commit here (not bot)
arturadib authored
164 exec('git init');
165 exec('git remote add origin ' + REPO);
f6ba384 Artur Adib Using ShellJS
arturadib authored
166 exec('git add -A');
790f608 Artur Adib remove target.pagesrepo, commit here (not bot)
arturadib authored
167 exec('git commit -am "gh-pages site created via make.js script"');
168 exec('git branch -m gh-pages');
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
169
f6ba384 Artur Adib Using ShellJS
arturadib authored
170 echo();
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
171 echo('Website built in ' + GH_PAGES_DIR);
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
172 };
f6ba384 Artur Adib Using ShellJS
arturadib authored
173
174 //
427a5f1 Yury Delendik Move localization to l10n folders; create 'make locale'
yurydelendik authored
175 // make locale
176 // Creates localized resources for the viewer and extension.
177 //
178 target.locale = function() {
179 var METADATA_OUTPUT = 'extensions/firefox/metadata.inc';
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
180 var CHROME_MANIFEST_OUTPUT = 'extensions/firefox/chrome.manifest.inc';
181 var EXTENSION_LOCALE_OUTPUT = 'extensions/firefox/locale';
e5247e4 Yury Delendik Updates webL10n; using viewer.properties as is
yurydelendik authored
182 var VIEWER_LOCALE_OUTPUT = 'web/locale/';
427a5f1 Yury Delendik Move localization to l10n folders; create 'make locale'
yurydelendik authored
183
184 cd(ROOT_DIR);
185 echo();
186 echo('### Building localization files');
187
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
188 rm('-rf', EXTENSION_LOCALE_OUTPUT);
189 mkdir('-p', EXTENSION_LOCALE_OUTPUT);
e5247e4 Yury Delendik Updates webL10n; using viewer.properties as is
yurydelendik authored
190 rm('-rf', VIEWER_LOCALE_OUTPUT);
191 mkdir('-p', VIEWER_LOCALE_OUTPUT);
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
192
193 var subfolders = ls(LOCALE_SRC_DIR);
427a5f1 Yury Delendik Move localization to l10n folders; create 'make locale'
yurydelendik authored
194 subfolders.sort();
195 var metadataContent = '';
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
196 var chromeManifestContent = '';
427a5f1 Yury Delendik Move localization to l10n folders; create 'make locale'
yurydelendik authored
197 var viewerOutput = '';
198 for (var i = 0; i < subfolders.length; i++) {
199 var locale = subfolders[i];
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
200 var path = LOCALE_SRC_DIR + locale;
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
201 if (!test('-d', path)) {
427a5f1 Yury Delendik Move localization to l10n folders; create 'make locale'
yurydelendik authored
202 continue;
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
203 }
c6f0094 Tim van der Meij Implements importl10n command
timvandermeij authored
204 if (!/^[a-z][a-z]([a-z])?(-[A-Z][A-Z])?$/.test(locale)) {
427a5f1 Yury Delendik Move localization to l10n folders; create 'make locale'
yurydelendik authored
205 echo('Skipping invalid locale: ' + locale);
206 continue;
207 }
208
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
209 mkdir('-p', EXTENSION_LOCALE_OUTPUT + '/' + locale);
e5247e4 Yury Delendik Updates webL10n; using viewer.properties as is
yurydelendik authored
210 mkdir('-p', VIEWER_LOCALE_OUTPUT + '/' + locale);
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
211 chromeManifestContent += 'locale pdf.js ' + locale + ' locale/' +
212 locale + '/\n';
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
213
427a5f1 Yury Delendik Move localization to l10n folders; create 'make locale'
yurydelendik authored
214 if (test('-f', path + '/viewer.properties')) {
e5247e4 Yury Delendik Updates webL10n; using viewer.properties as is
yurydelendik authored
215 viewerOutput += '[' + locale + ']\n' +
216 '@import url(' + locale + '/viewer.properties)\n\n';
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
217 cp(path + '/viewer.properties', EXTENSION_LOCALE_OUTPUT + '/' + locale);
e5247e4 Yury Delendik Updates webL10n; using viewer.properties as is
yurydelendik authored
218 cp(path + '/viewer.properties', VIEWER_LOCALE_OUTPUT + '/' + locale);
427a5f1 Yury Delendik Move localization to l10n folders; create 'make locale'
yurydelendik authored
219 }
220
080c3e7 Brendan Dahl Merge upstream. Use new l10n.
brendandahl authored
221 if (test('-f', path + '/chrome.properties')) {
222 cp(path + '/chrome.properties', EXTENSION_LOCALE_OUTPUT + '/' + locale);
427a5f1 Yury Delendik Move localization to l10n folders; create 'make locale'
yurydelendik authored
223 }
224
225 if (test('-f', path + '/metadata.inc')) {
226 var metadata = cat(path + '/metadata.inc');
227 metadataContent += metadata;
228 }
229 }
e5247e4 Yury Delendik Updates webL10n; using viewer.properties as is
yurydelendik authored
230 viewerOutput.to(VIEWER_LOCALE_OUTPUT + 'locale.properties');
427a5f1 Yury Delendik Move localization to l10n folders; create 'make locale'
yurydelendik authored
231 metadataContent.to(METADATA_OUTPUT);
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
232 chromeManifestContent.to(CHROME_MANIFEST_OUTPUT);
427a5f1 Yury Delendik Move localization to l10n folders; create 'make locale'
yurydelendik authored
233 };
234
235 //
69efd9c Yury Delendik CMaps binary packing
yurydelendik authored
236 // make cmaps
1d8f6cf Yury Delendik Updates make.js for cmaps and make binary cmaps by default
yurydelendik authored
237 // Compresses cmap files. Ensure that Adobe cmap download and uncompressed at
238 // ./external/cmaps location.
69efd9c Yury Delendik CMaps binary packing
yurydelendik authored
239 //
240 target.cmaps = function (args) {
241 var CMAP_INPUT = 'external/cmaps';
1d8f6cf Yury Delendik Updates make.js for cmaps and make binary cmaps by default
yurydelendik authored
242 var VIEWER_CMAP_OUTPUT = 'external/bcmaps';
243
69efd9c Yury Delendik CMaps binary packing
yurydelendik authored
244 cd(ROOT_DIR);
245 echo();
246 echo('### Building cmaps');
247
1d8f6cf Yury Delendik Updates make.js for cmaps and make binary cmaps by default
yurydelendik authored
248 // testing a file that usually present
249 if (!test('-f', CMAP_INPUT + '/UniJIS-UCS2-H')) {
250 echo('./external/cmaps has no cmap files, please download them from:');
251 echo(' http://sourceforge.net/adobe/cmap/wiki/Home/');
252 exit(1);
253 }
254
255 rm(VIEWER_CMAP_OUTPUT + '*.bcmap');
69efd9c Yury Delendik CMaps binary packing
yurydelendik authored
256
257 var compressCmaps =
258 require('./external/cmapscompress/compress.js').compressCmaps;
259 compressCmaps(CMAP_INPUT, VIEWER_CMAP_OUTPUT, true);
260 };
261
262 //
f6ba384 Artur Adib Using ShellJS
arturadib authored
263 // make bundle
264 // Bundles all source files into one wrapper 'pdf.js' file, in the given order.
265 //
ef423ef Mack Duan Implement progressive loading of PDFs
mduan authored
266 target.bundle = function(args) {
267 args = args || {};
3f530c4 Yury Delendik Specifies default workerSrc (if possible)
yurydelendik authored
268 var defines = args.defines || DEFINES;
ef423ef Mack Duan Implement progressive loading of PDFs
mduan authored
269 var excludes = args.excludes || [];
270
7b70710 Yury Delendik Traces pdf.js version
yurydelendik authored
271 target.buildnumber();
272
f6ba384 Artur Adib Using ShellJS
arturadib authored
273 cd(ROOT_DIR);
274 echo();
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
275 echo('### Bundling files into ' + BUILD_TARGET);
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
276 var reg = /\n\/\* -\*- Mode(.|\n)*?Mozilla Foundation(.|\n)*?'use strict';/g;
f6ba384 Artur Adib Using ShellJS
arturadib authored
277
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
278 function bundle(filename, dir, SRC_FILES, EXT_SRC_FILES) {
279 for (var i = 0, length = excludes.length; i < length; ++i) {
280 var exclude = excludes[i];
281 var index = SRC_FILES.indexOf(exclude);
282 if (index >= 0) {
283 SRC_FILES.splice(index, 1);
284 }
ef423ef Mack Duan Implement progressive loading of PDFs
mduan authored
285 }
286
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
287 var bundle = cat(SRC_FILES),
288 bundleVersion = EXTENSION_VERSION,
289 bundleBuild = exec('git log --format="%h" -n 1',
290 {silent: true}).output.replace('\n', '');
291
292 crlfchecker.checkIfCrlfIsPresent(SRC_FILES);
293
294 // Strip out all the vim/license headers.
295 bundle = bundle.replace(reg, '');
296
297 // Append external files last since we don't want to modify them.
298 bundle += cat(EXT_SRC_FILES);
299
300 // This just preprocesses the empty pdf.js file, we don't actually want to
301 // preprocess everything yet since other build targets use this file.
3f530c4 Yury Delendik Specifies default workerSrc (if possible)
yurydelendik authored
302 builder.preprocess(filename, dir, builder.merge(defines,
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
303 {BUNDLE: bundle,
304 BUNDLE_VERSION: bundleVersion,
3f530c4 Yury Delendik Specifies default workerSrc (if possible)
yurydelendik authored
305 BUNDLE_BUILD: bundleBuild}));
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
306 }
76d877e Brendan Dahl Strip out license for bundled version.
brendandahl authored
307
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
308 if (!test('-d', BUILD_DIR)) {
f6ba384 Artur Adib Using ShellJS
arturadib authored
309 mkdir(BUILD_DIR);
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
310 }
f6ba384 Artur Adib Using ShellJS
arturadib authored
311
1838ec0 Greg Jordan Add a singlefile target to build one concatenated file
gjuggler authored
312 var SHARED_SRC_FILES = [
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
313 'shared/util.js',
314 'shared/colorspace.js',
315 'shared/function.js',
316 'shared/annotation.js',
1838ec0 Greg Jordan Add a singlefile target to build one concatenated file
gjuggler authored
317 ];
318
319 var MAIN_SRC_FILES = SHARED_SRC_FILES.concat([
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
320 'display/api.js',
321 'display/metadata.js',
322 'display/canvas.js',
bf432a3 Yury Delendik Refactors shared/pattern.js into core/ and display/
yurydelendik authored
323 'display/pattern_helper.js',
bb2529d Brendan Dahl Move the creation of canvas path fonts to the worker.
brendandahl authored
324 'display/font_loader.js'
1838ec0 Greg Jordan Add a singlefile target to build one concatenated file
gjuggler authored
325 ]);
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
326
327 var WORKER_SRC_FILES = [
328 'core/network.js',
329 'core/chunked_stream.js',
330 'core/pdf_manager.js',
331 'core/core.js',
332 'core/obj.js',
333 'core/charsets.js',
334 'core/cidmaps.js',
335 'core/crypto.js',
bf432a3 Yury Delendik Refactors shared/pattern.js into core/ and display/
yurydelendik authored
336 'core/pattern.js',
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
337 'core/evaluator.js',
338 'core/fonts.js',
bb2529d Brendan Dahl Move the creation of canvas path fonts to the worker.
brendandahl authored
339 'core/font_renderer.js',
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
340 'core/glyphlist.js',
341 'core/image.js',
342 'core/metrics.js',
343 'core/parser.js',
e932705 Yury Delendik Basic function.js split
yurydelendik authored
344 'core/ps_parser.js',
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
345 'core/stream.js',
346 'core/worker.js',
7b5b517 Felix Kälberer Extract duplicate arithmetic decoder to own class
fkaelberer authored
347 'core/arithmetic_decoder.js',
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
348 'core/jpx.js',
349 'core/jbig2.js',
f32e65b Brendan Dahl Read multi-byte character codes based on codespace ranges.
brendandahl authored
350 'core/bidi.js',
351 'core/cmap.js'
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
352 ];
b13798f Kalervo Kujala Add carriage return checks to make.js.
kkujala authored
353
1838ec0 Greg Jordan Add a singlefile target to build one concatenated file
gjuggler authored
354 if (!defines.SINGLE_FILE) {
355 // We want shared_src_files in both pdf.js and pdf.worker.js
356 // unless it's being built in singlefile mode.
357 WORKER_SRC_FILES = SHARED_SRC_FILES.concat(WORKER_SRC_FILES);
04e2235 Greg Jordan Fix singlefile build target
gjuggler authored
358 } else {
359 // In singlefile mode, all of the src files will be bundled into
360 // the main pdf.js outuput.
361 MAIN_SRC_FILES = MAIN_SRC_FILES.concat(WORKER_SRC_FILES);
1838ec0 Greg Jordan Add a singlefile target to build one concatenated file
gjuggler authored
362 }
363
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
364 var EXT_SRC_FILES = [
365 '../external/jpgjs/jpg.js'
366 ];
76d877e Brendan Dahl Strip out license for bundled version.
brendandahl authored
367
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
368 cd(SRC_DIR);
76d877e Brendan Dahl Strip out license for bundled version.
brendandahl authored
369
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
370 bundle('pdf.js', ROOT_DIR + BUILD_TARGET, MAIN_SRC_FILES, []);
371 var srcCopy = ROOT_DIR + BUILD_DIR + 'pdf.worker.js.temp';
372 cp('pdf.js', srcCopy);
373 bundle(srcCopy, ROOT_DIR + BUILD_WORKER_TARGET, WORKER_SRC_FILES,
374 EXT_SRC_FILES);
375 rm(srcCopy);
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
376 };
f6ba384 Artur Adib Using ShellJS
arturadib authored
377
1838ec0 Greg Jordan Add a singlefile target to build one concatenated file
gjuggler authored
378 //
379 // make singlefile
380 // Concatenates pdf.js and pdf.worker.js into one big pdf.combined.js, and
381 // flags the script loader to not attempt to load the separate worker JS file.
382 //
383 target.singlefile = function() {
384 cd(ROOT_DIR);
385 echo();
386 echo('### Creating singlefile build');
387
388 var SINGLE_FILE_DIR = BUILD_DIR + '/singlefile/';
389 var SINGLE_FILE_TARGET = BUILD_DIR + 'pdf.combined.js';
390
391 var defines = builder.merge(DEFINES, {SINGLE_FILE: true});
392 target.bundle({defines: defines});
393
394 cd(ROOT_DIR);
395
396 rm('-rf', SINGLE_FILE_DIR);
397 mkdir('-p', SINGLE_FILE_DIR);
398 mkdir('-p', SINGLE_FILE_DIR + BUILD_DIR);
399
400 var setup = {
401 defines: defines,
402 copy: [],
403 preprocess: [
404 [BUILD_TARGETS, SINGLE_FILE_DIR + BUILD_DIR]
405 ]
406 };
407 builder.build(setup);
408
409 cd(SINGLE_FILE_DIR);
410
411 echo();
04e2235 Greg Jordan Fix singlefile build target
gjuggler authored
412 echo('### Moving pdf.js to pdf.combined.js');
1838ec0 Greg Jordan Add a singlefile target to build one concatenated file
gjuggler authored
413 var pdfJs = cat(BUILD_TARGET);
414 pdfJs.to(SINGLE_FILE_TARGET);
415
416 rm(BUILD_TARGET);
417 rm(BUILD_WORKER_TARGET);
418
419 };
420
83b6eae Vivin Paliath pr #3356
vivin authored
421 function cleanupJSSource(file) {
422 var content = cat(file);
423
424 // Strip out all the vim/license headers.
425 var reg = /\n\/\* -\*- Mode(.|\n)*?Mozilla Foundation(.|\n)*?'use strict';/g;
426 content = content.replace(reg, '');
f6ba384 Artur Adib Using ShellJS
arturadib authored
427
83b6eae Vivin Paliath pr #3356
vivin authored
428 content.to(file);
429 }
f6ba384 Artur Adib Using ShellJS
arturadib authored
430
2b298a7 Yury Delendik Adds make minified command
yurydelendik authored
431 //
432 // make minified
433 // Builds the minified production viewer that should be compatible with most
434 // modern HTML5 browsers. Requires Google Closure Compiler.
435 //
436 target.minified = function() {
437 var compilerPath = process.env['CLOSURE_COMPILER'];
438 if (!compilerPath) {
439 echo('### Closure Compiler is not set. Specify CLOSURE_COMPILER variable');
440 exit(1);
441 }
442
443 target.bundle({});
444 target.locale();
445
446 cd(ROOT_DIR);
447 echo();
448 echo('### Creating minified viewer');
449
450 rm('-rf', MINIFIED_DIR);
451 mkdir('-p', MINIFIED_DIR);
452 mkdir('-p', MINIFIED_DIR + BUILD_DIR);
453 mkdir('-p', MINIFIED_DIR + '/web');
1d8f6cf Yury Delendik Updates make.js for cmaps and make binary cmaps by default
yurydelendik authored
454 mkdir('-p', MINIFIED_DIR + '/web/cmaps');
2b298a7 Yury Delendik Adds make minified command
yurydelendik authored
455
456 var defines = builder.merge(DEFINES, {GENERIC: true, MINIFIED: true});
457
458 var setup = {
459 defines: defines,
460 copy: [
461 [COMMON_WEB_FILES, MINIFIED_DIR + '/web'],
462 ['web/viewer.css', MINIFIED_DIR + '/web'],
463 ['web/compressed.tracemonkey-pldi-09.pdf', MINIFIED_DIR + '/web'],
1d8f6cf Yury Delendik Updates make.js for cmaps and make binary cmaps by default
yurydelendik authored
464 ['external/bcmaps/*', MINIFIED_DIR + '/web/cmaps'],
2b298a7 Yury Delendik Adds make minified command
yurydelendik authored
465 ['web/locale', MINIFIED_DIR + '/web']
466 ],
467 preprocess: [
468 [BUILD_TARGETS, MINIFIED_DIR + BUILD_DIR],
469 [COMMON_WEB_FILES_PREPROCESS, MINIFIED_DIR + '/web']
470 ]
471 };
472 builder.build(setup);
473
474 var viewerFiles = [
475 'web/compatibility.js',
476 'external/webL10n/l10n.js',
477 MINIFIED_DIR + BUILD_DIR + 'pdf.js',
478 MINIFIED_DIR + '/web/viewer.js'
479 ];
480 var cmdPrefix = 'java -jar \"' + compilerPath + '\" ' +
481 '--language_in ECMASCRIPT5 ' +
482 '--warning_level QUIET ' +
483 '--compilation_level SIMPLE_OPTIMIZATIONS ';
484
485 echo();
486 echo('### Minifying js files');
487
488 exec(cmdPrefix + viewerFiles.map(function(s) {
489 return '--js \"' + s + '\"';
490 }).join(' ') +
491 ' --js_output_file \"' + MINIFIED_DIR + '/web/pdf.viewer.js\"');
492 exec(cmdPrefix + '--js \"' + MINIFIED_DIR + '/build/pdf.js' + '\" ' +
493 '--js_output_file \"' + MINIFIED_DIR + '/build/pdf.min.js' + '\"');
494 exec(cmdPrefix + '--js \"' + MINIFIED_DIR + '/build/pdf.worker.js' + '\" ' +
495 '--js_output_file \"' + MINIFIED_DIR + '/build/pdf.worker.min.js' + '\"');
496
497 echo();
498 echo('### Cleaning js files');
499
500 rm(MINIFIED_DIR + '/web/viewer.js');
501 rm(MINIFIED_DIR + '/web/debugger.js');
502 rm(MINIFIED_DIR + '/build/pdf.js');
503 rm(MINIFIED_DIR + '/build/pdf.worker.js');
504 mv(MINIFIED_DIR + '/build/pdf.min.js',
505 MINIFIED_DIR + '/build/pdf.js');
506 mv(MINIFIED_DIR + '/build/pdf.worker.min.js',
507 MINIFIED_DIR + '/build/pdf.worker.js');
508 };
509
5cf0d8f Yury Delendik Enforces maxlen for jshint
yurydelendik authored
510 ////////////////////////////////////////////////////////////////////////////////
f6ba384 Artur Adib Using ShellJS
arturadib authored
511 //
512 // Extension stuff
513 //
514
76ff549 Brendan Dahl Bump version number to 0.8.
brendandahl authored
515 var EXTENSION_BASE_VERSION = '0ac55ac879d1c0eea9c0d155d5bbd9b11560f631',
516 EXTENSION_VERSION_PREFIX = '0.8.',
6abbc28 notmasteryet Changing make.js
notmasteryet authored
517 EXTENSION_BUILD_NUMBER,
518 EXTENSION_VERSION;
f6ba384 Artur Adib Using ShellJS
arturadib authored
519
520 //
521 // make extension
522 //
523 target.extension = function() {
524 cd(ROOT_DIR);
525 echo();
526 echo('### Building extensions');
527
085723a Yury Delendik make the locale stuff a precondition for make extension
yurydelendik authored
528 target.locale();
f6ba384 Artur Adib Using ShellJS
arturadib authored
529 target.firefox();
8dc41e7 Andreas Bovens adjusted some more chrome references in make.js and README.js as per @yu...
andreasbovens authored
530 target.chromium();
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
531 };
f6ba384 Artur Adib Using ShellJS
arturadib authored
532
533 target.buildnumber = function() {
534 cd(ROOT_DIR);
535 echo();
536 echo('### Getting extension build number');
537
332ae4c Brendan Dahl Change to the Apache v2 license.
brendandahl authored
538 var lines = exec('git log --format=oneline ' +
539 EXTENSION_BASE_VERSION + '..', {silent: true}).output;
f6ba384 Artur Adib Using ShellJS
arturadib authored
540 // Build number is the number of commits since base version
332ae4c Brendan Dahl Change to the Apache v2 license.
brendandahl authored
541 EXTENSION_BUILD_NUMBER = lines ? lines.match(/\n/g).length : 0;
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
542
543 echo('Extension build number: ' + EXTENSION_BUILD_NUMBER);
6abbc28 notmasteryet Changing make.js
notmasteryet authored
544
545 EXTENSION_VERSION = EXTENSION_VERSION_PREFIX + EXTENSION_BUILD_NUMBER;
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
546 };
f6ba384 Artur Adib Using ShellJS
arturadib authored
547
548 //
549 // make firefox
550 //
551 target.firefox = function() {
552 cd(ROOT_DIR);
553 echo();
554 echo('### Building Firefox extension');
e0a6b23 Brendan Dahl Move builder/preprocessor into its own file.
brendandahl authored
555 var defines = builder.merge(DEFINES, {FIREFOX: true});
f6ba384 Artur Adib Using ShellJS
arturadib authored
556
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
557 var FIREFOX_BUILD_CONTENT_DIR = FIREFOX_BUILD_DIR + '/content/',
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
558 FIREFOX_EXTENSION_DIR = 'extensions/firefox/',
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
559 FIREFOX_CONTENT_DIR = EXTENSION_SRC_DIR + '/firefox/content/',
f6ba384 Artur Adib Using ShellJS
arturadib authored
560 FIREFOX_EXTENSION_FILES_TO_COPY =
561 ['*.js',
562 '*.rdf',
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
563 '*.svg',
cd1fd17 Brendan Dahl Add icon for extension.
brendandahl authored
564 '*.png',
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
565 '*.manifest',
566 'locale',
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
567 '../../LICENSE'],
f6ba384 Artur Adib Using ShellJS
arturadib authored
568 FIREFOX_EXTENSION_FILES =
6abbc28 notmasteryet Changing make.js
notmasteryet authored
569 ['bootstrap.js',
f6ba384 Artur Adib Using ShellJS
arturadib authored
570 'install.rdf',
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
571 'chrome.manifest',
cd1fd17 Brendan Dahl Add icon for extension.
brendandahl authored
572 'icon.png',
573 'icon64.png',
6abbc28 notmasteryet Changing make.js
notmasteryet authored
574 'content',
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
575 'locale',
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
576 'LICENSE'],
f6ba384 Artur Adib Using ShellJS
arturadib authored
577 FIREFOX_EXTENSION_NAME = 'pdf.js.xpi',
578 FIREFOX_AMO_EXTENSION_NAME = 'pdf.js.amo.xpi';
579
085723a Yury Delendik make the locale stuff a precondition for make extension
yurydelendik authored
580 target.locale();
3f530c4 Yury Delendik Specifies default workerSrc (if possible)
yurydelendik authored
581 target.bundle({ excludes: ['core/network.js'], defines: defines });
f6ba384 Artur Adib Using ShellJS
arturadib authored
582 cd(ROOT_DIR);
583
584 // Clear out everything in the firefox extension build directory
585 rm('-rf', FIREFOX_BUILD_DIR);
586 mkdir('-p', FIREFOX_BUILD_CONTENT_DIR);
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
587 mkdir('-p', FIREFOX_BUILD_CONTENT_DIR + BUILD_DIR);
588 mkdir('-p', FIREFOX_BUILD_CONTENT_DIR + '/web');
1d8f6cf Yury Delendik Updates make.js for cmaps and make binary cmaps by default
yurydelendik authored
589 mkdir('-p', FIREFOX_BUILD_CONTENT_DIR + '/web/cmaps');
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
590
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
591 cp(FIREFOX_CONTENT_DIR + 'PdfJs-stub.jsm',
592 FIREFOX_BUILD_CONTENT_DIR + 'PdfJs.jsm');
1bb7a7e Yury Delendik Adds stub PdfJs.jsm for FF15
yurydelendik authored
593
ba23a9e Yury Delendik Adds initial telemetry probes
yurydelendik authored
594 cp(FIREFOX_CONTENT_DIR + 'PdfJsTelemetry-addon.jsm',
595 FIREFOX_BUILD_CONTENT_DIR + 'PdfJsTelemetry.jsm');
596
b8f7bca Brendan Dahl Use only one resource url for moz central build.
brendandahl authored
597 cp(FIREFOX_CONTENT_DIR + 'PdfStreamConverter.jsm',
598 FIREFOX_BUILD_CONTENT_DIR);
599
600 cp(FIREFOX_CONTENT_DIR + 'PdfRedirector.jsm',
601 FIREFOX_BUILD_CONTENT_DIR);
602
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
603 // Copy extension files
6046c55 Kalervo Kujala Fix few jslint warnings in make.js.
kkujala authored
604 cd(FIREFOX_EXTENSION_DIR);
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
605 cp('-R', FIREFOX_EXTENSION_FILES_TO_COPY, ROOT_DIR + FIREFOX_BUILD_DIR);
f6ba384 Artur Adib Using ShellJS
arturadib authored
606 cd(ROOT_DIR);
607
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
608 var setup = {
609 defines: defines,
610 copy: [
611 [COMMON_WEB_FILES, FIREFOX_BUILD_CONTENT_DIR + '/web'],
1d8f6cf Yury Delendik Updates make.js for cmaps and make binary cmaps by default
yurydelendik authored
612 ['external/bcmaps/*', FIREFOX_BUILD_CONTENT_DIR + '/web/cmaps'],
6046c55 Kalervo Kujala Fix few jslint warnings in make.js.
kkujala authored
613 [FIREFOX_EXTENSION_DIR + 'tools/l10n.js',
f6cfab0 Jonas Jenwald [Firefox] Stop importing default_preferences.js as a module and include ...
Snuffleupagus authored
614 FIREFOX_BUILD_CONTENT_DIR + '/web']
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
615 ],
616 preprocess: [
babd8df Brendan Dahl Un-inline pdf.js for the extension/mozcentral and remove fetch pdf by co...
brendandahl authored
617 [COMMON_WEB_FILES_PREPROCESS, FIREFOX_BUILD_CONTENT_DIR + '/web'],
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
618 [BUILD_TARGETS, FIREFOX_BUILD_CONTENT_DIR + BUILD_DIR],
f6cfab0 Jonas Jenwald [Firefox] Stop importing default_preferences.js as a module and include ...
Snuffleupagus authored
619 [SRC_DIR + 'core/network.js', FIREFOX_BUILD_CONTENT_DIR],
620 [FIREFOX_EXTENSION_DIR + 'bootstrap.js', FIREFOX_BUILD_DIR]
2ab481a Yury Delendik Removes foreign for Firefox CSS prefixes
yurydelendik authored
621 ],
622 preprocessCSS: [
623 ['firefox', 'web/viewer.css',
624 FIREFOX_BUILD_CONTENT_DIR + '/web/viewer.css']
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
625 ]
626 };
e0a6b23 Brendan Dahl Move builder/preprocessor into its own file.
brendandahl authored
627 builder.build(setup);
f6ba384 Artur Adib Using ShellJS
arturadib authored
628
83b6eae Vivin Paliath pr #3356
vivin authored
629 cleanupJSSource(FIREFOX_BUILD_CONTENT_DIR + '/web/viewer.js');
f6cfab0 Jonas Jenwald [Firefox] Stop importing default_preferences.js as a module and include ...
Snuffleupagus authored
630 cleanupJSSource(FIREFOX_BUILD_DIR + 'bootstrap.js');
83b6eae Vivin Paliath pr #3356
vivin authored
631
c3bdf1e Artur Adib adding new find() commands
arturadib authored
632 // Remove '.DS_Store' and other hidden files
a0a5c58 Artur Adib Upgrading ShellJS, introducing 'makeref'
arturadib authored
633 find(FIREFOX_BUILD_DIR).forEach(function(file) {
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
634 if (file.match(/^\./)) {
c3bdf1e Artur Adib adding new find() commands
arturadib authored
635 rm('-f', file);
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
636 }
a0a5c58 Artur Adib Upgrading ShellJS, introducing 'makeref'
arturadib authored
637 });
f6ba384 Artur Adib Using ShellJS
arturadib authored
638
639 // Update the build version number
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
640 sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION,
641 FIREFOX_BUILD_DIR + '/install.rdf');
642 sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION,
643 FIREFOX_BUILD_DIR + '/update.rdf');
644
645 sed('-i', /PDFJSSCRIPT_STREAM_CONVERTER_ID/, FIREFOX_STREAM_CONVERTER_ID,
b8f7bca Brendan Dahl Use only one resource url for moz central build.
brendandahl authored
646 FIREFOX_BUILD_CONTENT_DIR + 'PdfStreamConverter.jsm');
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
647 sed('-i', /PDFJSSCRIPT_PREF_PREFIX/, FIREFOX_PREF_PREFIX,
b8f7bca Brendan Dahl Use only one resource url for moz central build.
brendandahl authored
648 FIREFOX_BUILD_CONTENT_DIR + 'PdfStreamConverter.jsm');
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
649 sed('-i', /PDFJSSCRIPT_MOZ_CENTRAL/, 'false',
b8f7bca Brendan Dahl Use only one resource url for moz central build.
brendandahl authored
650 FIREFOX_BUILD_CONTENT_DIR + 'PdfStreamConverter.jsm');
4bee4c6 Brendan Dahl Use different id's for moz central and extension.
brendandahl authored
651
427a5f1 Yury Delendik Move localization to l10n folders; create 'make locale'
yurydelendik authored
652 // Update localized metadata
653 var localizedMetadata = cat(EXTENSION_SRC_DIR + '/firefox/metadata.inc');
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
654 sed('-i', /.*PDFJS_LOCALIZED_METADATA.*\n/, localizedMetadata,
655 FIREFOX_BUILD_DIR + '/install.rdf');
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
656 var chromeManifest = cat(EXTENSION_SRC_DIR + '/firefox/chrome.manifest.inc');
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
657 sed('-i', /.*PDFJS_SUPPORTED_LOCALES.*\n/, chromeManifest,
658 FIREFOX_BUILD_DIR + '/chrome.manifest');
427a5f1 Yury Delendik Move localization to l10n folders; create 'make locale'
yurydelendik authored
659
f6ba384 Artur Adib Using ShellJS
arturadib authored
660 // Create the xpi
661 cd(FIREFOX_BUILD_DIR);
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
662 exec('zip -r ' + FIREFOX_EXTENSION_NAME + ' ' +
663 FIREFOX_EXTENSION_FILES.join(' '));
f6ba384 Artur Adib Using ShellJS
arturadib authored
664 echo('extension created: ' + FIREFOX_EXTENSION_NAME);
665 cd(ROOT_DIR);
666
667 // Build the amo extension too (remove the updateUrl)
668 cd(FIREFOX_BUILD_DIR);
669 sed('-i', /.*updateURL.*\n/, '', 'install.rdf');
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
670 exec('zip -r ' + FIREFOX_AMO_EXTENSION_NAME + ' ' +
671 FIREFOX_EXTENSION_FILES.join(' '));
f6ba384 Artur Adib Using ShellJS
arturadib authored
672 echo('AMO extension created: ' + FIREFOX_AMO_EXTENSION_NAME);
673 cd(ROOT_DIR);
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
674 };
675
676 //
677 // make mozcentral
678 //
679 target.mozcentral = function() {
680 cd(ROOT_DIR);
681 echo();
682 echo('### Building mozilla-central extension');
e0a6b23 Brendan Dahl Move builder/preprocessor into its own file.
brendandahl authored
683 var defines = builder.merge(DEFINES, {MOZCENTRAL: true});
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
684
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
685 var MOZCENTRAL_DIR = BUILD_DIR + 'mozcentral/',
424f522 Artur Adib Fixed moz-central manifest; bundling Mochitests
arturadib authored
686 MOZCENTRAL_EXTENSION_DIR = MOZCENTRAL_DIR + 'browser/extensions/pdfjs/',
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
687 MOZCENTRAL_CONTENT_DIR = MOZCENTRAL_EXTENSION_DIR + 'content/',
688 MOZCENTRAL_L10N_DIR = MOZCENTRAL_DIR + 'browser/locales/en-US/pdfviewer/',
424f522 Artur Adib Fixed moz-central manifest; bundling Mochitests
arturadib authored
689 MOZCENTRAL_TEST_DIR = MOZCENTRAL_EXTENSION_DIR + 'test/',
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
690 FIREFOX_CONTENT_DIR = EXTENSION_SRC_DIR + '/firefox/content/',
691 FIREFOX_EXTENSION_FILES_TO_COPY =
fb0fd9e Yury Delendik Adds mozcentralcheck and mozcentraldiff targets
yurydelendik authored
692 ['*.svg',
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
693 '*.png',
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
694 '*.manifest',
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
695 'README.mozilla',
696 '../../LICENSE'],
697 DEFAULT_LOCALE_FILES =
03032d2 Brendan Dahl Add chrome.properties for moz central build.
brendandahl authored
698 [LOCALE_SRC_DIR + 'en-US/viewer.properties',
2684c79 Tim van der Meij Cleaning up files in extension
timvandermeij authored
699 LOCALE_SRC_DIR + 'en-US/chrome.properties'],
700 FIREFOX_MC_EXCLUDED_FILES =
701 ['icon.png',
702 'icon64.png'];
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
703
3f530c4 Yury Delendik Specifies default workerSrc (if possible)
yurydelendik authored
704 target.bundle({ excludes: ['core/network.js'], defines: defines });
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
705 cd(ROOT_DIR);
706
707 // Clear out everything in the firefox extension build directory
708 rm('-rf', MOZCENTRAL_DIR);
709 mkdir('-p', MOZCENTRAL_CONTENT_DIR);
710 mkdir('-p', MOZCENTRAL_L10N_DIR);
711 mkdir('-p', MOZCENTRAL_CONTENT_DIR + BUILD_DIR);
712 mkdir('-p', MOZCENTRAL_CONTENT_DIR + '/web');
1d8f6cf Yury Delendik Updates make.js for cmaps and make binary cmaps by default
yurydelendik authored
713 mkdir('-p', MOZCENTRAL_CONTENT_DIR + '/web/cmaps');
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
714
f6cfab0 Jonas Jenwald [Firefox] Stop importing default_preferences.js as a module and include ...
Snuffleupagus authored
715 // Do not copy PdfJs.jsm, since it should be run through the preprocessor.
716
ba23a9e Yury Delendik Adds initial telemetry probes
yurydelendik authored
717 cp(FIREFOX_CONTENT_DIR + 'PdfJsTelemetry.jsm', MOZCENTRAL_CONTENT_DIR);
b8f7bca Brendan Dahl Use only one resource url for moz central build.
brendandahl authored
718 cp(FIREFOX_CONTENT_DIR + 'PdfStreamConverter.jsm', MOZCENTRAL_CONTENT_DIR);
719 cp(FIREFOX_CONTENT_DIR + 'PdfRedirector.jsm', MOZCENTRAL_CONTENT_DIR);
3d7f01d Brendan Dahl Add global pref to enable/disable. Control pdf.js in application prefer...
brendandahl authored
720
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
721 // Copy extension files
722 cd('extensions/firefox');
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
723 cp('-R', FIREFOX_EXTENSION_FILES_TO_COPY,
724 ROOT_DIR + MOZCENTRAL_EXTENSION_DIR);
424f522 Artur Adib Fixed moz-central manifest; bundling Mochitests
arturadib authored
725 mv('-f', ROOT_DIR + MOZCENTRAL_EXTENSION_DIR + '/chrome-mozcentral.manifest',
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
726 ROOT_DIR + MOZCENTRAL_EXTENSION_DIR + '/chrome.manifest');
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
727 cd(ROOT_DIR);
728
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
729 var setup = {
730 defines: defines,
731 copy: [
732 [COMMON_WEB_FILES, MOZCENTRAL_CONTENT_DIR + '/web'],
1d8f6cf Yury Delendik Updates make.js for cmaps and make binary cmaps by default
yurydelendik authored
733 ['external/bcmaps/*', MOZCENTRAL_CONTENT_DIR + '/web/cmaps'],
f6cfab0 Jonas Jenwald [Firefox] Stop importing default_preferences.js as a module and include ...
Snuffleupagus authored
734 ['extensions/firefox/tools/l10n.js', MOZCENTRAL_CONTENT_DIR + '/web']
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
735 ],
736 preprocess: [
babd8df Brendan Dahl Un-inline pdf.js for the extension/mozcentral and remove fetch pdf by co...
brendandahl authored
737 [COMMON_WEB_FILES_PREPROCESS, MOZCENTRAL_CONTENT_DIR + '/web'],
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
738 [BUILD_TARGETS, MOZCENTRAL_CONTENT_DIR + BUILD_DIR],
f6cfab0 Jonas Jenwald [Firefox] Stop importing default_preferences.js as a module and include ...
Snuffleupagus authored
739 [SRC_DIR + 'core/network.js', MOZCENTRAL_CONTENT_DIR],
740 [FIREFOX_CONTENT_DIR + 'PdfJs.jsm', MOZCENTRAL_CONTENT_DIR]
2ab481a Yury Delendik Removes foreign for Firefox CSS prefixes
yurydelendik authored
741 ],
742 preprocessCSS: [
894c82c Yury Delendik Removes -moz-box-sizing usage
yurydelendik authored
743 ['mozcentral',
744 'web/viewer.css',
745 MOZCENTRAL_CONTENT_DIR + '/web/viewer.css']
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
746 ]
747 };
e0a6b23 Brendan Dahl Move builder/preprocessor into its own file.
brendandahl authored
748 builder.build(setup);
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
749
83b6eae Vivin Paliath pr #3356
vivin authored
750 cleanupJSSource(MOZCENTRAL_CONTENT_DIR + '/web/viewer.js');
f6cfab0 Jonas Jenwald [Firefox] Stop importing default_preferences.js as a module and include ...
Snuffleupagus authored
751 cleanupJSSource(MOZCENTRAL_CONTENT_DIR + '/PdfJs.jsm');
83b6eae Vivin Paliath pr #3356
vivin authored
752
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
753 // Remove '.DS_Store' and other hidden files
754 find(MOZCENTRAL_DIR).forEach(function(file) {
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
755 if (file.match(/^\./)) {
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
756 rm('-f', file);
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
757 }
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
758 });
759
2684c79 Tim van der Meij Cleaning up files in extension
timvandermeij authored
760 // Remove excluded files
761 cd(MOZCENTRAL_EXTENSION_DIR);
762 FIREFOX_MC_EXCLUDED_FILES.forEach(function(file) {
763 if (test('-f', file)) {
764 rm('-r', file);
765 }
766 });
767 cd(ROOT_DIR);
768
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
769 // Copy default localization files
770 cp(DEFAULT_LOCALE_FILES, MOZCENTRAL_L10N_DIR);
771
772 // Update the build version number
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
773 sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION,
774 MOZCENTRAL_EXTENSION_DIR + 'README.mozilla');
6abbc28 notmasteryet Changing make.js
notmasteryet authored
775
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
776 sed('-i', /PDFJSSCRIPT_STREAM_CONVERTER_ID/, MOZCENTRAL_STREAM_CONVERTER_ID,
b8f7bca Brendan Dahl Use only one resource url for moz central build.
brendandahl authored
777 MOZCENTRAL_CONTENT_DIR + 'PdfStreamConverter.jsm');
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
778 sed('-i', /PDFJSSCRIPT_PREF_PREFIX/, MOZCENTRAL_PREF_PREFIX,
b8f7bca Brendan Dahl Use only one resource url for moz central build.
brendandahl authored
779 MOZCENTRAL_CONTENT_DIR + 'PdfStreamConverter.jsm');
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
780 sed('-i', /PDFJSSCRIPT_MOZ_CENTRAL/, 'true',
b8f7bca Brendan Dahl Use only one resource url for moz central build.
brendandahl authored
781 MOZCENTRAL_CONTENT_DIR + 'PdfStreamConverter.jsm');
4bee4c6 Brendan Dahl Use different id's for moz central and extension.
brendandahl authored
782
424f522 Artur Adib Fixed moz-central manifest; bundling Mochitests
arturadib authored
783 // Copy test files
784 mkdir('-p', MOZCENTRAL_TEST_DIR);
785 cp('-Rf', 'test/mozcentral/*', MOZCENTRAL_TEST_DIR);
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
786 };
f6ba384 Artur Adib Using ShellJS
arturadib authored
787
6d35073 Brendan Dahl Initial build for b2g.
brendandahl authored
788 target.b2g = function() {
fd4e40c Brendan Dahl New GUI for B2G viewer.
brendandahl authored
789 target.locale();
7b70710 Yury Delendik Traces pdf.js version
yurydelendik authored
790
6d35073 Brendan Dahl Initial build for b2g.
brendandahl authored
791 echo();
792 echo('### Building B2G (Firefox OS App)');
c79acf5 Brendan Dahl Fix the B2G viewer and enable bot preview.
brendandahl authored
793 var B2G_BUILD_CONTENT_DIR = B2G_BUILD_DIR + '/content/';
e0a6b23 Brendan Dahl Move builder/preprocessor into its own file.
brendandahl authored
794 var defines = builder.merge(DEFINES, { B2G: true });
3f530c4 Yury Delendik Specifies default workerSrc (if possible)
yurydelendik authored
795 target.bundle({ defines: defines });
e0a6b23 Brendan Dahl Move builder/preprocessor into its own file.
brendandahl authored
796
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
797 // Clear out everything in the b2g build directory
6d35073 Brendan Dahl Initial build for b2g.
brendandahl authored
798 cd(ROOT_DIR);
799 rm('-Rf', B2G_BUILD_DIR);
800 mkdir('-p', B2G_BUILD_CONTENT_DIR);
801 mkdir('-p', B2G_BUILD_CONTENT_DIR + BUILD_DIR);
802 mkdir('-p', B2G_BUILD_CONTENT_DIR + '/web');
1d8f6cf Yury Delendik Updates make.js for cmaps and make binary cmaps by default
yurydelendik authored
803 mkdir('-p', B2G_BUILD_CONTENT_DIR + '/web/cmaps');
6d35073 Brendan Dahl Initial build for b2g.
brendandahl authored
804
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
805 var setup = {
806 defines: defines,
807 copy: [
fd4e40c Brendan Dahl New GUI for B2G viewer.
brendandahl authored
808 ['extensions/b2g/images', B2G_BUILD_CONTENT_DIR + '/web'],
809 ['extensions/b2g/viewer.html', B2G_BUILD_CONTENT_DIR + '/web'],
810 ['extensions/b2g/viewer.css', B2G_BUILD_CONTENT_DIR + '/web'],
e5247e4 Yury Delendik Updates webL10n; using viewer.properties as is
yurydelendik authored
811 ['web/locale', B2G_BUILD_CONTENT_DIR + '/web'],
1d8f6cf Yury Delendik Updates make.js for cmaps and make binary cmaps by default
yurydelendik authored
812 ['external/bcmaps/*', B2G_BUILD_CONTENT_DIR + '/web/cmaps'],
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
813 ['external/webL10n/l10n.js', B2G_BUILD_CONTENT_DIR + '/web']
814 ],
815 preprocess: [
fd4e40c Brendan Dahl New GUI for B2G viewer.
brendandahl authored
816 ['web/viewer.js', B2G_BUILD_CONTENT_DIR + '/web'],
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
817 [BUILD_TARGETS, B2G_BUILD_CONTENT_DIR + BUILD_DIR]
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
818 ]
6d35073 Brendan Dahl Initial build for b2g.
brendandahl authored
819 };
e0a6b23 Brendan Dahl Move builder/preprocessor into its own file.
brendandahl authored
820 builder.build(setup);
83b6eae Vivin Paliath pr #3356
vivin authored
821
822 cleanupJSSource(B2G_BUILD_CONTENT_DIR + '/web/viewer.js');
6d35073 Brendan Dahl Initial build for b2g.
brendandahl authored
823 };
824
f6ba384 Artur Adib Using ShellJS
arturadib authored
825 //
826 // make chrome
827 //
8dc41e7 Andreas Bovens adjusted some more chrome references in make.js and README.js as per @yu...
andreasbovens authored
828 target.chromium = function() {
69efd9c Yury Delendik CMaps binary packing
yurydelendik authored
829 target.locale();
830
f6ba384 Artur Adib Using ShellJS
arturadib authored
831 cd(ROOT_DIR);
832 echo();
8dc41e7 Andreas Bovens adjusted some more chrome references in make.js and README.js as per @yu...
andreasbovens authored
833 echo('### Building Chromium extension');
e0a6b23 Brendan Dahl Move builder/preprocessor into its own file.
brendandahl authored
834 var defines = builder.merge(DEFINES, {CHROME: true});
f6ba384 Artur Adib Using ShellJS
arturadib authored
835
4a4f570 Andreas Bovens adjusted paths in make.js to reflect chromium instead of chrome
andreasbovens authored
836 var CHROME_BUILD_DIR = BUILD_DIR + '/chromium/',
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
837 CHROME_BUILD_CONTENT_DIR = CHROME_BUILD_DIR + '/content/';
f6ba384 Artur Adib Using ShellJS
arturadib authored
838
3f530c4 Yury Delendik Specifies default workerSrc (if possible)
yurydelendik authored
839 target.bundle({ defines: defines });
f6ba384 Artur Adib Using ShellJS
arturadib authored
840 cd(ROOT_DIR);
841
842 // Clear out everything in the chrome extension build directory
843 rm('-Rf', CHROME_BUILD_DIR);
844 mkdir('-p', CHROME_BUILD_CONTENT_DIR);
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
845 mkdir('-p', CHROME_BUILD_CONTENT_DIR + BUILD_DIR);
846 mkdir('-p', CHROME_BUILD_CONTENT_DIR + '/web');
f6ba384 Artur Adib Using ShellJS
arturadib authored
847
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
848 var setup = {
849 defines: defines,
850 copy: [
851 [COMMON_WEB_FILES, CHROME_BUILD_CONTENT_DIR + '/web'],
4a4f570 Andreas Bovens adjusted paths in make.js to reflect chromium instead of chrome
andreasbovens authored
852 [['extensions/chromium/*.json',
853 'extensions/chromium/*.html',
854 'extensions/chromium/*.js',
855 'extensions/chromium/*.css',
856 'extensions/chromium/icon*.png',],
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
857 CHROME_BUILD_DIR],
e5247e4 Yury Delendik Updates webL10n; using viewer.properties as is
yurydelendik authored
858 ['external/webL10n/l10n.js', CHROME_BUILD_CONTENT_DIR + '/web'],
2ab481a Yury Delendik Removes foreign for Firefox CSS prefixes
yurydelendik authored
859 ['web/viewer.css', CHROME_BUILD_CONTENT_DIR + '/web'],
1d8f6cf Yury Delendik Updates make.js for cmaps and make binary cmaps by default
yurydelendik authored
860 ['external/bcmaps/*', CHROME_BUILD_CONTENT_DIR + '/web/cmaps'],
e5247e4 Yury Delendik Updates webL10n; using viewer.properties as is
yurydelendik authored
861 ['web/locale', CHROME_BUILD_CONTENT_DIR + '/web']
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
862 ],
863 preprocess: [
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
864 [BUILD_TARGETS, CHROME_BUILD_CONTENT_DIR + BUILD_DIR],
e5247e4 Yury Delendik Updates webL10n; using viewer.properties as is
yurydelendik authored
865 [COMMON_WEB_FILES_PREPROCESS, CHROME_BUILD_CONTENT_DIR + '/web']
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
866 ]
867 };
e0a6b23 Brendan Dahl Move builder/preprocessor into its own file.
brendandahl authored
868 builder.build(setup);
b96152b Jakob Miland Support for building .crx file (re-visited)
saebekassebil authored
869
83b6eae Vivin Paliath pr #3356
vivin authored
870 cleanupJSSource(CHROME_BUILD_CONTENT_DIR + '/web/viewer.js');
871
6ca9245 moderation Changes to allowed versioned building of Chrome extension that meets new
moderation authored
872 // Update the build version number
873 sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION,
874 CHROME_BUILD_DIR + '/manifest.json');
875
e181a3c Rob Wu Highly improved Chrome extension
Rob--W authored
876 // Allow PDF.js resources to be loaded by adding the files to
877 // the "web_accessible_resources" section.
878 var file_list = ls('-RA', CHROME_BUILD_CONTENT_DIR);
879 var public_chrome_files = file_list.reduce(function(war, file) {
880 // Exclude directories (naive: Exclude paths without dot)
881 if (file.indexOf('.') !== -1) {
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
882 // Only add a comma after the first file
883 if (war) {
884 war += ',\n';
885 }
886 war += JSON.stringify('content/' + file);
e181a3c Rob Wu Highly improved Chrome extension
Rob--W authored
887 }
888 return war;
889 }, '');
890 sed('-i', /"content\/\*"/, public_chrome_files,
891 CHROME_BUILD_DIR + '/manifest.json');
892
b96152b Jakob Miland Support for building .crx file (re-visited)
saebekassebil authored
893 // Bundle the files to a Chrome extension file .crx if path to key is set
894 var pem = env['PDFJS_CHROME_KEY'];
895 if (!pem) {
896 return;
897 }
898
899 echo();
900 echo('### Bundling .crx extension into ' + CHROME_BUILD_DIR);
901
902 if (!test('-f', pem)) {
903 echo('Incorrect PDFJS_CHROME_KEY path');
904 exit(1);
905 }
906
907 var browserManifest = env['PDF_BROWSERS'] ||
908 'test/resources/browser_manifests/browser_manifest.json';
909
910 if (!test('-f', browserManifest)) {
911 echo('Browser manifest file ' + browserManifest + ' does not exist.');
912 echo('Try copying one of the examples in test/resources/browser_manifests');
913 exit(1);
914 }
915
c4eab85 Jon Buckley Issue #2008 - Fix lint errors for make.js
jbuck authored
916 var manifest;
b96152b Jakob Miland Support for building .crx file (re-visited)
saebekassebil authored
917 try {
c4eab85 Jon Buckley Issue #2008 - Fix lint errors for make.js
jbuck authored
918 manifest = JSON.parse(cat(browserManifest));
b96152b Jakob Miland Support for building .crx file (re-visited)
saebekassebil authored
919 } catch (e) {
920 echo('Malformed browser manifest file');
921 echo(e.message);
922 exit(1);
923 }
924
925 var executable;
926 manifest.forEach(function(browser) {
927 if (browser.name === 'chrome') {
928 executable = browser.path;
929 }
930 });
931
932 // If there was no chrome entry in the browser manifest, exit
c2cfa99 Yury Delendik Fixing new make.js lint errors
yurydelendik authored
933 if (!executable) {
b96152b Jakob Miland Support for building .crx file (re-visited)
saebekassebil authored
934 echo('There was no \'chrome\' entry in the browser manifest');
935 exit(1);
936 }
937
938 // If we're on a Darwin (Mac) OS, then let's check for an .app path
939 if (process.platform === 'darwin' && executable.indexOf('.app') !== -1) {
df32b43 Artur Adib Update make.js
arturadib authored
940 executable = executable + '/Contents/MacOS/Google Chrome';
b96152b Jakob Miland Support for building .crx file (re-visited)
saebekassebil authored
941 }
942
943 // If the chrome executable doesn't exist
c2cfa99 Yury Delendik Fixing new make.js lint errors
yurydelendik authored
944 if (!test('-f', executable)) {
b96152b Jakob Miland Support for building .crx file (re-visited)
saebekassebil authored
945 echo('Incorrect executable path to chrome');
946 exit(1);
947 }
948
949 // Let chrome pack the extension for us
950 exec('"' + executable + '"' +
951 ' --no-message-box' +
952 ' "--pack-extension=' + ROOT_DIR + CHROME_BUILD_DIR + '"' +
953 ' "--pack-extension-key=' + pem + '"');
954
955 // Rename to pdf.js.crx
956 mv(BUILD_DIR + 'chrome.crx', CHROME_BUILD_DIR + 'pdf.js.crx');
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
957 };
f6ba384 Artur Adib Using ShellJS
arturadib authored
958
959
5cf0d8f Yury Delendik Enforces maxlen for jshint
yurydelendik authored
960 ////////////////////////////////////////////////////////////////////////////////
f6ba384 Artur Adib Using ShellJS
arturadib authored
961 //
962 // Test stuff
963 //
964
965 //
966 // make test
967 //
968 target.test = function() {
e18a2c5 Brendan Dahl Use test.py for unit tests too.
brendandahl authored
969 target.unittest({}, function() {
970 target.browsertest();
971 });
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
972 };
f6ba384 Artur Adib Using ShellJS
arturadib authored
973
974 //
89ceead Artur Adib make bottest
arturadib authored
975 // make bottest
976 // (Special tests for the Github bot)
977 //
978 target.bottest = function() {
eea1d90 Brendan Dahl Fix bottest.
brendandahl authored
979 target.unittest({}, function() {
5afec33 Yury Delendik Adds ttx test harness
yurydelendik authored
980 target.fonttest({}, function() {
981 target.browsertest({noreftest: true});
982 });
e18a2c5 Brendan Dahl Use test.py for unit tests too.
brendandahl authored
983 });
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
984 };
f6ba384 Artur Adib Using ShellJS
arturadib authored
985
986 //
987 // make browsertest
988 //
89ceead Artur Adib make bottest
arturadib authored
989 target.browsertest = function(options) {
f6ba384 Artur Adib Using ShellJS
arturadib authored
990 cd(ROOT_DIR);
991 echo();
992 echo('### Running browser tests');
993
994 var PDF_TEST = env['PDF_TEST'] || 'test_manifest.json',
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
995 PDF_BROWSERS = env['PDF_BROWSERS'] ||
996 'resources/browser_manifests/browser_manifest.json';
f6ba384 Artur Adib Using ShellJS
arturadib authored
997
a0a5c58 Artur Adib Upgrading ShellJS, introducing 'makeref'
arturadib authored
998 if (!test('-f', 'test/' + PDF_BROWSERS)) {
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
999 echo('Browser manifest file test/' + PDF_BROWSERS + ' does not exist.');
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
1000 echo('Copy one of the examples in test/resources/browser_manifests/');
f6ba384 Artur Adib Using ShellJS
arturadib authored
1001 exit(1);
1002 }
1003
3740bed Artur Adib minor fixes
arturadib authored
1004 var reftest = (options && options.noreftest) ? '' : '--reftest';
89ceead Artur Adib make bottest
arturadib authored
1005
f6ba384 Artur Adib Using ShellJS
arturadib authored
1006 cd('test');
0fe0bb1 Yury Delendik Removes test.py
yurydelendik authored
1007 exec('node test.js ' + reftest + ' --browserManifestFile=' +
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
1008 PDF_BROWSERS + ' --manifestFile=' + PDF_TEST, {async: true});
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
1009 };
f6ba384 Artur Adib Using ShellJS
arturadib authored
1010
1011 //
1012 // make unittest
1013 //
e18a2c5 Brendan Dahl Use test.py for unit tests too.
brendandahl authored
1014 target.unittest = function(options, callback) {
f6ba384 Artur Adib Using ShellJS
arturadib authored
1015 cd(ROOT_DIR);
1016 echo();
1017 echo('### Running unit tests');
1018
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
1019 var PDF_BROWSERS = env['PDF_BROWSERS'] ||
1020 'resources/browser_manifests/browser_manifest.json';
a0a5c58 Artur Adib Upgrading ShellJS, introducing 'makeref'
arturadib authored
1021
e18a2c5 Brendan Dahl Use test.py for unit tests too.
brendandahl authored
1022 if (!test('-f', 'test/' + PDF_BROWSERS)) {
1023 echo('Browser manifest file test/' + PDF_BROWSERS + ' does not exist.');
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
1024 echo('Copy one of the examples in test/resources/browser_manifests/');
e18a2c5 Brendan Dahl Use test.py for unit tests too.
brendandahl authored
1025 exit(1);
1026 }
1027 callback = callback || function() {};
1028 cd('test');
0fe0bb1 Yury Delendik Removes test.py
yurydelendik authored
1029 exec('node test.js --unitTest --browserManifestFile=' +
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
1030 PDF_BROWSERS, {async: true}, callback);
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
1031 };
f6ba384 Artur Adib Using ShellJS
arturadib authored
1032
a0a5c58 Artur Adib Upgrading ShellJS, introducing 'makeref'
arturadib authored
1033 //
5afec33 Yury Delendik Adds ttx test harness
yurydelendik authored
1034 // make fonttest
1035 //
1036 target.fonttest = function(options, callback) {
1037 cd(ROOT_DIR);
1038 echo();
1039 echo('### Running font tests');
1040
1041 var PDF_BROWSERS = env['PDF_BROWSERS'] ||
1042 'resources/browser_manifests/browser_manifest.json';
1043
1044 if (!test('-f', 'test/' + PDF_BROWSERS)) {
1045 echo('Browser manifest file test/' + PDF_BROWSERS + ' does not exist.');
1046 echo('Copy one of the examples in test/resources/browser_manifests/');
1047 exit(1);
1048 }
1049 callback = callback || function() {};
1050 cd('test');
0fe0bb1 Yury Delendik Removes test.py
yurydelendik authored
1051 exec('node test.js --fontTest --browserManifestFile=' +
5afec33 Yury Delendik Adds ttx test harness
yurydelendik authored
1052 PDF_BROWSERS, {async: true}, callback);
1053 };
1054
1055 //
3740bed Artur Adib minor fixes
arturadib authored
1056 // make botmakeref
1057 //
1058 target.botmakeref = function() {
1059 cd(ROOT_DIR);
1060 echo();
1061 echo('### Creating reference images');
1062
1063 var PDF_TEST = env['PDF_TEST'] || 'test_manifest.json',
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
1064 PDF_BROWSERS = env['PDF_BROWSERS'] ||
1065 'resources/browser_manifests/browser_manifest.json';
3740bed Artur Adib minor fixes
arturadib authored
1066
1067 if (!test('-f', 'test/' + PDF_BROWSERS)) {
1068 echo('Browser manifest file test/' + PDF_BROWSERS + ' does not exist.');
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
1069 echo('Copy one of the examples in test/resources/browser_manifests/');
3740bed Artur Adib minor fixes
arturadib authored
1070 exit(1);
1071 }
1072
1073 cd('test');
0fe0bb1 Yury Delendik Removes test.py
yurydelendik authored
1074 exec('node test.js --masterMode --noPrompts ' +
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
1075 '--browserManifestFile=' + PDF_BROWSERS, {async: true});
a0a5c58 Artur Adib Upgrading ShellJS, introducing 'makeref'
arturadib authored
1076 };
1077
fb0fd9e Yury Delendik Adds mozcentralcheck and mozcentraldiff targets
yurydelendik authored
1078 ////////////////////////////////////////////////////////////////////////////////
1079 //
1080 // Baseline operation
1081 //
1082 target.baseline = function() {
1083 cd(ROOT_DIR);
1084
1085 echo();
1086 echo('### Creating baseline environment');
1087
1088 var baselineCommit = env['BASELINE'];
1089 if (!baselineCommit) {
1090 echo('Baseline commit is not provided. Please specify BASELINE variable');
1091 exit(1);
1092 }
1093
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
1094 if (!test('-d', BUILD_DIR)) {
fb0fd9e Yury Delendik Adds mozcentralcheck and mozcentraldiff targets
yurydelendik authored
1095 mkdir(BUILD_DIR);
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
1096 }
fb0fd9e Yury Delendik Adds mozcentralcheck and mozcentraldiff targets
yurydelendik authored
1097
1098 var BASELINE_DIR = BUILD_DIR + 'baseline';
1099 if (test('-d', BASELINE_DIR)) {
1100 cd(BASELINE_DIR);
1101 exec('git fetch origin');
1102 } else {
1103 cd(BUILD_DIR);
1104 exec('git clone .. baseline');
1105 cd(ROOT_DIR + BASELINE_DIR);
1106 }
1107 exec('git checkout ' + baselineCommit);
1108 };
1109
1110 target.mozcentralbaseline = function() {
1111 target.baseline();
1112
1113 cd(ROOT_DIR);
1114
1115 echo();
1116 echo('### Creating mozcentral baseline environment');
1117
1118 var BASELINE_DIR = BUILD_DIR + 'baseline';
1119 var MOZCENTRAL_BASELINE_DIR = BUILD_DIR + 'mozcentral.baseline';
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
1120 if (test('-d', MOZCENTRAL_BASELINE_DIR)) {
fb0fd9e Yury Delendik Adds mozcentralcheck and mozcentraldiff targets
yurydelendik authored
1121 rm('-rf', MOZCENTRAL_BASELINE_DIR);
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
1122 }
fb0fd9e Yury Delendik Adds mozcentralcheck and mozcentraldiff targets
yurydelendik authored
1123
1124 cd(BASELINE_DIR);
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
1125 if (test('-d', 'build')) {
fb0fd9e Yury Delendik Adds mozcentralcheck and mozcentraldiff targets
yurydelendik authored
1126 rm('-rf', 'build');
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
1127 }
fb0fd9e Yury Delendik Adds mozcentralcheck and mozcentraldiff targets
yurydelendik authored
1128 exec('node make mozcentral');
1129
1130 cd(ROOT_DIR);
1131 mkdir(MOZCENTRAL_BASELINE_DIR);
1132 cp('-Rf', BASELINE_DIR + '/build/mozcentral/*', MOZCENTRAL_BASELINE_DIR);
1133 // fixing baseline
1134 if (test('-f', MOZCENTRAL_BASELINE_DIR +
1135 '/browser/extensions/pdfjs/PdfStreamConverter.js')) {
1136 rm(MOZCENTRAL_BASELINE_DIR +
1137 '/browser/extensions/pdfjs/PdfStreamConverter.js');
1138 }
1139
1140 cd(MOZCENTRAL_BASELINE_DIR);
1141 exec('git init');
1142 exec('git add .');
1143 exec('git commit -m "mozcentral baseline"');
1144 };
1145
1146 target.mozcentraldiff = function() {
1147 target.mozcentral();
1148
1149 cd(ROOT_DIR);
1150
1151 echo();
1152 echo('### Creating mozcentral diff');
1153
1154 var MOZCENTRAL_DIFF = BUILD_DIR + 'mozcentral.diff';
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
1155 if (test('-f', MOZCENTRAL_DIFF)) {
fb0fd9e Yury Delendik Adds mozcentralcheck and mozcentraldiff targets
yurydelendik authored
1156 rm(MOZCENTRAL_DIFF);
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
1157 }
fb0fd9e Yury Delendik Adds mozcentralcheck and mozcentraldiff targets
yurydelendik authored
1158
1159 var MOZCENTRAL_BASELINE_DIR = BUILD_DIR + 'mozcentral.baseline';
1160 if (!test('-d', MOZCENTRAL_BASELINE_DIR)) {
1161 echo('mozcentral baseline was not found');
1162 echo('Please build one using "node make mozcentralbaseline"');
1163 exit(1);
1164 }
1165 cd(MOZCENTRAL_BASELINE_DIR);
1166 exec('git reset --hard');
1167 cd(ROOT_DIR); rm('-rf', MOZCENTRAL_BASELINE_DIR + '/*'); // trying to be safe
1168 cd(MOZCENTRAL_BASELINE_DIR);
1169 cp('-Rf', '../mozcentral/*', '.');
1170 exec('git add -A');
1171 exec('git diff --binary --cached --unified=8', {silent: true}).output.
1172 to('../mozcentral.diff');
1173
1174 echo('Result diff can be found at ' + MOZCENTRAL_DIFF);
1175 };
1176
1177 target.mozcentralcheck = function() {
1178 cd(ROOT_DIR);
1179
1180 echo();
1181 echo('### Checking mozcentral changes');
1182
1183 var mcPath = env['MC_PATH'];
1184 if (!mcPath) {
1185 echo('mozilla-central path is not provided.');
1186 echo('Please specify MC_PATH variable');
1187 exit(1);
1188 }
1189 if ((mcPath[0] != '/' && mcPath[0] != '~' && mcPath[1] != ':') ||
1190 !test('-d', mcPath)) {
1191 echo('mozilla-central path is not in absolute form or does not exist.');
1192 exit(1);
1193 }
1194
1195 var MOZCENTRAL_DIFF = BUILD_DIR + 'mozcentral_changes.diff';
1196 if (test('-f', MOZCENTRAL_DIFF)) {
1197 rm(MOZCENTRAL_DIFF);
1198 }
1199
1200 var MOZCENTRAL_BASELINE_DIR = BUILD_DIR + 'mozcentral.baseline';
1201 if (!test('-d', MOZCENTRAL_BASELINE_DIR)) {
1202 echo('mozcentral baseline was not found');
1203 echo('Please build one using "node make mozcentralbaseline"');
1204 exit(1);
1205 }
1206 cd(MOZCENTRAL_BASELINE_DIR);
1207 exec('git reset --hard');
1208 cd(ROOT_DIR); rm('-rf', MOZCENTRAL_BASELINE_DIR + '/*'); // trying to be safe
1209 cd(MOZCENTRAL_BASELINE_DIR);
1210 mkdir('browser');
1211 cd('browser');
1212 mkdir('-p', 'extensions/pdfjs');
1213 cp('-Rf', mcPath + '/browser/extensions/pdfjs/*', 'extensions/pdfjs');
1214 mkdir('-p', 'locales/en-US/pdfviewer');
1215 cp('-Rf', mcPath + '/browser/locales/en-US/pdfviewer/*',
1216 'locales/en-US/pdfviewer');
1217 // Remove '.DS_Store' and other hidden files
1218 find('.').forEach(function(file) {
1219 if (file.match(/^\.\w|~$/)) {
1220 rm('-f', file);
1221 }
1222 });
1223
1224 cd('..');
1225 exec('git add -A');
1226 var diff = exec('git diff --binary --cached --unified=8',
1227 {silent: true}).output;
1228
1229 if (diff) {
1230 echo('There were changes found at mozilla-central.');
1231 diff.to('../mozcentral_changes.diff');
1232 echo('Result diff can be found at ' + MOZCENTRAL_DIFF);
1233 exit(1);
1234 }
1235
1236 echo('Success: there are no changes at mozilla-central');
1237 };
1238
f6ba384 Artur Adib Using ShellJS
arturadib authored
1239
5cf0d8f Yury Delendik Enforces maxlen for jshint
yurydelendik authored
1240 ////////////////////////////////////////////////////////////////////////////////
f6ba384 Artur Adib Using ShellJS
arturadib authored
1241 //
1242 // Other
1243 //
1244
1245 //
1246 // make server
1247 //
1248 target.server = function() {
1249 cd(ROOT_DIR);
1250 echo();
1251 echo('### Starting local server');
1252
4df24f4 Yury Delendik Replaces pythons web server
yurydelendik authored
1253 var WebServer = require('./test/webserver.js').WebServer;
1254 var server = new WebServer();
1255 server.port = 8888;
1256 server.start();
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
1257 };
f6ba384 Artur Adib Using ShellJS
arturadib authored
1258
1259 //
1260 // make lint
1261 //
1262 target.lint = function() {
1263 cd(ROOT_DIR);
1264 echo();
cb68adb Yury Delendik Replacing gjslint with jshint; fixing jshint for windows
yurydelendik authored
1265 echo('### Linting JS files');
19dbeaa Jon Buckley Issue #2008 - Add jshint
jbuck authored
1266
c4eab85 Jon Buckley Issue #2008 - Fix lint errors for make.js
jbuck authored
1267 var LINT_FILES = ['make.js',
10cdb48 Jon Buckley Issue #2008 - Fix lint errors for external/builder/
jbuck authored
1268 'external/builder/',
c226147 Jon Buckley Issue #2008 - Fix lint errors for external/crlfchecker/
jbuck authored
1269 'external/crlfchecker/',
19dbeaa Jon Buckley Issue #2008 - Add jshint
jbuck authored
1270 'src/',
cb68adb Yury Delendik Replacing gjslint with jshint; fixing jshint for windows
yurydelendik authored
1271 'web/',
63f4380 Yury Delendik Fixes lint for windows; adds test/font/fontutils.js
yurydelendik authored
1272 'test/downloadutils.js',
1273 'test/driver.js',
1274 'test/reporter.js',
1275 'test/test.js',
1276 'test/testutils.js',
1277 'test/webbrowser.js',
1278 'test/webserver.js',
1279 'test/font/fontutils.js',
1280 'test/font/ttxdriver.js',
cb68adb Yury Delendik Replacing gjslint with jshint; fixing jshint for windows
yurydelendik authored
1281 'test/unit/',
1282 'extensions/firefox/',
4a4f570 Andreas Bovens adjusted paths in make.js to reflect chromium instead of chrome
andreasbovens authored
1283 'extensions/chromium/'
19dbeaa Jon Buckley Issue #2008 - Add jshint
jbuck authored
1284 ];
1285
cb68adb Yury Delendik Replacing gjslint with jshint; fixing jshint for windows
yurydelendik authored
1286 var jshintPath = path.normalize('./node_modules/.bin/jshint');
1287 if (!test('-f', jshintPath)) {
1288 echo('jshint is not installed -- installing...');
2c82e72 Mitar Updated to current latest stable version of jshint.
mitar authored
1289 exec('npm install jshint@2.4.x'); // TODO read version from package.json
cb68adb Yury Delendik Replacing gjslint with jshint; fixing jshint for windows
yurydelendik authored
1290 }
1291
1292 exit(exec('"' + jshintPath + '" --reporter test/reporter.js ' +
5cf0d8f Yury Delendik Enforces maxlen for jshint
yurydelendik authored
1293 LINT_FILES.join(' ')).code);
cb68adb Yury Delendik Replacing gjslint with jshint; fixing jshint for windows
yurydelendik authored
1294
1295 crlfchecker.checkIfCrlfIsPresent(LINT_FILES);
19dbeaa Jon Buckley Issue #2008 - Add jshint
jbuck authored
1296 };
1297
1298 //
f6ba384 Artur Adib Using ShellJS
arturadib authored
1299 // make clean
1300 //
1301 target.clean = function() {
1302 cd(ROOT_DIR);
1303 echo();
1304 echo('### Cleaning up project builds');
1305
1306 rm('-rf', BUILD_DIR);
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
1307 };
b13798f Kalervo Kujala Add carriage return checks to make.js.
kkujala authored
1308
f4b677a Yury Delendik Generates proxy Makefile
yurydelendik authored
1309 //
1310 // make makefile
1311 //
1312 target.makefile = function() {
1313 var makefileContent = 'help:\n\tnode make\n\n';
dc451b0 Yury Delendik Adds .PHONY to Makefile
yurydelendik authored
1314 var targetsNames = [];
f4b677a Yury Delendik Generates proxy Makefile
yurydelendik authored
1315 for (var i in target) {
1316 makefileContent += i + ':\n\tnode make ' + i + '\n\n';
dc451b0 Yury Delendik Adds .PHONY to Makefile
yurydelendik authored
1317 targetsNames.push(i);
f4b677a Yury Delendik Generates proxy Makefile
yurydelendik authored
1318 }
dc451b0 Yury Delendik Adds .PHONY to Makefile
yurydelendik authored
1319 makefileContent += '.PHONY: ' + targetsNames.join(' ') + '\n';
f4b677a Yury Delendik Generates proxy Makefile
yurydelendik authored
1320 makefileContent.to('Makefile');
1321 };
c6f0094 Tim van der Meij Implements importl10n command
timvandermeij authored
1322
1323 //
1324 //make importl10n
1325 //
1326 target.importl10n = function() {
1327 var locales = require('./external/importL10n/locales.js');
1328 var LOCAL_L10N_DIR = 'l10n';
1329
1330 cd(ROOT_DIR);
1331 echo();
1332 echo('### Importing translations from mozilla-aurora');
1333
1334 if (!test('-d', LOCAL_L10N_DIR)) {
1335 mkdir(LOCAL_L10N_DIR);
1336 }
1337 cd(LOCAL_L10N_DIR);
1338
1339 locales.downloadL10n();
1340 };
Something went wrong with that request. Please try again.