Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing dependency versions when required versions differ #559

Merged
merged 8 commits into from May 18, 2016
Merged

Conversation

toddm
Copy link
Contributor

@toddm toddm commented May 3, 2016

Fixes NuGet/Home#759

@emgarten

Fixing pack so that dependencies are included with the indirectly referenced version is lower than the project's referenced version.

{
foreach (var dependency in set.Dependencies)
{
if (dependency.Id == id && dependency.VersionSpec.MinVersion < version)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the id compare should be case-insensitive

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version check should use Satisfies, this isn't taking into account >= or if the min version is included in the range

@emgarten
Copy link
Member

emgarten commented May 4, 2016

If ProjectFactory is still using NuGet.Core.dll it should just go away.

@emgarten
Copy link
Member

emgarten commented May 4, 2016

@toddm
Copy link
Contributor Author

toddm commented May 6, 2016

Pushed another version - this one gets rid of the Walker and just tries to figure it out on it's own. I didn't use Satisfies because it doesn't cover the case of a higher minimum.

{
found = true;

if (dependency.VersionSpec.MinVersion < projectPackage.Version ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this work if MinVersion is null, I see the IsMinInclusive check afterwards

@emgarten
Copy link
Member

emgarten commented May 7, 2016

Does this need to go through the framework groups individually? It seems like it's possible to filter too much like this.

VersionSpec is from nuget.core.dll is there any reason the dependencies come out of package builder as the old types?

{
// returns true if the dependency should be added to the package
// This happens if the dependency is not a dependency of a dependecy
// Or if the project dependency version is > the dependency's dependency version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this logic a bit too simplistic? Isn't what we really care about what version would actually get installed based on the requested version? For example, if a dependency A requests dependency B of version >=1.0.11, but there is no 1.0.11 we might get 1.0.12. In that scenario, if version 1.0.12 is what we currently have, then we don't need to include that dependency in the minimal set (even though it > the specified version).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a tricky one, since feeds can change we should probably assume that the minimum version does exist somewhere and not try to fit the dependencies to the current state of the feeds.

@toddm
Copy link
Contributor Author

toddm commented May 16, 2016

I've pulled out a bunch of NuGet.Core references from ProjectFactory but with the same behavior.

To address a question above, packing csproj projects only build for one target framework so there is no need to go through them individually.

var dependency = packagesAndDependencies[package.Id].Item2;
dependencies[dependency.Id] = new PackageDependency(dependency.Id, VersionRange.Parse(dependency.VersionSpec.ToString()));
var dependency = packagesAndDependencies[package.GetIdentity().Id].Item2;
dependencies[dependency.Id] = new PackageDependency(dependency.Id, VersionRange.Parse(dependency.VersionRange.ToString()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PackageDependency should be immutable, does this need to make a copy of it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@emgarten
Copy link
Member

@emgarten
Copy link
Member

:shipit:

@toddm toddm merged commit f74af8b into dev May 18, 2016
@toddm toddm deleted the dev-toddmosc-759 branch May 18, 2016 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants