From 2ddc63e538732f4c31e5ea949beb35b31df16aaa Mon Sep 17 00:00:00 2001 From: ekatek Date: Wed, 28 May 2014 18:16:12 -0700 Subject: [PATCH] project safeToUse to solve infinite loops in tests --- tools/catalog.js | 2 +- tools/project.js | 19 +++++++++++++++++-- .../tests/apps/package-tests/.meteor/packages | 1 - 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/tools/catalog.js b/tools/catalog.js index 32d77222b1..b2d548d896 100644 --- a/tools/catalog.js +++ b/tools/catalog.js @@ -276,7 +276,7 @@ _.extend(CompleteCatalog.prototype, { // see what the project thinks and recalculate everything. Similarly, if the // project root path has not been initialized, we are probably running // outside of a project, and have nothing to look at for guidance. - if (opts.ignoreProjectDeps || !project.rootDir) { + if (opts.ignoreProjectDeps || !project.rootDir || !project.safeToUse) { return self.resolver.resolve(deps, constr, resolverOpts); } diff --git a/tools/project.js b/tools/project.js index dbc9f8e666..8f846a2c9b 100644 --- a/tools/project.js +++ b/tools/project.js @@ -94,6 +94,10 @@ var Project = function () { // by any constraint-related operations. self.appId = null; + // Should we use this project as a source for dependencies? Certainly not + // until it has a root directory. + self.viableDepSource = false; + // Whenever we change the constraints, we invalidate many constraint-related // fields. Rather than recomputing immediately, let's wait until we are done // and then recompute when needed. @@ -129,6 +133,10 @@ _.extend(Project.prototype, { // dependencies that we counted with the previous rootPath are wrong and we // need to recompute them. self._depsUpToDate = false; + + // The good news, is that if the catalog is initialized, we can now use this + // project's version lock file as a source for our dependencies. + self.viableDepSource = true; }, // Rereads all the on-disk files by reinitalizing the project with the same directory. @@ -161,6 +169,12 @@ _.extend(Project.prototype, { } if (!self._depsUpToDate) { + + // We are calculating this project's dependencies, so we obviously should not + // use it as a source of version locks (unless specified explicitly through + // previousVersions). + self.viableDepSource = false; + // Use current release to calculate packages & combined constraints. var releasePackages = release.current.isProperRelease() ? release.current.getPackages() : {}; @@ -173,8 +187,7 @@ _.extend(Project.prototype, { // disaster. var newVersions = catalog.complete.resolveConstraints( self.combinedConstraints, - { previousSolution: self.dependencies }, - { ignoreProjectDeps: true } + { previousSolution: self.dependencies } ); // If the result is now what it used to be, rewrite the files on @@ -194,7 +207,9 @@ _.extend(Project.prototype, { // We are done! self._depsUpToDate = true; + self.safeToUse = true; } + }, // Given a set of packages from a release, recalculates all the constraints on diff --git a/tools/tests/apps/package-tests/.meteor/packages b/tools/tests/apps/package-tests/.meteor/packages index fd8f4bd847..4daa89c271 100644 --- a/tools/tests/apps/package-tests/.meteor/packages +++ b/tools/tests/apps/package-tests/.meteor/packages @@ -1,2 +1 @@ -depends-on-plugin standard-app-packages