diff --git a/tools/bundler.js b/tools/bundler.js index db87c937ae..53aee9a947 100644 --- a/tools/bundler.js +++ b/tools/bundler.js @@ -438,6 +438,8 @@ var Target = function (options) { // Map from package name to package directory of all packages used. self.pluginProviderPackageDirs = {}; + self.usedPackages = {}; + // 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 @@ -569,12 +571,15 @@ _.extend(Target.prototype, { // What unibuilds will be used in the target? Built in Phase 1, read in // Phase 2. var usedUnibuilds = {}; // Map from unibuild.id to Unibuild. - var usedPackages = {}; // Map from package name to true; + self.usedPackages = {}; // Map from package name to true; var addToGetsUsed = function (unibuild) { if (_.has(usedUnibuilds, unibuild.id)) return; usedUnibuilds[unibuild.id] = unibuild; - usedPackages[unibuild.pkg.name] = true; + if (unibuild.name === 'main') { + // Only track real packages, not plugin pseudo-packages. + self.usedPackages[unibuild.pkg.name] = true; + } // XXX #3006 combine if (isopackCache) { isopackCompiler.eachUsedUnibuild({ @@ -647,14 +652,14 @@ _.extend(Target.prototype, { arch: self.arch, isopackCache: isopackCache, skipUnordered: true, - acceptableWeakPackages: usedPackages, + acceptableWeakPackages: self.usedPackages, skipDebugOnly: !project.project.includeDebug }, processUnibuild); } else { compiler.eachUsedUnibuild( unibuild.uses, self.arch, packageLoader, { skipUnordered: true, - acceptableWeakPackages: usedPackages, + acceptableWeakPackages: self.usedPackages, skipDebugOnly: !project.project.includeDebug }, processUnibuild); @@ -2367,7 +2372,8 @@ exports.buildJsImage = function (options) { return { image: target.toJsImage(), watchSet: target.getWatchSet(), - pluginProviderPackageDirs: target.getPluginProviderPackageDirs() + pluginProviderPackageDirs: target.getPluginProviderPackageDirs(), + usedPackageNames: _.keys(target.usedPackages) }; }; diff --git a/tools/isopack-compiler.js b/tools/isopack-compiler.js index eab2921bca..ad6621dfc3 100644 --- a/tools/isopack-compiler.js +++ b/tools/isopack-compiler.js @@ -54,6 +54,8 @@ exports.compile = function (packageSource, options) { var pluginWatchSet = packageSource.pluginWatchSet.clone(); var plugins = {}; + var pluginProviderPackageNames = {}; + // Build plugins _.each(packageSource.pluginInfo, function (info) { buildmessage.enterJob({ @@ -76,11 +78,16 @@ exports.compile = function (packageSource, options) { 'plugin', info.name)), catalog: packageSource.catalog }); + if (buildmessage.jobHasMessages()) + return; // Add the plugin's sources to our list. _.each(info.sources, function (source) { sources.push(source); }); + _.each(buildResult.usedPackageNames, function (packageName) { + pluginProviderPackageNames[packageName] = true; + }); // Add this plugin's dependencies to our "plugin dependency" // WatchSet. buildResult.watchSet will end up being the merged @@ -135,8 +142,6 @@ exports.compile = function (packageSource, options) { debugOnly: packageSource.debugOnly }); - var pluginProviderPackageNames = {}; - _.each(packageSource.architectures, function (unibuild) { var unibuildResult = compileUnibuild({ isopack: isopk, diff --git a/tools/isopack.js b/tools/isopack.js index 1e14808f3a..b5374351ab 100644 --- a/tools/isopack.js +++ b/tools/isopack.js @@ -41,6 +41,7 @@ var Unibuild = function (isopack, options) { options = options || {}; self.pkg = isopack; + self.name = options.name; self.arch = options.arch; self.uses = options.uses; @@ -58,7 +59,7 @@ var Unibuild = function (isopack, options) { // to keep track of Unibuilds in a map; it's used by bundler // and compiler. We put some human readable info in here too to make // debugging easier. - self.id = isopack.name + "." + self.pkg.name + "@" + self.arch + "#" + + self.id = self.pkg.name + "." + self.name + "@" + self.arch + "#" + (nextBuildId ++); // Prelink output.