From e9cdeeb1e871d4e682d5d034348cddca96274f5a Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Wed, 20 Jan 2016 20:15:16 +0100 Subject: [PATCH] Pack with concrete template file should work for type project - fixes #1414 --- RELEASE_NOTES.md | 3 +++ integrationtests/Paket.IntegrationTests/PackSpecs.fs | 4 ++-- .../{PaketBug.csproj => PaketBug.csprojtemplate} | 0 .../PaketBug/{paket.csproj.template => paket.template} | 0 src/Paket.Core/PackageProcess.fs | 10 +++++++--- src/Paket/Paket.fsproj | 4 ++-- 6 files changed, 14 insertions(+), 7 deletions(-) rename integrationtests/scenarios/i001376-pack-template/before/PaketBug/{PaketBug.csproj => PaketBug.csprojtemplate} (100%) rename integrationtests/scenarios/i001376-pack-template/before/PaketBug/{paket.csproj.template => paket.template} (100%) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 72f737010d..ad28700a6c 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,6 @@ +#### 2.46.2 - 20.01.2016 +* BUGFIX: Pack with concrete template file should work for type project - https://github.com/fsprojects/Paket/issues/1414 + #### 2.46.1 - 19.01.2016 * BUGFIX: Don't use symbol packages when using filesystem source with symbol package - https://github.com/fsprojects/Paket/issues/1413 diff --git a/integrationtests/Paket.IntegrationTests/PackSpecs.fs b/integrationtests/Paket.IntegrationTests/PackSpecs.fs index d5037a5e5d..2280a09fc0 100644 --- a/integrationtests/Paket.IntegrationTests/PackSpecs.fs +++ b/integrationtests/Paket.IntegrationTests/PackSpecs.fs @@ -58,10 +58,10 @@ let ``#1375 pack with projectUrl commandline``() = [] let ``#1376 fail template``() = let outPath = Path.Combine(scenarioTempPath "i001376-pack-template","out") - let templatePath = Path.Combine(scenarioTempPath "i001376-pack-template","PaketBug\paket.csproj.template") + let templatePath = Path.Combine(scenarioTempPath "i001376-pack-template","PaketBug\paket.template") paket ("pack -v output \"" + outPath + "\" templatefile " + templatePath) "i001376-pack-template" |> ignore let fileInfo = FileInfo(Path.Combine(outPath, "PaketBug.1.0.0.0.nupkg")) let (expectedFileSize: int64) = int64(1542) - Assert.False(fileInfo.Length = expectedFileSize) + fileInfo.Length |> shouldBeGreaterThan expectedFileSize File.Delete(Path.Combine(scenarioTempPath "i001376-pack-template","PaketBug","paket.template")) \ No newline at end of file diff --git a/integrationtests/scenarios/i001376-pack-template/before/PaketBug/PaketBug.csproj b/integrationtests/scenarios/i001376-pack-template/before/PaketBug/PaketBug.csprojtemplate similarity index 100% rename from integrationtests/scenarios/i001376-pack-template/before/PaketBug/PaketBug.csproj rename to integrationtests/scenarios/i001376-pack-template/before/PaketBug/PaketBug.csprojtemplate diff --git a/integrationtests/scenarios/i001376-pack-template/before/PaketBug/paket.csproj.template b/integrationtests/scenarios/i001376-pack-template/before/PaketBug/paket.template similarity index 100% rename from integrationtests/scenarios/i001376-pack-template/before/PaketBug/paket.csproj.template rename to integrationtests/scenarios/i001376-pack-template/before/PaketBug/paket.template diff --git a/src/Paket.Core/PackageProcess.fs b/src/Paket.Core/PackageProcess.fs index 33ba8442c7..2465bbc61d 100644 --- a/src/Paket.Core/PackageProcess.fs +++ b/src/Paket.Core/PackageProcess.fs @@ -122,9 +122,7 @@ let Pack(workingDir,dependencies : DependenciesFile, packageOutputPath, buildCon // load up project files and grab meta data let projectTemplates = - match templateFile with - | Some template -> Map.empty - | None -> + let getAllProjectsFiles workingDir = ProjectFile.FindAllProjects workingDir |> Array.choose (fun projectFile -> match ProjectFile.FindTemplatesFile(FileInfo(projectFile.FileName)) with @@ -141,6 +139,12 @@ let Pack(workingDir,dependencies : DependenciesFile, packageOutputPath, buildCon Path.GetFullPath projectFile.FileName |> normalizePath,(merged,projectFile)) |> Map.ofArray + match templateFile with + | Some template -> + getAllProjectsFiles (FileInfo(template).Directory.FullName) + |> Map.filter (fun p (t,_) -> normalizePath t.FileName = normalizePath template) + | None -> getAllProjectsFiles workingDir + // add dependencies let allTemplates = let optWithSymbols projectFile templateFile = diff --git a/src/Paket/Paket.fsproj b/src/Paket/Paket.fsproj index dba60e369d..f7f30e77b8 100644 --- a/src/Paket/Paket.fsproj +++ b/src/Paket/Paket.fsproj @@ -38,7 +38,7 @@ pack output D:\code\paketbug\output install restore - update + pack -v output "D:\code\Paket\integrationtests\scenarios\i001376-pack-template\temp\out" templatefile "D:\code\Paket\integrationtests\scenarios\i001376-pack-template\temp\PaketBug\paket.template" Project paket.exe c:\code\Paketkopie @@ -48,7 +48,7 @@ d:\code\paketrepro D:\code\Paket\integrationtests\scenarios\i001270-net461\temp C:\code\restore - D:\code\Paket\integrationtests\scenarios\i001387-nugetv3\temp + D:\code\Paket\integrationtests\scenarios\i001376-pack-template\temp pdbonly