Bug 756542 - Implement make files to include Add-on SDK modules in builds. r=gavin
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Mon, 20 Aug 2012 13:51:39 +0200
changeset 102800 d24355724d6e90b685107a561972488607d8ed79
parent 102799 f33b216d95eb202bb088245c49bce2277970b61a
child 102801 80de6c5ae79fcc721101400ff51fb675a30b8d3d
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersgavin
bugs756542
milestone17.0a1
Bug 756542 - Implement make files to include Add-on SDK modules in builds. r=gavin
toolkit/Makefile.in
toolkit/addon-sdk/Makefile.in
toolkit/addon-sdk/loader.js
toolkit/addon-sdk/promise/Makefile.in
toolkit/addon-sdk/promise/core.js
--- a/toolkit/Makefile.in
+++ b/toolkit/Makefile.in
@@ -5,16 +5,17 @@
 DEPTH     = @DEPTH@
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 PARALLEL_DIRS = \
+  addon-sdk \
   components \
   content \
   devtools \
   identity \
   locales \
   mozapps/downloads \
   mozapps/extensions \
   mozapps/handling \
new file mode 100644
--- /dev/null
+++ b/toolkit/addon-sdk/Makefile.in
@@ -0,0 +1,23 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DEPTH     = @DEPTH@
+topsrcdir = @top_srcdir@
+srcdir    = @srcdir@
+VPATH     = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+include $(topsrcdir)/config/config.mk
+
+DIRS += \
+  promise \
+  $(NULL)
+
+JS_MODULES_PATH := $(FINAL_TARGET)/modules/commonjs
+
+EXTRA_JS_MODULES := \
+  loader.js \
+  $(NULL)
+
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/addon-sdk/loader.js
+++ b/toolkit/addon-sdk/loader.js
@@ -4,29 +4,30 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 ;(function(id, factory) { // Module boilerplate :(
   if (typeof(define) === 'function') { // RequireJS
     define(factory);
   } else if (typeof(require) === 'function') { // CommonJS
     factory.call(this, require, exports, module);
   } else if (~String(this).indexOf('BackstagePass')) { // JSM
+    this[factory.name] = {};
     factory(function require(uri) {
       var imports = {};
       this['Components'].utils.import(uri, imports);
       return imports;
-    }, this, { uri: __URI__, id: id });
-    this.EXPORTED_SYMBOLS = Object.keys(this);
+    }, this[factory.name], { uri: __URI__, id: id });
+    this.EXPORTED_SYMBOLS = [factory.name];
   } else {  // Browser or alike
     var globals = this
     factory(function require(id) {
       return globals[id];
     }, (globals[id] = {}), { uri: document.location.href + '#' + id, id: id });
   }
-}).call(this, 'loader', function(require, exports, module) {
+}).call(this, 'loader', function Loader(require, exports, module) {
 
 'use strict';
 
 const { classes: Cc, Constructor: CC, interfaces: Ci, utils: Cu,
         results: Cr, manager: Cm } = Components;
 const systemPrincipal = CC('@mozilla.org/systemprincipal;1', 'nsIPrincipal')();
 const { loadSubScript } = Cc['@mozilla.org/moz/jssubscript-loader;1'].
                      getService(Ci.mozIJSSubScriptLoader);
new file mode 100644
--- /dev/null
+++ b/toolkit/addon-sdk/promise/Makefile.in
@@ -0,0 +1,19 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DEPTH     = @DEPTH@
+topsrcdir = @top_srcdir@
+srcdir    = @srcdir@
+VPATH     = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+include $(topsrcdir)/config/config.mk
+
+JS_MODULES_PATH := $(FINAL_TARGET)/modules/commonjs/promise
+
+EXTRA_JS_MODULES := \
+  core.js \
+  $(NULL)
+
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/addon-sdk/promise/core.js
+++ b/toolkit/addon-sdk/promise/core.js
@@ -3,29 +3,30 @@
          forin: true latedef: false */
 /*global define: true, Cu: true, __URI__: true */
 ;(function(id, factory) { // Module boilerplate :(
   if (typeof(define) === 'function') { // RequireJS
     define(factory);
   } else if (typeof(require) === 'function') { // CommonJS
     factory.call(this, require, exports, module);
   } else if (String(this).indexOf('BackstagePass') >= 0) { // JSM
+    this[factory.name] = {};
     factory(function require(uri) {
       var imports = {};
       this['Components'].utils.import(uri, imports);
       return imports;
-    }, this, { uri: __URI__, id: id });
-    this.EXPORTED_SYMBOLS = Object.keys(this);
+    }, this[factory.name], { uri: __URI__, id: id });
+    this.EXPORTED_SYMBOLS = [factory.name];
   } else {  // Browser or alike
     var globals = this;
     factory(function require(id) {
       return globals[id];
     }, (globals[id] = {}), { uri: document.location.href + '#' + id, id: id });
   }
-}).call(this, 'promise/core', function(require, exports, module) {
+}).call(this, 'promise/core', function Promise(require, exports, module) {
 
 'use strict';
 
 /**
  * Internal utility: Wraps given `value` into simplified promise, successfully
  * fulfilled to a given `value`. Note the result is not a complete promise
  * implementation, as its method `then` does not returns anything.
  */