Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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