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

Update getResolverStrategy for rootRequirements #3670

Merged
merged 4 commits into from
Oct 2, 2019

Conversation

BlythMeister
Copy link
Contributor

When root requirement, us the resolver strategy for direct dependencies.
Even if it also has other requirements

Attempted fix for #3669

And meaning that the statement that all direct dependencies will still get their latest matching versions, no matter the value of the strategy option. If you want to influence the resolution of direct dependencies then read about the lowest_matching option. in the docs is actually correct

When root requirement, us the resolver strategy for direct dependencies.
Even if it also has other requirements
…File

These should not be considered as "top level"
These dependencies are specified in the dependencies file
As a result, we should get the latest version of them
@BlythMeister BlythMeister changed the title WIP: Update getResolverStrategy for rootRequirements Update getResolverStrategy for rootRequirements Sep 27, 2019
@BlythMeister
Copy link
Contributor Author

@forki this change does update tests...but i think that the tests contradict the documented behaviour.

In these tests, the dependencies are specified in the paket.dependencies file
However, we do not expect to get the latest version

@BlythMeister
Copy link
Contributor Author

Is there anything more needed from me to get this merged?
Looks like the build went green 🙂

@@ -159,7 159,7 @@ let ``should favor strategy from parent that overrides strategy``() =
let resolved =
DependenciesFile.FromSource(config)
|> resolve graph2 UpdateMode.UpdateAll
getVersion resolved.[PackageName "Castle.Windsor"] |> shouldEqual "3.2.1"
getVersion resolved.[PackageName "Castle.Windsor"] |> shouldEqual "3.3.0"
Copy link
Member

Choose a reason for hiding this comment

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

why is this increased? I thought we use min strategy?

Copy link
Contributor Author

@BlythMeister BlythMeister Oct 2, 2019

Choose a reason for hiding this comment

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

this test:

let graph2 = 
  OfSimpleGraph [
    "Nancy.Bootstrappers.Windsor","0.23",["Castle.Windsor",VersionRequirement(VersionRange.AtLeast "3.2.1",PreReleaseStatus.No)]
    "Castle.Windsor","3.2.0",["Castle.Core",VersionRequirement(VersionRange.AtLeast "3.2.0",PreReleaseStatus.No)]
    "Castle.Windsor","3.2.1",["Castle.Core",VersionRequirement(VersionRange.AtLeast "3.2.0",PreReleaseStatus.No)]
    "Castle.Windsor","3.3.0",["Castle.Core",VersionRequirement(VersionRange.AtLeast "3.3.0",PreReleaseStatus.No)]
    "Castle.Windsor-NLog","3.2.0.1",["Castle.Core-NLog",VersionRequirement(VersionRange.AtLeast "3.2.0",PreReleaseStatus.No)]
    "Castle.Windsor-NLog","3.3.0",["Castle.Core-NLog",VersionRequirement(VersionRange.AtLeast "3.3.0",PreReleaseStatus.No)]
    "Castle.Core-NLog","3.2.0",["Castle.Core",VersionRequirement(VersionRange.AtLeast "3.2.0",PreReleaseStatus.No)]
    "Castle.Core-NLog","3.3.0",["Castle.Core",VersionRequirement(VersionRange.AtLeast "3.3.0",PreReleaseStatus.No)]
    "Castle.Core-NLog","3.3.1",["Castle.Core",VersionRequirement(VersionRange.AtLeast "3.3.1",PreReleaseStatus.No)]
    "Castle.Core","3.2.0",[]
    "Castle.Core","3.2.1",[]
    "Castle.Core","3.2.2",[]
    "Castle.Core","3.3.0",[]
    "Castle.Core","3.3.1",[]
  ]

.....

[<Test>]
let ``should favor strategy from parent that overrides strategy``() = 
    let config = """
    strategy max
    source http://www.nuget.org/api/v2
    nuget Nancy.Bootstrappers.Windsor !~> 0.23
    nuget Castle.Windsor
    nuget Castle.Windsor-NLog !> 0
    """
    let resolved =
        DependenciesFile.FromSource(config)
        |> resolve graph2 UpdateMode.UpdateAll
    getVersion resolved.[PackageName "Castle.Windsor"] |> shouldEqual "3.3.0"
    getVersion resolved.[PackageName "Castle.Windsor-NLog"] |> shouldEqual "3.3.0"
    getVersion resolved.[PackageName "Castle.Core-NLog"] |> shouldEqual "3.3.0"
    getVersion resolved.[PackageName "Castle.Core"] |> shouldEqual "3.3.0"
    getVersion resolved.[PackageName "Nancy.Bootstrappers.Windsor"] |> shouldEqual "0.23"

is set to max but more importantly has Castle.Windsor as a top level dependency. So should take the latest version

@forki forki merged commit 2c0f52a into fsprojects:master Oct 2, 2019
@forki
Copy link
Member

forki commented Oct 2, 2019

thank you

@BlythMeister BlythMeister deleted the topLevelMin branch May 11, 2021 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants