Skip to content

Commit 10a4c93

Browse files
author
Maxime Mangel
authored
Merge pull request #41 from fable-compiler/fable2
Update to Fable 2.0
2 parents 6b77a9a + 8046e52 commit 10a4c93

File tree

10 files changed

+192
-646
lines changed

10 files changed

+192
-646
lines changed

.paket/Paket.Restore.targets

Lines changed: 112 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,49 @@
1111
<PaketRootPath>$(MSBuildThisFileDirectory)..\</PaketRootPath>
1212
<PaketRestoreCacheFile>$(PaketRootPath)paket-files\paket.restore.cached</PaketRestoreCacheFile>
1313
<PaketLockFilePath>$(PaketRootPath)paket.lock</PaketLockFilePath>
14+
<PaketBootstrapperStyle>classic</PaketBootstrapperStyle>
15+
<PaketBootstrapperStyle Condition="Exists('$(PaketToolsPath)paket.bootstrapper.proj')">proj</PaketBootstrapperStyle>
16+
<PaketExeImage>assembly</PaketExeImage>
17+
<PaketExeImage Condition=" '$(PaketBootstrapperStyle)' == 'proj' ">native</PaketExeImage>
1418
<MonoPath Condition="'$(MonoPath)' == '' And Exists('/Library/Frameworks/Mono.framework/Commands/mono')">/Library/Frameworks/Mono.framework/Commands/mono</MonoPath>
1519
<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>
2120

22-
<!-- .net core fdd -->
21+
<!-- PaketBootStrapper -->
22+
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' AND Exists('$(PaketRootPath)paket.bootstrapper.exe')">$(PaketRootPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
23+
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' ">$(PaketToolsPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
24+
<PaketBootStrapperExeDir Condition=" Exists('$(PaketBootStrapperExePath)') " >$([System.IO.Path]::GetDirectoryName("$(PaketBootStrapperExePath)"))\</PaketBootStrapperExeDir>
25+
26+
<!-- Paket -->
27+
28+
<!-- windows, root => tool => proj style => bootstrapper => global -->
29+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' AND Exists('$(PaketRootPath)paket.exe') ">$(PaketRootPath)paket.exe</PaketExePath>
30+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' AND Exists('$(PaketToolsPath)paket.exe') ">$(PaketToolsPath)paket.exe</PaketExePath>
31+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' AND '$(PaketBootstrapperStyle)' == 'proj' ">$(PaketToolsPath)paket.exe</PaketExePath>
32+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' AND Exists('$(PaketBootStrapperExeDir)') ">$(_PaketBootStrapperExeDir)paket.exe</PaketExePath>
33+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' ">paket.exe</PaketExePath>
34+
35+
<!-- no windows, try native paket as default, root => tool => proj style => mono paket => bootstrpper => global -->
36+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketRootPath)paket') ">$(PaketRootPath)paket</PaketExePath>
37+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketToolsPath)paket') ">$(PaketToolsPath)paket</PaketExePath>
38+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND '$(PaketBootstrapperStyle)' == 'proj' ">$(PaketToolsPath)paket</PaketExePath>
39+
40+
<!-- no windows, try mono paket -->
41+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketRootPath)paket.exe') ">$(PaketRootPath)paket.exe</PaketExePath>
42+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketToolsPath)paket.exe') ">$(PaketToolsPath)paket.exe</PaketExePath>
43+
44+
<!-- no windows, try bootstrapper -->
45+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketBootStrapperExeDir)') ">$(PaketBootStrapperExeDir)paket.exe</PaketExePath>
46+
47+
<!-- no windows, try global native paket -->
48+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' ">paket</PaketExePath>
49+
50+
<!-- Paket command -->
2351
<_PaketExeExtension>$([System.IO.Path]::GetExtension("$(PaketExePath)"))</_PaketExeExtension>
24-
<PaketCommand Condition=" '$(_PaketExeExtension)' == '.dll' ">dotnet "$(PaketExePath)"</PaketCommand>
52+
<PaketCommand Condition=" '$(PaketCommand)' == '' AND '$(_PaketExeExtension)' == '.dll' ">dotnet "$(PaketExePath)"</PaketCommand>
53+
<PaketCommand Condition=" '$(PaketCommand)' == '' AND '$(OS)' != 'Windows_NT' AND '$(_PaketExeExtension)' == '.exe' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</PaketCommand>
54+
<PaketCommand Condition=" '$(PaketCommand)' == '' ">"$(PaketExePath)"</PaketCommand>
2555

26-
<!-- no extension is a shell script -->
27-
<PaketCommand Condition=" '$(_PaketExeExtension)' == '' ">"$(PaketExePath)"</PaketCommand>
2856

29-
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' AND Exists('$(PaketRootPath)paket.bootstrapper.exe')">$(PaketRootPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
30-
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' ">$(PaketToolsPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
3157
<PaketBootStrapperCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
3258
<PaketBootStrapperCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
3359

@@ -36,9 +62,16 @@
3662
<!-- see https://github.com/fsharp/fslang-design/blob/master/RFCs/FS-1032-fsharp-in-dotnet-sdk.md -->
3763
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
3864
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
65+
66+
<!-- Disable Paket restore under NCrunch build -->
67+
<PaketRestoreDisabled Condition="'$(NCrunch)' == '1'">True</PaketRestoreDisabled>
3968
</PropertyGroup>
4069

41-
<Target Name="PaketRestore" Condition="'$(PaketRestoreDisabled)' != 'True'" BeforeTargets="_GenerateDotnetCliToolReferenceSpecs;_GenerateProjectRestoreGraphPerFramework;_GenerateRestoreGraphWalkPerFramework;CollectPackageReferences" >
70+
<Target Name="PaketBootstrapping" Condition="Exists('$(PaketToolsPath)paket.bootstrapper.proj')">
71+
<MSBuild Projects="$(PaketToolsPath)paket.bootstrapper.proj" Targets="Restore" />
72+
</Target>
73+
74+
<Target Name="PaketRestore" Condition="'$(PaketRestoreDisabled)' != 'True'" BeforeTargets="_GenerateDotnetCliToolReferenceSpecs;_GenerateProjectRestoreGraphPerFramework;_GenerateRestoreGraphWalkPerFramework;CollectPackageReferences" DependsOnTargets="PaketBootstrapping">
4275

4376
<!-- Step 1 Check if lockfile is properly restored -->
4477
<PropertyGroup>
@@ -72,12 +105,16 @@
72105
<PaketRestoreRequired Condition=" '$(PaketRestoreLockFileHash)' == '' ">true</PaketRestoreRequired>
73106
</PropertyGroup>
74107

75-
<PropertyGroup Condition="'$(PaketPropsVersion)' != '5.174.2' ">
108+
<!--
109+
This value should match the version in the props generated by paket
110+
If they differ, this means we need to do a restore in order to ensure correct dependencies
111+
-->
112+
<PropertyGroup Condition="'$(PaketPropsVersion)' != '5.185.3' ">
76113
<PaketRestoreRequired>true</PaketRestoreRequired>
77114
</PropertyGroup>
78115

79116
<!-- Do a global restore if required -->
80-
<Exec Command='$(PaketBootStrapperCommand)' Condition="Exists('$(PaketBootStrapperExePath)') AND !(Exists('$(PaketExePath)'))" ContinueOnError="false" />
117+
<Exec Command='$(PaketBootStrapperCommand)' Condition=" '$(PaketBootstrapperStyle)' == 'classic' AND Exists('$(PaketBootStrapperExePath)') AND !(Exists('$(PaketExePath)'))" ContinueOnError="false" />
81118
<Exec Command='$(PaketCommand) restore' Condition=" '$(PaketRestoreRequired)' == 'true' " ContinueOnError="false" />
82119

83120
<!-- Step 2 Detect project specific changes -->
@@ -141,15 +178,19 @@
141178

142179
<ItemGroup Condition="($(DesignTimeBuild) != true OR '$(PaketPropsLoaded)' != 'true') AND '@(PaketReferencesFileLines)' != '' " >
143180
<PaketReferencesFileLinesInfo Include="@(PaketReferencesFileLines)" >
181+
<Splits>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',').Length)</Splits>
144182
<PackageName>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0])</PackageName>
145183
<PackageVersion>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1])</PackageVersion>
146184
<AllPrivateAssets>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[4])</AllPrivateAssets>
185+
<CopyLocal Condition="'$(Splits)' == '6'">$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[5])</CopyLocal>
147186
</PaketReferencesFileLinesInfo>
148187
<PackageReference Include="%(PaketReferencesFileLinesInfo.PackageName)">
149188
<Version>%(PaketReferencesFileLinesInfo.PackageVersion)</Version>
150189
<PrivateAssets Condition=" ('%(PaketReferencesFileLinesInfo.AllPrivateAssets)' == 'true') Or ('$(PackAsTool)' == 'true') ">All</PrivateAssets>
151-
<ExcludeAssets Condition="%(PaketReferencesFileLinesInfo.AllPrivateAssets) == 'exclude'">runtime</ExcludeAssets>
190+
<ExcludeAssets Condition=" '%(PaketReferencesFileLinesInfo.Splits)' == '6' And %(PaketReferencesFileLinesInfo.CopyLocal) == 'false'">runtime</ExcludeAssets>
191+
<ExcludeAssets Condition=" '%(PaketReferencesFileLinesInfo.Splits)' != '6' And %(PaketReferencesFileLinesInfo.AllPrivateAssets) == 'exclude'">runtime</ExcludeAssets>
152192
<Publish Condition=" '$(PackAsTool)' == 'true' ">true</Publish>
193+
<AllowExplicitVersion>true</AllowExplicitVersion>
153194
</PackageReference>
154195
</ItemGroup>
155196

@@ -181,19 +222,27 @@
181222
<Target Name="PaketDisableDirectPack" AfterTargets="_IntermediatePack" BeforeTargets="GenerateNuspec" Condition="('$(IsPackable)' == '' Or '$(IsPackable)' == 'true') And Exists('$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).references')" >
182223
<PropertyGroup>
183224
<ContinuePackingAfterGeneratingNuspec>false</ContinuePackingAfterGeneratingNuspec>
225+
<DetectedMSBuildVersion>$(MSBuildVersion)</DetectedMSBuildVersion>
226+
<DetectedMSBuildVersion Condition="$(MSBuildVersion) == ''">15.8.0</DetectedMSBuildVersion>
184227
</PropertyGroup>
185228
</Target>
186229

187230
<Target Name="PaketOverrideNuspec" AfterTargets="GenerateNuspec" Condition="('$(IsPackable)' == '' Or '$(IsPackable)' == 'true') And Exists('$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).references')" >
188231
<ItemGroup>
189232
<_NuspecFilesNewLocation Include="$(BaseIntermediateOutputPath)$(Configuration)\*.nuspec"/>
233+
<MSBuildMajorVersion Include="$(DetectedMSBuildVersion.Replace(`-`, `.`).Split(`.`)[0])" />
234+
<MSBuildMinorVersion Include="$(DetectedMSBuildVersion.Replace(`-`, `.`).Split(`.`)[1])" />
190235
</ItemGroup>
191236

192237
<PropertyGroup>
193238
<PaketProjectFile>$(MSBuildProjectDirectory)/$(MSBuildProjectFile)</PaketProjectFile>
194239
<ContinuePackingAfterGeneratingNuspec>true</ContinuePackingAfterGeneratingNuspec>
195-
<UseNewPack>false</UseNewPack>
196-
<UseNewPack Condition=" '$(NuGetToolVersion)' != '4.0.0' ">true</UseNewPack>
240+
<UseMSBuild15_9_Pack>false</UseMSBuild15_9_Pack>
241+
<UseMSBuild15_9_Pack Condition=" '@(MSBuildMajorVersion)' > '15' OR ('@(MSBuildMajorVersion)' == '15' AND '@(MSBuildMinorVersion)' > '8') ">true</UseMSBuild15_9_Pack>
242+
<UseMSBuild15_8_Pack>false</UseMSBuild15_8_Pack>
243+
<UseMSBuild15_8_Pack Condition=" '$(NuGetToolVersion)' != '4.0.0' AND (! $(UseMSBuild15_9_Pack)) ">true</UseMSBuild15_8_Pack>
244+
<UseNuGet4_Pack>false</UseNuGet4_Pack>
245+
<UseNuGet4_Pack Condition=" (! $(UseMSBuild15_8_Pack)) AND (! $(UseMSBuild15_9_Pack)) ">true</UseNuGet4_Pack>
197246
<AdjustedNuspecOutputPath>$(BaseIntermediateOutputPath)$(Configuration)</AdjustedNuspecOutputPath>
198247
<AdjustedNuspecOutputPath Condition="@(_NuspecFilesNewLocation) == ''">$(BaseIntermediateOutputPath)</AdjustedNuspecOutputPath>
199248
</PropertyGroup>
@@ -208,9 +257,52 @@
208257
<Output TaskParameter="AbsolutePaths" PropertyName="NuspecFileAbsolutePath" />
209258
</ConvertToAbsolutePath>
210259

211-
212260
<!-- Call Pack -->
213-
<PackTask Condition="$(UseNewPack)"
261+
<PackTask Condition="$(UseMSBuild15_9_Pack)"
262+
PackItem="$(PackProjectInputFile)"
263+
PackageFiles="@(_PackageFiles)"
264+
PackageFilesToExclude="@(_PackageFilesToExclude)"
265+
PackageVersion="$(PackageVersion)"
266+
PackageId="$(PackageId)"
267+
Title="$(Title)"
268+
Authors="$(Authors)"
269+
Description="$(Description)"
270+
Copyright="$(Copyright)"
271+
RequireLicenseAcceptance="$(PackageRequireLicenseAcceptance)"
272+
LicenseUrl="$(PackageLicenseUrl)"
273+
ProjectUrl="$(PackageProjectUrl)"
274+
IconUrl="$(PackageIconUrl)"
275+
ReleaseNotes="$(PackageReleaseNotes)"
276+
Tags="$(PackageTags)"
277+
DevelopmentDependency="$(DevelopmentDependency)"
278+
BuildOutputInPackage="@(_BuildOutputInPackage)"
279+
TargetPathsToSymbols="@(_TargetPathsToSymbols)"
280+
SymbolPackageFormat="symbols.nupkg"
281+
TargetFrameworks="@(_TargetFrameworks)"
282+
AssemblyName="$(AssemblyName)"
283+
PackageOutputPath="$(PackageOutputAbsolutePath)"
284+
IncludeSymbols="$(IncludeSymbols)"
285+
IncludeSource="$(IncludeSource)"
286+
PackageTypes="$(PackageType)"
287+
IsTool="$(IsTool)"
288+
RepositoryUrl="$(RepositoryUrl)"
289+
RepositoryType="$(RepositoryType)"
290+
SourceFiles="@(_SourceFiles->Distinct())"
291+
NoPackageAnalysis="$(NoPackageAnalysis)"
292+
MinClientVersion="$(MinClientVersion)"
293+
Serviceable="$(Serviceable)"
294+
FrameworkAssemblyReferences="@(_FrameworkAssemblyReferences)"
295+
ContinuePackingAfterGeneratingNuspec="$(ContinuePackingAfterGeneratingNuspec)"
296+
NuspecOutputPath="$(AdjustedNuspecOutputPath)"
297+
IncludeBuildOutput="$(IncludeBuildOutput)"
298+
BuildOutputFolder="$(BuildOutputTargetFolder)"
299+
ContentTargetFolders="$(ContentTargetFolders)"
300+
RestoreOutputPath="$(RestoreOutputAbsolutePath)"
301+
NuspecFile="$(NuspecFileAbsolutePath)"
302+
NuspecBasePath="$(NuspecBasePath)"
303+
NuspecProperties="$(NuspecProperties)"/>
304+
305+
<PackTask Condition="$(UseMSBuild15_8_Pack)"
214306
PackItem="$(PackProjectInputFile)"
215307
PackageFiles="@(_PackageFiles)"
216308
PackageFilesToExclude="@(_PackageFilesToExclude)"
@@ -253,7 +345,7 @@
253345
NuspecBasePath="$(NuspecBasePath)"
254346
NuspecProperties="$(NuspecProperties)"/>
255347

256-
<PackTask Condition="! $(UseNewPack)"
348+
<PackTask Condition="$(UseNuGet4_Pack)"
257349
PackItem="$(PackProjectInputFile)"
258350
PackageFiles="@(_PackageFiles)"
259351
PackageFilesToExclude="@(_PackageFilesToExclude)"

RELEASE_NOTES.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### 2.0.0-beta-001
2+
- Convert to Fable 2
3+
14
### 2.0.0-alpha-014
25
- fixed `pickerItem` function.
36

@@ -120,4 +123,4 @@ https://github.com/iyegoroff/fable-react-native/blob/ea8bf8ff51a1d702edb9db44620
120123
* Added first prototype of FlatList mappings
121124

122125
### 1.1.2
123-
* Fix error with toolbarAndroid
126+
* Fix error with toolbarAndroid

paket.dependencies

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ storage:none
44
nuget Fable.Core
55
nuget Fable.React
66
nuget Fable.PowerPack
7+
nuget Thoth.Json
78

89
group Build
910
framework: net46
@@ -12,4 +13,4 @@ framework: net46
1213
nuget FSharp.Core redirects:force, content:none
1314
nuget FAKE
1415
github fsharp/FAKE modules/Octokit/Octokit.fsx
15-
github fable-compiler/fake-helpers Fable.FakeHelpers.fs
16+
github fable-compiler/fake-helpers Fable.FakeHelpers.fs

0 commit comments

Comments
 (0)