diff --git a/tools/bundler.js b/tools/bundler.js index 59c287e0ac..90c1a3b1dd 100644 --- a/tools/bundler.js +++ b/tools/bundler.js @@ -1654,7 +1654,7 @@ exports.bundle = function (options) { var appDir = project.project.rootDir; var packageLoader = project.project.getPackageLoader(); var downloaded = project.project._ensurePackagesExistOnDisk( - project.project.dependencies, arch); + project.project.dependencies, { arch: arch, verbose: true }); if (_.keys(downloaded).length !== _.keys(project.project.dependencies).length) { diff --git a/tools/commands-packages.js b/tools/commands-packages.js index 9cc37e7611..1d6a736897 100644 --- a/tools/commands-packages.js +++ b/tools/commands-packages.js @@ -457,6 +457,7 @@ main.registerCommand({ var contents = fs.readdirSync(localPackageDir); var myPackages = {}; var toPublish = {}; + var canBuild = true; var messages = buildmessage.capture( {title: "rebuilding local packages"}, function () { @@ -486,7 +487,8 @@ main.registerCommand({ requireVersion: true }); if (buildmessage.jobHasMessages()) { - process.stderr.write("Error reading package:" + item + "\n"); + process.stderr.write("\n ...Error reading package:" + item + "\n"); + canBuild = false; return; }; @@ -505,10 +507,14 @@ main.registerCommand({ // it doesn't we should fail. Hopefully, of course, we have // tested our stuff before deciding to publish it to the package // server, but we need to be careful. + var directDeps = + compiler.determineBuildTimeDependencies(packageSource).directDependencies; + project._ensurePackagesExistOnDisk(directDeps); var compileResult = compiler.compile(packageSource, { officialBuild: true }); if (buildmessage.jobHasMessages()) { - process.stderr.write("Error compiling unipackage:" + item + "\n"); + process.stderr.write("\n ... Error compiling unipackage: " + item + "\n"); + canBuild = false; return; }; process.stdout.write("."); @@ -545,6 +551,15 @@ main.registerCommand({ process.stdout.write("new package or version\n"); return; } else { + // If we can't build some of our packages, then we care about + // that far more than we care about hash conflicts (and fixing + // the errors will change the hashes as well). Don't even + // bother checking until that happens. + if (!canBuild) { + process.stdout.write("hash comparison skipped \n"); + return; + } + var existingBuild = catalog.official.getBuildWithPreciseBuildArchitectures( oldVersion, diff --git a/tools/commands.js b/tools/commands.js index 644f468d71..04af408a49 100644 --- a/tools/commands.js +++ b/tools/commands.js @@ -191,7 +191,7 @@ main.registerCommand({ var releasePackages = release.current.getPackages(); // HACK: relies on fact that the function below doesn't actually // have any relation to the project directory - project._ensurePackagesExistOnDisk(releasePackages); + project._ensurePackagesExistOnDisk(releasePackages, { verbose: true }); loadPackages( _.keys(releasePackages), new packageLoader.PackageLoader({versions: releasePackages})); @@ -986,6 +986,7 @@ main.registerCommand({ // We are going to operate in the special test project, so let's remap our // main project to the test directory. project.setRootDir(testRunnerAppDir); + project.setMuted(true); // Mute output where applicable project.writeMeteorReleaseVersion(release.current.name || 'none'); project.forceEditPackages( [options['driver-package'] || 'test-in-browser'], diff --git a/tools/project.js b/tools/project.js index 92279e6f3b..46393a95ad 100644 --- a/tools/project.js +++ b/tools/project.js @@ -83,9 +83,23 @@ var Project = function () { // fields. Rather than recomputing immediately, let's wait until we are done // and then recompute when needed. self._depsUpToDate = false; + + // In verbose mode (default) we print stuff out. When the project is something + // automatic, like test-packages or get-ready, we should mute the (expected) + // output. For example, we don't need to tell the user that we are adding + // packages to an app during test-packages. + self.muted = false; }; _.extend(Project.prototype, { + + // Sets the mute flag on the project. Muted projects don't print out non-error + // output. + setMuted : function (muted) { + var self = this; + self.muted = muted; + }, + // Set a given root directory as the project's root directory. Figure out all // relevant file paths and read in data that is independent of the constraint // solver. @@ -272,6 +286,7 @@ _.extend(Project.prototype, { // // return 0 if everything went well, or 1 if we failed in some way. showPackageChanges : function (versions, newVersions, options) { + var self = this; // options.skipPackages // options.ondiskPackages @@ -331,9 +346,11 @@ _.extend(Project.prototype, { return 1; // Show the user the messageLog of packages we added. - _.each(messageLog, function (msg) { - process.stdout.write(msg + "\n"); - }); + if (!self.muted) { + _.each(messageLog, function (msg) { + process.stdout.write(msg + "\n"); + }); + } return 0; }, @@ -617,8 +634,11 @@ _.extend(Project.prototype, { // // This primarily exists as a safety check to be used when doing operations // that could lead to changes in the versions file. - _ensurePackagesExistOnDisk : function (versions, arch) { - arch = arch || archinfo.host(); + _ensurePackagesExistOnDisk : function (versions, options) { + var self = this; + options = options || {}; + var arch = options.arch || archinfo.host(); + var verbose = options.verbose || !self.muted; var downloadedPackages = {}; _.each(versions, function (version, name) { var packageVersionInfo = { packageName: name, version: version }; @@ -626,7 +646,7 @@ _.extend(Project.prototype, { var available = tropohouse.default.maybeDownloadPackageForArchitectures( packageVersionInfo, ['browser', arch], - true /* print downloading message */ + verbose /* print downloading message */ ); downloadedPackages[name] = version; } catch (err) { @@ -660,7 +680,8 @@ _.extend(Project.prototype, { // First, we need to make sure that we have downloaded all the packages that // we are going to use. So, go through the versions and call tropohouse to // make sure that we have them. - var downloadedPackages = self._ensurePackagesExistOnDisk(newVersions); + var downloadedPackages = self._ensurePackagesExistOnDisk(newVersions, + { verbose: true }); // Return the packages that we have downloaded successfully and let the // client deal with reporting the error to the user.