Skip to content

Commit 04461a9

Browse files
panesofglasseulerfx
authored andcommitted
Migrate to netstandard2.0
1 parent c2b1619 commit 04461a9

11 files changed

Lines changed: 291 additions & 101 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ release.sh
180180
localpackages/
181181
paket-files
182182
*.orig
183-
.paket/paket.exe
184183
docs/content/license.md
185184
docs/content/release-notes.md
186185
.fake

.paket/Paket.Restore.targets

Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<!-- Prevent dotnet template engine to parse this file -->
3+
<!--/-:cnd:noEmit-->
4+
<PropertyGroup>
5+
<!-- make MSBuild track this file for incremental builds. -->
6+
<!-- ref https://blogs.msdn.microsoft.com/msbuild/2005/09/26/how-to-ensure-changes-to-a-custom-target-file-prompt-a-rebuild/ -->
7+
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
8+
<!-- Mark that this target file has been loaded. -->
9+
<IsPaketRestoreTargetsFileLoaded>true</IsPaketRestoreTargetsFileLoaded>
10+
<PaketToolsPath>$(MSBuildThisFileDirectory)</PaketToolsPath>
11+
<PaketRootPath>$(MSBuildThisFileDirectory)..\</PaketRootPath>
12+
<PaketRestoreCacheFile>$(PaketRootPath)paket-files\paket.restore.cached</PaketRestoreCacheFile>
13+
<PaketLockFilePath>$(PaketRootPath)paket.lock</PaketLockFilePath>
14+
<MonoPath Condition="'$(MonoPath)' == '' And Exists('/Library/Frameworks/Mono.framework/Commands/mono')">/Library/Frameworks/Mono.framework/Commands/mono</MonoPath>
15+
<MonoPath Condition="'$(MonoPath)' == ''">mono</MonoPath>
16+
<!-- Paket command -->
17+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketRootPath)paket.exe')">$(PaketRootPath)paket.exe</PaketExePath>
18+
<PaketExePath Condition=" '$(PaketExePath)' == '' ">$(PaketToolsPath)paket.exe</PaketExePath>
19+
<PaketCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketExePath)"</PaketCommand>
20+
<PaketCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</PaketCommand>
21+
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' AND Exists('$(PaketRootPath)paket.bootstrapper.exe')">$(PaketRootPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
22+
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' ">$(PaketToolsPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
23+
<PaketBootStrapperCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
24+
<PaketBootStrapperCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
25+
26+
<!-- Disable automagic references for F# dotnet sdk -->
27+
<!-- This will not do anything for other project types -->
28+
<!-- see https://github.com/fsharp/fslang-design/blob/master/RFCs/FS-1032-fsharp-in-dotnet-sdk.md -->
29+
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
30+
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
31+
</PropertyGroup>
32+
33+
<Target Name="PaketRestore" BeforeTargets="_GenerateDotnetCliToolReferenceSpecs;_GenerateProjectRestoreGraphPerFramework;_GenerateRestoreGraphWalkPerFramework;CollectPackageReferences" >
34+
35+
<!-- Step 1 Check if lockfile is properly restored -->
36+
<PropertyGroup>
37+
<PaketRestoreRequired>true</PaketRestoreRequired>
38+
<NoWarn>$(NoWarn);NU1603</NoWarn>
39+
</PropertyGroup>
40+
41+
<PropertyGroup Condition="Exists('$(PaketRestoreCacheFile)') ">
42+
<PaketRestoreCachedHash>$([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)'))</PaketRestoreCachedHash>
43+
<PaketRestoreLockFileHash>$([System.IO.File]::ReadAllText('$(PaketLockFilePath)'))</PaketRestoreLockFileHash>
44+
<PaketRestoreRequired>true</PaketRestoreRequired>
45+
<PaketRestoreRequired Condition=" '$(PaketRestoreLockFileHash)' == '$(PaketRestoreCachedHash)' ">false</PaketRestoreRequired>
46+
<PaketRestoreRequired Condition=" '$(PaketRestoreLockFileHash)' == '' ">true</PaketRestoreRequired>
47+
</PropertyGroup>
48+
49+
<!-- Do a global restore if required -->
50+
<Exec Command='$(PaketBootStrapperCommand)' Condition="Exists('$(PaketBootStrapperExePath)') AND !(Exists('$(PaketExePath)'))" ContinueOnError="false" />
51+
<Exec Command='$(PaketCommand) restore' Condition=" '$(PaketRestoreRequired)' == 'true' " ContinueOnError="false" />
52+
53+
<!-- Step 2 Detect project specific changes -->
54+
<PropertyGroup>
55+
<PaketReferencesCachedFilePath>$(MSBuildProjectDirectory)\obj\$(MSBuildProjectFile).paket.references.cached</PaketReferencesCachedFilePath>
56+
<!-- MyProject.fsproj.paket.references has the highest precedence -->
57+
<PaketOriginalReferencesFilePath>$(MSBuildProjectFullPath).paket.references</PaketOriginalReferencesFilePath>
58+
<!-- MyProject.paket.references -->
59+
<PaketOriginalReferencesFilePath Condition=" !Exists('$(PaketOriginalReferencesFilePath)')">$(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references</PaketOriginalReferencesFilePath>
60+
<!-- paket.references -->
61+
<PaketOriginalReferencesFilePath Condition=" !Exists('$(PaketOriginalReferencesFilePath)')">$(MSBuildProjectDirectory)\paket.references</PaketOriginalReferencesFilePath>
62+
<PaketResolvedFilePath>$(MSBuildProjectDirectory)\obj\$(MSBuildProjectFile).$(TargetFramework).paket.resolved</PaketResolvedFilePath>
63+
<PaketRestoreRequired>true</PaketRestoreRequired>
64+
<PaketRestoreRequiredReason>references-file-or-cache-not-found</PaketRestoreRequiredReason>
65+
</PropertyGroup>
66+
67+
<!-- Step 2 a Detect changes in references file -->
68+
<PropertyGroup Condition="Exists('$(PaketOriginalReferencesFilePath)') AND Exists('$(PaketReferencesCachedFilePath)') ">
69+
<PaketRestoreCachedHash>$([System.IO.File]::ReadAllText('$(PaketReferencesCachedFilePath)'))</PaketRestoreCachedHash>
70+
<PaketRestoreReferencesFileHash>$([System.IO.File]::ReadAllText('$(PaketOriginalReferencesFilePath)'))</PaketRestoreReferencesFileHash>
71+
<PaketRestoreRequiredReason>references-file</PaketRestoreRequiredReason>
72+
<PaketRestoreRequired Condition=" '$(PaketRestoreReferencesFileHash)' == '$(PaketRestoreCachedHash)' ">false</PaketRestoreRequired>
73+
</PropertyGroup>
74+
75+
<PropertyGroup Condition="!Exists('$(PaketOriginalReferencesFilePath)') AND !Exists('$(PaketReferencesCachedFilePath)') ">
76+
<!-- If both don't exist there is nothing to do. -->
77+
<PaketRestoreRequired>false</PaketRestoreRequired>
78+
</PropertyGroup>
79+
80+
<!-- Step 2 b detect relevant changes in project file (new targetframework) -->
81+
<PropertyGroup Condition=" !Exists('$(PaketResolvedFilePath)') AND '$(TargetFramework)' != '' ">
82+
<PaketRestoreRequired>true</PaketRestoreRequired>
83+
<PaketRestoreRequiredReason>target-framework '$(TargetFramework)'</PaketRestoreRequiredReason>
84+
</PropertyGroup>
85+
86+
<!-- Step 3 Restore project specific stuff if required -->
87+
<Warning Condition=" '$(PaketRestoreRequired)' == 'true' " Text="Detected a change ('$(PaketRestoreRequiredReason)') in the project file '$(MSBuildProjectFullPath)', calling paket restore" />
88+
<Exec Command='$(PaketCommand) restore --project "$(MSBuildProjectFullPath)"' Condition=" '$(PaketRestoreRequired)' == 'true' " ContinueOnError="false" />
89+
90+
<!-- This shouldn't actually happen, but just to be sure. -->
91+
<Error Condition=" !Exists('$(PaketResolvedFilePath)') AND '$(TargetFramework)' != '' " Text="A paket file for the framework '$(TargetFramework)' is missing. Please delete 'paket-files/paket.restore.cached' and call 'paket restore'." />
92+
93+
<!-- Step 4 forward all msbuild properties (PackageReference, DotNetCliToolReference) to msbuild -->
94+
<ReadLinesFromFile Condition="Exists('$(PaketResolvedFilePath)')" File="$(PaketResolvedFilePath)" >
95+
<Output TaskParameter="Lines" ItemName="PaketReferencesFileLines"/>
96+
</ReadLinesFromFile>
97+
98+
<ItemGroup Condition=" Exists('$(PaketResolvedFilePath)') AND '@(PaketReferencesFileLines)' != '' " >
99+
<PaketReferencesFileLinesInfo Include="@(PaketReferencesFileLines)" >
100+
<PackageName>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0])</PackageName>
101+
<PackageVersion>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1])</PackageVersion>
102+
</PaketReferencesFileLinesInfo>
103+
<PackageReference Include="%(PaketReferencesFileLinesInfo.PackageName)">
104+
<Version>%(PaketReferencesFileLinesInfo.PackageVersion)</Version>
105+
</PackageReference>
106+
</ItemGroup>
107+
108+
<PropertyGroup>
109+
<PaketCliToolFilePath>$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).paket.clitools</PaketCliToolFilePath>
110+
</PropertyGroup>
111+
112+
<ReadLinesFromFile File="$(PaketCliToolFilePath)" >
113+
<Output TaskParameter="Lines" ItemName="PaketCliToolFileLines"/>
114+
</ReadLinesFromFile>
115+
116+
<ItemGroup Condition=" '@(PaketCliToolFileLines)' != '' " >
117+
<PaketCliToolFileLinesInfo Include="@(PaketCliToolFileLines)" >
118+
<PackageName>$([System.String]::Copy('%(PaketCliToolFileLines.Identity)').Split(',')[0])</PackageName>
119+
<PackageVersion>$([System.String]::Copy('%(PaketCliToolFileLines.Identity)').Split(',')[1])</PackageVersion>
120+
</PaketCliToolFileLinesInfo>
121+
<DotNetCliToolReference Include="%(PaketCliToolFileLinesInfo.PackageName)">
122+
<Version>%(PaketCliToolFileLinesInfo.PackageVersion)</Version>
123+
</DotNetCliToolReference>
124+
</ItemGroup>
125+
126+
<PropertyGroup>
127+
<RestoreConfigFile>$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).NuGet.Config</RestoreConfigFile>
128+
</PropertyGroup>
129+
130+
</Target>
131+
132+
<Target Name="PaketDisableDirectPack" AfterTargets="_IntermediatePack" BeforeTargets="GenerateNuspec" Condition="('$(IsPackable)' == '' Or '$(IsPackable)' == 'true') And Exists('$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).references')" >
133+
<PropertyGroup>
134+
<ContinuePackingAfterGeneratingNuspec>false</ContinuePackingAfterGeneratingNuspec>
135+
</PropertyGroup>
136+
</Target>
137+
138+
<Target Name="PaketOverrideNuspec" AfterTargets="GenerateNuspec" Condition="('$(IsPackable)' == '' Or '$(IsPackable)' == 'true') And Exists('$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).references')" >
139+
<PropertyGroup>
140+
<PaketProjectFile>$(MSBuildProjectDirectory)/$(MSBuildProjectFile)</PaketProjectFile>
141+
<ContinuePackingAfterGeneratingNuspec>true</ContinuePackingAfterGeneratingNuspec>
142+
<UseNewPack>false</UseNewPack>
143+
<UseNewPack Condition=" '$(NuGetToolVersion)' != '4.0.0' ">true</UseNewPack>
144+
</PropertyGroup>
145+
146+
<ItemGroup>
147+
<_NuspecFiles Include="$(BaseIntermediateOutputPath)*.nuspec"/>
148+
</ItemGroup>
149+
150+
<Exec Command='$(PaketCommand) fix-nuspecs files "@(_NuspecFiles)" project-file "$(PaketProjectFile)" ' Condition="@(_NuspecFiles) != ''" />
151+
152+
<ConvertToAbsolutePath Condition="@(_NuspecFiles) != ''" Paths="@(_NuspecFiles)">
153+
<Output TaskParameter="AbsolutePaths" PropertyName="NuspecFileAbsolutePath" />
154+
</ConvertToAbsolutePath>
155+
156+
<!-- Call Pack -->
157+
<PackTask Condition="$(UseNewPack)"
158+
PackItem="$(PackProjectInputFile)"
159+
PackageFiles="@(_PackageFiles)"
160+
PackageFilesToExclude="@(_PackageFilesToExclude)"
161+
PackageVersion="$(PackageVersion)"
162+
PackageId="$(PackageId)"
163+
Title="$(Title)"
164+
Authors="$(Authors)"
165+
Description="$(Description)"
166+
Copyright="$(Copyright)"
167+
RequireLicenseAcceptance="$(PackageRequireLicenseAcceptance)"
168+
LicenseUrl="$(PackageLicenseUrl)"
169+
ProjectUrl="$(PackageProjectUrl)"
170+
IconUrl="$(PackageIconUrl)"
171+
ReleaseNotes="$(PackageReleaseNotes)"
172+
Tags="$(PackageTags)"
173+
DevelopmentDependency="$(DevelopmentDependency)"
174+
BuildOutputInPackage="@(_BuildOutputInPackage)"
175+
TargetPathsToSymbols="@(_TargetPathsToSymbols)"
176+
TargetFrameworks="@(_TargetFrameworks)"
177+
AssemblyName="$(AssemblyName)"
178+
PackageOutputPath="$(PackageOutputAbsolutePath)"
179+
IncludeSymbols="$(IncludeSymbols)"
180+
IncludeSource="$(IncludeSource)"
181+
PackageTypes="$(PackageType)"
182+
IsTool="$(IsTool)"
183+
RepositoryUrl="$(RepositoryUrl)"
184+
RepositoryType="$(RepositoryType)"
185+
SourceFiles="@(_SourceFiles->Distinct())"
186+
NoPackageAnalysis="$(NoPackageAnalysis)"
187+
MinClientVersion="$(MinClientVersion)"
188+
Serviceable="$(Serviceable)"
189+
FrameworkAssemblyReferences="@(_FrameworkAssemblyReferences)"
190+
ContinuePackingAfterGeneratingNuspec="$(ContinuePackingAfterGeneratingNuspec)"
191+
NuspecOutputPath="$(BaseIntermediateOutputPath)"
192+
IncludeBuildOutput="$(IncludeBuildOutput)"
193+
BuildOutputFolder="$(BuildOutputTargetFolder)"
194+
ContentTargetFolders="$(ContentTargetFolders)"
195+
RestoreOutputPath="$(RestoreOutputAbsolutePath)"
196+
NuspecFile="$(NuspecFileAbsolutePath)"
197+
NuspecBasePath="$(NuspecBasePath)"
198+
NuspecProperties="$(NuspecProperties)"/>
199+
200+
<PackTask Condition="! $(UseNewPack)"
201+
PackItem="$(PackProjectInputFile)"
202+
PackageFiles="@(_PackageFiles)"
203+
PackageFilesToExclude="@(_PackageFilesToExclude)"
204+
PackageVersion="$(PackageVersion)"
205+
PackageId="$(PackageId)"
206+
Title="$(Title)"
207+
Authors="$(Authors)"
208+
Description="$(Description)"
209+
Copyright="$(Copyright)"
210+
RequireLicenseAcceptance="$(PackageRequireLicenseAcceptance)"
211+
LicenseUrl="$(PackageLicenseUrl)"
212+
ProjectUrl="$(PackageProjectUrl)"
213+
IconUrl="$(PackageIconUrl)"
214+
ReleaseNotes="$(PackageReleaseNotes)"
215+
Tags="$(PackageTags)"
216+
TargetPathsToAssemblies="@(_TargetPathsToAssemblies->'%(FinalOutputPath)')"
217+
TargetPathsToSymbols="@(_TargetPathsToSymbols)"
218+
TargetFrameworks="@(_TargetFrameworks)"
219+
AssemblyName="$(AssemblyName)"
220+
PackageOutputPath="$(PackageOutputAbsolutePath)"
221+
IncludeSymbols="$(IncludeSymbols)"
222+
IncludeSource="$(IncludeSource)"
223+
PackageTypes="$(PackageType)"
224+
IsTool="$(IsTool)"
225+
RepositoryUrl="$(RepositoryUrl)"
226+
RepositoryType="$(RepositoryType)"
227+
SourceFiles="@(_SourceFiles->Distinct())"
228+
NoPackageAnalysis="$(NoPackageAnalysis)"
229+
MinClientVersion="$(MinClientVersion)"
230+
Serviceable="$(Serviceable)"
231+
AssemblyReferences="@(_References)"
232+
ContinuePackingAfterGeneratingNuspec="$(ContinuePackingAfterGeneratingNuspec)"
233+
NuspecOutputPath="$(BaseIntermediateOutputPath)"
234+
IncludeBuildOutput="$(IncludeBuildOutput)"
235+
BuildOutputFolder="$(BuildOutputTargetFolder)"
236+
ContentTargetFolders="$(ContentTargetFolders)"
237+
RestoreOutputPath="$(RestoreOutputAbsolutePath)"
238+
NuspecFile="$(NuspecFileAbsolutePath)"
239+
NuspecBasePath="$(NuspecBasePath)"
240+
NuspecProperties="$(NuspecProperties)"/>
241+
</Target>
242+
<!--/+:cnd:noEmit-->
243+
</Project>

.paket/paket.bootstrapper.exe

-13 KB
Binary file not shown.

.paket/paket.exe

58.3 KB
Binary file not shown.

.paket/paket.targets

Lines changed: 0 additions & 36 deletions
This file was deleted.

build.cmd

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
@echo off
22
cls
33

4-
.paket\paket.bootstrapper.exe
5-
if errorlevel 1 (
6-
exit /b %errorlevel%
7-
)
8-
94
.paket\paket.exe restore
105
if errorlevel 1 (
116
exit /b %errorlevel%
127
)
138

149
IF NOT EXIST build.fsx (
1510
.paket\paket.exe update
16-
packages\FAKE\tools\FAKE.exe init.fsx
11+
packages\build\FAKE\tools\FAKE.exe init.fsx
1712
)
18-
packages\FAKE\tools\FAKE.exe build.fsx %*
13+
packages\build\FAKE\tools\FAKE.exe build.fsx %*

build.fsx

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,14 @@
22
// FAKE build script
33
// --------------------------------------------------------------------------------------
44

5-
#r @"packages/FAKE/tools/FakeLib.dll"
5+
#r @"packages/build/FAKE/tools/FakeLib.dll"
66

77
open Fake
88
open Fake.Git
99
open Fake.AssemblyInfoFile
1010
open Fake.ReleaseNotesHelper
1111
open System
1212
open System.IO
13-
#if MONO
14-
#else
15-
#load "packages/SourceLink.Fake/tools/Fake.fsx"
16-
open SourceLink
17-
#endif
1813

1914
// --------------------------------------------------------------------------------------
2015
// START TODO: Provide project-specific details below
@@ -118,28 +113,6 @@ Target "RunTests" (fun _ ->
118113
OutputFile = "TestResults.xml" })
119114
)
120115

121-
#if MONO
122-
#else
123-
// --------------------------------------------------------------------------------------
124-
// SourceLink allows Source Indexing on the PDB generated by the compiler, this allows
125-
// the ability to step through the source code of external libraries https://github.com/ctaggart/SourceLink
126-
127-
Target "SourceLink" (fun _ ->
128-
let baseUrl = sprintf "%s/%s/{0}/%%var2%%" gitRaw (project.ToLower())
129-
use repo = new GitRepo(__SOURCE_DIRECTORY__)
130-
!! "src/**/*.fsproj"
131-
|> Seq.iter (fun f ->
132-
let proj = VsProj.LoadRelease f
133-
logfn "source linking %s" proj.OutputFilePdb
134-
let files = proj.Compiles -- "**/AssemblyInfo.fs"
135-
repo.VerifyChecksums files
136-
proj.VerifyPdbChecksums files
137-
proj.CreateSrcSrv baseUrl repo.Revision (repo.Paths files)
138-
Pdbstr.exec proj.OutputFilePdb proj.OutputFilePdbSrcSrv
139-
)
140-
)
141-
#endif
142-
143116
// --------------------------------------------------------------------------------------
144117
// Build a NuGet package
145118

@@ -311,10 +284,6 @@ Target "All" DoNothing
311284
=?> ("ReleaseDocs",isLocalBuild)
312285

313286
"All"
314-
//#if MONO
315-
//#else
316-
// =?> ("SourceLink", Pdbstr.tryFind().IsSome )
317-
//#endif
318287
==> "NuGet"
319288
==> "BuildPackage"
320289

0 commit comments

Comments
 (0)