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"
1913
2014open System
2115open System.IO
@@ -24,6 +18,7 @@ open System.Threading
2418open Fake
2519open Fake.Tools .Git
2620open Fake.DotNet
21+ open Fake.DotNet .NuGet
2722open Fake.IO
2823open Fake.IO .FileSystemOperators
2924open Fake.IO .Globbing .Operators
@@ -33,57 +28,32 @@ open Fake.Core
3328open Fake.Api
3429open Octokit
3530
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+
3645// --------------------------------------------------------------------------------------
3746// Information about the project are used
3847// --------------------------------------------------------------------------------------
39- // - for version and project name in generated AssemblyInfo file
4048// - by the generated NuGet package
4149// - to run tests and to publish documentation on GitHub gh-pages
4250// - for documentation, you also need to edit info in "docs/tools/generate.fsx"
4351
44-
52+ let [<Literal>] DotNetMoniker = " net6.0 "
4553let project = " FSharp.Data.GraphQL"
46- let summary = " FSharp implementation of Facebook GraphQL query language"
47- let gitName = " FSharp.Data.GraphQL"
4854let release = ReleaseNotes.load " RELEASE_NOTES.md"
4955let projectRepo = " https://github.com/fsprojects/FSharp.Data.GraphQL.git"
5056
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-
8757// --------------------------------------------------------------------------------------
8858// Clean build results
8959
@@ -98,16 +68,10 @@ Target.create "CleanDocs" (fun _ ->
9868// --------------------------------------------------------------------------------------
9969// Build library & test project
10070
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.
10371Target.create " Restore" ( fun _ ->
10472 !! " src/**/*.??proj"
10573 -- " 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))
11175
11276
11377Target.create " Build" <| fun _ ->
@@ -123,7 +87,7 @@ let startGraphQLServer (project: string) (streamRef: DataRef<Stream>) =
12387
12488 let projectName = Path.GetFileNameWithoutExtension( project)
12589 let projectPath = Path.GetDirectoryName( project)
126- let serverExe = projectPath </> " bin" </> " Release" </> " net5.0 " </> ( projectName + " .dll" )
90+ let serverExe = projectPath </> " bin" </> " Release" </> DotNetMoniker </> ( projectName + " .dll" )
12791
12892 CreateProcess.fromRawCommandLine " dotnet" serverExe
12993 |> CreateProcess.withStandardInput ( CreatePipe streamRef)
@@ -215,22 +179,19 @@ Target.create "ReleaseDocs" (fun _ ->
215179
216180let pack id =
217181 Shell.cleanDir <| sprintf " nuget/%s .%s " project id
218- Paket.pack( fun p ->
182+ id
183+ |> NuGet.NuGetPack( fun p ->
219184 { p with
220- ToolType = ToolType.CreateLocalTool()
221185 Version = release.NugetVersion
222186 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+ })
226189
227190let publishPackage id =
228191 pack id
229- Paket.push ( fun p ->
192+ NuGet.NuGetPublish ( fun p ->
230193 { 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 })
234195
235196Target.create " PublishServer" ( fun _ ->
236197 publishPackage " Server"
@@ -269,7 +230,6 @@ Target.create "PackAll" ignore
269230
270231" Clean"
271232 ==> " Restore"
272- =?> ( " AssemblyInfo" , BuildServer.isLocalBuild)
273233 ==> " Build"
274234 ==> " RunUnitTests"
275235 ==> " StartStarWarsServer"
@@ -287,4 +247,8 @@ Target.create "PackAll" ignore
287247 ==> " PackMiddleware"
288248 ==> " PackAll"
289249
290- Target.runOrDefault " All"
250+ Target.runOrDefaultWithArguments " All"
251+
252+ #if ! FAKE
253+ execContext.Context.Clear()
254+ #endif
0 commit comments