Skip to content

Commit

Permalink
build coreclr version using nuget -- because we need project.json.loc…
Browse files Browse the repository at this point in the history
…k for deployment
  • Loading branch information
KevinRansom committed Nov 10, 2015
1 parent f39c4f2 commit fdc96fa
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 134 deletions.
26 changes: 3 additions & 23 deletions paket.dependencies
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
source https://www.myget.org/F/dotnet-buildtools
source https://www.myget.org/F/dotnet-core
source https://www.myget.org/F/fsharp-daily
source https://nuget.org/api/v2
Expand All @@ -7,7 +8,7 @@ nuget FSharp.Core ~> 3.1.2
nuget Http.fs-prerelease
nuget Nancy.Owin
nuget RazorEngine
nuget NuGet.CommandLine
nuget NuGet.CommandLine
nuget FsCheck = 2.0.7
nuget Fuchu.FsCheck
nuget Fuchu.PerfUtil ~> 0.6
Expand All @@ -18,25 +19,4 @@ nuget WebSocketSharp
nuget openssl.redist
nuget DotLiquid

nuget System.Collections.Concurrent 4.0.11-beta-23506
nuget System.Console 4.0.0-beta-23506
nuget System.Diagnostics.Debug 4.0.11-beta-23506
nuget System.Diagnostics.Process 4.1.0-beta-23506
nuget System.Diagnostics.TraceSource 4.0.0-beta-23506
nuget System.Net.Http 4.0.1-beta-23506
nuget System.Net.Sockets 4.1.0-beta-23506
nuget System.Net.Primitives 4.0.11-beta-23506
nuget System.Net.Requests 4.0.11-beta-23506
nuget System.Net.WebHeaderCollection 4.0.1-beta-23506
nuget System.IO.Compression 4.1.0-beta-23506
nuget System.IO.FileSystem 4.0.1-beta-23506
nuget System.Reflection 4.1.0-beta-23506
nuget System.Reflection.TypeExtensions 4.1.0-beta-23506
nuget System.Runtime.Serialization.Json 4.0.1-beta-23506
nuget System.Security.Claims 4.0.1-beta-23506
nuget System.Security.Cryptography.Algorithms 4.0.0-beta-23506
nuget System.Security.Cryptography.Primitives 4.0.0-beta-23506
nuget System.Security.Cryptography.X509Certificates 4.0.0-beta-23506
nuget System.Threading.Thread 4.0.0-beta-23506
nuget System.Text.RegularExpressions 4.0.11-beta-23506
nuget runtime.win7-x64.Microsoft.FSharp.Compiler.netcore 1.0.0-alpha-0002
nuget runtime.win7-x64.Microsoft.FSharp.Compiler.netcore
2 changes: 1 addition & 1 deletion src/Suave/Logging/LogLevel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ type LogLevel =
| 4 -> Warn
| 5 -> Error
| 6 -> Fatal
| _ as i -> failwith "rank %i not available" i) i
| _ as i -> failwith (sprintf "rank %i not available" i)) i

static member op_LessThan (a, b) = (a :> IComparable<LogLevel>).CompareTo(b) < 0
static member op_LessThanOrEqual (a, b) = (a :> IComparable<LogLevel>).CompareTo(b) <= 0
Expand Down
9 changes: 6 additions & 3 deletions src/Suave/Proxy.fs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ let restrictedHeaders = [| "Accept";
"Proxy-Connection"
|]

[<Literal>]let headerIdsDate = "Date"
[<Literal>]let headerIdsExpect = "Expect"
[<Literal>]let headerIdsUserAgent = "User-Agent"
[<Literal>]
let headerIdsDate = "Date"
[<Literal>]
let headerIdsExpect = "Expect"
[<Literal>]
let headerIdsUserAgent = "User-Agent"

type private HttpWebRequest with
member this.GetRequestStream () =
Expand Down
149 changes: 42 additions & 107 deletions src/Suave/Suave.fsproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<FscToolPath>..\..\packages\runtime.win7-x64.Microsoft.FSharp.Compiler.netcore</FscToolPath>
<PropertyGroup Condition=" '$(TargetPlatform)' == 'coreclr' ">
<NuGetPackagesDirectory>..\..\packages</NuGetPackagesDirectory>
<FscToolPath>$(NuGetPackagesDirectory)\runtime.win7-x64.Microsoft.FSharp.Compiler.netcore</FscToolPath>
<OtherFlags>--targetprofile:netcore --simpleresolution --noframework</OtherFlags>
<ImplicitlyExpandTargetFramework>false</ImplicitlyExpandTargetFramework>
<ImplicitlyExpandDesignTimeFacades>false</ImplicitlyExpandDesignTimeFacades>
<NoStdLib>true</NoStdLib>
<NoExplicitReferenceToStdLib>true</NoExplicitReferenceToStdLib>
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<NoStdLib>true</NoStdLib>
<NoExplicitReferenceToStdLib>true</NoExplicitReferenceToStdLib>
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
<OutputPath>bin\coreclr</OutputPath>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<DefineConstants>$(DefineConstants);LIMITED_WEB_CLIENT</DefineConstants>
<NuGetIngoreLockFile>true</NuGetIngoreLockFile>
<NuGetTargetMoniker>DNXCore,Version=v5.0</NuGetTargetMoniker>
<BaseNuGetRuntimeIdentifier>win7</BaseNuGetRuntimeIdentifier>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetPlatform)' != 'coreclr' ">
<FscToolPath></FscToolPath>
<OtherFlags></OtherFlags>
<OutputPath>bin</OutputPath>
<ResolveNuGetPackages>false</ResolveNuGetPackages>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
</PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand All @@ -19,13 +31,13 @@
<OutputType>Library</OutputType>
<RootNamespace>Suave</RootNamespace>
<AssemblyName>Suave</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<Name>Suave</Name>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<OutputPath>$(OutputPath)\Debug\</OutputPath>
<DefineConstants>$(DefineConstants);DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<ConsolePause>false</ConsolePause>
Expand All @@ -37,7 +49,7 @@
<DebugSymbols>true</DebugSymbols>
<Optimize>true</Optimize>
<Tailcalls>true</Tailcalls>
<OutputPath>bin\Release\</OutputPath>
<OutputPath>$(OutputPath)\Release\</OutputPath>
<ErrorReport>prompt</ErrorReport>
<ConsolePause>false</ConsolePause>
<WarningLevel>3</WarningLevel>
Expand All @@ -51,7 +63,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<OutputPath>$(OutputPath)\Debug\</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<ConsolePause>false</ConsolePause>
Expand All @@ -64,7 +76,7 @@
<DebugSymbols>true</DebugSymbols>
<Optimize>true</Optimize>
<Tailcalls>true</Tailcalls>
<OutputPath>bin\Release\</OutputPath>
<OutputPath>$(OutputPath)\bin\Release\</OutputPath>
<ErrorReport>prompt</ErrorReport>
<ConsolePause>false</ConsolePause>
<WarningLevel>3</WarningLevel>
Expand All @@ -86,7 +98,7 @@
</Otherwise>
</Choose>
<Import Project="$(FSharpTargetsPath)" Condition="Exists('$(FSharpTargetsPath)')" />
<Import Project="..\..\tools\paket.targets" />
<Import Project="..\..\tools\paket.targets" Condition=" '$(TargetPlatform)' != 'coreclr' " />
<ItemGroup>
<Compile Include="Utils\Aether.fs" />
<Compile Include="Utils\Async.fs" />
Expand Down Expand Up @@ -136,102 +148,25 @@
<Compile Include="Json.fs" />
<Compile Include="Proxy.fs" />
<Compile Include="AssemblyVersionInfo.fs" Condition="Exists('AssemblyVersionInfo.fs')" />
<None Include="paket.references" />
<None Include="paket.references" Condition=" '$(TargetPlatform)' != 'coreclr' " />
<None Include="project.json" Condition=" '$(TargetPlatform)' == 'coreclr' " />
<Content Include="App.config" />
</ItemGroup>
<ItemGroup>
<Reference Include="FSharp.Core">
<HintPath>..\..\packages\runtime.win7-x64.Microsoft.FSharp.Compiler.netcore\FSharp.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<ItemGroup Condition=" '$(TargetPlatform)' == 'coreclr' ">
<Reference Include="$(NuGetPackagesDirectory)\runtime.win7-x64.Microsoft.FSharp.Compiler.netcore\fsharp.core.dll" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Collections">
<HintPath>..\..\packages\System.Collections\ref\dotnet\System.Collections.dll</HintPath>
</Reference>
<Reference Include="System.Collections.Concurrent">
<HintPath>..\..\packages\System.Collections.Concurrent\ref\netcore50\System.Collections.Concurrent.dll</HintPath>
</Reference>
<Reference Include="System.Console">
<HintPath>..\..\packages\System.Console\ref\dotnet5.4\System.Console.dll</HintPath>
</Reference>
<Reference Include="System.Globalization">
<HintPath>..\..\packages\System.Globalization\ref\dotnet\System.Globalization.dll</HintPath>
</Reference>
<Reference Include="System.Diagnostics.Debug">
<HintPath>..\..\packages\System.Diagnostics.Debug\ref\netcore50\System.Diagnostics.Debug.dll</HintPath>
</Reference>
<Reference Include="System.Diagnostics.Process">
<HintPath>..\..\packages\System.Diagnostics.Process\ref\dotnet5.4\System.Diagnostics.Process.dll</HintPath>
</Reference>
<Reference Include="System.Diagnostics.TraceSource">
<HintPath>..\..\packages\System.Diagnostics.TraceSource\ref\dotnet5.4\System.Diagnostics.TraceSource.dll</HintPath>
</Reference>
<Reference Include="System.IO">
<HintPath>..\..\packages\System.IO\ref\dotnet\System.IO.dll</HintPath>
</Reference>
<Reference Include="System.IO.Compression">
<HintPath>..\..\packages\System.IO.Compression\ref\netcore50\System.IO.Compression.dll</HintPath>
</Reference>
<Reference Include="System.IO.FileSystem">
<HintPath>..\..\packages\System.IO.FileSystem\ref\dotnet5.4\System.IO.FileSystem.dll</HintPath>
</Reference>
<Reference Include="System.IO.FileSystem.Primitives">
<HintPath>..\..\packages\System.IO.FileSystem.Primitives\ref\dotnet\System.IO.FileSystem.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http">
<HintPath>..\..\packages\System.Net.Http\ref\netcore50\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="System.Net.Primitives">
<HintPath>..\..\packages\System.Net.Primitives\ref\netcore50\System.Net.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Net.Requests">
<HintPath>..\..\packages\System.Net.Requests\ref\dotnet5.4\System.Net.Requests.dll</HintPath>
</Reference>
<Reference Include="System.Net.Sockets">
<HintPath>..\..\packages\System.Net.Sockets\ref\dotnet5.4\System.Net.Sockets.dll</HintPath>
</Reference>
<Reference Include="System.Net.WebHeaderCollection">
<HintPath>..\..\packages\System.Net.WebHeaderCollection\ref\dotnet5.4\System.Net.WebHeaderCollection.dll</HintPath>
</Reference>
<Reference Include="System.Reflection">
<HintPath>..\..\packages\System.Reflection\ref\netcore50\System.Reflection.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Extensions">
<HintPath>..\..\packages\System.Runtime.Extensions\ref\dotnet\System.Runtime.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Runtime">
<HintPath>..\..\packages\System.Runtime\ref\dotnet\System.Runtime.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization.Json">
<HintPath>..\..\packages\System.Runtime.Serialization.Json\ref\netcore50\System.Runtime.Serialization.Json.dll</HintPath>
</Reference>
<Reference Include="System.Security.Claims">
<HintPath>..\..\packages\System.Security.Claims\ref\dotnet5.4\System.Security.Claims.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Algorithms">
<HintPath>..\..\packages\System.Security.Cryptography.Algorithms\ref\dotnet5.4\System.Security.Cryptography.Algorithms.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Primitives">
<HintPath>..\..\packages\System.Security.Cryptography.Primitives\ref\dotnet5.4\System.Security.Cryptography.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.X509Certificates">
<HintPath>..\..\packages\System.Security.Cryptography.X509Certificates\ref\dotnet5.4\System.Security.Cryptography.X509Certificates.dll</HintPath>
</Reference>
<Reference Include="System.Text.Encoding">
<HintPath>..\..\packages\System.Text.Encoding\ref\dotnet\System.Text.Encoding.dll</HintPath>
</Reference>
<Reference Include="System.Text.RegularExpressions">
<HintPath>..\..\packages\System.Text.RegularExpressions\ref\netcore50\System.Text.RegularExpressions.dll</HintPath>
</Reference>
<Reference Include="System.Threading">
<HintPath>..\..\packages\System.Threading\ref\dotnet\System.Threading.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Thread">
<HintPath>..\..\packages\System.Threading.Thread\ref\dotnet5.4\System.Threading.Thread.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks">
<HintPath>..\..\packages\System.Threading.Tasks\ref\dotnet\System.Threading.Tasks.dll</HintPath>
</Reference>
<ItemGroup Condition=" '$(TargetPlatform)' != 'coreclr' ">
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Numerics" />
<Reference Include="System.Runtime.Caching" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml" />
</ItemGroup>
</Project>
<Target Name="BeforeBuild" BeforeTargets="Build" Condition="'$(TargetPlatform)' == 'coreclr'">
<Exec Command="..\..\tools\nuget\NuGet.exe restore -Source https://www.myget.org/F/dotnet-core;https://www.myget.org/F/fsharp-daily;https://nuget.org/api/v2 project.json -PackagesDirectory ..\..\packages -Verbosity detailed" />
</Target>
</Project>
35 changes: 35 additions & 0 deletions src/Suave/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1-beta-23506",
"System.Collections.Concurrent": "4.0.11-beta-23506",
"System.Console": "4.0.0-beta-23506",
"System.Diagnostics.Debug": "4.0.11-beta-23506",
"System.Diagnostics.Process": "4.1.0-beta-23506",
"System.Diagnostics.TraceSource": "4.0.0-beta-23506",
"System.Net.Http": "4.0.1-beta-23506",
"System.Net.Sockets": "4.1.0-beta-23506",
"System.Net.Primitives": "4.0.11-beta-23506",
"System.Net.Requests": "4.0.11-beta-23506",
"System.Net.WebHeaderCollection": "4.0.1-beta-23506",
"System.IO.Compression": "4.1.0-beta-23506",
"System.IO.FileSystem": "4.0.1-beta-23506",
"System.Reflection": "4.1.0-beta-23506",
"System.Reflection.TypeExtensions": "4.1.0-beta-23506",
"System.Runtime.Serialization.Json": "4.0.1-beta-23506",
"System.Security.Claims": "4.0.1-beta-23506",
"System.Security.Cryptography.Algorithms": "4.0.0-beta-23506",
"System.Security.Cryptography.Primitives": "4.0.0-beta-23506",
"System.Security.Cryptography.X509Certificates": "4.0.0-beta-23506",
"System.Threading.Thread": "4.0.0-beta-23506",
"System.Text.Encoding": "4.0.11-beta-23506",
"System.Text.RegularExpressions": "4.0.11-beta-23506"
},
"runtimes": {
"win7": { },
"linux": { },
},
"frameworks": {
"dnxcore50": { }
}
}
"
Binary file added tools/nuget/nuget.exe
Binary file not shown.

5 comments on commit fdc96fa

@forki
Copy link

@forki forki commented on fdc96fa Nov 11, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need project.json.lock? there are other options: http://blog.ctaggart.com/2015/10/minimal-coreclr-console-app.html

btw: paket+dnx discussion is at fsprojects/Paket#736

/cc @tpetricek

@tpetricek
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think this does not really need project.json. AFAIK project.json is only required when you are building ASP.NET vNext applications.

All we need here is to somehow instruct MSBuild to reference the right versions of the packages rather than using the "normal NET" versions.

As you can see in the bits deleted from paket.dependencies, I tried to do exactly that in my first attempt :-) but I just could not get MSBuild to respect the references.

@forki If you had time to mess with this, I think what's needed is to get a version exactly before this commit - then you can build it using MSBuild and you'll see that the -r: parameters passed to the compiler are pointing to normal .NET rather than the DLLs explicitly specified by the <Reference ...> tags. If we can figure out why that's happening, then I'm pretty sure we don't need project.json here.

@stuarthillary
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assembly resolution follows a pattern that is defined in the Microsoft.Common.targets file that is found in the directory C:\Windows\Microsoft.NET\Framework\v4.0.30319 . Here is the relevant snippet from the file:

<PropertyGroup>
    <AssemblyFoldersSuffix Condition=" '$(AssemblyFoldersSuffix)' == '' ">AssemblyFoldersEx</AssemblyFoldersSuffix>
    <FrameworkRegistryBase Condition=" '$(FrameworkRegistryBase)' == '' ">Software\Microsoft\$(TargetFrameworkIdentifier)</FrameworkRegistryBase>
    <TargetPlatformRegistryBase Condition="'$(TargetPlatformRegistryBase)' == ''">Software\Microsoft\Microsoft SDKs\$(TargetPlatformIdentifier)</TargetPlatformRegistryBase>
    <!--
        The SearchPaths property is set to find assemblies in the following order:

            (1) Files from current project - indicated by {CandidateAssemblyFiles}
            (2) $(ReferencePath) - the reference path property, which comes from the .USER file.
            (3) The hintpath from the referenced item itself, indicated by {HintPathFromItem}.
            (4) The directory of MSBuild's "target" runtime from GetFrameworkPath.
                The "target" runtime folder is the folder of the runtime that MSBuild is a part of.
            (5) Registered assembly folders, indicated by {Registry:*,*,*}
            (6) Legacy registered assembly folders, indicated by {AssemblyFolders}
            (7) Resolve to the GAC.
            (8) Treat the reference's Include as if it were a real file name.
            (9) Look in the application's output folder (like bin\debug)
        -->
    <AssemblySearchPaths Condition=" '$(AssemblySearchPaths)' == ''">
      {CandidateAssemblyFiles};
      $(ReferencePath);
      {HintPathFromItem};
      {TargetFrameworkDirectory};
      {Registry:$(FrameworkRegistryBase),$(TargetFrameworkVersion),$(AssemblyFoldersSuffix)$(AssemblyFoldersExConditions)};
      {AssemblyFolders};
      {GAC};
      {RawFileName};
      $(OutDir)
    </AssemblySearchPaths>

This suggests that the assemblies are either being resolved before needing the hint paths, or that the hint paths are incorrect and the normal .NET assemblies are being resolved using the other rules.

This old post from Jomo Fisher maybe of help (the code will need to be adapted to use the correct paths for Microsoft.Build*.dll and correct assembly resolution rules):

http://blogs.msdn.com/b/jomo_fisher/archive/2008/05/22/programmatically-resolve-assembly-name-to-full-path-the-same-way-msbuild-does.aspx

@forki
Copy link

@forki forki commented on fdc96fa Nov 12, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tpetricek
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stuarthillary Thank you! This is perhaps the first time someone told me something about MS Build and I actually understood it :-)

Please sign in to comment.