@@ -33,10 +33,11 @@ open Octokit
3333
3434#if ! FAKE
3535let execContext =
36- System.Environment.GetCommandLineArgs()
36+ System.Environment.GetCommandLineArgs ()
3737 |> Array.skip 2 // skip fsi.exe; build.fsx
3838 |> Array.toList
3939 |> Fake.Core.Context.FakeExecutionContext.Create false __ SOURCE_ FILE__
40+
4041execContext
4142|> Fake.Core.Context.RuntimeContext.Fake
4243|> Fake.Core.Context.setExecutionContext
@@ -57,93 +58,85 @@ let projectRepo = "https://github.com/fsprojects/FSharp.Data.GraphQL.git"
5758// --------------------------------------------------------------------------------------
5859// Clean build results
5960
60- Target.create " Clean" ( fun _ ->
61- Shell.cleanDirs [ " bin" ; " temp" ]
62- )
61+ Target.create " Clean" <| fun _ -> Shell.cleanDirs [ " bin" ; " temp" ]
6362
64- Target.create " CleanDocs" ( fun _ ->
65- Shell.cleanDirs [ " docs/output" ]
66- )
63+ Target.create " CleanDocs" <| fun _ -> Shell.cleanDirs [ " docs/output" ]
6764
6865// --------------------------------------------------------------------------------------
6966// Build library & test project
7067
71- Target.create " Restore" ( fun _ ->
68+ Target.create " Restore" <| fun _ ->
7269 !! " src/**/*.??proj"
7370 -- " src/**/*.shproj"
74- |> Seq.iter ( fun pattern -> DotNet.restore id pattern))
71+ |> Seq.iter ( fun pattern -> DotNet.restore id pattern)
7572
7673
77- Target.create " Build" <| fun _ ->
74+ Target.create " Build" <| fun _ ->
7875 " FSharp.Data.GraphQL.sln"
79- |> DotNet.build ( fun o ->
80- { o with Configuration = DotNet.BuildConfiguration.Release; MSBuildParams = { o.MSBuildParams with DisableInternalBinLog = true }})
81-
82- let startGraphQLServer ( project : string ) ( streamRef : DataRef < Stream >) =
83- DotNet.build ( fun options ->
84- { options with
76+ |> DotNet.build ( fun o ->
77+ { o with
8578 Configuration = DotNet.BuildConfiguration.Release
86- MSBuildParams = { options.MSBuildParams with DisableInternalBinLog = true }}) project
87-
88- let projectName = Path.GetFileNameWithoutExtension( project)
89- let projectPath = Path.GetDirectoryName( project)
79+ MSBuildParams = { o.MSBuildParams with DisableInternalBinLog = true } })
80+
81+ let startGraphQLServer ( project : string ) ( streamRef : DataRef < Stream >) =
82+ DotNet.build
83+ ( fun options ->
84+ { options with
85+ Configuration = DotNet.BuildConfiguration.Release
86+ MSBuildParams = { options.MSBuildParams with DisableInternalBinLog = true } })
87+ project
88+
89+ let projectName = Path.GetFileNameWithoutExtension ( project)
90+ let projectPath = Path.GetDirectoryName ( project)
9091 let serverExe = projectPath </> " bin" </> " Release" </> DotNetMoniker </> ( projectName + " .dll" )
9192
9293 CreateProcess.fromRawCommandLine " dotnet" serverExe
93- |> CreateProcess.withStandardInput ( CreatePipe streamRef)
94- |> Proc.start
95- |> ignore
94+ |> CreateProcess.withStandardInput ( CreatePipe streamRef) |> Proc.start |> ignore
9695
97- System.Threading.Thread.Sleep( 2000 )
96+ System.Threading.Thread.Sleep ( 2000 )
9897
9998let runTests ( project : string ) =
100- DotNet.build ( fun options ->
101- { options with
102- Configuration = DotNet.BuildConfiguration.Release
103- MSBuildParams = { options.MSBuildParams with DisableInternalBinLog = true }} ) project
104- DotNet.test ( fun options ->
105- { options with
106- Configuration = DotNet.BuildConfiguration.Release
107- MSBuildParams = { options.MSBuildParams with DisableInternalBinLog = true }
108- Common = { options.Common with
109- CustomParams = Some " --no-build -v=normal" } }) project
99+ DotNet.build
100+ ( fun options ->
101+ { options with
102+ Configuration = DotNet.BuildConfiguration.Release
103+ MSBuildParams = { options.MSBuildParams with DisableInternalBinLog = true } })
104+ project
105+
106+ DotNet.test
107+ ( fun options ->
108+ { options with
109+ Configuration = DotNet.BuildConfiguration.Release
110+ MSBuildParams = { options.MSBuildParams with DisableInternalBinLog = true }
111+ Common = { options.Common with CustomParams = Some " --no-build -v=normal" } })
112+ project
110113
111114let starWarsServerStream = StreamRef.Empty
112- Target.create " StartStarWarsServer" ( fun _ ->
115+
116+ Target.create " StartStarWarsServer" <| fun _ ->
113117 Target.activateFinal " StopStarWarsServer"
114118 let project = " samples" </> " star-wars-api" </> " FSharp.Data.GraphQL.Samples.StarWarsApi.fsproj"
115119 startGraphQLServer project starWarsServerStream
116- )
117120
118- Target.createFinal " StopStarWarsServer" ( fun _ ->
119- try
120- starWarsServerStream.Value.Write([| 0 uy|], 0 , 1 )
121- with
122- | e -> printfn " %s " e.Message
123- )
121+ Target.createFinal " StopStarWarsServer" <| fun _ ->
122+ try starWarsServerStream.Value.Write ([| 0 uy |], 0 , 1 )
123+ with e -> printfn " %s " e.Message
124124
125125
126126let integrationServerStream = StreamRef.Empty
127- Target.create " StartIntegrationServer" ( fun _ ->
127+
128+ Target.create " StartIntegrationServer" <| fun _ ->
128129 Target.activateFinal " StopIntegrationServer"
129130 let project = " tests" </> " FSharp.Data.GraphQL.IntegrationTests.Server" </> " FSharp.Data.GraphQL.IntegrationTests.Server.fsproj"
130131 startGraphQLServer project integrationServerStream
131- )
132132
133- Target.createFinal " StopIntegrationServer" ( fun _ ->
134- try
135- integrationServerStream.Value.Write([| 0 uy|], 0 , 1 )
136- with
137- | e -> printfn " %s " e.Message
138- )
133+ Target.createFinal " StopIntegrationServer" <| fun _ ->
134+ try integrationServerStream.Value.Write ([| 0 uy |], 0 , 1 )
135+ with e -> printfn " %s " e.Message
139136
140- Target.create " RunUnitTests" ( fun _ ->
141- runTests " tests/FSharp.Data.GraphQL.Tests/FSharp.Data.GraphQL.Tests.fsproj"
142- )
137+ Target.create " RunUnitTests" <| fun _ -> runTests " tests/FSharp.Data.GraphQL.Tests/FSharp.Data.GraphQL.Tests.fsproj"
143138
144- Target.create " RunIntegrationTests" ( fun _ ->
145- runTests " tests/FSharp.Data.GraphQL.IntegrationTests/FSharp.Data.GraphQL.IntegrationTests.fsproj"
146- )
139+ Target.create " RunIntegrationTests" <| fun _ -> runTests " tests/FSharp.Data.GraphQL.IntegrationTests/FSharp.Data.GraphQL.IntegrationTests.fsproj"
147140
148141let prepareDocGen () =
149142 Shell.rm " docs/release-notes.md"
@@ -156,70 +149,51 @@ let prepareDocGen () =
156149
157150 Shell.cleanDir " .fsdocs"
158151
159- Target.create " GenerateDocs" ( fun _ ->
152+ Target.create " GenerateDocs" <| fun _ ->
160153 prepareDocGen ()
161154 DotNet.exec id " fsdocs" " build --clean" |> ignore
162- )
163155
164- Target.create " GenerateDocsWatch" ( fun _ ->
156+ Target.create " GenerateDocsWatch" <| fun _ ->
165157 prepareDocGen ()
166158 DotNet.exec id " fsdocs" " watch --clean" |> ignore
167- System.Console.ReadKey() |> ignore
168- )
159+ System.Console.ReadKey () |> ignore
169160
170- Target.create " ReleaseDocs" ( fun _ ->
161+ Target.create " ReleaseDocs" <| fun _ ->
171162 Git.Repository.clone " " projectRepo " temp/gh-pages"
172163 Git.Branches.checkoutBranch " temp/gh-pages" " gh-pages"
173- Shell.copyRecursive " output" " temp/gh-pages" true |> printfn " %A "
164+ Shell.copyRecursive " output" " temp/gh-pages" true |> printfn " %A "
174165 Git.CommandHelper.runSimpleGitCommand " temp/gh-pages" " add ." |> printfn " %s "
166+
175167 let cmd = sprintf """ commit -a -m "Update generated documentation for version %s """ release.NugetVersion
176- Git.CommandHelper.runSimpleGitCommand " temp/gh-pages" cmd |> printfn " %s "
168+ Git.CommandHelper.runSimpleGitCommand " temp/gh-pages" cmd |> printfn " %s "
177169 Git.Branches.push " temp/gh-pages"
178- )
179170
180171let pack id =
181172 Shell.cleanDir <| sprintf " nuget/%s .%s " project id
182- id
183- |> NuGet.NuGetPack( fun p ->
173+ id |> NuGet.NuGetPack ( fun p ->
184174 { p with
185175 Version = release.NugetVersion
186176 OutputPath = sprintf " nuget/%s .%s " project id
187- //IncludeReferencedProjects = false
188- })
177+ //IncludeReferencedProjects = false
178+ })
189179
190180let publishPackage id =
191181 pack id
192- NuGet.NuGetPublish( fun p ->
193- { p with
194- WorkingDir = sprintf " nuget/%s .%s " project id })
182+ NuGet.NuGetPublish <| fun p -> { p with WorkingDir = sprintf " nuget/%s .%s " project id }
195183
196- Target.create " PublishServer" ( fun _ ->
197- publishPackage " Server"
198- )
184+ Target.create " PublishServer" <| fun _ -> publishPackage " Server"
199185
200- Target.create " PublishClient" ( fun _ ->
201- publishPackage " Client"
202- )
186+ Target.create " PublishClient" <| fun _ -> publishPackage " Client"
203187
204- Target.create " PublishMiddleware" ( fun _ ->
205- publishPackage " Server.Middleware"
206- )
188+ Target.create " PublishMiddleware" <| fun _ -> publishPackage " Server.Middleware"
207189
208- Target.create " PackShared" ( fun _ ->
209- pack " Shared"
210- )
190+ Target.create " PackShared" <| fun _ -> pack " Shared"
211191
212- Target.create " PackServer" ( fun _ ->
213- pack " Server"
214- )
192+ Target.create " PackServer" <| fun _ -> pack " Server"
215193
216- Target.create " PackClient" ( fun _ ->
217- pack " Client"
218- )
194+ Target.create " PackClient" <| fun _ -> pack " Client"
219195
220- Target.create " PackMiddleware" ( fun _ ->
221- pack " Server.Middleware"
222- )
196+ Target.create " PackMiddleware" <| fun _ -> pack " Server.Middleware"
223197
224198
225199// --------------------------------------------------------------------------------------
@@ -229,26 +203,25 @@ Target.create "All" ignore
229203Target.create " PackAll" ignore
230204
231205" Clean"
232- ==> " Restore"
233- ==> " Build"
234- ==> " RunUnitTests"
235- ==> " StartStarWarsServer"
236- ==> " StartIntegrationServer"
237- ==> " RunIntegrationTests"
238- ==> " All"
239- =?> ( " GenerateDocs" , Environment.environVar " APPVEYOR" = " True" )
240-
241- " CleanDocs"
242- ==> " GenerateDocs"
206+ ==> " Restore"
207+ ==> " Build"
208+ ==> " RunUnitTests"
209+ ==> " StartStarWarsServer"
210+ ==> " StartIntegrationServer"
211+ ==> " RunIntegrationTests"
212+ ==> " All"
213+ =?> ( " GenerateDocs" , Environment.environVar " APPVEYOR" = " True" )
214+
215+ " CleanDocs" ==> " GenerateDocs"
243216
244217" PackShared"
245- ==> " PackServer"
246- ==> " PackClient"
247- ==> " PackMiddleware"
248- ==> " PackAll"
218+ ==> " PackServer"
219+ ==> " PackClient"
220+ ==> " PackMiddleware"
221+ ==> " PackAll"
249222
250223Target.runOrDefaultWithArguments " All"
251224
252225#if ! FAKE
253- execContext.Context.Clear()
254- #endif
226+ execContext.Context.Clear ()
227+ #endif
0 commit comments