Skip to content
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

Reference to tool GitVersion.Tool in toolsettings.cake needs to be updated #1014

Open
cake-contrib-bot opened this issue Aug 2, 2024 · 1 comment · May be fixed by #1015
Open

Reference to tool GitVersion.Tool in toolsettings.cake needs to be updated #1014

cake-contrib-bot opened this issue Aug 2, 2024 · 1 comment · May be fixed by #1015

Comments

@cake-contrib-bot
Copy link
Contributor

Reference to GitVersion.Tool 5.12.0 in toolsettings.cake should be updated to 6.0.0

cake-contrib-bot added a commit to cake-contrib-bot/Cake.Recipe that referenced this issue Aug 2, 2024
@kcamp
Copy link
Contributor

kcamp commented Feb 12, 2025

@gep13 I saw your comments on the linked PR - I wanted to make a couple of notes to help others who might stumble on this as much as anything; it seems that the Cake team is generally aware of the breaking changes in GitVersion 6.0, and I suspect you are probably aware of the impact to Recipe from the failing checks and your comments in #1015.

The 6.x version of GitVersion contains changes that make it incompatible with Recipe at the current stable version atCake.Recipe.3.1.0, so even pulling in the tool update on an ad hoc basis via SetToolPreprocessorDirectives fails. The variables that the Recipe implementation relies on to calculate the version were removed as part of 6.0.

See GitTools/GitVersion#2325 and related PR - GitTools/GitVersion#3130

The variables that were removed that matter to the Recipe implementation appear to be -

  • GitVersion_LegacySemVerPadded
  • GitVersion_CommitsSinceVersionSourcePadded

Based on the changes in the PR to the file docs/input/docs/reference/variables.md, Recipe was previously using the following:

"LegacySemVer": "3.22.11-beta99",
"LegacySemVerPadded": "3.22.11-beta0099",
"CommitsSinceVersionSourcePadded": "0007",

It seems that Recipe could easily enough create a backward compatible implementation [consistent with the existing Recipe implementation] by manipulating some of the variables that are still available (padding/concatenating as necessary)

"PreReleaseLabelWithDash": "-beta",
"PreReleaseNumber": 99,
"CommitsSinceVersionSource": 7,
"MajorMinorPatch": "3.22.11"

I think the question becomes whether a deliberately implemented "backward compatible" implementation local to Cake.Recipe is the best path forward? Or do we follow whatever lead that may be set from the upstream Cake tool and the related alias methods/types that may come of cake-build/cake#4453 ? If you have some feedback on approach there, it might be possible to develop a fix in Recipe absent any broader change to the Cake tool.

--

For reference & in case anyone else finds this & it helps, this is the diagnostic output of a 6.x tool reference -

// override net5.0 version for current runner
ToolSettings.SetToolPreprocessorDirectives(gitVersionGlobalTool: "#tool dotnet:?package=GitVersion.Tool&version=6.1.0");

... 

// output

Executing: "C:/git/cake-demo/tools/dotnet-gitversion.exe" -output json -verbosity Diagnostic
{
  "AssemblySemFileVer": "0.1.0.0",
  "AssemblySemVer": "0.1.0.0",
  "BranchName": "cake-recipe",
  "BuildMetaData": null,
  "CommitDate": "2025-02-11",
  "CommitsSinceVersionSource": 0,
  "EscapedBranchName": "cake-recipe",
  "FullBuildMetaData": "Branch.cake-recipe.Sha.60be7287582f480903e660f99f68093cdddadb3b",
  "FullSemVer": "0.1.0",
  "InformationalVersion": "0.1.0+Branch.cake-recipe.Sha.60be7287582f480903e660f99f68093cdddadb3b",
  "Major": 0,
  "MajorMinorPatch": "0.1.0",
  "Minor": 1,
  "Patch": 0,
  "PreReleaseLabel": "",
  "PreReleaseLabelWithDash": "",
  "PreReleaseNumber": null,
  "PreReleaseTag": "",
  "PreReleaseTagWithDash": "",
  "SemVer": "0.1.0",
  "Sha": "60be7287582f480903e660f99f68093cdddadb3b",
  "ShortSha": "60be728",
  "UncommittedChanges": 1,
  "VersionSourceSha": "60be7287582f480903e660f99f68093cdddadb3b",
  "WeightedPreReleaseNumber": 60000
}
Calculated Semantic Version: [NULL]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants