diff --git a/tools/bundler.js b/tools/bundler.js index a8bafb7f97..c719710f8a 100644 --- a/tools/bundler.js +++ b/tools/bundler.js @@ -1427,11 +1427,10 @@ _.extend(ServerTarget.prototype, { 'os.linux.x86_64': 'Linux_x86_64', 'os.osx.x86_64': 'Darwin_x86_64' }; - var arch = archinfo.host(); - var platform = archToPlatform[arch]; + var platform = archToPlatform[self.arch]; if (! platform) { buildmessage.error("MDG does not publish dev_bundles for arch: " + - arch); + self.arch); // Recover by bailing out and leaving a partially built target return; } @@ -1661,6 +1660,7 @@ var writeSiteArchive = function (targets, outputPath, options) { * - minify: minify the CSS and JS assets (boolean, default false) * - testPackages: array of package objects or package names whose * tests should be additionally included in this bundle + * - arch: the server architecture to target (defaults to archinfo.host()) * * Returns an object with keys: * - errors: A buildmessage.MessageSet, or falsy if bundling succeeded. @@ -1737,7 +1737,7 @@ exports.bundle = function (options) { var makeServerTarget = function (app, clientTarget) { var targetOptions = { library: library, - arch: archinfo.host(), + arch: buildOptions.arch || archinfo.host(), releaseName: releaseName }; if (clientTarget) @@ -2005,6 +2005,11 @@ exports.buildJsImage = function (options) { var target = new JsImageTarget({ library: options.library, + // This function does not yet support cross-compilation (neither does + // initFromOptions). That's OK for now since we're only trying to support + // cross-bundling, not cross-package-building, and this function is only + // used to build plugins (during package build) and for unipackage.load + // (which always wants to build for the current host). arch: archinfo.host() }); target.make({ packages: [pkg] }); diff --git a/tools/commands.js b/tools/commands.js index fa67c49f35..d4e99876b6 100644 --- a/tools/commands.js +++ b/tools/commands.js @@ -62,6 +62,8 @@ var getPackages = function () { return null; }; +var XXX_DEPLOY_ARCH = 'os.linux.x86_64'; + /////////////////////////////////////////////////////////////////////////////// // options that act like commands /////////////////////////////////////////////////////////////////////////////// @@ -640,7 +642,9 @@ constraint.packageName + "@" + constraint.versionConstraint + ": no such versio // system. (Later we may also need to download more builds to be able to // deploy to another architecture.) var available = tropohouse.maybeDownloadPackageForArchitectures( - versionInfo, ['browser', archinfo.host()]); + // XXX we also download the deploy arch now, because we don't run the + // constraint solver / downloader anywhere other than add-package yet. + versionInfo, ['browser', archinfo.host(), XXX_DEPLOY_ARCH]); if (! available) { // XXX maybe we shouldn't be letting the constraint solver choose // things that don't have the right arches? @@ -778,7 +782,8 @@ main.registerCommand({ outputPath: bundlePath, nodeModulesMode: options['for-deploy'] ? 'skip' : 'copy', buildOptions: { - minify: ! options.debug + minify: ! options.debug, + arch: XXX_DEPLOY_ARCH // XXX should do this in deploy instead but it's easier to test with bundle } }); if (bundleResult.errors) { diff --git a/tools/packages.js b/tools/packages.js index 9a3b15d693..e6c5d4bcf0 100644 --- a/tools/packages.js +++ b/tools/packages.js @@ -1229,10 +1229,10 @@ _.extend(Package.prototype, { self.sources = _.uniq(self.sources); }, - // Programmatically initialized a package from scratch. For now, - // cannot create browser packages. This function does not retrieve - // the package's dependencies from the library, and on return, - // the package will be in an unbuilt state. + // Programmatically initialized a package from scratch. For now, cannot create + // browser packages or cross-targeted packages (eg os.linux when host is + // os.osx). This function does not retrieve the package's dependencies from + // the library, and on return, the package will be in an unbuilt state. // // Unlike user-facing methods of creating a package // (initFromPackageDir, initFromAppDir) this does not implicitly add