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

adjust defaultBenchmarkDotNetVersion on build #1879

Merged
merged 6 commits into from
Jul 4, 2023

Conversation

askazakov
Copy link
Contributor

@askazakov askazakov commented Dec 30, 2021

Some automatization to reconcile BenchmarkDotNet version with default version in template

If it's good enough I will fix templates for VB and F# also. If not just close PR

@dnfadmin
Copy link

dnfadmin commented Dec 30, 2021

CLA assistant check
All CLA requirements met.

@askazakov askazakov mentioned this pull request Jul 3, 2023
Copy link
Member

@AndreyAkinshin AndreyAkinshin left a comment

Choose a reason for hiding this comment

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

Thanks for the PR (and sorry for the late review). In general, I like this approach, we can try to use it. Once the review comments are resolved, I will merge this PR.

InputFilename="templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json"
OutputFilename="templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json"
MatchExpression='("defaultValue": )"([\d+\.?]+)"'
ReplacementText='${1}"$(Major).$(Minor).$(Revision)"' />
Copy link
Member

Choose a reason for hiding this comment

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

With the recent changes, we should use $(VersionPrefix) instead of $(Major).$(Minor).$(Revision).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed at c6bd682

OutputFilename="templates/BenchmarkDotNet.BenchmarkProjectTemplate.CSharp/.template.config/template.json"
MatchExpression='("defaultValue": )"([\d+\.?]+)"'
ReplacementText='${1}"$(Major).$(Minor).$(Revision)"' />
<PropertyGroup>
Copy link
Member

Choose a reason for hiding this comment

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

It seems that we don't actually need this PropertyGroup: all the arguments are defined in attributes of ReplaceFileText.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed at 4f7eac2

templates/BenchmarkDotNet.Templates.csproj Show resolved Hide resolved
@askazakov
Copy link
Contributor Author

I've tried

var jsonNode = JsonNode.Parse(json);
jsonNode["symbols"]["version"]["defaultValue"] = $(VersionPrefix)

instead of

Regex.Replace(...)

but it leads to changes in .template.json
image

should I investigate with

            var encoderSettings = new TextEncoderSettings();
            encoderSettings.AllowRange(UnicodeRanges.BasicLatin);
            encoderSettings.AllowCharacters('\u0027');

?

Or current solution with Regex is good enough?

@askazakov
Copy link
Contributor Author

I've tried

var jsonNode = JsonNode.Parse(json);
jsonNode["symbols"]["version"]["defaultValue"] = $(VersionPrefix)

instead of

Regex.Replace(...)

but it leads to changes in .template.json image

should I investigate with

            var encoderSettings = new TextEncoderSettings();
            encoderSettings.AllowRange(UnicodeRanges.BasicLatin);
            encoderSettings.AllowCharacters('\u0027');

?

Or current solution with Regex is good enough?

disregard this. It will not work due to dotnet/msbuild#5737

@AndreyAkinshin AndreyAkinshin merged commit c4debea into dotnet:master Jul 4, 2023
7 checks passed
@AndreyAkinshin
Copy link
Member

@askazakov thanks!

@AndreyAkinshin AndreyAkinshin added this to the v0.13.6 milestone Jul 4, 2023
@askazakov askazakov deleted the actual-version-in-template branch July 19, 2023 07:39
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 this pull request may close these issues.

3 participants