Skip to content

Commit

Permalink
Github dependencies reference transitive nuget packages to projects - f…
Browse files Browse the repository at this point in the history
…ixes #1578
  • Loading branch information
forki committed Apr 7, 2016
1 parent 4010ef1 commit f024316
Show file tree
Hide file tree
Showing 12 changed files with 275 additions and 7 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 2.58.4 - 07.04.2016
* BUGFIX: Github dependencies reference transitive NuGet packages to projects - https://github.com/fsprojects/Paket/issues/1578

#### 2.58.3 - 05.04.2016
* BUGFIX: Add "*.fsi" files as <Compile> by default - https://github.com/fsprojects/Paket/pull/1573

Expand Down
10 changes: 10 additions & 0 deletions integrationtests/Paket.IntegrationTests/InstallSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,16 @@ let ``#1523 should emit correct .NET in mixed setting``() =
let s2 = File.ReadAllText newFile |> normalizeLineEndings
s2 |> shouldEqual s1

[<Test>]
let ``#1578 should reference transitive dep from ref``() =
let scenario = "i001578-transitive-ref"
install scenario |> ignore
let newFile = Path.Combine(scenarioTempPath scenario,"TestPaketDotNet","TestPaketDotNet.csproj")
let oldFile = Path.Combine(originalScenarioPath scenario,"TestPaketDotNet","TestPaketDotNet.csprojtemplate")
let s1 = File.ReadAllText oldFile |> normalizeLineEndings
let s2 = File.ReadAllText newFile |> normalizeLineEndings
s2 |> shouldEqual s1

[<Test>]
let ``#1458 should not install conflicting deps from different groups``() =
try
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestPaket", "TestPaket\TestPaket.vcxproj", "{BDBD2D92-542F-4AC4-BCDB-5C6EFC42FD44}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestPaketDotNet", "TestPaketDotNet\TestPaketDotNet.csproj", "{AAE0F858-9A99-440B-983A-CD4EA5615AE5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BDBD2D92-542F-4AC4-BCDB-5C6EFC42FD44}.Debug|Any CPU.ActiveCfg = Debug|Win32
{BDBD2D92-542F-4AC4-BCDB-5C6EFC42FD44}.Debug|x64.ActiveCfg = Debug|x64
{BDBD2D92-542F-4AC4-BCDB-5C6EFC42FD44}.Debug|x64.Build.0 = Debug|x64
{BDBD2D92-542F-4AC4-BCDB-5C6EFC42FD44}.Debug|x86.ActiveCfg = Debug|Win32
{BDBD2D92-542F-4AC4-BCDB-5C6EFC42FD44}.Debug|x86.Build.0 = Debug|Win32
{BDBD2D92-542F-4AC4-BCDB-5C6EFC42FD44}.Release|Any CPU.ActiveCfg = Release|Win32
{BDBD2D92-542F-4AC4-BCDB-5C6EFC42FD44}.Release|x64.ActiveCfg = Release|x64
{BDBD2D92-542F-4AC4-BCDB-5C6EFC42FD44}.Release|x64.Build.0 = Release|x64
{BDBD2D92-542F-4AC4-BCDB-5C6EFC42FD44}.Release|x86.ActiveCfg = Release|Win32
{BDBD2D92-542F-4AC4-BCDB-5C6EFC42FD44}.Release|x86.Build.0 = Release|Win32
{AAE0F858-9A99-440B-983A-CD4EA5615AE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AAE0F858-9A99-440B-983A-CD4EA5615AE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AAE0F858-9A99-440B-983A-CD4EA5615AE5}.Debug|x64.ActiveCfg = Debug|Any CPU
{AAE0F858-9A99-440B-983A-CD4EA5615AE5}.Debug|x64.Build.0 = Debug|Any CPU
{AAE0F858-9A99-440B-983A-CD4EA5615AE5}.Debug|x86.ActiveCfg = Debug|Any CPU
{AAE0F858-9A99-440B-983A-CD4EA5615AE5}.Debug|x86.Build.0 = Debug|Any CPU
{AAE0F858-9A99-440B-983A-CD4EA5615AE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AAE0F858-9A99-440B-983A-CD4EA5615AE5}.Release|Any CPU.Build.0 = Release|Any CPU
{AAE0F858-9A99-440B-983A-CD4EA5615AE5}.Release|x64.ActiveCfg = Release|Any CPU
{AAE0F858-9A99-440B-983A-CD4EA5615AE5}.Release|x64.Build.0 = Release|Any CPU
{AAE0F858-9A99-440B-983A-CD4EA5615AE5}.Release|x86.ActiveCfg = Release|Any CPU
{AAE0F858-9A99-440B-983A-CD4EA5615AE5}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
Original file line number Diff line number Diff line change
@@ -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("TestPaketDotNet")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TestPaketDotNet")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[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("aae0f858-9a99-440b-983a-cd4ea5615ae5")]

// 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")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{AAE0F858-9A99-440B-983A-CD4EA5615AE5}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TestPaketDotNet</RootNamespace>
<AssemblyName>TestPaketDotNet</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Content Include="..\paket-files\fsharp\FAKE\modules\Octokit\Octokit.fsx">
<Paket>True</Paket>
<Link>paket-files/Octokit.fsx</Link>
</Content>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.0')">
<ItemGroup>
<Reference Include="System.IO">
<HintPath>..\packages\Microsoft.Bcl\lib\net40\System.IO.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
<Reference Include="System.Runtime">
<HintPath>..\packages\Microsoft.Bcl\lib\net40\System.Runtime.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
<Reference Include="System.Threading.Tasks">
<HintPath>..\packages\Microsoft.Bcl\lib\net40\System.Threading.Tasks.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.0')">
<ItemGroup>
<Reference Include="System.Net.Http.Extensions">
<HintPath>..\packages\Microsoft.Net.Http\lib\net40\System.Net.Http.Extensions.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
<Reference Include="System.Net.Http.Primitives">
<HintPath>..\packages\Microsoft.Net.Http\lib\net40\System.Net.Http.Primitives.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
<Reference Include="System.Net.Http.WebRequest">
<HintPath>..\packages\Microsoft.Net.Http\lib\net40\System.Net.Http.WebRequest.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1')">
<ItemGroup>
<Reference Include="Octokit">
<HintPath>..\packages\Octokit\lib\net45\Octokit.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == 'WindowsPhoneApp') Or ($(TargetFrameworkIdentifier) == '.NETCore') Or ($(TargetFrameworkIdentifier) == 'WindowsPhone' And ($(TargetFrameworkVersion) == 'v8.0' Or $(TargetFrameworkVersion) == 'v8.1')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid') Or ($(TargetFrameworkIdentifier) == 'MonoTouch') Or ($(TargetFrameworkIdentifier) == 'Xamarin.iOS') Or ($(TargetFrameworkIdentifier) == 'Xamarin.Mac') Or ($(TargetFrameworkProfile) == 'Profile7') Or ($(TargetFrameworkProfile) == 'Profile31') Or ($(TargetFrameworkProfile) == 'Profile32') Or ($(TargetFrameworkProfile) == 'Profile44') Or ($(TargetFrameworkProfile) == 'Profile49') Or ($(TargetFrameworkProfile) == 'Profile78') Or ($(TargetFrameworkProfile) == 'Profile84') Or ($(TargetFrameworkProfile) == 'Profile111') Or ($(TargetFrameworkProfile) == 'Profile151') Or ($(TargetFrameworkProfile) == 'Profile157') Or ($(TargetFrameworkProfile) == 'Profile259')">
<ItemGroup>
<Reference Include="Octokit">
<HintPath>..\packages\Octokit\lib\portable-net45+wp80+win+wpa81\Octokit.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
File:Octokit.fsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source https://www.nuget.org/api/v2
github fsharp/FAKE modules/Octokit/Octokit.fsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
NUGET
remote: https://www.nuget.org/api/v2
specs:
Microsoft.Bcl (1.1.10) - framework: net10, net11, net20, net30, net35, net40, net40-full
Microsoft.Bcl.Build (>= 1.0.14)
Microsoft.Bcl.Build (1.0.21) - import_targets: false, framework: net10, net11, net20, net30, net35, net40, net40-full
Microsoft.Net.Http (2.2.29) - framework: net10, net11, net20, net30, net35, net40, net40-full
Microsoft.Bcl (>= 1.1.10)
Microsoft.Bcl.Build (>= 1.0.14)
Octokit (0.19)
Microsoft.Net.Http - framework: net10, net11, net20, net30, net35, net40, net40-full
GITHUB
remote: fsharp/FAKE
specs:
modules/Octokit/Octokit.fsx (00e0dddce9aacc1aa27924eb134999bcf94a9e0e)
Octokit
2 changes: 1 addition & 1 deletion src/Paket.Core/InstallProcess.fs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ let InstallIntoProjects(options : InstallerOptions, forceTouch, dependenciesFile
let usedPackages =
referenceFile.Groups
|> Seq.map (fun kv ->
kv.Value.NugetPackages
lockFile.GetRemoteReferencedPackages(referenceFile,kv.Value) @ kv.Value.NugetPackages
|> Seq.map (fun ps ->
let group =
match lockFile.Groups |> Map.tryFind kv.Key with
Expand Down
32 changes: 27 additions & 5 deletions src/Paket.Core/LockFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -553,11 +553,22 @@ type LockFile(fileName:string,groups: Map<GroupName,LockFileGroup>) =
let usedPackages = Dictionary<_,_>()

for g in referencesFile.Groups do
for p in g.Value.NugetPackages do
let k = g.Key,p.Name
if usedPackages.ContainsKey k then
failwithf "Package %O is referenced more than once in %s within group %O." p.Name referencesFile.FileName g.Key
usedPackages.Add(k,p)
match this.Groups |> Map.tryFind g.Key with
| None -> failwithf "Group %O was referenced in %s, but not found in paket.lock." g.Key referencesFile.FileName
| Some lockGroup ->
for p in g.Value.NugetPackages do
let k = g.Key,p.Name
if usedPackages.ContainsKey k |> not then
usedPackages.Add(k,p)

for r in g.Value.RemoteFiles do
match lockGroup.RemoteFiles |> List.tryFind (fun x -> x.Name = r.Name) with
| None -> failwithf "Remote file %O was referenced in %s, but not found in paket.lock." r.Name referencesFile.FileName
| Some lockRemote ->
for p,_ in lockRemote.Dependencies do
let k = g.Key,p
if usedPackages.ContainsKey k |> not then
usedPackages.Add(k,PackageInstallSettings.Default(p.ToString()))

for g in referencesFile.Groups do
g.Value.NugetPackages
Expand All @@ -571,6 +582,17 @@ type LockFile(fileName:string,groups: Map<GroupName,LockFileGroup>) =

usedPackages

member this.GetRemoteReferencedPackages(referencesFile:ReferencesFile,installGroup:InstallGroup) =
[for r in installGroup.RemoteFiles do
match this.Groups |> Map.tryFind installGroup.Name with
| None -> failwithf "Group %O was referenced in %s, but not found in paket.lock." installGroup.Name referencesFile.FileName
| Some lockGroup ->
match lockGroup.RemoteFiles |> List.tryFind (fun x -> x.Name.EndsWith(r.Name)) with
| None -> failwithf "Remote file %O was referenced in %s, but not found in paket.lock." r.Name referencesFile.FileName
| Some lockRemote ->
for p,_ in lockRemote.Dependencies do
yield PackageInstallSettings.Default(p.ToString())]

member this.GetPackageHull(groupName,referencesFile:ReferencesFile) =
let usedPackages = Dictionary<_,_>()
match referencesFile.Groups |> Map.tryFind groupName with
Expand Down
2 changes: 1 addition & 1 deletion src/Paket/Paket.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<StartAction>Project</StartAction>
<StartProgram>paket.exe</StartProgram>
<StartArguments>install</StartArguments>
<StartWorkingDirectory>D:\code\Paket\integrationtests\scenarios\i001552-install-mvvmlightlibs-again\temp</StartWorkingDirectory>
<StartWorkingDirectory>D:\code\Paket\integrationtests\scenarios\i001578-transitive-ref\temp</StartWorkingDirectory>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand Down

0 comments on commit f024316

Please sign in to comment.