Skip to content

Removed Paket and Fake-CLI, migrated to Packages.props, updated to .NET 6 and F# 6 #378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 9 additions & 21 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"paket": {
"version": "5.257.0",
"commands": [
"paket"
]
},
"fake-cli": {
"version": "5.20.4",
"commands": [
"fake"
]
},
"fsharp.formatting.commandtool": {
"version": "11.1.0",
"commands": [
"fsdocs"
]
}
"version": 1,
"isRoot": true,
"tools": {
"fsharp.formatting.commandtool": {
"version": "11.1.0",
"commands": [
"fsdocs"
]
}
}
}
6 changes: 2 additions & 4 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
dotnet: [5.0.100]
dotnet: [6.0.400]
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -31,7 +31,5 @@ jobs:
dotnet-version: ${{ matrix.dotnet }}
- name: Install local tools
run: dotnet tool restore
- name: Paket Restore
run: dotnet paket restore
- name: Build and Test
run: dotnet fake run build.fsx
run: dotnet fsi build.fsx
494 changes: 0 additions & 494 deletions .paket/Paket.Restore.targets

This file was deleted.

29 changes: 29 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Project>
<Sdk Name="Microsoft.Build.CentralPackageVersions" Version="2.1.3" />

<PropertyGroup>
<LangVersion>6.0</LangVersion>
<!--<NoWarn>$(NoWarn)</NoWarn>-->
<TreatWarningsAsErrors Condition="'$(Configuration)' != 'Debug'">true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup Label="NuGet">
<Authors>John Bazinga, Andrii Chebukin, </Authors>
<Product>FSharp.Data.GraphQL</Product>
<Summary>F# implementation of Facebook GraphQL query language</Summary>

<PackageVersion>1.1.0</PackageVersion>
<PackageTags>FSharp GraphQL Relay React Middleware</PackageTags>
<PackageReadmeFile>README.md</PackageReadmeFile>
<!--<PackageIcon>packageIcon.png</PackageIcon>-->
<!--<PackageIconUrl>https://www.newtonsoft.com/content/images/nugeticon.png</PackageIconUrl>-->
<PackageProjectUrl>https://fsprojects.github.io/FSharp.Data.GraphQL</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<EmbedUntrackedSources>true</EmbedUntrackedSources>

<MinVerTagPrefix>v</MinVerTagPrefix>
</PropertyGroup>
</Project>
20 changes: 12 additions & 8 deletions FSharp.Data.GraphQL.sln
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28922.388
# Visual Studio Version 17
VisualStudioVersion = 17.3.32811.315
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{63297B98-5CED-492C-A5B7-A5B4F73CF142}"
ProjectSection(SolutionItems) = preProject
paket.dependencies = paket.dependencies
paket.lock = paket.lock
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{A6A6AF7D-D6E3-442D-9B1E-58CC91879BE1}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Data.GraphQL.Server", "src\FSharp.Data.GraphQL.Server\FSharp.Data.GraphQL.Server.fsproj", "{474179D3-0090-49E9-88F8-2971C0966077}"
Expand Down Expand Up @@ -137,6 +131,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "server", "server", "{9D5C46
samples\client-provider\file-upload\server\types.mjs = samples\client-provider\file-upload\server\types.mjs
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E3330910-8B6C-4191-8046-D6D57FBC39B1}"
ProjectSection(SolutionItems) = preProject
Directory.Build.targets = Directory.Build.targets
global.json = global.json
LICENSE.txt = LICENSE.txt
Packages.props = Packages.props
README.md = README.md
RELEASE_NOTES.md = RELEASE_NOTES.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
31 changes: 31 additions & 0 deletions Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MicrosoftExtensionsVersion>6.0.*</MicrosoftExtensionsVersion>
<AspNetCoreVersion>6.0.*</AspNetCoreVersion>
<XUnitVersion>2.*</XUnitVersion>
</PropertyGroup>
<ItemGroup Label="Common">
<PackageReference Update="FParsec" Version="1.1.1" />
<!--<PackageReference Update="FSharp.Core" Version="4.7.2">-->
<PackageReference Update="FSharp.Core" Version="6.0.*">
<ExcludeAssets>contentFiles</ExcludeAssets>
</PackageReference>
<PackageReference Update="Microsoft.Extensions.Http" Version="$(MicrosoftExtensionsVersion)" />
<PackageReference Update="NuGet.CommandLine" Version="1.*" />
<PackageReference Update="System.Reactive" Version="5.*" />
</ItemGroup>
<ItemGroup Label="Tests and Samples">
<PackageReference Update="BenchmarkDotNet" Version="0.*" />
<PackageReference Update="EntityFramework" Version="1.*" />
<PackageReference Update="FSharp.Data.TypeProviders" Version="1.*" />
<PackageReference Update="Giraffe" Version="6.*" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.*" />
<PackageReference Update="Newtonsoft.Json" Version="13.*" />
<PackageReference Update="Suave" Version="2.*" />
<PackageReference Update="xunit" Version="$(XUnitVersion)" />
<PackageReference Update="xunit.runner.utility" Version="$(XUnitVersion)" />
<PackageReference Update="xunit.runner.console" Version="$(XUnitVersion)" />
<PackageReference Update="xunit.runner.visualstudio" Version="$(XUnitVersion)" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion build.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dotnet tool restore
dotnet fake run build.fsx %*
dotnet fsi build.fsx %*
118 changes: 41 additions & 77 deletions build.fsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
#r "paket:
nuget Fake.Core.Target
nuget Fake.DotNet.Cli
nuget Fake.Tools.Git
nuget Fake.DotNet.AssemblyInfoFile
nuget Fake.Core.ReleaseNotes
nuget Fake.Core.UserInput
nuget Fake.DotNet.MSBuild
nuget Fake.IO.FileSystem
nuget Fake.DotNet.Fsc
nuget Fake.Api.GitHub
nuget Fake.DotNet.Paket
nuget Octokit
nuget FSharp.Core //"

#if !FAKE
#load ".fake/build.fsx/intellisense.fsx"
#endif
#r "nuget: Fake.Api.GitHub"
#r "nuget: Fake.Core.ReleaseNotes"
#r "nuget: Fake.Core.Target"
#r "nuget: Fake.Core.UserInput"
#r "nuget: Fake.DotNet.AssemblyInfoFile"
#r "nuget: Fake.DotNet.Cli"
#r "nuget: Fake.DotNet.Fsc"
#r "nuget: Fake.DotNet.MSBuild"
#r "nuget: Fake.IO.FileSystem"
#r "nuget: Fake.Tools.Git"
#r "nuget: System.Reactive"
#r "nuget: Octokit"

open System
open System.IO
Expand All @@ -24,6 +18,7 @@ open System.Threading
open Fake
open Fake.Tools.Git
open Fake.DotNet
open Fake.DotNet.NuGet
open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.IO.Globbing.Operators
Expand All @@ -33,57 +28,32 @@ open Fake.Core
open Fake.Api
open Octokit

// https://github.com/fsprojects/FAKE/issues/2517
// Regular header and `#load ".fake/build.fsx/intellisense.fsx"`

#if !FAKE
let execContext =
System.Environment.GetCommandLineArgs()
|> Array.skip 2 // skip fsi.exe; build.fsx
|> Array.toList
|> Fake.Core.Context.FakeExecutionContext.Create false __SOURCE_FILE__
execContext
|> Fake.Core.Context.RuntimeContext.Fake
|> Fake.Core.Context.setExecutionContext
#endif

// --------------------------------------------------------------------------------------
// Information about the project are used
// --------------------------------------------------------------------------------------
// - for version and project name in generated AssemblyInfo file
// - by the generated NuGet package
// - to run tests and to publish documentation on GitHub gh-pages
// - for documentation, you also need to edit info in "docs/tools/generate.fsx"


let [<Literal>] DotNetMoniker = "net6.0"
let project = "FSharp.Data.GraphQL"
let summary = "FSharp implementation of Facebook GraphQL query language"
let gitName = "FSharp.Data.GraphQL"
let release = ReleaseNotes.load "RELEASE_NOTES.md"
let projectRepo = "https://github.com/fsprojects/FSharp.Data.GraphQL.git"

// Generate assembly info files with the right version & up-to-date information
Target.create "AssemblyInfo" (fun _ ->
let getAssemblyInfoAttributes projectName =
[ AssemblyInfo.Title projectName
AssemblyInfo.Product project
AssemblyInfo.Description summary
AssemblyInfo.Version release.AssemblyVersion
AssemblyInfo.FileVersion release.AssemblyVersion ]
let internalsVisibility (fsproj: string) =
match fsproj with
| f when f.EndsWith "FSharp.Data.GraphQL.Shared.fsproj" ->
[ AssemblyInfo.InternalsVisibleTo "FSharp.Data.GraphQL.Server"
AssemblyInfo.InternalsVisibleTo "FSharp.Data.GraphQL.Client"
AssemblyInfo.InternalsVisibleTo "FSharp.Data.GraphQL.Client.DesignTime"
AssemblyInfo.InternalsVisibleTo "FSharp.Data.GraphQL.Tests" ]
| f when f.EndsWith "FSharp.Data.GraphQL.Server.fsproj" ->
[ AssemblyInfo.InternalsVisibleTo "FSharp.Data.GraphQL.Benchmarks"
AssemblyInfo.InternalsVisibleTo "FSharp.Data.GraphQL.Tests" ]
| _ -> []

let getProjectDetails (projectPath:string) =
let projectName = System.IO.Path.GetFileNameWithoutExtension(projectPath)
( projectPath,
projectName,
System.IO.Path.GetDirectoryName(projectPath),
(getAssemblyInfoAttributes projectName)
)

!! "src/**/*.fsproj"
//-- "src/FSharp.Data.GraphQL.Client.DesignTime/FSharp.Data.GraphQL.Client.DesignTime.fsproj"
|> Seq.map getProjectDetails
|> Seq.iter (fun (projFileName, _, folderName, attributes) ->
AssemblyInfoFile.createFSharp (folderName </> "AssemblyInfo.fs") (attributes @ internalsVisibility projFileName)
)
)

// --------------------------------------------------------------------------------------
// Clean build results

Expand All @@ -98,16 +68,10 @@ Target.create "CleanDocs" (fun _ ->
// --------------------------------------------------------------------------------------
// Build library & test project

// We need to disable parallel restoring of projects to because running paket in parallel from Mono
// is giving errors in Unix based operating systems.
Target.create "Restore" (fun _ ->
!! "src/**/*.??proj"
-- "src/**/*.shproj"
|> Seq.iter (fun pattern ->
DotNet.restore (fun options ->
{ options with MSBuildParams = { options.MSBuildParams with DisableInternalBinLog = true } }
) pattern
))
|> Seq.iter (fun pattern -> DotNet.restore id pattern))


Target.create "Build" <| fun _ ->
Expand All @@ -123,7 +87,7 @@ let startGraphQLServer (project: string) (streamRef: DataRef<Stream>) =

let projectName = Path.GetFileNameWithoutExtension(project)
let projectPath = Path.GetDirectoryName(project)
let serverExe = projectPath </> "bin" </> "Release" </> "net5.0" </> (projectName + ".dll")
let serverExe = projectPath </> "bin" </> "Release" </> DotNetMoniker </> (projectName + ".dll")

CreateProcess.fromRawCommandLine "dotnet" serverExe
|> CreateProcess.withStandardInput (CreatePipe streamRef)
Expand Down Expand Up @@ -215,22 +179,19 @@ Target.create "ReleaseDocs" (fun _ ->

let pack id =
Shell.cleanDir <| sprintf "nuget/%s.%s" project id
Paket.pack(fun p ->
id
|> NuGet.NuGetPack(fun p ->
{ p with
ToolType = ToolType.CreateLocalTool()
Version = release.NugetVersion
OutputPath = sprintf "nuget/%s.%s" project id
TemplateFile = sprintf "src/%s.%s/%s.%s.fsproj.paket.template" project id project id
MinimumFromLockFile = true
IncludeReferencedProjects = false })
//IncludeReferencedProjects = false
})

let publishPackage id =
pack id
Paket.push(fun p ->
NuGet.NuGetPublish(fun p ->
{ p with
ToolType = ToolType.CreateLocalTool()
WorkingDir = sprintf "nuget/%s.%s" project id
PublishUrl = "https://www.nuget.org/api/v2/package" })
WorkingDir = sprintf "nuget/%s.%s" project id })

Target.create "PublishServer" (fun _ ->
publishPackage "Server"
Expand Down Expand Up @@ -269,7 +230,6 @@ Target.create "PackAll" ignore

"Clean"
==> "Restore"
=?> ("AssemblyInfo", BuildServer.isLocalBuild)
==> "Build"
==> "RunUnitTests"
==> "StartStarWarsServer"
Expand All @@ -287,4 +247,8 @@ Target.create "PackAll" ignore
==> "PackMiddleware"
==> "PackAll"

Target.runOrDefault "All"
Target.runOrDefaultWithArguments "All"

#if !FAKE
execContext.Context.Clear()
#endif
Loading