From e4837216024dca3514dfa8eb010c24cdccdd49d9 Mon Sep 17 00:00:00 2001 From: David Glasser Date: Thu, 1 Aug 2013 12:41:49 -0700 Subject: [PATCH] Remember the library resolution of packages used by the plugin program itself. --- tools/bundler.js | 16 +++++++++++++++- tools/packages.js | 5 +++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/tools/bundler.js b/tools/bundler.js index 2eff91765e..bbdbb0bc9f 100644 --- a/tools/bundler.js +++ b/tools/bundler.js @@ -404,6 +404,9 @@ var Target = function (options) { // On-disk dependencies of this target. self.watchSet = new watch.WatchSet(); + // Map from package name to package directory of all packages used. + self.pluginProviderPackageDirs = {}; + // node_modules directories that we need to copy into the target (or // otherwise make available at runtime.) A map from an absolute path // on disk (NodeModulesDirectory.sourcePath) to a @@ -671,6 +674,11 @@ _.extend(Target.prototype, { // Depend on the source files that produced these resources. self.watchSet.merge(slice.watchSet); + // Remember the library resolution of all packages used in these + // resources. + // XXX assumes that this merges cleanly + _.extend(self.pluginProviderPackageDirs, + slice.pkg.pluginProviderPackageDirs) }); }, @@ -706,6 +714,11 @@ _.extend(Target.prototype, { return self.watchSet; }, + getPluginProviderPackageDirs: function () { + var self = this; + return self.pluginProviderPackageDirs; + }, + // Return the most inclusive architecture with which this target is // compatible. For example, if we set out to build a // 'os.linux.x86_64' version of this target (by passing that as @@ -1830,7 +1843,8 @@ exports.buildJsImage = function (options) { return { image: target.toJsImage(), - watchSet: target.getWatchSet() + watchSet: target.getWatchSet(), + pluginProviderPackageDirs: target.getPluginProviderPackageDirs() }; }; diff --git a/tools/packages.js b/tools/packages.js index bec44f5855..7ee8dc248a 100644 --- a/tools/packages.js +++ b/tools/packages.js @@ -1006,6 +1006,11 @@ _.extend(Package.prototype, { // Add this plugin's dependencies to our "plugin dependency" WatchSet. self.pluginWatchSet.merge(buildResult.watchSet); + // Remember the library resolution of all packages used by the plugin. + // XXX assumes that this merges cleanly + _.extend(self.pluginProviderPackageDirs, + buildResult.pluginProviderPackageDirs); + // Register the built plugin's code. self.plugins[info.name] = buildResult.image; });