Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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