Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 1345 lines (1138 sloc) 39.196 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',
1838ec0 Greg Jordan Add a singlefile target to build one concatenated file
gjuggler authored
373 ];
374
375 var MAIN_SRC_FILES = SHARED_SRC_FILES.concat([
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
376 'display/api.js',
377 'display/metadata.js',
378 'display/canvas.js',
f57c693 Yury Delendik Implements WebGL support
yurydelendik authored
379 'display/webgl.js',
bf432a3 Yury Delendik Refactors shared/pattern.js into core/ and display/
yurydelendik authored
380 'display/pattern_helper.js',
bdeca30 Yury Delendik Splits shared/annotation.js into core/ and display/
yurydelendik authored
381 'display/font_loader.js',
382 'display/annotation_helper.js',
1838ec0 Greg Jordan Add a singlefile target to build one concatenated file
gjuggler authored
383 ]);
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
384
5a49d2e Christian Krebs Create the WORKER_SRC_FILES and EXT_SRC_FILES lists in make automaticall...
chriskr authored
385 var srcFiles = builder.getWorkerSrcFiles('src/worker_loader.js');
386 var WORKER_SRC_FILES = srcFiles.srcFiles;
b13798f Kalervo Kujala Add carriage return checks to make.js.
kkujala authored
387
1838ec0 Greg Jordan Add a singlefile target to build one concatenated file
gjuggler authored
388 if (!defines.SINGLE_FILE) {
389 // We want shared_src_files in both pdf.js and pdf.worker.js
390 // unless it's being built in singlefile mode.
391 WORKER_SRC_FILES = SHARED_SRC_FILES.concat(WORKER_SRC_FILES);
04e2235 Greg Jordan Fix singlefile build target
gjuggler authored
392 } else {
393 // In singlefile mode, all of the src files will be bundled into
394 // the main pdf.js outuput.
395 MAIN_SRC_FILES = MAIN_SRC_FILES.concat(WORKER_SRC_FILES);
1838ec0 Greg Jordan Add a singlefile target to build one concatenated file
gjuggler authored
396 }
397
5a49d2e Christian Krebs Create the WORKER_SRC_FILES and EXT_SRC_FILES lists in make automaticall...
chriskr authored
398 var EXT_SRC_FILES = srcFiles.externalSrcFiles;
76d877e Brendan Dahl Strip out license for bundled version.
brendandahl authored
399
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
400 cd(SRC_DIR);
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 bundle('pdf.js', ROOT_DIR + BUILD_TARGET, MAIN_SRC_FILES, []);
403 var srcCopy = ROOT_DIR + BUILD_DIR + 'pdf.worker.js.temp';
404 cp('pdf.js', srcCopy);
405 bundle(srcCopy, ROOT_DIR + BUILD_WORKER_TARGET, WORKER_SRC_FILES,
406 EXT_SRC_FILES);
407 rm(srcCopy);
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
408 };
f6ba384 Artur Adib Using ShellJS
arturadib authored
409
1838ec0 Greg Jordan Add a singlefile target to build one concatenated file
gjuggler authored
410 //
411 // make singlefile
412 // Concatenates pdf.js and pdf.worker.js into one big pdf.combined.js, and
413 // flags the script loader to not attempt to load the separate worker JS file.
414 //
415 target.singlefile = function() {
416 cd(ROOT_DIR);
417 echo();
418 echo('### Creating singlefile build');
419
420 var SINGLE_FILE_DIR = BUILD_DIR + '/singlefile/';
421 var SINGLE_FILE_TARGET = BUILD_DIR + 'pdf.combined.js';
422
423 var defines = builder.merge(DEFINES, {SINGLE_FILE: true});
424 target.bundle({defines: defines});
425
426 cd(ROOT_DIR);
427
428 rm('-rf', SINGLE_FILE_DIR);
429 mkdir('-p', SINGLE_FILE_DIR);
430 mkdir('-p', SINGLE_FILE_DIR + BUILD_DIR);
431
432 var setup = {
433 defines: defines,
434 copy: [],
435 preprocess: [
436 [BUILD_TARGETS, SINGLE_FILE_DIR + BUILD_DIR]
437 ]
438 };
439 builder.build(setup);
440
441 cd(SINGLE_FILE_DIR);
442
443 echo();
04e2235 Greg Jordan Fix singlefile build target
gjuggler authored
444 echo('### Moving pdf.js to pdf.combined.js');
1838ec0 Greg Jordan Add a singlefile target to build one concatenated file
gjuggler authored
445 var pdfJs = cat(BUILD_TARGET);
446 pdfJs.to(SINGLE_FILE_TARGET);
447
448 rm(BUILD_TARGET);
449 rm(BUILD_WORKER_TARGET);
450
451 };
452
83b6eae Vivin Paliath pr #3356
vivin authored
453 function cleanupJSSource(file) {
454 var content = cat(file);
455
456 // Strip out all the vim/license headers.
457 var reg = /\n\/\* -\*- Mode(.|\n)*?Mozilla Foundation(.|\n)*?'use strict';/g;
458 content = content.replace(reg, '');
f6ba384 Artur Adib Using ShellJS
arturadib authored
459
83b6eae Vivin Paliath pr #3356
vivin authored
460 content.to(file);
461 }
f6ba384 Artur Adib Using ShellJS
arturadib authored
462
2b298a7 Yury Delendik Adds make minified command
yurydelendik authored
463 //
464 // make minified
465 // Builds the minified production viewer that should be compatible with most
466 // modern HTML5 browsers. Requires Google Closure Compiler.
467 //
468 target.minified = function() {
469 var compilerPath = process.env['CLOSURE_COMPILER'];
470 if (!compilerPath) {
471 echo('### Closure Compiler is not set. Specify CLOSURE_COMPILER variable');
472 exit(1);
473 }
474
475 target.bundle({});
476 target.locale();
477
478 cd(ROOT_DIR);
479 echo();
480 echo('### Creating minified viewer');
481
482 rm('-rf', MINIFIED_DIR);
483 mkdir('-p', MINIFIED_DIR);
484 mkdir('-p', MINIFIED_DIR + BUILD_DIR);
485 mkdir('-p', MINIFIED_DIR + '/web');
1d8f6cf Yury Delendik Updates make.js for cmaps and make binary cmaps by default
yurydelendik authored
486 mkdir('-p', MINIFIED_DIR + '/web/cmaps');
2b298a7 Yury Delendik Adds make minified command
yurydelendik authored
487
488 var defines = builder.merge(DEFINES, {GENERIC: true, MINIFIED: true});
489
490 var setup = {
491 defines: defines,
492 copy: [
493 [COMMON_WEB_FILES, MINIFIED_DIR + '/web'],
494 ['web/viewer.css', MINIFIED_DIR + '/web'],
495 ['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
496 ['external/bcmaps/*', MINIFIED_DIR + '/web/cmaps'],
2b298a7 Yury Delendik Adds make minified command
yurydelendik authored
497 ['web/locale', MINIFIED_DIR + '/web']
498 ],
499 preprocess: [
500 [BUILD_TARGETS, MINIFIED_DIR + BUILD_DIR],
501 [COMMON_WEB_FILES_PREPROCESS, MINIFIED_DIR + '/web']
502 ]
503 };
504 builder.build(setup);
505
506 var viewerFiles = [
507 'web/compatibility.js',
508 'external/webL10n/l10n.js',
509 MINIFIED_DIR + BUILD_DIR + 'pdf.js',
510 MINIFIED_DIR + '/web/viewer.js'
511 ];
512 var cmdPrefix = 'java -jar \"' + compilerPath + '\" ' +
513 '--language_in ECMASCRIPT5 ' +
514 '--warning_level QUIET ' +
515 '--compilation_level SIMPLE_OPTIMIZATIONS ';
516
517 echo();
518 echo('### Minifying js files');
519
520 exec(cmdPrefix + viewerFiles.map(function(s) {
521 return '--js \"' + s + '\"';
522 }).join(' ') +
523 ' --js_output_file \"' + MINIFIED_DIR + '/web/pdf.viewer.js\"');
524 exec(cmdPrefix + '--js \"' + MINIFIED_DIR + '/build/pdf.js' + '\" ' +
525 '--js_output_file \"' + MINIFIED_DIR + '/build/pdf.min.js' + '\"');
526 exec(cmdPrefix + '--js \"' + MINIFIED_DIR + '/build/pdf.worker.js' + '\" ' +
527 '--js_output_file \"' + MINIFIED_DIR + '/build/pdf.worker.min.js' + '\"');
528
529 echo();
530 echo('### Cleaning js files');
531
532 rm(MINIFIED_DIR + '/web/viewer.js');
533 rm(MINIFIED_DIR + '/web/debugger.js');
534 rm(MINIFIED_DIR + '/build/pdf.js');
535 rm(MINIFIED_DIR + '/build/pdf.worker.js');
536 mv(MINIFIED_DIR + '/build/pdf.min.js',
537 MINIFIED_DIR + '/build/pdf.js');
538 mv(MINIFIED_DIR + '/build/pdf.worker.min.js',
539 MINIFIED_DIR + '/build/pdf.worker.js');
540 };
541
5cf0d8f Yury Delendik Enforces maxlen for jshint
yurydelendik authored
542 ////////////////////////////////////////////////////////////////////////////////
f6ba384 Artur Adib Using ShellJS
arturadib authored
543 //
544 // Extension stuff
545 //
546
547 //
548 // make extension
549 //
550 target.extension = function() {
551 cd(ROOT_DIR);
552 echo();
553 echo('### Building extensions');
554
085723a Yury Delendik make the locale stuff a precondition for make extension
yurydelendik authored
555 target.locale();
f6ba384 Artur Adib Using ShellJS
arturadib authored
556 target.firefox();
8dc41e7 Andreas Bovens adjusted some more chrome references in make.js and README.js as per @yu...
andreasbovens authored
557 target.chromium();
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
558 };
f6ba384 Artur Adib Using ShellJS
arturadib authored
559
560 target.buildnumber = function() {
561 cd(ROOT_DIR);
562 echo();
563 echo('### Getting extension build number');
564
332ae4c Brendan Dahl Change to the Apache v2 license.
brendandahl authored
565 var lines = exec('git log --format=oneline ' +
3ce622a Brendan Dahl Redo and add more documentation to gh-pages.
brendandahl authored
566 config.baseVersion + '..', {silent: true}).output;
f6ba384 Artur Adib Using ShellJS
arturadib authored
567 // Build number is the number of commits since base version
3ce622a Brendan Dahl Redo and add more documentation to gh-pages.
brendandahl authored
568 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
569
3ce622a Brendan Dahl Redo and add more documentation to gh-pages.
brendandahl authored
570 echo('Extension build number: ' + BUILD_NUMBER);
6abbc28 notmasteryet Changing make.js
notmasteryet authored
571
3ce622a Brendan Dahl Redo and add more documentation to gh-pages.
brendandahl authored
572 VERSION = config.versionPrefix + BUILD_NUMBER;
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
573 };
f6ba384 Artur Adib Using ShellJS
arturadib authored
574
575 //
576 // make firefox
577 //
578 target.firefox = function() {
579 cd(ROOT_DIR);
580 echo();
581 echo('### Building Firefox extension');
e0a6b23 Brendan Dahl Move builder/preprocessor into its own file.
brendandahl authored
582 var defines = builder.merge(DEFINES, {FIREFOX: true});
f6ba384 Artur Adib Using ShellJS
arturadib authored
583
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
584 var FIREFOX_BUILD_CONTENT_DIR = FIREFOX_BUILD_DIR + '/content/',
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
585 FIREFOX_EXTENSION_DIR = 'extensions/firefox/',
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
586 FIREFOX_CONTENT_DIR = EXTENSION_SRC_DIR + '/firefox/content/',
f6ba384 Artur Adib Using ShellJS
arturadib authored
587 FIREFOX_EXTENSION_FILES_TO_COPY =
588 ['*.js',
589 '*.rdf',
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
590 '*.svg',
cd1fd17 Brendan Dahl Add icon for extension.
brendandahl authored
591 '*.png',
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
592 '*.manifest',
593 'locale',
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
594 '../../LICENSE'],
f6ba384 Artur Adib Using ShellJS
arturadib authored
595 FIREFOX_EXTENSION_FILES =
6abbc28 notmasteryet Changing make.js
notmasteryet authored
596 ['bootstrap.js',
f6ba384 Artur Adib Using ShellJS
arturadib authored
597 'install.rdf',
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
598 'chrome.manifest',
cd1fd17 Brendan Dahl Add icon for extension.
brendandahl authored
599 'icon.png',
600 'icon64.png',
6abbc28 notmasteryet Changing make.js
notmasteryet authored
601 'content',
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
602 'locale',
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
603 'LICENSE'],
f6ba384 Artur Adib Using ShellJS
arturadib authored
604 FIREFOX_EXTENSION_NAME = 'pdf.js.xpi',
605 FIREFOX_AMO_EXTENSION_NAME = 'pdf.js.amo.xpi';
606
085723a Yury Delendik make the locale stuff a precondition for make extension
yurydelendik authored
607 target.locale();
3f530c4 Yury Delendik Specifies default workerSrc (if possible)
yurydelendik authored
608 target.bundle({ excludes: ['core/network.js'], defines: defines });
f6ba384 Artur Adib Using ShellJS
arturadib authored
609 cd(ROOT_DIR);
610
611 // Clear out everything in the firefox extension build directory
612 rm('-rf', FIREFOX_BUILD_DIR);
613 mkdir('-p', FIREFOX_BUILD_CONTENT_DIR);
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
614 mkdir('-p', FIREFOX_BUILD_CONTENT_DIR + BUILD_DIR);
615 mkdir('-p', FIREFOX_BUILD_CONTENT_DIR + '/web');
1d8f6cf Yury Delendik Updates make.js for cmaps and make binary cmaps by default
yurydelendik authored
616 mkdir('-p', FIREFOX_BUILD_CONTENT_DIR + '/web/cmaps');
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
617
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
618 cp(FIREFOX_CONTENT_DIR + 'PdfJs-stub.jsm',
619 FIREFOX_BUILD_CONTENT_DIR + 'PdfJs.jsm');
1bb7a7e Yury Delendik Adds stub PdfJs.jsm for FF15
yurydelendik authored
620
ba23a9e Yury Delendik Adds initial telemetry probes
yurydelendik authored
621 cp(FIREFOX_CONTENT_DIR + 'PdfJsTelemetry-addon.jsm',
622 FIREFOX_BUILD_CONTENT_DIR + 'PdfJsTelemetry.jsm');
623
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
624 // Copy extension files
6046c55 Kalervo Kujala Fix few jslint warnings in make.js.
kkujala authored
625 cd(FIREFOX_EXTENSION_DIR);
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
626 cp('-R', FIREFOX_EXTENSION_FILES_TO_COPY, ROOT_DIR + FIREFOX_BUILD_DIR);
f6ba384 Artur Adib Using ShellJS
arturadib authored
627 cd(ROOT_DIR);
628
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
629 var setup = {
630 defines: defines,
631 copy: [
632 [COMMON_WEB_FILES, FIREFOX_BUILD_CONTENT_DIR + '/web'],
d95f786 Yury Delendik Adds compatibility.js to the Firefox extension
yurydelendik authored
633 ['web/compatibility.js', FIREFOX_BUILD_CONTENT_DIR + '/web'],
1d8f6cf Yury Delendik Updates make.js for cmaps and make binary cmaps by default
yurydelendik authored
634 ['external/bcmaps/*', FIREFOX_BUILD_CONTENT_DIR + '/web/cmaps'],
6046c55 Kalervo Kujala Fix few jslint warnings in make.js.
kkujala authored
635 [FIREFOX_EXTENSION_DIR + 'tools/l10n.js',
f6cfab0 Jonas Jenwald [Firefox] Stop importing default_preferences.js as a module and include ...
Snuffleupagus authored
636 FIREFOX_BUILD_CONTENT_DIR + '/web']
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
637 ],
638 preprocess: [
babd8df Brendan Dahl Un-inline pdf.js for the extension/mozcentral and remove fetch pdf by co...
brendandahl authored
639 [COMMON_WEB_FILES_PREPROCESS, FIREFOX_BUILD_CONTENT_DIR + '/web'],
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
640 [BUILD_TARGETS, FIREFOX_BUILD_CONTENT_DIR + BUILD_DIR],
b9ba808 Yury Delendik Adds some addon/mozcentral files to the preprocessor
yurydelendik authored
641 [FIREFOX_CONTENT_DIR + 'PdfStreamConverter.jsm',
642 FIREFOX_BUILD_CONTENT_DIR],
643 [FIREFOX_CONTENT_DIR + 'PdfRedirector.jsm', FIREFOX_BUILD_CONTENT_DIR],
f6cfab0 Jonas Jenwald [Firefox] Stop importing default_preferences.js as a module and include ...
Snuffleupagus authored
644 [SRC_DIR + 'core/network.js', FIREFOX_BUILD_CONTENT_DIR],
645 [FIREFOX_EXTENSION_DIR + 'bootstrap.js', FIREFOX_BUILD_DIR]
2ab481a Yury Delendik Removes foreign for Firefox CSS prefixes
yurydelendik authored
646 ],
647 preprocessCSS: [
648 ['firefox', 'web/viewer.css',
649 FIREFOX_BUILD_CONTENT_DIR + '/web/viewer.css']
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
650 ]
651 };
e0a6b23 Brendan Dahl Move builder/preprocessor into its own file.
brendandahl authored
652 builder.build(setup);
f6ba384 Artur Adib Using ShellJS
arturadib authored
653
83b6eae Vivin Paliath pr #3356
vivin authored
654 cleanupJSSource(FIREFOX_BUILD_CONTENT_DIR + '/web/viewer.js');
f6cfab0 Jonas Jenwald [Firefox] Stop importing default_preferences.js as a module and include ...
Snuffleupagus authored
655 cleanupJSSource(FIREFOX_BUILD_DIR + 'bootstrap.js');
83b6eae Vivin Paliath pr #3356
vivin authored
656
c3bdf1e Artur Adib adding new find() commands
arturadib authored
657 // Remove '.DS_Store' and other hidden files
a0a5c58 Artur Adib Upgrading ShellJS, introducing 'makeref'
arturadib authored
658 find(FIREFOX_BUILD_DIR).forEach(function(file) {
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
659 if (file.match(/^\./)) {
c3bdf1e Artur Adib adding new find() commands
arturadib authored
660 rm('-f', file);
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
661 }
a0a5c58 Artur Adib Upgrading ShellJS, introducing 'makeref'
arturadib authored
662 });
f6ba384 Artur Adib Using ShellJS
arturadib authored
663
664 // Update the build version number
3ce622a Brendan Dahl Redo and add more documentation to gh-pages.
brendandahl authored
665 sed('-i', /PDFJSSCRIPT_VERSION/, VERSION,
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
666 FIREFOX_BUILD_DIR + '/install.rdf');
3ce622a Brendan Dahl Redo and add more documentation to gh-pages.
brendandahl authored
667 sed('-i', /PDFJSSCRIPT_VERSION/, VERSION,
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
668 FIREFOX_BUILD_DIR + '/update.rdf');
669
670 sed('-i', /PDFJSSCRIPT_STREAM_CONVERTER_ID/, FIREFOX_STREAM_CONVERTER_ID,
b8f7bca Brendan Dahl Use only one resource url for moz central build.
brendandahl authored
671 FIREFOX_BUILD_CONTENT_DIR + 'PdfStreamConverter.jsm');
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
672 sed('-i', /PDFJSSCRIPT_PREF_PREFIX/, FIREFOX_PREF_PREFIX,
b8f7bca Brendan Dahl Use only one resource url for moz central build.
brendandahl authored
673 FIREFOX_BUILD_CONTENT_DIR + 'PdfStreamConverter.jsm');
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
674 sed('-i', /PDFJSSCRIPT_MOZ_CENTRAL/, 'false',
b8f7bca Brendan Dahl Use only one resource url for moz central build.
brendandahl authored
675 FIREFOX_BUILD_CONTENT_DIR + 'PdfStreamConverter.jsm');
4bee4c6 Brendan Dahl Use different id's for moz central and extension.
brendandahl authored
676
427a5f1 Yury Delendik Move localization to l10n folders; create 'make locale'
yurydelendik authored
677 // Update localized metadata
678 var localizedMetadata = cat(EXTENSION_SRC_DIR + '/firefox/metadata.inc');
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
679 sed('-i', /.*PDFJS_LOCALIZED_METADATA.*\n/, localizedMetadata,
680 FIREFOX_BUILD_DIR + '/install.rdf');
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
681 var chromeManifest = cat(EXTENSION_SRC_DIR + '/firefox/chrome.manifest.inc');
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
682 sed('-i', /.*PDFJS_SUPPORTED_LOCALES.*\n/, chromeManifest,
683 FIREFOX_BUILD_DIR + '/chrome.manifest');
427a5f1 Yury Delendik Move localization to l10n folders; create 'make locale'
yurydelendik authored
684
f6ba384 Artur Adib Using ShellJS
arturadib authored
685 // Create the xpi
686 cd(FIREFOX_BUILD_DIR);
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
687 exec('zip -r ' + FIREFOX_EXTENSION_NAME + ' ' +
688 FIREFOX_EXTENSION_FILES.join(' '));
f6ba384 Artur Adib Using ShellJS
arturadib authored
689 echo('extension created: ' + FIREFOX_EXTENSION_NAME);
690 cd(ROOT_DIR);
691
692 // Build the amo extension too (remove the updateUrl)
693 cd(FIREFOX_BUILD_DIR);
694 sed('-i', /.*updateURL.*\n/, '', 'install.rdf');
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
695 exec('zip -r ' + FIREFOX_AMO_EXTENSION_NAME + ' ' +
696 FIREFOX_EXTENSION_FILES.join(' '));
f6ba384 Artur Adib Using ShellJS
arturadib authored
697 echo('AMO extension created: ' + FIREFOX_AMO_EXTENSION_NAME);
698 cd(ROOT_DIR);
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
699 };
700
701 //
702 // make mozcentral
703 //
704 target.mozcentral = function() {
705 cd(ROOT_DIR);
706 echo();
707 echo('### Building mozilla-central extension');
e0a6b23 Brendan Dahl Move builder/preprocessor into its own file.
brendandahl authored
708 var defines = builder.merge(DEFINES, {MOZCENTRAL: true});
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
709
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
710 var MOZCENTRAL_DIR = BUILD_DIR + 'mozcentral/',
424f522 Artur Adib Fixed moz-central manifest; bundling Mochitests
arturadib authored
711 MOZCENTRAL_EXTENSION_DIR = MOZCENTRAL_DIR + 'browser/extensions/pdfjs/',
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
712 MOZCENTRAL_CONTENT_DIR = MOZCENTRAL_EXTENSION_DIR + 'content/',
713 MOZCENTRAL_L10N_DIR = MOZCENTRAL_DIR + 'browser/locales/en-US/pdfviewer/',
424f522 Artur Adib Fixed moz-central manifest; bundling Mochitests
arturadib authored
714 MOZCENTRAL_TEST_DIR = MOZCENTRAL_EXTENSION_DIR + 'test/',
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
715 FIREFOX_CONTENT_DIR = EXTENSION_SRC_DIR + '/firefox/content/',
716 FIREFOX_EXTENSION_FILES_TO_COPY =
fb0fd9e Yury Delendik Adds mozcentralcheck and mozcentraldiff targets
yurydelendik authored
717 ['*.svg',
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
718 '*.png',
6323c8e Yury Delendik Loading extension resources via stringbundle
yurydelendik authored
719 '*.manifest',
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
720 'README.mozilla',
721 '../../LICENSE'],
722 DEFAULT_LOCALE_FILES =
03032d2 Brendan Dahl Add chrome.properties for moz central build.
brendandahl authored
723 [LOCALE_SRC_DIR + 'en-US/viewer.properties',
2684c79 Tim van der Meij Cleaning up files in extension
timvandermeij authored
724 LOCALE_SRC_DIR + 'en-US/chrome.properties'],
725 FIREFOX_MC_EXCLUDED_FILES =
726 ['icon.png',
727 'icon64.png'];
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
728
3f530c4 Yury Delendik Specifies default workerSrc (if possible)
yurydelendik authored
729 target.bundle({ excludes: ['core/network.js'], defines: defines });
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
730 cd(ROOT_DIR);
731
732 // Clear out everything in the firefox extension build directory
733 rm('-rf', MOZCENTRAL_DIR);
734 mkdir('-p', MOZCENTRAL_CONTENT_DIR);
735 mkdir('-p', MOZCENTRAL_L10N_DIR);
736 mkdir('-p', MOZCENTRAL_CONTENT_DIR + BUILD_DIR);
737 mkdir('-p', MOZCENTRAL_CONTENT_DIR + '/web');
1d8f6cf Yury Delendik Updates make.js for cmaps and make binary cmaps by default
yurydelendik authored
738 mkdir('-p', MOZCENTRAL_CONTENT_DIR + '/web/cmaps');
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
739
ba23a9e Yury Delendik Adds initial telemetry probes
yurydelendik authored
740 cp(FIREFOX_CONTENT_DIR + 'PdfJsTelemetry.jsm', MOZCENTRAL_CONTENT_DIR);
3d7f01d Brendan Dahl Add global pref to enable/disable. Control pdf.js in application prefer...
brendandahl authored
741
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
742 // Copy extension files
743 cd('extensions/firefox');
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
744 cp('-R', FIREFOX_EXTENSION_FILES_TO_COPY,
745 ROOT_DIR + MOZCENTRAL_EXTENSION_DIR);
424f522 Artur Adib Fixed moz-central manifest; bundling Mochitests
arturadib authored
746 mv('-f', ROOT_DIR + MOZCENTRAL_EXTENSION_DIR + '/chrome-mozcentral.manifest',
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
747 ROOT_DIR + MOZCENTRAL_EXTENSION_DIR + '/chrome.manifest');
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
748 cd(ROOT_DIR);
749
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
750 var setup = {
751 defines: defines,
752 copy: [
753 [COMMON_WEB_FILES, MOZCENTRAL_CONTENT_DIR + '/web'],
1d8f6cf Yury Delendik Updates make.js for cmaps and make binary cmaps by default
yurydelendik authored
754 ['external/bcmaps/*', MOZCENTRAL_CONTENT_DIR + '/web/cmaps'],
f6cfab0 Jonas Jenwald [Firefox] Stop importing default_preferences.js as a module and include ...
Snuffleupagus authored
755 ['extensions/firefox/tools/l10n.js', MOZCENTRAL_CONTENT_DIR + '/web']
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
756 ],
757 preprocess: [
babd8df Brendan Dahl Un-inline pdf.js for the extension/mozcentral and remove fetch pdf by co...
brendandahl authored
758 [COMMON_WEB_FILES_PREPROCESS, MOZCENTRAL_CONTENT_DIR + '/web'],
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
759 [BUILD_TARGETS, MOZCENTRAL_CONTENT_DIR + BUILD_DIR],
f6cfab0 Jonas Jenwald [Firefox] Stop importing default_preferences.js as a module and include ...
Snuffleupagus authored
760 [SRC_DIR + 'core/network.js', MOZCENTRAL_CONTENT_DIR],
b9ba808 Yury Delendik Adds some addon/mozcentral files to the preprocessor
yurydelendik authored
761 [FIREFOX_CONTENT_DIR + 'PdfStreamConverter.jsm', MOZCENTRAL_CONTENT_DIR],
762 [FIREFOX_CONTENT_DIR + 'PdfRedirector.jsm', MOZCENTRAL_CONTENT_DIR],
f6cfab0 Jonas Jenwald [Firefox] Stop importing default_preferences.js as a module and include ...
Snuffleupagus authored
763 [FIREFOX_CONTENT_DIR + 'PdfJs.jsm', MOZCENTRAL_CONTENT_DIR]
2ab481a Yury Delendik Removes foreign for Firefox CSS prefixes
yurydelendik authored
764 ],
765 preprocessCSS: [
894c82c Yury Delendik Removes -moz-box-sizing usage
yurydelendik authored
766 ['mozcentral',
767 'web/viewer.css',
768 MOZCENTRAL_CONTENT_DIR + '/web/viewer.css']
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
769 ]
770 };
e0a6b23 Brendan Dahl Move builder/preprocessor into its own file.
brendandahl authored
771 builder.build(setup);
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
772
83b6eae Vivin Paliath pr #3356
vivin authored
773 cleanupJSSource(MOZCENTRAL_CONTENT_DIR + '/web/viewer.js');
f6cfab0 Jonas Jenwald [Firefox] Stop importing default_preferences.js as a module and include ...
Snuffleupagus authored
774 cleanupJSSource(MOZCENTRAL_CONTENT_DIR + '/PdfJs.jsm');
83b6eae Vivin Paliath pr #3356
vivin authored
775
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
776 // Remove '.DS_Store' and other hidden files
777 find(MOZCENTRAL_DIR).forEach(function(file) {
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
778 if (file.match(/^\./)) {
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
779 rm('-f', file);
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
780 }
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
781 });
782
2684c79 Tim van der Meij Cleaning up files in extension
timvandermeij authored
783 // Remove excluded files
784 cd(MOZCENTRAL_EXTENSION_DIR);
785 FIREFOX_MC_EXCLUDED_FILES.forEach(function(file) {
786 if (test('-f', file)) {
787 rm('-r', file);
788 }
789 });
790 cd(ROOT_DIR);
791
6aa1615 Yury Delendik Add mozcontral options
yurydelendik authored
792 // Copy default localization files
793 cp(DEFAULT_LOCALE_FILES, MOZCENTRAL_L10N_DIR);
794
795 // Update the build version number
3ce622a Brendan Dahl Redo and add more documentation to gh-pages.
brendandahl authored
796 sed('-i', /PDFJSSCRIPT_VERSION/, VERSION,
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
797 MOZCENTRAL_EXTENSION_DIR + 'README.mozilla');
6abbc28 notmasteryet Changing make.js
notmasteryet authored
798
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
799 sed('-i', /PDFJSSCRIPT_STREAM_CONVERTER_ID/, MOZCENTRAL_STREAM_CONVERTER_ID,
b8f7bca Brendan Dahl Use only one resource url for moz central build.
brendandahl authored
800 MOZCENTRAL_CONTENT_DIR + 'PdfStreamConverter.jsm');
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
801 sed('-i', /PDFJSSCRIPT_PREF_PREFIX/, MOZCENTRAL_PREF_PREFIX,
b8f7bca Brendan Dahl Use only one resource url for moz central build.
brendandahl authored
802 MOZCENTRAL_CONTENT_DIR + 'PdfStreamConverter.jsm');
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
803 sed('-i', /PDFJSSCRIPT_MOZ_CENTRAL/, 'true',
b8f7bca Brendan Dahl Use only one resource url for moz central build.
brendandahl authored
804 MOZCENTRAL_CONTENT_DIR + 'PdfStreamConverter.jsm');
4bee4c6 Brendan Dahl Use different id's for moz central and extension.
brendandahl authored
805
424f522 Artur Adib Fixed moz-central manifest; bundling Mochitests
arturadib authored
806 // Copy test files
807 mkdir('-p', MOZCENTRAL_TEST_DIR);
808 cp('-Rf', 'test/mozcentral/*', MOZCENTRAL_TEST_DIR);
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
809 };
f6ba384 Artur Adib Using ShellJS
arturadib authored
810
6d35073 Brendan Dahl Initial build for b2g.
brendandahl authored
811 target.b2g = function() {
fd4e40c Brendan Dahl New GUI for B2G viewer.
brendandahl authored
812 target.locale();
7b70710 Yury Delendik Traces pdf.js version
yurydelendik authored
813
6d35073 Brendan Dahl Initial build for b2g.
brendandahl authored
814 echo();
815 echo('### Building B2G (Firefox OS App)');
c79acf5 Brendan Dahl Fix the B2G viewer and enable bot preview.
brendandahl authored
816 var B2G_BUILD_CONTENT_DIR = B2G_BUILD_DIR + '/content/';
e0a6b23 Brendan Dahl Move builder/preprocessor into its own file.
brendandahl authored
817 var defines = builder.merge(DEFINES, { B2G: true });
3f530c4 Yury Delendik Specifies default workerSrc (if possible)
yurydelendik authored
818 target.bundle({ defines: defines });
e0a6b23 Brendan Dahl Move builder/preprocessor into its own file.
brendandahl authored
819
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
820 // Clear out everything in the b2g build directory
6d35073 Brendan Dahl Initial build for b2g.
brendandahl authored
821 cd(ROOT_DIR);
822 rm('-Rf', B2G_BUILD_DIR);
823 mkdir('-p', B2G_BUILD_CONTENT_DIR);
824 mkdir('-p', B2G_BUILD_CONTENT_DIR + BUILD_DIR);
825 mkdir('-p', B2G_BUILD_CONTENT_DIR + '/web');
1d8f6cf Yury Delendik Updates make.js for cmaps and make binary cmaps by default
yurydelendik authored
826 mkdir('-p', B2G_BUILD_CONTENT_DIR + '/web/cmaps');
6d35073 Brendan Dahl Initial build for b2g.
brendandahl authored
827
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
828 var setup = {
829 defines: defines,
830 copy: [
fd4e40c Brendan Dahl New GUI for B2G viewer.
brendandahl authored
831 ['extensions/b2g/images', B2G_BUILD_CONTENT_DIR + '/web'],
832 ['extensions/b2g/viewer.html', B2G_BUILD_CONTENT_DIR + '/web'],
833 ['extensions/b2g/viewer.css', B2G_BUILD_CONTENT_DIR + '/web'],
e5247e4 Yury Delendik Updates webL10n; using viewer.properties as is
yurydelendik authored
834 ['web/locale', B2G_BUILD_CONTENT_DIR + '/web'],
1d8f6cf Yury Delendik Updates make.js for cmaps and make binary cmaps by default
yurydelendik authored
835 ['external/bcmaps/*', B2G_BUILD_CONTENT_DIR + '/web/cmaps'],
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
836 ['external/webL10n/l10n.js', B2G_BUILD_CONTENT_DIR + '/web']
837 ],
838 preprocess: [
fd4e40c Brendan Dahl New GUI for B2G viewer.
brendandahl authored
839 ['web/viewer.js', B2G_BUILD_CONTENT_DIR + '/web'],
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
840 [BUILD_TARGETS, B2G_BUILD_CONTENT_DIR + BUILD_DIR]
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
841 ]
6d35073 Brendan Dahl Initial build for b2g.
brendandahl authored
842 };
e0a6b23 Brendan Dahl Move builder/preprocessor into its own file.
brendandahl authored
843 builder.build(setup);
83b6eae Vivin Paliath pr #3356
vivin authored
844
845 cleanupJSSource(B2G_BUILD_CONTENT_DIR + '/web/viewer.js');
6d35073 Brendan Dahl Initial build for b2g.
brendandahl authored
846 };
847
f6ba384 Artur Adib Using ShellJS
arturadib authored
848 //
849 // make chrome
850 //
8dc41e7 Andreas Bovens adjusted some more chrome references in make.js and README.js as per @yu...
andreasbovens authored
851 target.chromium = function() {
69efd9c Yury Delendik CMaps binary packing
yurydelendik authored
852 target.locale();
853
f6ba384 Artur Adib Using ShellJS
arturadib authored
854 cd(ROOT_DIR);
855 echo();
8dc41e7 Andreas Bovens adjusted some more chrome references in make.js and README.js as per @yu...
andreasbovens authored
856 echo('### Building Chromium extension');
e0a6b23 Brendan Dahl Move builder/preprocessor into its own file.
brendandahl authored
857 var defines = builder.merge(DEFINES, {CHROME: true});
f6ba384 Artur Adib Using ShellJS
arturadib authored
858
4a4f570 Andreas Bovens adjusted paths in make.js to reflect chromium instead of chrome
andreasbovens authored
859 var CHROME_BUILD_DIR = BUILD_DIR + '/chromium/',
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
860 CHROME_BUILD_CONTENT_DIR = CHROME_BUILD_DIR + '/content/';
f6ba384 Artur Adib Using ShellJS
arturadib authored
861
3f530c4 Yury Delendik Specifies default workerSrc (if possible)
yurydelendik authored
862 target.bundle({ defines: defines });
f6ba384 Artur Adib Using ShellJS
arturadib authored
863 cd(ROOT_DIR);
864
865 // Clear out everything in the chrome extension build directory
866 rm('-Rf', CHROME_BUILD_DIR);
867 mkdir('-p', CHROME_BUILD_CONTENT_DIR);
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
868 mkdir('-p', CHROME_BUILD_CONTENT_DIR + BUILD_DIR);
869 mkdir('-p', CHROME_BUILD_CONTENT_DIR + '/web');
f6ba384 Artur Adib Using ShellJS
arturadib authored
870
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
871 var setup = {
872 defines: defines,
873 copy: [
874 [COMMON_WEB_FILES, CHROME_BUILD_CONTENT_DIR + '/web'],
4a4f570 Andreas Bovens adjusted paths in make.js to reflect chromium instead of chrome
andreasbovens authored
875 [['extensions/chromium/*.json',
876 'extensions/chromium/*.html',
877 'extensions/chromium/*.js',
878 'extensions/chromium/*.css',
879 'extensions/chromium/icon*.png',],
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
880 CHROME_BUILD_DIR],
e5247e4 Yury Delendik Updates webL10n; using viewer.properties as is
yurydelendik authored
881 ['external/webL10n/l10n.js', CHROME_BUILD_CONTENT_DIR + '/web'],
2ab481a Yury Delendik Removes foreign for Firefox CSS prefixes
yurydelendik authored
882 ['web/viewer.css', CHROME_BUILD_CONTENT_DIR + '/web'],
1d8f6cf Yury Delendik Updates make.js for cmaps and make binary cmaps by default
yurydelendik authored
883 ['external/bcmaps/*', CHROME_BUILD_CONTENT_DIR + '/web/cmaps'],
e5247e4 Yury Delendik Updates webL10n; using viewer.properties as is
yurydelendik authored
884 ['web/locale', CHROME_BUILD_CONTENT_DIR + '/web']
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
885 ],
886 preprocess: [
5ecce49 Brendan Dahl Split files into worker and main thread pieces.
brendandahl authored
887 [BUILD_TARGETS, CHROME_BUILD_CONTENT_DIR + BUILD_DIR],
e5247e4 Yury Delendik Updates webL10n; using viewer.properties as is
yurydelendik authored
888 [COMMON_WEB_FILES_PREPROCESS, CHROME_BUILD_CONTENT_DIR + '/web']
492fa6e Brendan Dahl Add the new preprocessor.
brendandahl authored
889 ]
890 };
e0a6b23 Brendan Dahl Move builder/preprocessor into its own file.
brendandahl authored
891 builder.build(setup);
b96152b Jakob Miland Support for building .crx file (re-visited)
saebekassebil authored
892
83b6eae Vivin Paliath pr #3356
vivin authored
893 cleanupJSSource(CHROME_BUILD_CONTENT_DIR + '/web/viewer.js');
894
6ca9245 moderation Changes to allowed versioned building of Chrome extension that meets new
moderation authored
895 // Update the build version number
3ce622a Brendan Dahl Redo and add more documentation to gh-pages.
brendandahl authored
896 sed('-i', /PDFJSSCRIPT_VERSION/, VERSION,
6ca9245 moderation Changes to allowed versioned building of Chrome extension that meets new
moderation authored
897 CHROME_BUILD_DIR + '/manifest.json');
898
e181a3c Rob Wu Highly improved Chrome extension
Rob--W authored
899 // Allow PDF.js resources to be loaded by adding the files to
900 // the "web_accessible_resources" section.
901 var file_list = ls('-RA', CHROME_BUILD_CONTENT_DIR);
902 var public_chrome_files = file_list.reduce(function(war, file) {
903 // Exclude directories (naive: Exclude paths without dot)
904 if (file.indexOf('.') !== -1) {
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
905 // Only add a comma after the first file
906 if (war) {
907 war += ',\n';
908 }
909 war += JSON.stringify('content/' + file);
e181a3c Rob Wu Highly improved Chrome extension
Rob--W authored
910 }
911 return war;
912 }, '');
913 sed('-i', /"content\/\*"/, public_chrome_files,
914 CHROME_BUILD_DIR + '/manifest.json');
915
b96152b Jakob Miland Support for building .crx file (re-visited)
saebekassebil authored
916 // Bundle the files to a Chrome extension file .crx if path to key is set
917 var pem = env['PDFJS_CHROME_KEY'];
918 if (!pem) {
919 return;
920 }
921
922 echo();
923 echo('### Bundling .crx extension into ' + CHROME_BUILD_DIR);
924
925 if (!test('-f', pem)) {
926 echo('Incorrect PDFJS_CHROME_KEY path');
927 exit(1);
928 }
929
930 var browserManifest = env['PDF_BROWSERS'] ||
931 'test/resources/browser_manifests/browser_manifest.json';
932
933 if (!test('-f', browserManifest)) {
934 echo('Browser manifest file ' + browserManifest + ' does not exist.');
935 echo('Try copying one of the examples in test/resources/browser_manifests');
936 exit(1);
937 }
938
c4eab85 Jon Buckley Issue #2008 - Fix lint errors for make.js
jbuck authored
939 var manifest;
b96152b Jakob Miland Support for building .crx file (re-visited)
saebekassebil authored
940 try {
c4eab85 Jon Buckley Issue #2008 - Fix lint errors for make.js
jbuck authored
941 manifest = JSON.parse(cat(browserManifest));
b96152b Jakob Miland Support for building .crx file (re-visited)
saebekassebil authored
942 } catch (e) {
943 echo('Malformed browser manifest file');
944 echo(e.message);
945 exit(1);
946 }
947
948 var executable;
949 manifest.forEach(function(browser) {
950 if (browser.name === 'chrome') {
951 executable = browser.path;
952 }
953 });
954
955 // If there was no chrome entry in the browser manifest, exit
c2cfa99 Yury Delendik Fixing new make.js lint errors
yurydelendik authored
956 if (!executable) {
b96152b Jakob Miland Support for building .crx file (re-visited)
saebekassebil authored
957 echo('There was no \'chrome\' entry in the browser manifest');
958 exit(1);
959 }
960
961 // If we're on a Darwin (Mac) OS, then let's check for an .app path
962 if (process.platform === 'darwin' && executable.indexOf('.app') !== -1) {
df32b43 Artur Adib Update make.js
arturadib authored
963 executable = executable + '/Contents/MacOS/Google Chrome';
b96152b Jakob Miland Support for building .crx file (re-visited)
saebekassebil authored
964 }
965
966 // If the chrome executable doesn't exist
c2cfa99 Yury Delendik Fixing new make.js lint errors
yurydelendik authored
967 if (!test('-f', executable)) {
b96152b Jakob Miland Support for building .crx file (re-visited)
saebekassebil authored
968 echo('Incorrect executable path to chrome');
969 exit(1);
970 }
971
972 // Let chrome pack the extension for us
973 exec('"' + executable + '"' +
974 ' --no-message-box' +
975 ' "--pack-extension=' + ROOT_DIR + CHROME_BUILD_DIR + '"' +
976 ' "--pack-extension-key=' + pem + '"');
977
978 // Rename to pdf.js.crx
979 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
980 };
f6ba384 Artur Adib Using ShellJS
arturadib authored
981
982
5cf0d8f Yury Delendik Enforces maxlen for jshint
yurydelendik authored
983 ////////////////////////////////////////////////////////////////////////////////
f6ba384 Artur Adib Using ShellJS
arturadib authored
984 //
985 // Test stuff
986 //
987
988 //
989 // make test
990 //
991 target.test = function() {
e18a2c5 Brendan Dahl Use test.py for unit tests too.
brendandahl authored
992 target.unittest({}, function() {
993 target.browsertest();
994 });
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
995 };
f6ba384 Artur Adib Using ShellJS
arturadib authored
996
997 //
89ceead Artur Adib make bottest
arturadib authored
998 // make bottest
999 // (Special tests for the Github bot)
1000 //
1001 target.bottest = function() {
eea1d90 Brendan Dahl Fix bottest.
brendandahl authored
1002 target.unittest({}, function() {
5afec33 Yury Delendik Adds ttx test harness
yurydelendik authored
1003 target.fonttest({}, function() {
1004 target.browsertest({noreftest: true});
1005 });
e18a2c5 Brendan Dahl Use test.py for unit tests too.
brendandahl authored
1006 });
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
1007 };
f6ba384 Artur Adib Using ShellJS
arturadib authored
1008
1009 //
1010 // make browsertest
1011 //
89ceead Artur Adib make bottest
arturadib authored
1012 target.browsertest = function(options) {
f6ba384 Artur Adib Using ShellJS
arturadib authored
1013 cd(ROOT_DIR);
1014 echo();
1015 echo('### Running browser tests');
1016
1017 var PDF_TEST = env['PDF_TEST'] || 'test_manifest.json',
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
1018 PDF_BROWSERS = env['PDF_BROWSERS'] ||
1019 'resources/browser_manifests/browser_manifest.json';
f6ba384 Artur Adib Using ShellJS
arturadib authored
1020
a0a5c58 Artur Adib Upgrading ShellJS, introducing 'makeref'
arturadib authored
1021 if (!test('-f', 'test/' + PDF_BROWSERS)) {
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
1022 echo('Browser manifest file test/' + PDF_BROWSERS + ' does not exist.');
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
1023 echo('Copy one of the examples in test/resources/browser_manifests/');
f6ba384 Artur Adib Using ShellJS
arturadib authored
1024 exit(1);
1025 }
1026
3740bed Artur Adib minor fixes
arturadib authored
1027 var reftest = (options && options.noreftest) ? '' : '--reftest';
89ceead Artur Adib make bottest
arturadib authored
1028
f6ba384 Artur Adib Using ShellJS
arturadib authored
1029 cd('test');
0fe0bb1 Yury Delendik Removes test.py
yurydelendik authored
1030 exec('node test.js ' + reftest + ' --browserManifestFile=' +
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
1031 PDF_BROWSERS + ' --manifestFile=' + PDF_TEST, {async: true});
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
1032 };
f6ba384 Artur Adib Using ShellJS
arturadib authored
1033
1034 //
1035 // make unittest
1036 //
e18a2c5 Brendan Dahl Use test.py for unit tests too.
brendandahl authored
1037 target.unittest = function(options, callback) {
f6ba384 Artur Adib Using ShellJS
arturadib authored
1038 cd(ROOT_DIR);
1039 echo();
1040 echo('### Running unit tests');
1041
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
1042 var PDF_BROWSERS = env['PDF_BROWSERS'] ||
1043 'resources/browser_manifests/browser_manifest.json';
a0a5c58 Artur Adib Upgrading ShellJS, introducing 'makeref'
arturadib authored
1044
e18a2c5 Brendan Dahl Use test.py for unit tests too.
brendandahl authored
1045 if (!test('-f', 'test/' + PDF_BROWSERS)) {
1046 echo('Browser manifest file test/' + PDF_BROWSERS + ' does not exist.');
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
1047 echo('Copy one of the examples in test/resources/browser_manifests/');
e18a2c5 Brendan Dahl Use test.py for unit tests too.
brendandahl authored
1048 exit(1);
1049 }
1050 callback = callback || function() {};
1051 cd('test');
0fe0bb1 Yury Delendik Removes test.py
yurydelendik authored
1052 exec('node test.js --unitTest --browserManifestFile=' +
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
1053 PDF_BROWSERS, {async: true}, callback);
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
1054 };
f6ba384 Artur Adib Using ShellJS
arturadib authored
1055
a0a5c58 Artur Adib Upgrading ShellJS, introducing 'makeref'
arturadib authored
1056 //
5afec33 Yury Delendik Adds ttx test harness
yurydelendik authored
1057 // make fonttest
1058 //
1059 target.fonttest = function(options, callback) {
1060 cd(ROOT_DIR);
1061 echo();
1062 echo('### Running font tests');
1063
1064 var PDF_BROWSERS = env['PDF_BROWSERS'] ||
1065 'resources/browser_manifests/browser_manifest.json';
1066
1067 if (!test('-f', 'test/' + PDF_BROWSERS)) {
1068 echo('Browser manifest file test/' + PDF_BROWSERS + ' does not exist.');
1069 echo('Copy one of the examples in test/resources/browser_manifests/');
1070 exit(1);
1071 }
1072 callback = callback || function() {};
1073 cd('test');
0fe0bb1 Yury Delendik Removes test.py
yurydelendik authored
1074 exec('node test.js --fontTest --browserManifestFile=' +
5afec33 Yury Delendik Adds ttx test harness
yurydelendik authored
1075 PDF_BROWSERS, {async: true}, callback);
1076 };
1077
1078 //
3740bed Artur Adib minor fixes
arturadib authored
1079 // make botmakeref
1080 //
1081 target.botmakeref = function() {
1082 cd(ROOT_DIR);
1083 echo();
1084 echo('### Creating reference images');
1085
1086 var PDF_TEST = env['PDF_TEST'] || 'test_manifest.json',
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
1087 PDF_BROWSERS = env['PDF_BROWSERS'] ||
1088 'resources/browser_manifests/browser_manifest.json';
3740bed Artur Adib minor fixes
arturadib authored
1089
1090 if (!test('-f', 'test/' + PDF_BROWSERS)) {
1091 echo('Browser manifest file test/' + PDF_BROWSERS + ' does not exist.');
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
1092 echo('Copy one of the examples in test/resources/browser_manifests/');
3740bed Artur Adib minor fixes
arturadib authored
1093 exit(1);
1094 }
1095
1096 cd('test');
0fe0bb1 Yury Delendik Removes test.py
yurydelendik authored
1097 exec('node test.js --masterMode --noPrompts ' +
413acae Kalervo Kujala Correct gjslint warnings in make.js.
kkujala authored
1098 '--browserManifestFile=' + PDF_BROWSERS, {async: true});
a0a5c58 Artur Adib Upgrading ShellJS, introducing 'makeref'
arturadib authored
1099 };
1100
fb0fd9e Yury Delendik Adds mozcentralcheck and mozcentraldiff targets
yurydelendik authored
1101 ////////////////////////////////////////////////////////////////////////////////
1102 //
1103 // Baseline operation
1104 //
1105 target.baseline = function() {
1106 cd(ROOT_DIR);
1107
1108 echo();
1109 echo('### Creating baseline environment');
1110
1111 var baselineCommit = env['BASELINE'];
1112 if (!baselineCommit) {
1113 echo('Baseline commit is not provided. Please specify BASELINE variable');
1114 exit(1);
1115 }
1116
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
1117 if (!test('-d', BUILD_DIR)) {
fb0fd9e Yury Delendik Adds mozcentralcheck and mozcentraldiff targets
yurydelendik authored
1118 mkdir(BUILD_DIR);
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
1119 }
fb0fd9e Yury Delendik Adds mozcentralcheck and mozcentraldiff targets
yurydelendik authored
1120
1121 var BASELINE_DIR = BUILD_DIR + 'baseline';
1122 if (test('-d', BASELINE_DIR)) {
1123 cd(BASELINE_DIR);
1124 exec('git fetch origin');
1125 } else {
1126 cd(BUILD_DIR);
1127 exec('git clone .. baseline');
1128 cd(ROOT_DIR + BASELINE_DIR);
1129 }
1130 exec('git checkout ' + baselineCommit);
1131 };
1132
1133 target.mozcentralbaseline = function() {
1134 target.baseline();
1135
1136 cd(ROOT_DIR);
1137
1138 echo();
1139 echo('### Creating mozcentral baseline environment');
1140
1141 var BASELINE_DIR = BUILD_DIR + 'baseline';
1142 var MOZCENTRAL_BASELINE_DIR = BUILD_DIR + 'mozcentral.baseline';
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
1143 if (test('-d', MOZCENTRAL_BASELINE_DIR)) {
fb0fd9e Yury Delendik Adds mozcentralcheck and mozcentraldiff targets
yurydelendik authored
1144 rm('-rf', MOZCENTRAL_BASELINE_DIR);
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
1145 }
fb0fd9e Yury Delendik Adds mozcentralcheck and mozcentraldiff targets
yurydelendik authored
1146
1147 cd(BASELINE_DIR);
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
1148 if (test('-d', 'build')) {
fb0fd9e Yury Delendik Adds mozcentralcheck and mozcentraldiff targets
yurydelendik authored
1149 rm('-rf', 'build');
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
1150 }
fb0fd9e Yury Delendik Adds mozcentralcheck and mozcentraldiff targets
yurydelendik authored
1151 exec('node make mozcentral');
1152
1153 cd(ROOT_DIR);
1154 mkdir(MOZCENTRAL_BASELINE_DIR);
1155 cp('-Rf', BASELINE_DIR + '/build/mozcentral/*', MOZCENTRAL_BASELINE_DIR);
1156 // fixing baseline
1157 if (test('-f', MOZCENTRAL_BASELINE_DIR +
1158 '/browser/extensions/pdfjs/PdfStreamConverter.js')) {
1159 rm(MOZCENTRAL_BASELINE_DIR +
1160 '/browser/extensions/pdfjs/PdfStreamConverter.js');
1161 }
1162
1163 cd(MOZCENTRAL_BASELINE_DIR);
1164 exec('git init');
1165 exec('git add .');
1166 exec('git commit -m "mozcentral baseline"');
1167 };
1168
1169 target.mozcentraldiff = function() {
1170 target.mozcentral();
1171
1172 cd(ROOT_DIR);
1173
1174 echo();
1175 echo('### Creating mozcentral diff');
1176
1177 var MOZCENTRAL_DIFF = BUILD_DIR + 'mozcentral.diff';
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
1178 if (test('-f', MOZCENTRAL_DIFF)) {
fb0fd9e Yury Delendik Adds mozcentralcheck and mozcentraldiff targets
yurydelendik authored
1179 rm(MOZCENTRAL_DIFF);
855b969 Jonas Jenwald Fix coding style in make.js
Snuffleupagus authored
1180 }
fb0fd9e Yury Delendik Adds mozcentralcheck and mozcentraldiff targets
yurydelendik authored
1181
1182 var MOZCENTRAL_BASELINE_DIR = BUILD_DIR + 'mozcentral.baseline';
1183 if (!test('-d', MOZCENTRAL_BASELINE_DIR)) {
1184 echo('mozcentral baseline was not found');
1185 echo('Please build one using "node make mozcentralbaseline"');
1186 exit(1);
1187 }
1188 cd(MOZCENTRAL_BASELINE_DIR);
1189 exec('git reset --hard');
1190 cd(ROOT_DIR); rm('-rf', MOZCENTRAL_BASELINE_DIR + '/*'); // trying to be safe
1191 cd(MOZCENTRAL_BASELINE_DIR);
1192 cp('-Rf', '../mozcentral/*', '.');
1193 exec('git add -A');
1194 exec('git diff --binary --cached --unified=8', {silent: true}).output.
1195 to('../mozcentral.diff');
1196
1197 echo('Result diff can be found at ' + MOZCENTRAL_DIFF);
1198 };
1199
1200 target.mozcentralcheck = function() {
1201 cd(ROOT_DIR);
1202
1203 echo();
1204 echo('### Checking mozcentral changes');
1205
1206 var mcPath = env['MC_PATH'];
1207 if (!mcPath) {
1208 echo('mozilla-central path is not provided.');
1209 echo('Please specify MC_PATH variable');
1210 exit(1);
1211 }
1212 if ((mcPath[0] != '/' && mcPath[0] != '~' && mcPath[1] != ':') ||
1213 !test('-d', mcPath)) {
1214 echo('mozilla-central path is not in absolute form or does not exist.');
1215 exit(1);
1216 }
1217
1218 var MOZCENTRAL_DIFF = BUILD_DIR + 'mozcentral_changes.diff';
1219 if (test('-f', MOZCENTRAL_DIFF)) {
1220 rm(MOZCENTRAL_DIFF);
1221 }
1222
1223 var MOZCENTRAL_BASELINE_DIR = BUILD_DIR + 'mozcentral.baseline';
1224 if (!test('-d', MOZCENTRAL_BASELINE_DIR)) {
1225 echo('mozcentral baseline was not found');
1226 echo('Please build one using "node make mozcentralbaseline"');
1227 exit(1);
1228 }
1229 cd(MOZCENTRAL_BASELINE_DIR);
1230 exec('git reset --hard');
1231 cd(ROOT_DIR); rm('-rf', MOZCENTRAL_BASELINE_DIR + '/*'); // trying to be safe
1232 cd(MOZCENTRAL_BASELINE_DIR);
1233 mkdir('browser');
1234 cd('browser');
1235 mkdir('-p', 'extensions/pdfjs');
1236 cp('-Rf', mcPath + '/browser/extensions/pdfjs/*', 'extensions/pdfjs');
1237 mkdir('-p', 'locales/en-US/pdfviewer');
1238 cp('-Rf', mcPath + '/browser/locales/en-US/pdfviewer/*',
1239 'locales/en-US/pdfviewer');
1240 // Remove '.DS_Store' and other hidden files
1241 find('.').forEach(function(file) {
1242 if (file.match(/^\.\w|~$/)) {
1243 rm('-f', file);
1244 }
1245 });
1246
1247 cd('..');
1248 exec('git add -A');
1249 var diff = exec('git diff --binary --cached --unified=8',
1250 {silent: true}).output;
1251
1252 if (diff) {
1253 echo('There were changes found at mozilla-central.');
1254 diff.to('../mozcentral_changes.diff');
1255 echo('Result diff can be found at ' + MOZCENTRAL_DIFF);
1256 exit(1);
1257 }
1258
1259 echo('Success: there are no changes at mozilla-central');
1260 };
1261
f6ba384 Artur Adib Using ShellJS
arturadib authored
1262
5cf0d8f Yury Delendik Enforces maxlen for jshint
yurydelendik authored
1263 ////////////////////////////////////////////////////////////////////////////////
f6ba384 Artur Adib Using ShellJS
arturadib authored
1264 //
1265 // Other
1266 //
1267
1268 //
1269 // make server
1270 //
1271 target.server = function() {
1272 cd(ROOT_DIR);
1273 echo();
1274 echo('### Starting local server');
1275
4df24f4 Yury Delendik Replaces pythons web server
yurydelendik authored
1276 var WebServer = require('./test/webserver.js').WebServer;
1277 var server = new WebServer();
1278 server.port = 8888;
1279 server.start();
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
1280 };
f6ba384 Artur Adib Using ShellJS
arturadib authored
1281
1282 //
1283 // make lint
1284 //
1285 target.lint = function() {
1286 cd(ROOT_DIR);
1287 echo();
cb68adb Yury Delendik Replacing gjslint with jshint; fixing jshint for windows
yurydelendik authored
1288 echo('### Linting JS files');
19dbeaa Jon Buckley Issue #2008 - Add jshint
jbuck authored
1289
cb68adb Yury Delendik Replacing gjslint with jshint; fixing jshint for windows
yurydelendik authored
1290 var jshintPath = path.normalize('./node_modules/.bin/jshint');
1291 if (!test('-f', jshintPath)) {
1292 echo('jshint is not installed -- installing...');
2c82e72 Mitar Updated to current latest stable version of jshint.
mitar authored
1293 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
1294 }
1295
fcebe57 Yury Delendik Introduces .jshintignore
yurydelendik authored
1296 var exitCode = exec('"' + jshintPath + '" .').code;
1d066b7 Tim van der Meij Removes custom test/reporter.js from the lint process
timvandermeij authored
1297 if (exitCode === 0) {
1298 echo('files checked, no errors found');
1299 }
19dbeaa Jon Buckley Issue #2008 - Add jshint
jbuck authored
1300 };
1301
1302 //
f6ba384 Artur Adib Using ShellJS
arturadib authored
1303 // make clean
1304 //
1305 target.clean = function() {
1306 cd(ROOT_DIR);
1307 echo();
1308 echo('### Cleaning up project builds');
1309
1310 rm('-rf', BUILD_DIR);
30888e9 notmasteryet Exclude make.js from the linting; fixes few lint make.js errors
notmasteryet authored
1311 };
b13798f Kalervo Kujala Add carriage return checks to make.js.
kkujala authored
1312
f4b677a Yury Delendik Generates proxy Makefile
yurydelendik authored
1313 //
1314 // make makefile
1315 //
1316 target.makefile = function() {
1317 var makefileContent = 'help:\n\tnode make\n\n';
dc451b0 Yury Delendik Adds .PHONY to Makefile
yurydelendik authored
1318 var targetsNames = [];
f4b677a Yury Delendik Generates proxy Makefile
yurydelendik authored
1319 for (var i in target) {
1320 makefileContent += i + ':\n\tnode make ' + i + '\n\n';
dc451b0 Yury Delendik Adds .PHONY to Makefile
yurydelendik authored
1321 targetsNames.push(i);
f4b677a Yury Delendik Generates proxy Makefile
yurydelendik authored
1322 }
dc451b0 Yury Delendik Adds .PHONY to Makefile
yurydelendik authored
1323 makefileContent += '.PHONY: ' + targetsNames.join(' ') + '\n';
f4b677a Yury Delendik Generates proxy Makefile
yurydelendik authored
1324 makefileContent.to('Makefile');
1325 };
c6f0094 Tim van der Meij Implements importl10n command
timvandermeij authored
1326
1327 //
1328 //make importl10n
1329 //
1330 target.importl10n = function() {
1331 var locales = require('./external/importL10n/locales.js');
1332 var LOCAL_L10N_DIR = 'l10n';
1333
1334 cd(ROOT_DIR);
1335 echo();
1336 echo('### Importing translations from mozilla-aurora');
1337
1338 if (!test('-d', LOCAL_L10N_DIR)) {
1339 mkdir(LOCAL_L10N_DIR);
1340 }
1341 cd(LOCAL_L10N_DIR);
1342
1343 locales.downloadL10n();
1344 };
Something went wrong with that request. Please try again.