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

Introduce "Groups" #1018

Merged
merged 211 commits into from
Sep 14, 2015
Merged

Introduce "Groups" #1018

merged 211 commits into from
Sep 14, 2015

Conversation

forki
Copy link
Member

@forki forki commented Aug 27, 2015

This is what's going to be Paket 2.0

Basic feature description

This new feature will allow us to organize our dependencies in groups and also allows easier conflict resolutions. Let's consider a small sample:

paket.dependencies

source https://nuget.org/api/v2

nuget Newtonsoft.Json
nuget UnionArgParser
nuget FSharp.Core

github forki/FsUnit FsUnit.fs
github fsharp/FAKE src/app/FakeLib/Globbing/Globbing.fs
github fsprojects/Chessie src/Chessie/ErrorHandling.fs

group Build
    source https://nuget.org/api/v2

    nuget FAKE
    nuget FSharp.Formatting
    nuget ILRepack

    github fsharp/FAKE modules/Octokit/Octokit.fsx

group Test
    source https://nuget.org/api/v2

    nuget NUnit.Runners
    nuget NUnit

As you can see we have 3 different groups. The first one is the default group (currently called "Main") and represents the backwards-compatible case. So the main group is what you currently have in Paket 1.x. The other two groups contain dependencies that are used for Build and Test.

Notice the indentation in groups is optional.

After paket update the corresponding lock file looks the following:

paket.lock

NUGET
  remote: https://nuget.org/api/v2
  specs:
    FSharp.Core (4.0.0.1)
    Newtonsoft.Json (7.0.1)
    UnionArgParser (0.6.3)
GITHUB
  remote: forki/FsUnit
  specs:
    FsUnit.fs (81d27fd09575a32c4ed52eadb2eeac5f365b8348)
  remote: fsharp/FAKE
  specs:
    src/app/FakeLib/Globbing/Globbing.fs (991bea743c5d5e8eec0defc7338a89281ed3f51a)
  remote: fsprojects/Chessie
  specs:
    src/Chessie/ErrorHandling.fs (1f23b1caeb1f87e750abc96a25109376771dd090)

GROUP Build
NUGET
  remote: https://nuget.org/api/v2
  specs:
    FAKE (4.3.1)
    FSharp.Compiler.Service (1.4.0.1)
    FSharp.Formatting (2.10.0)
      FSharp.Compiler.Service (>= 0.0.87)
      FSharpVSPowerTools.Core (1.8.0)
    FSharpVSPowerTools.Core (1.8.0)
      FSharp.Compiler.Service (>= 0.0.87)
    ILRepack (2.0.5)
    Microsoft.Bcl (1.1.10)
      Microsoft.Bcl.Build (>= 1.0.14)
    Microsoft.Bcl.Build (1.0.21)
    Microsoft.Net.Http (2.2.29)
      Microsoft.Bcl (>= 1.1.10)
      Microsoft.Bcl.Build (>= 1.0.14)
    Octokit (0.14.0)
      Microsoft.Net.Http
GITHUB
  remote: fsharp/FAKE
  specs:
    modules/Octokit/Octokit.fsx (991bea743c5d5e8eec0defc7338a89281ed3f51a)
      Octokit

GROUP Test
NUGET
  remote: https://nuget.org/api/v2
  specs:
    NUnit (2.6.4)
    NUnit.Runners (2.6.4)

As you can see every group is listed separately and we still have the backwards-compatible case for the "Main" group.
If you want to reference dependencies from projects you can do this via the following syntax in references files:

paket.references

File:FsUnit.fs .
FSharp.Core

group Test
  NUnit
  NUnit.Runners

New ways for conflict resolution

We got many requests to support multiple versions of the same package with Paket. This was not possible since we had no way to discriminate these.
Now we can support that by using multiple groups:

source https://nuget.org/api/v2

nuget Newtonsoft.Json

group Legacy
    source https://nuget.org/api/v2

    nuget Newtonsoft.Json ~> 6

Every group will be resolved independently so that we get:

NUGET
  remote: https://nuget.org/api/v2
  specs:
    Newtonsoft.Json (7.0.1)

GROUP Legacy
NUGET
  remote: https://nuget.org/api/v2
  specs:
    Newtonsoft.Json (6.0.8)

Paket is downloading both version. We will get packages/Newtonsoft.Json with version 7.0.1 and packages/legacy/Newtonsoft.Json with the 6.0.8 bits.
In your references files you can now decide which version you want to use:

group Legacy
Newtonsoft.Json

Open stuff

This is currently early alpha and definetly not production ready. But I will update this PR frequently and

Organizational remarks

  • Please send all Paket 2.0 PRs against the groups branch. I will start to release alpha versions from this branch.
  • Please continue to send all bugfix PR's against master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.