Skip to content

Commit

Permalink
Pack deps without template - fixes #1429
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Jan 25, 2016
1 parent e20488e commit 6991539
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion integrationtests/Paket.IntegrationTests/PackSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ let ``#1429 pack deps from template``() =
|> Async.RunSynchronously

details.Dependencies |> List.map (fun (x,_,_) -> x) |> shouldContain (PackageName "MySql.Data")
details.Dependencies |> List.map (fun (x,_,_) -> x) |> shouldContain (PackageName "PaketBug2")
details.Dependencies |> List.map (fun (x,_,_) -> x) |> shouldNotContain (PackageName "PaketBug2") // it's not packed in same round
details.Dependencies |> List.map (fun (x,_,_) -> x) |> shouldNotContain (PackageName "PaketBug")

File.Delete(Path.Combine(scenarioTempPath "i001429-pack-deps","PaketBug","paket.template"))
Expand Down
19 changes: 6 additions & 13 deletions src/Paket.Core/PackageMetaData.fs
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,10 @@ let findDependencies (dependencies : DependenciesFile) config platform (template
| None -> PreReleaseStatus.No
| _ -> PreReleaseStatus.All

let getProjects =
seq {
if includeReferencedProjects then
yield! project.GetAllInterProjectDependenciesWithoutProjectTemplates
else
yield project
}

let deps, files =
getProjects
|> Seq.filter (fun proj -> proj <> project)
|> Seq.fold (fun (deps, files) p ->
project.GetAllInterProjectDependenciesWithProjectTemplates |> Seq.toList
|> List.filter (fun proj -> proj <> project)
|> List.fold (fun (deps, files) p ->
match Map.tryFind p.FileName map with
| Some packagedRef -> packagedRef :: deps, files
| None ->
Expand All @@ -161,8 +153,9 @@ let findDependencies (dependencies : DependenciesFile) config platform (template
// Add the assembly + pdb + dll from this project
let templateWithOutput =
let additionalFiles =
let assemblyNames = getProjects
|> Seq.map (fun proj -> proj.GetAssemblyName())
let assemblyNames =
if includeReferencedProjects then project.GetAllInterProjectDependenciesWithoutProjectTemplates |> Seq.toList else [ project ]
|> List.map (fun proj -> proj.GetAssemblyName())

assemblyNames
|> Seq.collect (fun assemblyFileName ->
Expand Down
14 changes: 13 additions & 1 deletion src/Paket.Core/ProjectFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,17 @@ module ProjectFile =
| None -> true
)

let projectsWithTemplates this projects =
projects
|> Seq.filter(fun proj ->
if proj = this then true
else
let templateFilename = findTemplatesFile (FileInfo proj.FileName)
match templateFilename with
| Some tfn -> TemplateFile.IsProjectType tfn
| None -> false
)


let getOutputDirectory buildConfiguration buildPlatform (project:ProjectFile) =
let platforms =
Expand Down Expand Up @@ -1281,8 +1292,9 @@ type ProjectFile with

member this.GetRecursiveInterProjectDependencies = ProjectFile.getAllReferencedProjects this

member this.GetAllInterProjectDependenciesWithoutProjectTemplates = ProjectFile.getAllReferencedProjects this |> ProjectFile.projectsWithoutTemplates this
member this.GetAllInterProjectDependenciesWithoutProjectTemplates = ProjectFile.getAllReferencedProjects this |> ProjectFile.projectsWithoutTemplates this

member this.GetAllInterProjectDependenciesWithProjectTemplates = ProjectFile.getAllReferencedProjects this |> ProjectFile.projectsWithTemplates this

member this.ReplaceNuGetPackagesFile () = ProjectFile.removeNuGetTargetsEntries this

Expand Down

0 comments on commit 6991539

Please sign in to comment.