From 167616f50c421eb4243026bffb013d8ae7ba4b9a Mon Sep 17 00:00:00 2001 From: DCorriveau Date: Wed, 20 Jan 2016 08:47:19 -0500 Subject: [PATCH 1/2] Added pack template test --- .../Paket.IntegrationTests/PackSpecs.fs | 11 ++++ .../i001376-pack-template/before/PaketBug.sln | 22 +++++++ .../before/PaketBug/Class1.cs | 12 ++++ .../before/PaketBug/PaketBug.csproj | 55 ++++++++++++++++++ .../PaketBug/Properties/AssemblyInfo.cs | 36 ++++++++++++ .../before/PaketBug/bin/Release/PaketBug.dll | Bin 0 -> 4096 bytes .../before/PaketBug/paket.csproj.template | 4 ++ .../before/PaketBug/paket.references | 1 + .../before/paket.dependencies | 3 + .../i001376-pack-template/before/paket.lock | 4 ++ .../Paket.Bootstrapper.Tests.csproj | 5 +- 11 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 integrationtests/scenarios/i001376-pack-template/before/PaketBug.sln create mode 100644 integrationtests/scenarios/i001376-pack-template/before/PaketBug/Class1.cs create mode 100644 integrationtests/scenarios/i001376-pack-template/before/PaketBug/PaketBug.csproj create mode 100644 integrationtests/scenarios/i001376-pack-template/before/PaketBug/Properties/AssemblyInfo.cs create mode 100644 integrationtests/scenarios/i001376-pack-template/before/PaketBug/bin/Release/PaketBug.dll create mode 100644 integrationtests/scenarios/i001376-pack-template/before/PaketBug/paket.csproj.template create mode 100644 integrationtests/scenarios/i001376-pack-template/before/PaketBug/paket.references create mode 100644 integrationtests/scenarios/i001376-pack-template/before/paket.dependencies create mode 100644 integrationtests/scenarios/i001376-pack-template/before/paket.lock diff --git a/integrationtests/Paket.IntegrationTests/PackSpecs.fs b/integrationtests/Paket.IntegrationTests/PackSpecs.fs index 8bd93790d3..d5037a5e5d 100644 --- a/integrationtests/Paket.IntegrationTests/PackSpecs.fs +++ b/integrationtests/Paket.IntegrationTests/PackSpecs.fs @@ -54,3 +54,14 @@ let ``#1375 pack with projectUrl commandline``() = paket ("pack -v output \"" + outPath + "\" project-url \"http://localhost\"") "i001375-pack-specific" |> ignore File.Delete(Path.Combine(scenarioTempPath "i001375-pack-specific","PaketBug","paket.template")) + +[] +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") + 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) + + 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.sln b/integrationtests/scenarios/i001376-pack-template/before/PaketBug.sln new file mode 100644 index 0000000000..24ba390073 --- /dev/null +++ b/integrationtests/scenarios/i001376-pack-template/before/PaketBug.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PaketBug", "PaketBug\PaketBug.csproj", "{5B41A984-0C88-41C7-8669-41D298D0E450}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5B41A984-0C88-41C7-8669-41D298D0E450}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5B41A984-0C88-41C7-8669-41D298D0E450}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5B41A984-0C88-41C7-8669-41D298D0E450}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5B41A984-0C88-41C7-8669-41D298D0E450}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/integrationtests/scenarios/i001376-pack-template/before/PaketBug/Class1.cs b/integrationtests/scenarios/i001376-pack-template/before/PaketBug/Class1.cs new file mode 100644 index 0000000000..e32a964559 --- /dev/null +++ b/integrationtests/scenarios/i001376-pack-template/before/PaketBug/Class1.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PaketBug +{ + public class Class1 + { + } +} diff --git a/integrationtests/scenarios/i001376-pack-template/before/PaketBug/PaketBug.csproj b/integrationtests/scenarios/i001376-pack-template/before/PaketBug/PaketBug.csproj new file mode 100644 index 0000000000..a8db012b9b --- /dev/null +++ b/integrationtests/scenarios/i001376-pack-template/before/PaketBug/PaketBug.csproj @@ -0,0 +1,55 @@ + + + + + Debug + AnyCPU + {5B41A984-0C88-41C7-8669-41D298D0E450} + Library + Properties + PaketBug + + + v4.5.2 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/integrationtests/scenarios/i001376-pack-template/before/PaketBug/Properties/AssemblyInfo.cs b/integrationtests/scenarios/i001376-pack-template/before/PaketBug/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..53a060718b --- /dev/null +++ b/integrationtests/scenarios/i001376-pack-template/before/PaketBug/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("PaketBug")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("PaketBug")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("5b41a984-0c88-41c7-8669-41d298d0e450")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/integrationtests/scenarios/i001376-pack-template/before/PaketBug/bin/Release/PaketBug.dll b/integrationtests/scenarios/i001376-pack-template/before/PaketBug/bin/Release/PaketBug.dll new file mode 100644 index 0000000000000000000000000000000000000000..a9987dfc95964a9df2e91645d21e92654fc04893 GIT binary patch literal 4096 zcmd^CTWl0n82)E_p%mJ13zvv>nt}q-&2GD;tzv1rTWSft*j*OXRXRI+x*a+@v&_r_ z_1eT>!i&M64I3X6;Ts7 zjXw9nV|c502JsNBk>h}$H#3TAM2nb!&s0Ys>1wh5awHEWnNRmo46Lefh$4urnhygED zGoA_>MD{^Pm^KtSSDL}YzFP5A&>+!p#Z(R#xvwD3EkF%)L?yb?K%_A9Ur<|M$66$~ zYdC&jSSfnpoK8f7p9mo?r&o!pX+LvcEf zF)v}q=%KL~-k-9JZHG-ejX4v{mC+4ED|zzA_HNqf*Ral)$xM)#Yzf!q*VkNpH&QQ! zu!mlx81M|81YVSQUE(c?ze#LWSh`bUOyVob3rZuMm3TpNu1fqtxvA` zPhSIFx(R%lz5~8N-&6f!sYa9|sSSu_E0aRSjmMn5<94QCiUFF^=7l$0$Obc}Nl{aC z-Ef&lIajwG(@0Z%!SzIrCez1+?om+pY^TTzP8TfC$cbQ5IIdw^*iDqsoUHKn<3tiC zZD)SS!zN1?JW)0gvnKpNn}%FhgmwQQMj|vIR%`J8>?r zSqrsxQx0m^y;?!k&M!DdcJ3acgrj9dPOB`Ylw-7DdIhHaO`|sI42BU zxD>T>Ny9bLmGzDmj7)7l#g^6z_8X?C5f;P73@vNfu4m{j#YDQ0&1%a+`8+HWb^x-e zN*2lG;oPar77W?qX<=%oi*RHw@Qck?{m`uLk4C*J+!*DqdG zJ{+Z{t1qRJTOzm5KtZWj6{VFS&;VFF#KWd>g|-GKMiS+1w7XdGQ#jaqf?WzFS~rx1 zF~iN9+QJ03+y=H%%Mw*;w^dYSHHTXs$HRQ58W^N`B-FdJ_La|iCd9dIxmkHxpF`2F-}KRrD8-lk*gGk30@ zW1GwqDIH6flI5ff>@M8>{1fnm>$xdc7nbH2wwp3Sp>TI^PiJ1!=R4iJ(2ZF`Po>4I z?G&x?yHDBaV=1hx(A*_vFrP_t0smVvD~__ac&y$#)zV$NTzWKWJ2BH7*9^-);)IaL zA8Xy+4qx)?Wx36NHRIcea7)nQ@(8?j2sdOcpY{0L;m9D-Wq-#p3*!hdNpU&~9HD89 z#%PizFdqZ%$C&AQ{V#X?yMiMy`R{%HMBW({ZY4J+wUW5w9QZNtEg|63qFJ(~e4DgN zK&pZ3LavbqJsUHhF4wPtQw2GB&@#Z!-ow++NJT-_rN0QJxd*ftH>Xn8k0H8Cy7ZG@ z7H0}^=OOj**;POUrVxIOOSVZ!9at~r7RC)4DnA^n1^Qf_Cv`3OG|@kea+niU#|Tme za{jvFby)}7gV4)Lt0+2sf)UESTPe7tJs6fJ6&zZ U@g7K0{r@vu?0q1sf8dM$3qwaeFaQ7m literal 0 HcmV?d00001 diff --git a/integrationtests/scenarios/i001376-pack-template/before/PaketBug/paket.csproj.template b/integrationtests/scenarios/i001376-pack-template/before/PaketBug/paket.csproj.template new file mode 100644 index 0000000000..595dbf5ec8 --- /dev/null +++ b/integrationtests/scenarios/i001376-pack-template/before/PaketBug/paket.csproj.template @@ -0,0 +1,4 @@ +type project +id PaketBug +description + Silly empty demo project diff --git a/integrationtests/scenarios/i001376-pack-template/before/PaketBug/paket.references b/integrationtests/scenarios/i001376-pack-template/before/PaketBug/paket.references new file mode 100644 index 0000000000..6701ce8648 --- /dev/null +++ b/integrationtests/scenarios/i001376-pack-template/before/PaketBug/paket.references @@ -0,0 +1 @@ +MySql.Data \ No newline at end of file diff --git a/integrationtests/scenarios/i001376-pack-template/before/paket.dependencies b/integrationtests/scenarios/i001376-pack-template/before/paket.dependencies new file mode 100644 index 0000000000..e422f8433e --- /dev/null +++ b/integrationtests/scenarios/i001376-pack-template/before/paket.dependencies @@ -0,0 +1,3 @@ +source https://nuget.org/api/v2 + +nuget MySql.Data 6.9.8 \ No newline at end of file diff --git a/integrationtests/scenarios/i001376-pack-template/before/paket.lock b/integrationtests/scenarios/i001376-pack-template/before/paket.lock new file mode 100644 index 0000000000..729cb4c7bc --- /dev/null +++ b/integrationtests/scenarios/i001376-pack-template/before/paket.lock @@ -0,0 +1,4 @@ +NUGET + remote: https://www.nuget.org/api/v2 + specs: + MySql.Data (6.9.8) \ No newline at end of file diff --git a/tests/Paket.Bootstrapper.Tests/Paket.Bootstrapper.Tests.csproj b/tests/Paket.Bootstrapper.Tests/Paket.Bootstrapper.Tests.csproj index 6472d885bf..f8a65169ef 100644 --- a/tests/Paket.Bootstrapper.Tests/Paket.Bootstrapper.Tests.csproj +++ b/tests/Paket.Bootstrapper.Tests/Paket.Bootstrapper.Tests.csproj @@ -51,6 +51,9 @@ Paket.Bootstrapper + + + ..\..\packages\test\NUnit\lib\nunit.framework.dll @@ -58,4 +61,4 @@ True - + \ No newline at end of file From e9cdeeb1e871d4e682d5d034348cddca96274f5a Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Wed, 20 Jan 2016 20:15:16 +0100 Subject: [PATCH 2/2] 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