Skip to content

Commit

Permalink
Merge pull request #4080 from baronfel/packaging-again
Browse files Browse the repository at this point in the history
Unify packaging strategy for Paket.Core
  • Loading branch information
forki authored Sep 13, 2021
2 parents 9fb557a + 6744ab9 commit e4ceab3
Show file tree
Hide file tree
Showing 30 changed files with 408 additions and 1,294 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"paket": {
"version": "6.0.4",
"version": "6.0.13",
"commands": [
"paket"
]
Expand Down
83 changes: 15 additions & 68 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ System.IO.Directory.SetCurrentDirectory __SOURCE_DIRECTORY__

open Fake
open Fake.Git
open Fake.AssemblyInfoFile
open Fake.ReleaseNotesHelper
open Fake.UserInputHelper
open System
Expand All @@ -16,10 +15,6 @@ open Fake.Testing.NUnit3
open System.Security.Cryptography
open System.Xml.Linq

// --------------------------------------------------------------------------------------
// START TODO: Provide project-specific details below
// --------------------------------------------------------------------------------------

// Information about the project are used
// - for version and project name in generated AssemblyInfo file
// - by the generated NuGet package
Expand Down Expand Up @@ -108,41 +103,6 @@ let runDotnet workingDir args =

let testSuiteFilterFlakyTests = getEnvironmentVarAsBoolOrDefault "PAKET_TESTSUITE_FLAKYTESTS" false

let genFSAssemblyInfo (projectPath: string) =
let projectName = System.IO.Path.GetFileNameWithoutExtension(projectPath)
let folderName = System.IO.Path.GetFileName(System.IO.Path.GetDirectoryName(projectPath))
let basePath = "src" @@ folderName
let fileName = basePath @@ "AssemblyInfo.fs"
CreateFSharpAssemblyInfo fileName
[ Attribute.Title (projectName)
Attribute.Product project
Attribute.Company (authors |> String.concat ", ")
Attribute.Description summary
Attribute.Version release.AssemblyVersion
Attribute.FileVersion release.AssemblyVersion
Attribute.InformationalVersion release.NugetVersion ]

let genCSAssemblyInfo (projectPath: string) =
let projectName = System.IO.Path.GetFileNameWithoutExtension(projectPath)
let folderName = System.IO.Path.GetDirectoryName(projectPath)
let basePath = folderName @@ "Properties"
let fileName = basePath @@ "AssemblyInfo.cs"
CreateCSharpAssemblyInfo fileName
[ Attribute.Title (projectName)
Attribute.Product project
Attribute.Description summary
Attribute.Version release.AssemblyVersion
Attribute.FileVersion release.AssemblyVersion
Attribute.InformationalVersion release.NugetVersion ]

// Generate assembly info files with the right version & up-to-date information
Target "AssemblyInfo" (fun _ ->
let fsProjs = !! "src/**/*.fsproj"
let csProjs = !! "src/**/*.csproj"
fsProjs |> Seq.iter genFSAssemblyInfo
csProjs |> Seq.iter genCSAssemblyInfo
)

Target "InstallDotNetCore" (fun _ ->
dotnetExePath <- DotNetCli.InstallDotNetSDK dotnetcliVersion
Environment.SetEnvironmentVariable("DOTNET_EXE_PATH", dotnetExePath)
Expand Down Expand Up @@ -175,29 +135,14 @@ Target "CleanDocs" (fun _ ->
// Build library & test project

Target "Build" (fun _ ->
if isMono then
DotNetCli.Build (fun c ->
{ c with
Project = solutionFile
ToolPath = dotnetExePath
})
else
DotNetCli.Build (fun c ->
{ c with
Project = solutionFile
AdditionalArgs = [ "/p:SourceLinkCreate=true" ]
ToolPath = dotnetExePath
})
DotNetCli.Build (fun c ->
{ c with
Project = solutionFile
ToolPath = dotnetExePath
})
)

Target "Restore" (fun _ ->
//WORKAROUND dotnet restore with paket doesnt restore the PackageReference of SourceLink
// ref https://github.com/fsprojects/Paket/issues/2930
//TODO check if is needed, because a full paket restore is done in the build.bat/sh before run this fsx
Paket.Restore (fun p ->
{ p with
Group = "NetCoreTools" })

DotNetCli.RunCommand (fun c ->
{ c with
ToolPath = dotnetExePath
Expand Down Expand Up @@ -461,15 +406,18 @@ let releaseNotesProp releaseNotesLines =
path

Target "NuGet" (fun _ ->
Paket.Pack (fun p ->
{ p with
ToolPath = "bin/merged/paket.exe"
Version = release.NugetVersion
TemplateFile = "src/Paket.Core/paket.template"
ReleaseNotes = toLines release.Notes })
// pack as .NET tools
let releaseNotesPath = releaseNotesProp release.Notes

DotNetCli.Pack (fun c ->
{ c with
Project = "src/Paket.Core/Paket.Core.fsproj"
OutputPath = tempDir
AdditionalArgs =
[ sprintf "/p:Version=%s" release.NugetVersion
sprintf "/p:PackageReleaseNotesFile=%s" releaseNotesPath ]
ToolPath = dotnetExePath
})

DotNetCli.Pack (fun c ->
{ c with
Project = "src/Paket/Paket.fsproj"
Expand Down Expand Up @@ -731,7 +679,6 @@ Target "All" DoNothing
"Clean"
==> "InstallDotNetCore"
==> "Restore"
==> "AssemblyInfo"
==> "Build"
==> "Publish"
=?> ("RunTests", unlessBuildParams [ "SkipTests"; "SkipUnitTests" ])
Expand Down
9 changes: 0 additions & 9 deletions integrationtests/Paket.IntegrationTests/AssemblyInfo.fs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<Paket>True</Paket>
<Link>FsUnit.fs</Link>
</Compile>
<Compile Include="AssemblyInfo.fs" />
<Compile Include="TestHelper.fs" />
<Compile Include="NugetDownloadSpecs.fs" />
<Compile Include="InitSpecs.fs" />
Expand Down
22 changes: 0 additions & 22 deletions nuget/paket.template

This file was deleted.

14 changes: 5 additions & 9 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ nuget System.Security.Cryptography.ProtectedData >= 4.4
nuget NETStandard.Library ~> 2.0
nuget Microsoft.NETCore.App ~> 2.1
nuget System.Net.Http.WinHttpHandler >= 4.5
nuget Microsoft.NETFramework.ReferenceAssemblies.net461
nuget Nuget.Packaging
nuget Microsoft.Win32.Registry
nuget System.Diagnostics.TraceSource

# these two are not public dependencies, they're used for build-time only
# therefore, treat them as private.
nuget Microsoft.NETFramework.ReferenceAssemblies.net461 copy_local: true
nuget DotNet.ReproducibleBuilds copy_local: true

# tests
nuget Moq
nuget FSCheck
Expand All @@ -33,14 +37,6 @@ github fsharp/FAKE:0341a2e614eb2a7f34607cec914eb0ed83ce9add src/app/FakeLib/Glob
github fsprojects/FSharp.TypeProviders.SDK:dc5ac01a1ac288eceb1fd6f12a5d388236f4f8e5 src/AssemblyReader.fs
github forki/FsUnit FsUnit.fs

group NetCoreTools
storage: none
source https://nuget.org/api/v2
source https://api.nuget.org/v3/index.json

nuget SourceLink.Create.CommandLine 2.1.1
nuget SourceLink.Embed.PaketFiles 2.1.1

group Build
content: none
framework >= net461
Expand Down
Loading

0 comments on commit e4ceab3

Please sign in to comment.