Skip to content

Commit

Permalink
BUGFIX: Detect Lib folder on Linux - fixes #332
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Nov 6, 2014
1 parent 0764dbe commit 6fae68c
Show file tree
Hide file tree
Showing 7 changed files with 173 additions and 131 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 0.11.15 - 06.11.2014
* BUGFIX: Detect Lib folder on Linux - https://github.com/fsprojects/Paket/issues/332

#### 0.11.14 - 03.11.2014
* BUGFIX: Paket timing was incorrect - https://github.com/fsprojects/Paket/issues/326

Expand Down
8 changes: 5 additions & 3 deletions src/Paket.Core/Nuget.fs
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,14 @@ let DownloadPackage(auth, url, name, version, force) =
return! CopyFromCache(targetFile.FullName, name, version, force)
}

/// Finds all libraries in a nuget packge.
let GetLibFiles(targetFolder) =
let dir = DirectoryInfo(Path.Combine(targetFolder,"lib"))
/// Finds all libraries in a nuget package.
let GetLibFiles(targetFolder) =
let libs =
let dir = DirectoryInfo(targetFolder)
let libPath = dir.FullName.ToLower() + Path.DirectorySeparatorChar.ToString() + "lib" + Path.DirectorySeparatorChar.ToString()
if dir.Exists then
dir.GetFiles("*.*",SearchOption.AllDirectories)
|> Array.filter (fun fi -> fi.FullName.ToLower().Contains(libPath))
else
Array.empty

Expand Down
3 changes: 2 additions & 1 deletion src/Paket.Core/Utils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ let CleanDir path =

/// [omit]
let createRelativePath root path =
Uri(if String.IsNullOrEmpty root then System.Environment.CurrentDirectory + Path.DirectorySeparatorChar.ToString() else root).MakeRelativeUri(Uri(path)).ToString().Replace("/", "\\")
let uri = Uri(if String.IsNullOrEmpty root then System.Environment.CurrentDirectory + Path.DirectorySeparatorChar.ToString() else root)
uri.MakeRelativeUri(Uri(path)).ToString().Replace("/", "\\")

/// [omit]
let normalizeXml(doc:XmlDocument) =
Expand Down
4 changes: 2 additions & 2 deletions src/Paket/Paket.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
<DefineConstants>TRACE</DefineConstants>
<WarningLevel>3</WarningLevel>
<DocumentationFile>..\..\bin\Paket.xml</DocumentationFile>
<StartArguments>convert-from-nuget</StartArguments>
<StartWorkingDirectory>D:\code\gitnav</StartWorkingDirectory>
<StartArguments>update --hard</StartArguments>
<StartWorkingDirectory>D:\code\paketkopie</StartWorkingDirectory>
</PropertyGroup>
<PropertyGroup>
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
Expand Down
29 changes: 29 additions & 0 deletions tests/Paket.Tests/InstallModel/Xml/FantomasLib.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module Paket.InstallModel.Xml.FantomasLibSpecs

open Paket
open NUnit.Framework
open FsUnit
open Paket.TestHelpers

let expected = """
<ItemGroup xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Reference Include="FantomasLib">
<HintPath>..\..\..\Fantomas\Lib\FantomasLib.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>"""

[<Test>]
let ``should generate Xml for Fantomas 1.5``() =
let model =
InstallModel.CreateFromLibs("Fantomas", SemVer.Parse "1.5.0",
[ @"..\Fantomas\Lib\FantomasLib.dll"
@"..\Fantomas\Lib\FSharp.Core.dll"
@"..\Fantomas\Lib\Fantomas.exe" ],
Nuspec.Explicit ["FantomasLib.dll"]).FilterFallbacks()

let chooseNode = ProjectFile.Load("./ProjectFile/TestData/Empty.fsprojtest").Value.GenerateXml(model)
chooseNode.OuterXml
|> normalizeXml
|> shouldEqual (normalizeXml expected)
253 changes: 128 additions & 125 deletions tests/Paket.Tests/Paket.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,134 @@
</Target>
-->
<Import Project="$(SolutionDir)\.paket\paket.targets" />
<ItemGroup>
<Compile Include="..\..\paket-files\forki\FsUnit\FsUnit.fs">
<Paket>True</Paket>
<Link>FsUnit.fs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="TestHelpers.fs" />
<Compile Include="SemVerSpecs.fs" />
<Compile Include="CredentialStoreSpecs.fs" />
<Compile Include="NugetVersionRangeParserSpecs.fs" />
<Compile Include="NugetVersionRangeSerializerSpecs.fs" />
<Compile Include="BindingRedirect.fs" />
<Content Include="Nuspec\FSharp.Data.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Nuspec\FSharp.Data.Prerelease.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Nuspec\Octokit.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Nuspec\Fantomas.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Nuspec\Microsoft.Net.Http.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Nuspec\FsXaml.Wpf.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Nuspec\log4net.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Nuspec\FSharp.Data.SqlEnumProvider.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Nuspec\ReadOnlyCollectionExtensions.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Compile Include="Nuspec\NuspecSpecs.fs" />
<Content Include="NuGetOData\Fantomas.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="NuGetOData\Fleece.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="NuGetOData\ReadOnlyCollectionExtensions.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="NuGetOData\Rx-PlatformServices.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Compile Include="NuGetOData\ODataSpecs.fs" />
<Content Include="NuGetConfig\ClearTextPasswordConfig.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="NuGetConfig\PasswordConfig.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Compile Include="NuGetConfig\NuGetConfigSpecs.fs" />
<Compile Include="FilterVersionSpecs.fs" />
<Compile Include="DependenciesFile\VersionRangeSpecs.fs" />
<Compile Include="DependenciesFile\VersionRequirementSpecs.fs" />
<Compile Include="DependenciesFile\ParserSpecs.fs" />
<Compile Include="DependenciesFile\SaveSpecs.fs" />
<Compile Include="DependenciesFile\AddPackageSpecs.fs" />
<Compile Include="Resolver\DependencyGraphSpecs.fs" />
<Compile Include="Resolver\SimpleDependenciesSpecs.fs" />
<Compile Include="Resolver\CyclicGraphSpecs.fs" />
<Compile Include="Resolver\ConflictGraphSpecs.fs" />
<Compile Include="Resolver\CasingSpecs.fs" />
<Compile Include="Resolver\PessimisticStrategySpecs.fs" />
<Compile Include="Resolver\AddingDependenciesSpecs.fs" />
<Compile Include="Lockfile\GeneratorSpecs.fs" />
<Compile Include="Lockfile\GenerateStrictModeSpecs.fs" />
<Compile Include="Lockfile\GenerateContentNoneOptionSpecs.fs" />
<Compile Include="Lockfile\GenerateAuthModeSpecs.fs" />
<Compile Include="Lockfile\GeneratorWithMutlipleSourcesSpecs.fs" />
<Compile Include="Lockfile\ParserSpecs.fs" />
<Compile Include="Lockfile\ParserWithMultipleSourcesSpecs.fs" />
<Compile Include="ReferencesFile\ReferencesFileSpecs.fs" />
<Compile Include="Simplifier\BasicScenarioSpecs.fs" />
<None Include="ProjectFile\TestData\Project1.fsprojtest">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ProjectFile\TestData\Project2.fsprojtest">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ProjectFile\TestData\ProjectWithConditions.fsprojtest">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ProjectFile\TestData\Empty.fsprojtest">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ProjectFile\TestData\CustomFantomasNode.fsprojtest">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ProjectFile\TestData\NoCustomFantomasNode.fsprojtest">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Compile Include="ProjectFile\ConditionSpecs.fs" />
<Compile Include="ProjectFile\FileBuildActionSpecs.fs" />
<Compile Include="ProjectFile\InterProjectDependencySpecs.fs" />
<Compile Include="ProjectFile\OutputSpecs.fs" />
<Compile Include="InstallModel\FrameworkIdentifierSpecs.fs" />
<Compile Include="InstallModel\ProcessingSpecs.fs" />
<Compile Include="InstallModel\Xml\Fantomas.fs" />
<Compile Include="InstallModel\Xml\FantomasLib.fs" />
<Compile Include="InstallModel\Xml\Fuchu.fs" />
<Compile Include="InstallModel\Xml\SystemNetHttp.fs" />
<Compile Include="InstallModel\Xml\SystemNetHttpWithFrameworkReferences.fs" />
<Compile Include="InstallModel\Xml\ManualNodes.fs" />
<Compile Include="DependencyModel\ProjectDependencySpecs.fs" />
<None Include="paket.references" />
</ItemGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Security" />
<Reference Include="System.Xml" />
<ProjectReference Include="..\..\src\Paket.Core\Paket.Core.fsproj">
<Name>Paket.Core</Name>
<Project>{7bab0ae2-089f-4761-b138-a717aa2f86c5}</Project>
<Private>True</Private>
</ProjectReference>
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework'">
<Choose>
Expand Down Expand Up @@ -336,129 +464,4 @@
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="..\..\paket-files\forki\FsUnit\FsUnit.fs">
<Paket>True</Paket>
<Link>FsUnit.fs</Link>
</Compile>
<Compile Include="TestHelpers.fs" />
<Compile Include="SemVerSpecs.fs" />
<Compile Include="CredentialStoreSpecs.fs" />
<Compile Include="NugetVersionRangeParserSpecs.fs" />
<Compile Include="NugetVersionRangeSerializerSpecs.fs" />
<Compile Include="BindingRedirect.fs" />
<Content Include="Nuspec\FSharp.Data.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Nuspec\FSharp.Data.Prerelease.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Nuspec\Octokit.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Nuspec\Fantomas.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Nuspec\Microsoft.Net.Http.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Nuspec\FsXaml.Wpf.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Nuspec\log4net.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Nuspec\FSharp.Data.SqlEnumProvider.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Nuspec\ReadOnlyCollectionExtensions.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Compile Include="Nuspec\NuspecSpecs.fs" />
<Content Include="NuGetOData\Fantomas.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="NuGetOData\Fleece.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="NuGetOData\ReadOnlyCollectionExtensions.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="NuGetOData\Rx-PlatformServices.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Compile Include="NuGetOData\ODataSpecs.fs" />
<Content Include="NuGetConfig\ClearTextPasswordConfig.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="NuGetConfig\PasswordConfig.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Compile Include="NuGetConfig\NuGetConfigSpecs.fs" />
<Compile Include="FilterVersionSpecs.fs" />
<Compile Include="DependenciesFile\VersionRangeSpecs.fs" />
<Compile Include="DependenciesFile\VersionRequirementSpecs.fs" />
<Compile Include="DependenciesFile\ParserSpecs.fs" />
<Compile Include="DependenciesFile\SaveSpecs.fs" />
<Compile Include="DependenciesFile\AddPackageSpecs.fs" />
<Compile Include="Resolver\DependencyGraphSpecs.fs" />
<Compile Include="Resolver\SimpleDependenciesSpecs.fs" />
<Compile Include="Resolver\CyclicGraphSpecs.fs" />
<Compile Include="Resolver\ConflictGraphSpecs.fs" />
<Compile Include="Resolver\CasingSpecs.fs" />
<Compile Include="Resolver\PessimisticStrategySpecs.fs" />
<Compile Include="Resolver\AddingDependenciesSpecs.fs" />
<Compile Include="Lockfile\GeneratorSpecs.fs" />
<Compile Include="Lockfile\GenerateStrictModeSpecs.fs" />
<Compile Include="Lockfile\GenerateContentNoneOptionSpecs.fs" />
<Compile Include="Lockfile\GenerateAuthModeSpecs.fs" />
<Compile Include="Lockfile\GeneratorWithMutlipleSourcesSpecs.fs" />
<Compile Include="Lockfile\ParserSpecs.fs" />
<Compile Include="Lockfile\ParserWithMultipleSourcesSpecs.fs" />
<Compile Include="ReferencesFile\ReferencesFileSpecs.fs" />
<Compile Include="Simplifier\BasicScenarioSpecs.fs" />
<None Include="ProjectFile\TestData\Project1.fsprojtest">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ProjectFile\TestData\Project2.fsprojtest">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ProjectFile\TestData\ProjectWithConditions.fsprojtest">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ProjectFile\TestData\Empty.fsprojtest">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ProjectFile\TestData\CustomFantomasNode.fsprojtest">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ProjectFile\TestData\NoCustomFantomasNode.fsprojtest">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Compile Include="ProjectFile\ConditionSpecs.fs" />
<Compile Include="ProjectFile\FileBuildActionSpecs.fs" />
<Compile Include="ProjectFile\InterProjectDependencySpecs.fs" />
<Compile Include="ProjectFile\OutputSpecs.fs" />
<Compile Include="InstallModel\FrameworkIdentifierSpecs.fs" />
<Compile Include="InstallModel\ProcessingSpecs.fs" />
<Compile Include="InstallModel\Xml\Fantomas.fs" />
<Compile Include="InstallModel\Xml\Fuchu.fs" />
<Compile Include="InstallModel\Xml\SystemNetHttp.fs" />
<Compile Include="InstallModel\Xml\SystemNetHttpWithFrameworkReferences.fs" />
<Compile Include="InstallModel\Xml\ManualNodes.fs" />
<Compile Include="DependencyModel\ProjectDependencySpecs.fs" />
<None Include="paket.references" />
</ItemGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Security" />
<Reference Include="System.Xml" />
<ProjectReference Include="..\..\src\Paket.Core\Paket.Core.fsproj">
<Name>Paket.Core</Name>
<Project>{7bab0ae2-089f-4761-b138-a717aa2f86c5}</Project>
<Private>True</Private>
</ProjectReference>
<Reference Include="System.Xml.Linq" />
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions tests/Paket.Tests/ProjectFile/ConditionSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ let ``should detect CLR version from path``() =
let ``should detect client framework version from path``() =
FrameworkIdentifier.DetectFromPath(@"..\packages\Castle.Core\lib\net40-client\Castle.Core.dll")|> element |> shouldEqual (DotNetFramework(FrameworkVersion.V4_Client))

[<Test>]
let ``should detect client framework version from Lib path``() =
FrameworkIdentifier.DetectFromPath(@"..\packages\Castle.Core\Lib\net40-client\Castle.Core.dll")|> element |> shouldEqual (DotNetFramework(FrameworkVersion.V4_Client))

[<Test>]
let ``should detect net40-full as net40``() =
FrameworkIdentifier.DetectFromPath(@"..\packages\log4net\lib\net40-full\log4net.dll")|> element |> shouldEqual(DotNetFramework(FrameworkVersion.V4))
Expand Down

0 comments on commit 6fae68c

Please sign in to comment.