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

Handle transient dependencies better in pack command #649

Merged
merged 2 commits into from
Feb 24, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/Paket.Core/PackageMetaData.fs
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,27 @@ let findDependencies (dependencies : DependenciesFile) config (template : Templa
let withDepsAndIncluded =
files
|> List.fold (fun templatefile file -> addFile (toFile config file) targetDir templatefile) withDeps


let locked =
(dependencies.FindLockfile().FullName
|> LockFile.LoadFrom).ResolvedPackages

// Add any paket references
let referenceFile =
ProjectFile.FindReferencesFile <| FileInfo project.FileName |> Option.map (ReferencesFile.FromFile)
match referenceFile with
| Some r ->
r.NugetPackages
|> List.map (fun np -> np.Name.Id, dependencies.DirectDependencies.[np.Name])
|> List.map (fun np ->
let dep =
match Map.tryFind np.Name dependencies.DirectDependencies with
Copy link
Member

Choose a reason for hiding this comment

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

do we need to go via NormalizedPackageName or did we get both sides in correct casing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah... honestly not sure? I suppose we'd have to normalize both sides at that point; I'd take your advice as to whether it's needed.

Copy link
Member

Choose a reason for hiding this comment

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

I will check

| Some direct -> direct
// If it's a transiant dependency set
Copy link
Member

Choose a reason for hiding this comment

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

typo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes :)

// min version to current locked version
| None ->
let resolved =
locked |> Map.find (NormalizedPackageName np.Name)
VersionRequirement(Minimum resolved.Version, PreReleaseStatus.All)
np.Name.Id, dep)
|> List.fold addDependency withDepsAndIncluded
| None -> withDepsAndIncluded