-
Notifications
You must be signed in to change notification settings - Fork 585
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
WIP - Converted GitVersionHelper to FAKE 5 module #1988
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
09ff0ba
migrated GitVersion module
landy 6316c9e
updated obsolete comments in the legacy module
landy be09382
added GitVersion project to build and FakeLib
landy ca149d8
fixed formating
landy a72624f
Merge remote-tracking branch 'upstream/release/next' into gitversion
landy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Auto-Generated by FAKE; do not edit | ||
namespace System | ||
open System.Reflection | ||
|
||
[<assembly: AssemblyTitleAttribute("FAKE - F# Make GitVersion")>] | ||
[<assembly: AssemblyProductAttribute("FAKE - F# Make")>] | ||
[<assembly: AssemblyVersionAttribute("5.0.0")>] | ||
[<assembly: AssemblyInformationalVersionAttribute("5.0.0")>] | ||
[<assembly: AssemblyFileVersionAttribute("5.0.0")>] | ||
do () | ||
|
||
module internal AssemblyVersionInformation = | ||
let [<Literal>] AssemblyTitle = "FAKE - F# Make GitVersion" | ||
let [<Literal>] AssemblyProduct = "FAKE - F# Make" | ||
let [<Literal>] AssemblyVersion = "5.0.0" | ||
let [<Literal>] AssemblyInformationalVersion = "5.0.0" | ||
let [<Literal>] AssemblyFileVersion = "5.0.0" |
24 changes: 24 additions & 0 deletions
24
src/app/Fake.Tools.GitVersion/Fake.Tools.GitVersion.fsproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<TargetFrameworks>net46;netstandard1.6;netstandard2.0</TargetFrameworks> | ||
<DefineConstants>$(DefineConstants);NO_DOTNETCORE_BOOTSTRAP</DefineConstants> | ||
<AssemblyName>Fake.Tools.GitVersion</AssemblyName> | ||
<OutputType>Library</OutputType> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="AssemblyInfo.fs" /> | ||
<Compile Include="GitVersion.fs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Fake.Core.Environment\Fake.Core.Environment.fsproj" /> | ||
<ProjectReference Include="..\Fake.Core.Process\Fake.Core.Process.fsproj" /> | ||
<ProjectReference Include="..\Fake.IO.FileSystem\Fake.IO.FileSystem.fsproj" /> | ||
</ItemGroup> | ||
<Import Project="..\..\..\.paket\Paket.Restore.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
[<RequireQualifiedAccess>] | ||
module Fake.Tools.GitVersion | ||
|
||
open Newtonsoft.Json | ||
open System | ||
open System.IO | ||
open Fake.IO.Globbing | ||
open Fake.Core | ||
|
||
[<CLIMutable>] | ||
type GitversionParams = { | ||
ToolPath : string | ||
} | ||
|
||
let GitversionDefaults = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can probably make this private (or internal) |
||
ToolPath = Tools.findToolInSubPath "GitVersion.exe" (Environment.environVarOrDefault "ChocolateyInstall" (Directory.GetCurrentDirectory())) | ||
} | ||
|
||
type GitVersionProperties = { | ||
Major : int; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we change the formatting to be less intended and remove the |
||
Minor : int; | ||
Patch : int; | ||
PreReleaseTag : string; | ||
PreReleaseTagWithDash : string; | ||
PreReleaseLabel : string; | ||
PreReleaseNumber : Nullable<int>; | ||
BuildMetaData : string; | ||
BuildMetaDataPadded : string; | ||
FullBuildMetaData : string; | ||
MajorMinorPatch : string; | ||
SemVer : string; | ||
LegacySemVer : string; | ||
LegacySemVerPadded : string; | ||
AssemblySemVer : string; | ||
FullSemVer : string; | ||
InformationalVersion : string; | ||
BranchName : string; | ||
Sha : string; | ||
NuGetVersionV2 : string; | ||
NuGetVersion : string; | ||
CommitsSinceVersionSource : int; | ||
CommitsSinceVersionSourcePadded : string; | ||
CommitDate : string; | ||
} | ||
|
||
/// Runs [GitVersion](https://gitversion.readthedocs.io/en/latest/) on a .NET project file. | ||
/// ## Parameters | ||
/// | ||
/// - `setParams` - Function used to manipulate the GitversionDefaults value. | ||
/// | ||
/// ## Sample | ||
/// | ||
/// generateProperties id // Use Defaults | ||
/// generateProperties (fun p -> { p with ToolPath = "/path/to/directory" } | ||
let generateProperties (setParams : GitversionParams -> GitversionParams) = | ||
let parameters = GitversionDefaults |> setParams | ||
let timespan = TimeSpan.FromMinutes 1. | ||
|
||
let result = Process.execWithResult (fun info -> | ||
{info with FileName = parameters.ToolPath} ) timespan | ||
if result.ExitCode <> 0 then failwithf "GitVersion.exe failed with exit code %i and message %s" result.ExitCode (String.concat "" result.Messages) | ||
result.Messages |> String.concat "" |> fun j -> JsonConvert.DeserializeObject<GitVersionProperties>(j) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Newtonsoft.Json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the CLIMutable.