Skip to content

Commit 76472f8

Browse files
2sComplementet1975
authored andcommitted
Fixes #2, paket and sln (#3)
* Fixes #2, paket and sln * Removing comment
1 parent 1ae48c2 commit 76472f8

File tree

5 files changed

+147
-66
lines changed

5 files changed

+147
-66
lines changed

.paket/Paket.Restore.targets

+15-39
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,23 @@
4343
<!-- Step 1 Check if lockfile is properly restored -->
4444
<PropertyGroup>
4545
<PaketRestoreRequired>true</PaketRestoreRequired>
46-
<NoWarn>$(NoWarn);NU1603;NU1604;NU1605;NU1608</NoWarn>
46+
<NoWarn>$(NoWarn);NU1603</NoWarn>
4747
</PropertyGroup>
4848

4949
<!-- Because ReadAllText is slow on osx/linux, try to find shasum and awk -->
5050
<PropertyGroup>
51-
<PaketRestoreCachedHasher Condition="'$(OS)' != 'Windows_NT' And '$(PaketRestoreCachedHasher)' == '' And Exists('/usr/bin/shasum') And Exists('/usr/bin/awk')">/usr/bin/shasum "$(PaketRestoreCacheFile)" | /usr/bin/awk '{ print $1 }'</PaketRestoreCachedHasher>
52-
<PaketRestoreLockFileHasher Condition="'$(OS)' != 'Windows_NT' And '$(PaketRestoreLockFileHash)' == '' And Exists('/usr/bin/shasum') And Exists('/usr/bin/awk')">/usr/bin/shasum "$(PaketLockFilePath)" | /usr/bin/awk '{ print $1 }'</PaketRestoreLockFileHasher>
51+
<PaketRestoreCachedHasher Condition="'$(OS)' != 'Windows_NT' And '$(PaketRestoreCachedHasher)' == '' And Exists('/usr/bin/shasum') And Exists('/usr/bin/awk')">/usr/bin/shasum $(PaketRestoreCacheFile) | /usr/bin/awk '{ print $1 }'</PaketRestoreCachedHasher>
52+
<PaketRestoreLockFileHasher Condition="'$(OS)' != 'Windows_NT' And '$(PaketRestoreLockFileHash)' == '' And Exists('/usr/bin/shasum') And Exists('/usr/bin/awk')">/usr/bin/shasum $(PaketLockFilePath) | /usr/bin/awk '{ print $1 }'</PaketRestoreLockFileHasher>
5353
</PropertyGroup>
5454

5555
<!-- If shasum and awk exist get the hashes -->
5656
<Exec StandardOutputImportance="Low" Condition=" '$(PaketRestoreCachedHasher)' != '' " Command="$(PaketRestoreCachedHasher)" ConsoleToMSBuild='true'>
57-
<Output TaskParameter="ConsoleOutput" PropertyName="PaketRestoreCachedHash" />
57+
<Output TaskParameter="ConsoleOutput" PropertyName="PaketRestoreCachedHash" />
5858
</Exec>
5959
<Exec StandardOutputImportance="Low" Condition=" '$(PaketRestoreLockFileHasher)' != '' " Command="$(PaketRestoreLockFileHasher)" ConsoleToMSBuild='true'>
60-
<Output TaskParameter="ConsoleOutput" PropertyName="PaketRestoreLockFileHash" />
60+
<Output TaskParameter="ConsoleOutput" PropertyName="PaketRestoreLockFileHash" />
6161
</Exec>
6262

63-
<!-- Debug whats going on -->
64-
<Message Importance="low" Text="calling paket restore with targetframework=$(TargetFramework) targetframeworks=$(TargetFrameworks)" />
65-
6663
<PropertyGroup Condition="Exists('$(PaketRestoreCacheFile)') ">
6764
<!-- if no hash has been done yet fall back to just reading in the files and comparing them -->
6865
<PaketRestoreCachedHash Condition=" '$(PaketRestoreCachedHash)' == '' ">$([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)'))</PaketRestoreCachedHash>
@@ -72,22 +69,11 @@
7269
<PaketRestoreRequired Condition=" '$(PaketRestoreLockFileHash)' == '' ">true</PaketRestoreRequired>
7370
</PropertyGroup>
7471

75-
<PropertyGroup Condition="'$(PaketPropsVersion)' != '5.174.2' ">
76-
<PaketRestoreRequired>true</PaketRestoreRequired>
77-
</PropertyGroup>
78-
7972
<!-- Do a global restore if required -->
8073
<Exec Command='$(PaketBootStrapperCommand)' Condition="Exists('$(PaketBootStrapperExePath)') AND !(Exists('$(PaketExePath)'))" ContinueOnError="false" />
8174
<Exec Command='$(PaketCommand) restore' Condition=" '$(PaketRestoreRequired)' == 'true' " ContinueOnError="false" />
8275

8376
<!-- Step 2 Detect project specific changes -->
84-
<ItemGroup>
85-
<MyTargetFrameworks Condition="'$(TargetFramework)' != '' " Include="$(TargetFramework)"></MyTargetFrameworks>
86-
<!-- Don't include all frameworks when msbuild explicitly asks for a single one -->
87-
<MyTargetFrameworks Condition="'$(TargetFrameworks)' != '' AND '$(TargetFramework)' == '' " Include="$(TargetFrameworks)"></MyTargetFrameworks>
88-
<PaketResolvedFilePaths Include="@(MyTargetFrameworks -> '$(MSBuildProjectDirectory)\obj\$(MSBuildProjectFile).%(Identity).paket.resolved')"></PaketResolvedFilePaths>
89-
</ItemGroup>
90-
<Message Importance="low" Text="MyTargetFrameworks=@(MyTargetFrameworks) PaketResolvedFilePaths=@(PaketResolvedFilePaths)" />
9177
<PropertyGroup>
9278
<PaketReferencesCachedFilePath>$(MSBuildProjectDirectory)\obj\$(MSBuildProjectFile).paket.references.cached</PaketReferencesCachedFilePath>
9379
<!-- MyProject.fsproj.paket.references has the highest precedence -->
@@ -96,9 +82,7 @@
9682
<PaketOriginalReferencesFilePath Condition=" !Exists('$(PaketOriginalReferencesFilePath)')">$(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references</PaketOriginalReferencesFilePath>
9783
<!-- paket.references -->
9884
<PaketOriginalReferencesFilePath Condition=" !Exists('$(PaketOriginalReferencesFilePath)')">$(MSBuildProjectDirectory)\paket.references</PaketOriginalReferencesFilePath>
99-
100-
<DoAllResolvedFilesExist>false</DoAllResolvedFilesExist>
101-
<DoAllResolvedFilesExist Condition="Exists(%(PaketResolvedFilePaths.Identity))">true</DoAllResolvedFilesExist>
85+
<PaketResolvedFilePath>$(MSBuildProjectDirectory)\obj\$(MSBuildProjectFile).$(TargetFramework).paket.resolved</PaketResolvedFilePath>
10286
<PaketRestoreRequired>true</PaketRestoreRequired>
10387
<PaketRestoreRequiredReason>references-file-or-cache-not-found</PaketRestoreRequiredReason>
10488
</PropertyGroup>
@@ -117,40 +101,32 @@
117101
</PropertyGroup>
118102

119103
<!-- Step 2 b detect relevant changes in project file (new targetframework) -->
120-
<PropertyGroup Condition=" '$(DoAllResolvedFilesExist)' != 'true' ">
104+
<PropertyGroup Condition=" !Exists('$(PaketResolvedFilePath)') AND '$(TargetFramework)' != '' ">
121105
<PaketRestoreRequired>true</PaketRestoreRequired>
122-
<PaketRestoreRequiredReason>target-framework '$(TargetFramework)' or '$(TargetFrameworks)' files @(PaketResolvedFilePaths)</PaketRestoreRequiredReason>
106+
<PaketRestoreRequiredReason>target-framework '$(TargetFramework)'</PaketRestoreRequiredReason>
123107
</PropertyGroup>
124108

125109
<!-- Step 3 Restore project specific stuff if required -->
126110
<Message Condition=" '$(PaketRestoreRequired)' == 'true' " Importance="low" Text="Detected a change ('$(PaketRestoreRequiredReason)') in the project file '$(MSBuildProjectFullPath)', calling paket restore" />
127-
<Exec Command='$(PaketCommand) restore --project "$(MSBuildProjectFullPath)" --target-framework "$(TargetFrameworks)"' Condition=" '$(PaketRestoreRequired)' == 'true' AND '$(TargetFramework)' == '' " ContinueOnError="false" />
128-
<Exec Command='$(PaketCommand) restore --project "$(MSBuildProjectFullPath)" --target-framework "$(TargetFramework)"' Condition=" '$(PaketRestoreRequired)' == 'true' AND '$(TargetFramework)' != '' " ContinueOnError="false" />
111+
<Exec Command='$(PaketCommand) restore --project "$(MSBuildProjectFullPath)"' Condition=" '$(PaketRestoreRequired)' == 'true' " ContinueOnError="false" />
129112

130113
<!-- This shouldn't actually happen, but just to be sure. -->
131-
<PropertyGroup>
132-
<DoAllResolvedFilesExist>false</DoAllResolvedFilesExist>
133-
<DoAllResolvedFilesExist Condition="Exists(%(PaketResolvedFilePaths.Identity))">true</DoAllResolvedFilesExist>
134-
</PropertyGroup>
135-
<Error Condition=" '$(DoAllResolvedFilesExist)' != 'true' AND '$(ResolveNuGetPackages)' != 'False' " Text="One Paket file '@(PaketResolvedFilePaths)' is missing while restoring $(MSBuildProjectFile). Please delete 'paket-files/paket.restore.cached' and call 'paket restore'." />
114+
<Error Condition=" !Exists('$(PaketResolvedFilePath)') AND '$(TargetFramework)' != '' AND '$(ResolveNuGetPackages)' != 'False' " Text="Paket file '$(PaketResolvedFilePath)' is missing while restoring $(MSBuildProjectFile). Please delete 'paket-files/paket.restore.cached' and call 'paket restore'." />
136115

137116
<!-- Step 4 forward all msbuild properties (PackageReference, DotNetCliToolReference) to msbuild -->
138-
<ReadLinesFromFile Condition="($(DesignTimeBuild) != true OR '$(PaketPropsLoaded)' != 'true') AND '@(PaketResolvedFilePaths)' != ''" File="%(PaketResolvedFilePaths.Identity)" >
117+
<ReadLinesFromFile Condition="Exists('$(PaketResolvedFilePath)')" File="$(PaketResolvedFilePath)" >
139118
<Output TaskParameter="Lines" ItemName="PaketReferencesFileLines"/>
140119
</ReadLinesFromFile>
141120

142-
<ItemGroup Condition="($(DesignTimeBuild) != true OR '$(PaketPropsLoaded)' != 'true') AND '@(PaketReferencesFileLines)' != '' " >
121+
<ItemGroup Condition=" Exists('$(PaketResolvedFilePath)') AND '@(PaketReferencesFileLines)' != '' " >
143122
<PaketReferencesFileLinesInfo Include="@(PaketReferencesFileLines)" >
144123
<PackageName>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0])</PackageName>
145124
<PackageVersion>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1])</PackageVersion>
146125
<AllPrivateAssets>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[4])</AllPrivateAssets>
147-
<CopyLocal>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[5])</CopyLocal>
148126
</PaketReferencesFileLinesInfo>
149127
<PackageReference Include="%(PaketReferencesFileLinesInfo.PackageName)">
150128
<Version>%(PaketReferencesFileLinesInfo.PackageVersion)</Version>
151-
<PrivateAssets Condition=" ('%(PaketReferencesFileLinesInfo.AllPrivateAssets)' == 'true') Or ('$(PackAsTool)' == 'true') ">All</PrivateAssets>
152-
<ExcludeAssets Condition="%(PaketReferencesFileLinesInfo.CopyLocal) == 'false'">runtime</ExcludeAssets>
153-
<Publish Condition=" '$(PackAsTool)' == 'true' ">true</Publish>
129+
<PrivateAssets Condition="%(PaketReferencesFileLinesInfo.AllPrivateAssets) == 'true'">All</PrivateAssets>
154130
</PackageReference>
155131
</ItemGroup>
156132

@@ -207,8 +183,8 @@
207183

208184
<ConvertToAbsolutePath Condition="@(_NuspecFiles) != ''" Paths="@(_NuspecFiles)">
209185
<Output TaskParameter="AbsolutePaths" PropertyName="NuspecFileAbsolutePath" />
210-
</ConvertToAbsolutePath>
211-
186+
</ConvertToAbsolutePath>
187+
212188

213189
<!-- Call Pack -->
214190
<PackTask Condition="$(UseNewPack)"

.paket/paket.exe

8.04 MB
Binary file not shown.

src/FsCassy.Tests/InMemTests.fs

+64-3
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,35 @@ module Samples =
1414
open Statement
1515

1616
type X = {x:int}
17+
type T = {w:string; x:int; y:int; z:int}
18+
type en = | Zero = 0 | One = 1
19+
type E = { e:en }
20+
1721
let exampleWhere : Statement<X,_> =
1822
table
1923
>>= where (Quote.X(fun x -> x.x = 0))
2024
>>= read
2125

26+
let exampleWhereNone : Statement<X,_> =
27+
table
28+
>>= where (Quote.X(fun x -> x.x = 10))
29+
>>= read
30+
31+
let exampleFind : Statement<X,_> =
32+
table
33+
>>= where (Quote.X(fun x -> x.x = 0))
34+
>>= find
35+
36+
let exampleFindConversion : Statement<E,_> =
37+
table
38+
>>= where (Quote.X(fun e -> int e.e = 0 ))
39+
>>= find
40+
41+
let exampleFindNone : Statement<X,_> =
42+
table
43+
>>= where (Quote.X(fun x -> x.x = 10))
44+
>>= find
45+
2246
let exampleTake : Statement<X,_> =
2347
table
2448
>>= take 1
@@ -32,19 +56,27 @@ module Samples =
3256
let exampleUpdate : Statement<X,_> =
3357
table
3458
>>= where (Quote.X(fun x -> x.x = 0))
35-
>>= select (Quote.X(fun x -> { x with x = 10}))
59+
>>= select (Quote.X(fun x -> { x with x = 10 }))
3660
>>= update
3761
>>= withConsistency Consistency.Any
3862
>>= execute
3963

4064
let exampleUpdateIf : Statement<X,_> =
4165
table
4266
>>= where (Quote.X(fun x -> x.x = 0))
43-
>>= select (Quote.X(fun x -> { x with x = 10}))
67+
>>= select (Quote.X(fun x -> { x with x = 10 }))
4468
>>= updateIf (Quote.X(fun x -> x.x = 0))
4569
>>= withConsistency Consistency.Any
4670
>>= execute
4771

72+
let exampleUpdateNew : Statement<T,_> =
73+
table
74+
>>= where (Quote.X(fun t -> t.x = 7 && t.y = 8))
75+
>>= select (Quote.X(fun t -> { t with z = 9 }))
76+
>>= update
77+
>>= withConsistency Consistency.Any
78+
>>= execute
79+
4880
let exampleDelete : Statement<X,_> =
4981
table
5082
>>= where (Quote.X(fun x -> x.x = 0))
@@ -74,10 +106,31 @@ let ``InMem reads``() =
74106
|> Async.RunSynchronously |> List.ofSeq =! xs
75107

76108
[<Test>]
77-
let ``InMem where``() =
109+
let ``InMem reads where``() =
78110
Samples.exampleWhere |> InMem.Interpreter.execute (ResizeArray xs)
79111
|> Async.RunSynchronously |> List.ofSeq =! [{x=0}; {x=0}]
80112

113+
[<Test>]
114+
let ``InMem reads no-where``() =
115+
Samples.exampleWhereNone |> InMem.Interpreter.execute (ResizeArray xs)
116+
|> Async.RunSynchronously |> List.ofSeq =! []
117+
118+
[<Test>]
119+
let ``InMem finds where``() =
120+
Samples.exampleFind |> InMem.Interpreter.execute (ResizeArray xs)
121+
|> Async.RunSynchronously =! Some {x=0}
122+
123+
[<Test>]
124+
let ``InMem finds no-where converted``() =
125+
let xs = ResizeArray [ { e = en.One } ]
126+
Samples.exampleFindConversion |> InMem.Interpreter.execute (ResizeArray xs)
127+
|> Async.RunSynchronously =! None
128+
129+
[<Test>]
130+
let ``InMem finds no-where``() =
131+
Samples.exampleFindNone |> InMem.Interpreter.execute (ResizeArray xs)
132+
|> Async.RunSynchronously =! None
133+
81134
[<Test>]
82135
let ``InMem takes``() =
83136
Samples.exampleTake |> InMem.Interpreter.execute (ResizeArray xs)
@@ -109,6 +162,14 @@ let ``InMem updatesIf``() =
109162
|> Async.RunSynchronously
110163
xs.Contains {x=10} =! true
111164

165+
[<Test>]
166+
let ``InMem updatesNew``() =
167+
let xs = ResizeArray [ { w = "0"; x=1; y=2; z=3 }; { w = "0"; x=2; y=3; z=4 }; { w = "0"; x=3; y=4; z=5 } ]
168+
Samples.exampleUpdateNew |> InMem.Interpreter.execute xs
169+
|> Async.RunSynchronously
170+
xs.Count =! 4
171+
xs.Contains { w = null; x=7; y=8; z=9 } =! true
172+
112173
[<Test>]
113174
let ``InMem deletes``() =
114175
let xs = ResizeArray xs

src/FsCassy.sln

+14-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
21
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 2012
2+
# Visual Studio 15
3+
VisualStudioVersion = 15.0.28010.2036
4+
MinimumVisualStudioVersion = 10.0.40219.1
45
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{63297B98-5CED-492C-A5B7-A5B4F73CF142}"
56
ProjectSection(SolutionItems) = preProject
67
paket.dependencies = paket.dependencies
@@ -28,13 +29,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "content", "content", "{8E6D
2829
docs\content\tutorial.fsx = docs\content\tutorial.fsx
2930
EndProjectSection
3031
EndProject
31-
Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "FsCassy", "FsCassy\FsCassy.fsproj", "{D333F8C5-1914-4955-8EC1-5777D615B75E}"
32+
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FsCassy", "FsCassy\FsCassy.fsproj", "{D333F8C5-1914-4955-8EC1-5777D615B75E}"
3233
EndProject
33-
Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "FsCassy.Tests", "FsCassy.Tests\FsCassy.Tests.fsproj", "{91C4288D-997D-4ABA-9BDF-B8FF33781B8B}"
34+
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FsCassy.Tests", "FsCassy.Tests\FsCassy.Tests.fsproj", "{91C4288D-997D-4ABA-9BDF-B8FF33781B8B}"
3435
EndProject
35-
Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "FsCassy.Hopac", "FsCassy.Hopac\FsCassy.Hopac.fsproj", "{D333F8C6-1914-4955-8EC1-5777D615B75E}"
36+
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FsCassy.Hopac", "FsCassy.Hopac\FsCassy.Hopac.fsproj", "{D333F8C6-1914-4955-8EC1-5777D615B75E}"
3637
EndProject
37-
Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "FsCassy.Hopac.Tests", "FsCassy.Hopac.Tests\FsCassy.Hopac.Tests.fsproj", "{91C4288E-997D-4ABA-9BDF-B8FF33781B8B}"
38+
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FsCassy.Hopac.Tests", "FsCassy.Hopac.Tests\FsCassy.Hopac.Tests.fsproj", "{91C4288E-997D-4ABA-9BDF-B8FF33781B8B}"
3839
EndProject
3940
Global
4041
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -54,10 +55,10 @@ Global
5455
{D333F8C6-1914-4955-8EC1-5777D615B75E}.Debug|Any CPU.Build.0 = Debug|Any CPU
5556
{D333F8C6-1914-4955-8EC1-5777D615B75E}.Release|Any CPU.ActiveCfg = Release|Any CPU
5657
{D333F8C6-1914-4955-8EC1-5777D615B75E}.Release|Any CPU.Build.0 = Release|Any CPU
57-
{91C4288e-997D-4ABA-9BDF-B8FF33781B8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
58-
{91C4288e-997D-4ABA-9BDF-B8FF33781B8B}.Debug|Any CPU.Build.0 = Debug|Any CPU
59-
{91C4288e-997D-4ABA-9BDF-B8FF33781B8B}.Release|Any CPU.ActiveCfg = Release|Any CPU
60-
{91C4288e-997D-4ABA-9BDF-B8FF33781B8B}.Release|Any CPU.Build.0 = Release|Any CPU
58+
{91C4288E-997D-4ABA-9BDF-B8FF33781B8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
59+
{91C4288E-997D-4ABA-9BDF-B8FF33781B8B}.Debug|Any CPU.Build.0 = Debug|Any CPU
60+
{91C4288E-997D-4ABA-9BDF-B8FF33781B8B}.Release|Any CPU.ActiveCfg = Release|Any CPU
61+
{91C4288E-997D-4ABA-9BDF-B8FF33781B8B}.Release|Any CPU.Build.0 = Release|Any CPU
6162
EndGlobalSection
6263
GlobalSection(SolutionProperties) = preSolution
6364
HideSolutionNode = FALSE
@@ -66,4 +67,7 @@ Global
6667
{83F16175-43B1-4C90-A1EE-8E351C33435D} = {A6A6AF7D-D6E3-442D-9B1E-58CC91879BE1}
6768
{8E6D5255-776D-4B61-85F9-73C37AA1FB9A} = {A6A6AF7D-D6E3-442D-9B1E-58CC91879BE1}
6869
EndGlobalSection
70+
GlobalSection(ExtensibilityGlobals) = postSolution
71+
SolutionGuid = {77A3514B-2D3A-4DEA-895D-9B6E7DCC1495}
72+
EndGlobalSection
6973
EndGlobal

0 commit comments

Comments
 (0)