download correct arch of packages in bundle

This commit is contained in:
David Glasser
2014-11-12 13:58:25 -08:00
parent 1ea3a5c4a3
commit e737ef4cfe
4 changed files with 35 additions and 8 deletions

View File

@@ -26,6 +26,7 @@ var cordova = require('./commands-cordova.js');
var commandsPackages = require('./commands-packages.js');
var execFileSync = require('./utils.js').execFileSync;
var Console = require('./console.js').Console;
var projectContextModule = require('./project-context.js');
// The architecture used by Galaxy servers; it's the architecture used
// by 'meteor deploy'.
@@ -685,8 +686,7 @@ main.registerCommand(_.extend({ name: 'build' }, buildCommands),
// doesn't output a directory with all builds but rather only one tarball with
// server/client programs.
// XXX COMPAT WITH 0.9.1.1
main.registerCommand(_.extend({ name: 'bundle', hidden: true,
prepareProjectContext: true
main.registerCommand(_.extend({ name: 'bundle', hidden: true
}, buildCommands),
function (options) {
@@ -719,6 +719,21 @@ var buildCommand = function (options) {
// XXX #3006: We need to have downloaded packages for options.architecture AND
// archinfo.host()!
var projectContext = new projectContextModule.ProjectContext({
projectDir: options.appDir,
tropohouse: tropohouse.default,
serverArchitectures: _.uniq([bundleArch, archinfo.host()])
});
var messages = buildmessage.capture(function () {
projectContext.prepareProjectForBuild();
});
if (messages.hasMessages()) {
Console.error("=> Errors while initializing project:");
Console.printMessages(messages);
return 1;
}
// options['mobile-settings'] is used to set the initial value of
// `Meteor.settings` on mobile apps. Pass it on to options.settings,
// which is used in this command.
@@ -808,7 +823,7 @@ var buildCommand = function (options) {
var bundler = require(path.join(__dirname, 'bundler.js'));
var bundleResult = bundler.bundle({
projectContext: options.projectContext,
projectContext: projectContext,
includeDebug: !! options.debug,
outputPath: bundlePath,
buildOptions: {

View File

@@ -1191,7 +1191,9 @@ commandName + ": You're not in a Meteor project directory.\n" +
process.exit(1);
}
if (!command.catalogRefresh.doesNotUsePackages) {
// XXX #3006 this should go away, with catalog.complete.
if (! command.newfangledProject &&
! command.catalogRefresh.doesNotUsePackages) {
// OK, now it's finally time to set up the complete catalog. Only after this
// can we use the build system (other than to make and load isopackets).

View File

@@ -1,6 +1,7 @@
var _ = require('underscore');
var path = require('path');
var archinfo = require('./archinfo.js');
var buildmessage = require('./buildmessage.js');
var catalog = require('./catalog.js');
var catalogLocal = require('./catalog-local.js');
@@ -13,6 +14,8 @@ var packageMap = require('./package-map.js');
var utils = require('./utils.js');
var watch = require('./watch.js');
// This class follows the standard protocol where names beginning with _ should
// not be externally accessed.
exports.ProjectContext = function (options) {
var self = this;
if (!options.projectDir)
@@ -23,6 +26,11 @@ exports.ProjectContext = function (options) {
self.projectDir = options.projectDir;
self.tropohouse = options.tropohouse;
self._serverArchitectures = options.serverArchitectures || [];
// We always need to download host versions of packages, at least for plugins.
self._serverArchitectures.push(archinfo.host());
self._serverArchitectures = _.uniq(self._serverArchitectures);
// A WatchSet for all the files read by this class (eg .meteor/packages, etc).
self.projectWatchSet = new watch.WatchSet;
@@ -31,7 +39,7 @@ exports.ProjectContext = function (options) {
self.isopackCache = null;
// XXX #3006: Things we're leaving off for now:
// - constraints, combinedConstraints
// - combinedConstraints
// - cordovaPlugins, platforms
// - appId
// - muted (???)
@@ -196,7 +204,9 @@ _.extend(exports.ProjectContext.prototype, {
throw Error("which packages to download?");
// XXX #3006 This downloads archinfo.host packages. How about
// for deploy?
self.tropohouse.downloadPackagesMissingFromMap(self.packageMap);
self.tropohouse.downloadPackagesMissingFromMap(self.packageMap, {
serverArchitectures: self._serverArchitectures
});
},
_buildLocalPackages: function () {

View File

@@ -381,7 +381,7 @@ _.extend(exports.Tropohouse.prototype, {
var self = this;
buildmessage.assertInCapture();
options = options || {};
var serverArch = options.serverArch || archinfo.host();
var serverArchs = options.serverArchitectures || [archinfo.host()];
var downloadCallbacks = {};
buildmessage.enterJob('checking package versions', function () {
@@ -393,7 +393,7 @@ _.extend(exports.Tropohouse.prototype, {
returnDownloadCallback: true,
packageName: packageName,
version: info.version,
architectures: [serverArch],
architectures: serverArchs,
// Don't let tropohouse talk to the catalog, since there's no point.
definitelyNotLocal: true
});