1
- #r " paket:
2
- nuget Fake.Core.Target
3
- nuget Fake.DotNet.Cli
4
- nuget Fake.Tools.Git
5
- nuget Fake.DotNet.AssemblyInfoFile
6
- nuget Fake.Core.ReleaseNotes
7
- nuget Fake.Core.UserInput
8
- nuget Fake.DotNet.MSBuild
9
- nuget Fake.IO.FileSystem
10
- nuget Fake.DotNet.Fsc
11
- nuget Fake.Api.GitHub
12
- nuget Fake.DotNet.Paket
13
- nuget Octokit
14
- nuget FSharp.Core //"
15
-
16
- #if ! FAKE
17
- #load " .fake/build.fsx/intellisense.fsx"
18
- #endif
1
+ #r " nuget: Fake.Api.GitHub"
2
+ #r " nuget: Fake.Core.ReleaseNotes"
3
+ #r " nuget: Fake.Core.Target"
4
+ #r " nuget: Fake.Core.UserInput"
5
+ #r " nuget: Fake.DotNet.AssemblyInfoFile"
6
+ #r " nuget: Fake.DotNet.Cli"
7
+ #r " nuget: Fake.DotNet.Fsc"
8
+ #r " nuget: Fake.DotNet.MSBuild"
9
+ #r " nuget: Fake.IO.FileSystem"
10
+ #r " nuget: Fake.Tools.Git"
11
+ #r " nuget: System.Reactive"
12
+ #r " nuget: Octokit"
19
13
20
14
open System
21
15
open System.IO
@@ -24,6 +18,7 @@ open System.Threading
24
18
open Fake
25
19
open Fake.Tools .Git
26
20
open Fake.DotNet
21
+ open Fake.DotNet .NuGet
27
22
open Fake.IO
28
23
open Fake.IO .FileSystemOperators
29
24
open Fake.IO .Globbing .Operators
@@ -33,57 +28,32 @@ open Fake.Core
33
28
open Fake.Api
34
29
open Octokit
35
30
31
+ // https://github.com/fsprojects/FAKE/issues/2517
32
+ // Regular header and `#load ".fake/build.fsx/intellisense.fsx"`
33
+
34
+ #if ! FAKE
35
+ let execContext =
36
+ System.Environment.GetCommandLineArgs()
37
+ |> Array.skip 2 // skip fsi.exe; build.fsx
38
+ |> Array.toList
39
+ |> Fake.Core.Context.FakeExecutionContext.Create false __ SOURCE_ FILE__
40
+ execContext
41
+ |> Fake.Core.Context.RuntimeContext.Fake
42
+ |> Fake.Core.Context.setExecutionContext
43
+ #endif
44
+
36
45
// --------------------------------------------------------------------------------------
37
46
// Information about the project are used
38
47
// --------------------------------------------------------------------------------------
39
- // - for version and project name in generated AssemblyInfo file
40
48
// - by the generated NuGet package
41
49
// - to run tests and to publish documentation on GitHub gh-pages
42
50
// - for documentation, you also need to edit info in "docs/tools/generate.fsx"
43
51
44
-
52
+ let [<Literal>] DotNetMoniker = " net6.0 "
45
53
let project = " FSharp.Data.GraphQL"
46
- let summary = " FSharp implementation of Facebook GraphQL query language"
47
- let gitName = " FSharp.Data.GraphQL"
48
54
let release = ReleaseNotes.load " RELEASE_NOTES.md"
49
55
let projectRepo = " https://github.com/fsprojects/FSharp.Data.GraphQL.git"
50
56
51
- // Generate assembly info files with the right version & up-to-date information
52
- Target.create " AssemblyInfo" ( fun _ ->
53
- let getAssemblyInfoAttributes projectName =
54
- [ AssemblyInfo.Title projectName
55
- AssemblyInfo.Product project
56
- AssemblyInfo.Description summary
57
- AssemblyInfo.Version release.AssemblyVersion
58
- AssemblyInfo.FileVersion release.AssemblyVersion ]
59
- let internalsVisibility ( fsproj : string ) =
60
- match fsproj with
61
- | f when f.EndsWith " FSharp.Data.GraphQL.Shared.fsproj" ->
62
- [ AssemblyInfo.InternalsVisibleTo " FSharp.Data.GraphQL.Server"
63
- AssemblyInfo.InternalsVisibleTo " FSharp.Data.GraphQL.Client"
64
- AssemblyInfo.InternalsVisibleTo " FSharp.Data.GraphQL.Client.DesignTime"
65
- AssemblyInfo.InternalsVisibleTo " FSharp.Data.GraphQL.Tests" ]
66
- | f when f.EndsWith " FSharp.Data.GraphQL.Server.fsproj" ->
67
- [ AssemblyInfo.InternalsVisibleTo " FSharp.Data.GraphQL.Benchmarks"
68
- AssemblyInfo.InternalsVisibleTo " FSharp.Data.GraphQL.Tests" ]
69
- | _ -> []
70
-
71
- let getProjectDetails ( projectPath : string ) =
72
- let projectName = System.IO.Path.GetFileNameWithoutExtension( projectPath)
73
- ( projectPath,
74
- projectName,
75
- System.IO.Path.GetDirectoryName( projectPath),
76
- ( getAssemblyInfoAttributes projectName)
77
- )
78
-
79
- !! " src/**/*.fsproj"
80
- //-- "src/FSharp.Data.GraphQL.Client.DesignTime/FSharp.Data.GraphQL.Client.DesignTime.fsproj"
81
- |> Seq.map getProjectDetails
82
- |> Seq.iter ( fun ( projFileName , _ , folderName , attributes ) ->
83
- AssemblyInfoFile.createFSharp ( folderName </> " AssemblyInfo.fs" ) ( attributes @ internalsVisibility projFileName)
84
- )
85
- )
86
-
87
57
// --------------------------------------------------------------------------------------
88
58
// Clean build results
89
59
@@ -98,16 +68,10 @@ Target.create "CleanDocs" (fun _ ->
98
68
// --------------------------------------------------------------------------------------
99
69
// Build library & test project
100
70
101
- // We need to disable parallel restoring of projects to because running paket in parallel from Mono
102
- // is giving errors in Unix based operating systems.
103
71
Target.create " Restore" ( fun _ ->
104
72
!! " src/**/*.??proj"
105
73
-- " src/**/*.shproj"
106
- |> Seq.iter ( fun pattern ->
107
- DotNet.restore ( fun options ->
108
- { options with MSBuildParams = { options.MSBuildParams with DisableInternalBinLog = true } }
109
- ) pattern
110
- ))
74
+ |> Seq.iter ( fun pattern -> DotNet.restore id pattern))
111
75
112
76
113
77
Target.create " Build" <| fun _ ->
@@ -123,7 +87,7 @@ let startGraphQLServer (project: string) (streamRef: DataRef<Stream>) =
123
87
124
88
let projectName = Path.GetFileNameWithoutExtension( project)
125
89
let projectPath = Path.GetDirectoryName( project)
126
- let serverExe = projectPath </> " bin" </> " Release" </> " net5.0 " </> ( projectName + " .dll" )
90
+ let serverExe = projectPath </> " bin" </> " Release" </> DotNetMoniker </> ( projectName + " .dll" )
127
91
128
92
CreateProcess.fromRawCommandLine " dotnet" serverExe
129
93
|> CreateProcess.withStandardInput ( CreatePipe streamRef)
@@ -215,22 +179,19 @@ Target.create "ReleaseDocs" (fun _ ->
215
179
216
180
let pack id =
217
181
Shell.cleanDir <| sprintf " nuget/%s .%s " project id
218
- Paket.pack( fun p ->
182
+ id
183
+ |> NuGet.NuGetPack( fun p ->
219
184
{ p with
220
- ToolType = ToolType.CreateLocalTool()
221
185
Version = release.NugetVersion
222
186
OutputPath = sprintf " nuget/%s .%s " project id
223
- TemplateFile = sprintf " src/%s .%s /%s .%s .fsproj.paket.template" project id project id
224
- MinimumFromLockFile = true
225
- IncludeReferencedProjects = false })
187
+ //IncludeReferencedProjects = false
188
+ })
226
189
227
190
let publishPackage id =
228
191
pack id
229
- Paket.push ( fun p ->
192
+ NuGet.NuGetPublish ( fun p ->
230
193
{ p with
231
- ToolType = ToolType.CreateLocalTool()
232
- WorkingDir = sprintf " nuget/%s .%s " project id
233
- PublishUrl = " https://www.nuget.org/api/v2/package" })
194
+ WorkingDir = sprintf " nuget/%s .%s " project id })
234
195
235
196
Target.create " PublishServer" ( fun _ ->
236
197
publishPackage " Server"
@@ -269,7 +230,6 @@ Target.create "PackAll" ignore
269
230
270
231
" Clean"
271
232
==> " Restore"
272
- =?> ( " AssemblyInfo" , BuildServer.isLocalBuild)
273
233
==> " Build"
274
234
==> " RunUnitTests"
275
235
==> " StartStarWarsServer"
@@ -287,4 +247,8 @@ Target.create "PackAll" ignore
287
247
==> " PackMiddleware"
288
248
==> " PackAll"
289
249
290
- Target.runOrDefault " All"
250
+ Target.runOrDefaultWithArguments " All"
251
+
252
+ #if ! FAKE
253
+ execContext.Context.Clear()
254
+ #endif
0 commit comments