Skip to content

Commit

Permalink
Paket 'pack' should exclude 'project' template files correctly - fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Jul 18, 2016
1 parent edf0487 commit 32d2cb0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 3.7.4 - 18.07.2016
* BUGFIX: Paket 'pack' should exclude 'project' template files correctly - https://github.com/fsprojects/Paket/issues/1818

#### 3.7.3 - 14.07.2016
* PERFORMANCE: Do not scan node_modules path for project files - https://github.com/fsprojects/Paket/issues/1782

Expand Down
21 changes: 16 additions & 5 deletions src/Paket.Core/PackageProcess.fs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ let Pack(workingDir,dependenciesFile : DependenciesFile, packageOutputPath, buil
let version = version |> Option.map SemVer.Parse
let specificVersions = specificVersions |> Seq.map (fun (id : string,v) -> id, SemVer.Parse v) |> Map.ofSeq

let excludedTemplateIds =
match excludedTemplates with
| None -> Set.empty
| Some excluded -> set excluded

let allTemplateFiles =
let hashSet = new HashSet<_>()
match templateFile with
Expand All @@ -115,6 +120,7 @@ let Pack(workingDir,dependenciesFile : DependenciesFile, packageOutputPath, buil
| None ->
for template in TemplateFile.FindTemplateFiles workingDir do
hashSet.Add template |> ignore

hashSet

// load up project files and grab meta data
Expand All @@ -129,6 +135,14 @@ let Pack(workingDir,dependenciesFile : DependenciesFile, packageOutputPath, buil
match templateFile with
| CompleteTemplate _ -> false
| IncompleteTemplate -> true)
|> Array.filter (fun (_,templateFile) ->
match TemplateFile.tryGetId templateFile with
| Some id ->
if excludedTemplateIds.Contains id then
allTemplateFiles.Remove(templateFile.FileName) |> ignore
false
else true
| _ -> true)
|> Array.map (fun (projectFile,templateFile') ->
allTemplateFiles.Remove(templateFile'.FileName) |> ignore

Expand Down Expand Up @@ -177,11 +191,8 @@ let Pack(workingDir,dependenciesFile : DependenciesFile, packageOutputPath, buil
|> Seq.toList

let excludedTemplates =
match excludedTemplates with
| None -> allTemplates
| Some excluded ->
let excluded = set excluded
allTemplates |> List.filter (fun t -> match t with CompleteTemplate(c,_) -> not (excluded.Contains c.Id) | _ -> true)
allTemplates
|> List.filter (fun t -> match t with CompleteTemplate(c,_) -> not (excludedTemplateIds.Contains c.Id) | _ -> true)

// set projectUrl
let templatesWithProjectUrl =
Expand Down

0 comments on commit 32d2cb0

Please sign in to comment.