[Pkg-javascript-commits] [pdf.js] 54/141: Create the WORKER_SRC_FILES and EXT_SRC_FILES lists in make automatically

David Prévot taffit at moszumanska.debian.org
Sat Apr 19 22:40:29 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 5a49d2eb836d44b550eced0fbfd94b15682117fe
Author: Christian Krebs <chrisk at opera.com>
Date:   Wed Apr 9 14:04:43 2014 +0200

    Create the WORKER_SRC_FILES and EXT_SRC_FILES lists in make automatically
---
 external/builder/builder.js | 22 ++++++++++++++++++++++
 make.js                     | 33 +++------------------------------
 2 files changed, 25 insertions(+), 30 deletions(-)

diff --git a/external/builder/builder.js b/external/builder/builder.js
index 69b5d78..56a2990 100644
--- a/external/builder/builder.js
+++ b/external/builder/builder.js
@@ -220,6 +220,28 @@ function build(setup) {
 }
 exports.build = build;
 
+function getWorkerSrcFiles(filePath) {
+  var src = fs.readFileSync(filePath).toString();
+  var reSrcFiles = /var\s+otherFiles\s*=\s*(\[[^\]]*\])/;
+  var match = reSrcFiles.exec(src);
+  try {
+    var files = JSON.parse(match[1].replace(/'/g, '"'));
+    var srcFiles = files.filter(function(name) {
+      return name.indexOf('external') == -1;
+    });
+    var externalSrcFiles = files.filter(function(name) {
+      return name.indexOf('external') > -1;
+    });
+    return {
+      srcFiles: srcFiles,
+      externalSrcFiles: externalSrcFiles
+    };
+  } catch(e) {
+    return {};
+  }
+}
+exports.getWorkerSrcFiles = getWorkerSrcFiles;
+
 /**
  * Merge two defines arrays. Values in the second param will override values in
  * the first.
diff --git a/make.js b/make.js
index 6ba805b..953867b 100644
--- a/make.js
+++ b/make.js
@@ -325,33 +325,8 @@ target.bundle = function(args) {
     'display/font_loader.js'
   ]);
 
-  var WORKER_SRC_FILES = [
-    'core/network.js',
-    'core/chunked_stream.js',
-    'core/pdf_manager.js',
-    'core/core.js',
-    'core/obj.js',
-    'core/charsets.js',
-    'core/cidmaps.js',
-    'core/crypto.js',
-    'core/pattern.js',
-    'core/evaluator.js',
-    'core/fonts.js',
-    'core/font_renderer.js',
-    'core/glyphlist.js',
-    'core/image.js',
-    'core/metrics.js',
-    'core/parser.js',
-    'core/ps_parser.js',
-    'core/stream.js',
-    'core/worker.js',
-    'core/arithmetic_decoder.js',
-    'core/jpx.js',
-    'core/jbig2.js',
-    'core/bidi.js',
-    'core/cmap.js',
-    'core/murmurhash3.js'
-  ];
+  var srcFiles = builder.getWorkerSrcFiles('src/worker_loader.js');
+  var WORKER_SRC_FILES = srcFiles.srcFiles;
 
   if (!defines.SINGLE_FILE) {
     // We want shared_src_files in both pdf.js and pdf.worker.js
@@ -363,9 +338,7 @@ target.bundle = function(args) {
     MAIN_SRC_FILES = MAIN_SRC_FILES.concat(WORKER_SRC_FILES);
   }
 
-  var EXT_SRC_FILES = [
-    '../external/jpgjs/jpg.js'
-  ];
+  var EXT_SRC_FILES = srcFiles.externalSrcFiles;
 
   cd(SRC_DIR);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list