Skip to content
This repository was archived by the owner on Feb 8, 2022. It is now read-only.

use Nerdbank.GitVersioning #100

Merged
merged 17 commits into from
Mar 19, 2019
Merged

use Nerdbank.GitVersioning #100

merged 17 commits into from
Mar 19, 2019

Conversation

ctaggart
Copy link
Owner

@ctaggart ctaggart commented Mar 19, 2019

This revising the build system to use versioning from https://github.com/AArnott/Nerdbank.GitVersioning. It is one step closer to being fully deterministic so that you can build the same package locally, on AppVeyor, on Travis CI, on Azure Pipelines, or any other CI and get the same bytes. For convenience, the prelease versions are simply the git commit short and match git rev-parse --short HEAD as well as what GitHub shows.

@7sharp9, you should be able to run./build.ps1 and get a nupkg to try out elsewhere.


I'm getting libgit2sharp warning when I add this:

dotnet build Parser/Froto.Parser.fsproj
  Froto.Parser -> /Users/cameron/github/froto/Parser/bin/Debug/netstandard2.0/Froto.Parser.dll

Build succeeded.

/Users/cameron/.nuget/packages/microsoft.build.tasks.git/1.0.0-beta2-18618-05/build/Microsoft.Build.Tasks.Git.targets(20,5): warning : StrictFilePathMarshaler must be used on a FilePath. [/Users/cameron/github/froto/Parser/Froto.Parser.fsproj]
/Users/cameron/.nuget/packages/microsoft.build.tasks.git/1.0.0-beta2-18618-05/build/Microsoft.Build.Tasks.Git.targets(20,5): warning :    at LibGit2Sharp.Core.StrictFilePathMarshaler.MarshalManagedToNative(Object managedObj) [/Users/cameron/github/froto/Parser/Froto.Parser.fsproj]
/Users/cameron/.nuget/packages/microsoft.build.tasks.git/1.0.0-beta2-18618-05/build/Microsoft.Build.Tasks.Git.targets(20,5): warning :    at System.StubHelpers.MngdRefCustomMarshaler.ConvertContentsToNative(IntPtr pMarshalState, Object& pManagedHome, IntPtr pNativeHome) [/Users/cameron/github/froto/Parser/Froto.Parser.fsproj]
/Users/cameron/.nuget/packages/microsoft.build.tasks.git/1.0.0-beta2-18618-05/build/Microsoft.Build.Tasks.Git.targets(20,5): warning :    at LibGit2Sharp.Core.NativeMethods.git_repository_discover(GitBuf buf, FilePath start_path, Boolean across_fs, FilePath ceiling_dirs) [/Users/cameron/github/froto/Parser/Froto.Parser.fsproj]
/Users/cameron/.nuget/packages/microsoft.build.tasks.git/1.0.0-beta2-18618-05/build/Microsoft.Build.Tasks.Git.targets(20,5): warning :    at LibGit2Sharp.Core.Proxy.ConvertPath(Func`2 pathRetriever) [/Users/cameron/github/froto/Parser/Froto.Parser.fsproj]
/Users/cameron/.nuget/packages/microsoft.build.tasks.git/1.0.0-beta2-18618-05/build/Microsoft.Build.Tasks.Git.targets(20,5): warning :    at LibGit2Sharp.Repository.Discover(String startingPath) [/Users/cameron/github/froto/Parser/Froto.Parser.fsproj]
/Users/cameron/.nuget/packages/microsoft.build.tasks.git/1.0.0-beta2-18618-05/build/Microsoft.Build.Tasks.Git.targets(20,5): warning :    at Microsoft.Build.Tasks.Git.GitOperations.LocateRepository(String directory) in /_/src/Microsoft.Build.Tasks.Git.Operations/GitOperations.cs:line 26 [/Users/cameron/github/froto/Parser/Froto.Parser.fsproj]
/Users/cameron/.nuget/packages/microsoft.build.tasks.git/1.0.0-beta2-18618-05/build/Microsoft.Build.Tasks.Git.targets(20,5): warning :    at Microsoft.Build.Tasks.Git.RepositoryTasks.LocateRepository(LocateRepository task) in /_/src/Microsoft.Build.Tasks.Git.Operations/RepositoryTasks.cs:line 58 [/Users/cameron/github/froto/Parser/Froto.Parser.fsproj]
/Users/cameron/.nuget/packages/microsoft.sourcelink.common/1.0.0-beta2-18618-05/build/Microsoft.SourceLink.Common.targets(53,5): warning : Source control information is not available - the generated source link is empty. [/Users/cameron/github/froto/Parser/Froto.Parser.fsproj]
/Users/cameron/github/froto/Parser/obj/Debug/netstandard2.0/Froto.Parser.Version.fs(14,69): warning FS2003: The attribute System.Reflection.AssemblyInformationalVersionAttribute specified version '0.0.125+40a86c726a', but this value is invalid and has been ignored [/Users/cameron/github/froto/Parser/Froto.Parser.fsproj]
    3 Warning(s)
    0 Error(s)

Time Elapsed 00:00:04.77

@ctaggart
Copy link
Owner Author

Travis CI build failed with:

7.44s$ dotnet test Parser.Test/Froto.Parser.Test.fsproj
/home/travis/.nuget/packages/nerdbank.gitversioning/2.3.136/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018: The "Nerdbank.GitVersioning.Tasks.GetBuildVersion" task failed unexpectedly. [/home/travis/build/ctaggart/froto/Parser/Froto.Parser.fsproj]
/home/travis/.nuget/packages/nerdbank.gitversioning/2.3.136/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.DotNet.PlatformAbstractions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. [/home/travis/build/ctaggart/froto/Parser/Froto.Parser.fsproj]
/home/travis/.nuget/packages/nerdbank.gitversioning/2.3.136/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:  [/home/travis/build/ctaggart/froto/Parser/Froto.Parser.fsproj]
/home/travis/.nuget/packages/nerdbank.gitversioning/2.3.136/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at Nerdbank.GitVersioning.GitLoaderContext.GetNativeLibraryDirectory() [/home/travis/build/ctaggart/froto/Parser/Froto.Parser.fsproj]
/home/travis/.nuget/packages/nerdbank.gitversioning/2.3.136/build/Nerdbank.GitVersioning.targets(63,5): error MSB4018:    at Nerdbank.GitVersioning.GitLoaderContext.LoadUnmanagedDll(String unmanagedDllName) [/home/travis/build/ctaggart/froto/Parser/Froto.Parser.fsproj]

@ctaggart
Copy link
Owner Author

By default without a version.json, it produced:
/Users/cameron/github/froto/Parser/obj/Debug/netstandard2.0/Froto.Parser.Version.fs

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Froto.Parser
[<assembly: System.Reflection.AssemblyVersionAttribute("0.0.0.0")>]
[<assembly: System.Reflection.AssemblyFileVersionAttribute("0.0.125.43072")>]
[<assembly: System.Reflection.AssemblyInformationalVersionAttribute("0.0.125+40a86c726a")>]
do()
[<System.CodeDom.Compiler.GeneratedCode("Nerdbank.GitVersioning.Tasks","2.3.136.25003")>]
type internal ThisAssembly() =
  static member internal AssemblyVersion = "0.0.0.0"
  static member internal AssemblyFileVersion = "0.0.125.43072"
  static member internal AssemblyInformationalVersion = "0.0.125+40a86c726a"
  static member internal AssemblyName = "Froto.Parser"
  static member internal AssemblyTitle = "Froto.Parser"
  static member internal AssemblyConfiguration = "Debug"
  static member internal GitCommitId = "40a86c726a95abca52dd1fece35727c497f6b86a"
  static member internal RootNamespace = "Froto.Parser"
do()

It did not conflict with:
/Users/cameron/github/froto/Parser/obj/Debug/netstandard2.0/Froto.Parser.AssemblyInfo.fs

// <auto-generated>
//     Generated by the FSharp WriteCodeFragment class.
// </auto-generated>
namespace FSharp

open System
open System.Reflection


[<assembly: System.Reflection.AssemblyCompanyAttribute("Cameron Taggart, James Hugard")>]
[<assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")>]
[<assembly: System.Reflection.AssemblyDescriptionAttribute("A parser for .proto files for Protocol Buffers.")>]
[<assembly: System.Reflection.AssemblyProductAttribute("Froto.Parser")>]
[<assembly: System.Reflection.AssemblyTitleAttribute("Froto.Parser")>]
do()

script:
- dotnet restore Froto.unix.sln
- dotnet build Froto.unix.sln -c Release
- git fetch --unshallow
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed for Travis CI

@@ -27,5 +27,6 @@
<PackageReference Update="FSharp.Core" Version="4.5.2" />
<PackageReference Include="Argu" Version="4.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-*" PrivateAssets="All" />
<!-- <PackageReference Include="Nerdbank.GitVersioning" Version="2.3.136" /> -->
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nerbankbank.GitVersioning is failing F# exe builds with:

C:\projects\froto\Compiler\Program.fs(20,5): error FS0433: A function labeled with the 'EntryPointAttribute' attribute must be the last declaration in the last file in the compilation sequence. [C:\projects\froto\Compiler\Froto.Compiler.fsproj]

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -1060,6 +1060,7 @@ module RegressionTests =

[<Fact>]
let ``proto3 oneof type doesn't parse (#88)`` () =
System.Diagnostics.Debugger.Break()
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, don't need that.

@ctaggart ctaggart merged commit d29f23e into master Mar 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant