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

Refactor caching system in GitVersion #3797

Closed
wants to merge 1 commit into from
Closed

Conversation

arturcic
Copy link
Member

Changes include updating cache file format from YML to JSON (breaking change), removing unused methods, and optimizing file write/read operations. This allows to remove dependency on YamlDotNet. Various changes were also made to use more appropriate method identifiers and improve handling of cache file exceptions.

@arturcic arturcic added this to the 6.x milestone Nov 22, 2023
@arturcic arturcic marked this pull request as draft November 22, 2023 23:18
Changes include updating cache file format from YML to JSON, removing unused methods, and optimizing file write/read operations. This allows to remove dependency on YamlDotNet. Various changes were also made to use more appropriate method identifiers and improve handling of cache file exceptions.
Copy link
Member

@asbjornu asbjornu left a comment

Choose a reason for hiding this comment

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

Awesome work!

@@ -1,7 +1,6 @@
using System.Text.Encodings.Web;
Copy link
Member

Choose a reason for hiding this comment

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

Ideally, we shouldn't have a reference to System.Text.Encodings.Web or anything else besides System in GitVersion.Core.

Suggested change
using System.Text.Encodings.Web;

@@ -14,6 +13,22 @@ public static GitVersionVariables FromJson(string json)
return FromDictionary(variablePairs);
}

public static string ToJsonString(this GitVersionVariables gitVersionVariables)
Copy link
Member

Choose a reason for hiding this comment

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

Could we move the serialization of GitVersionVariables out from GitVersion.Core so we don't need dependencies on JSON? Ideally, I'd like to delete all <PackageReference> in GitVersion.Core.csproj.

<ItemGroup>
<PackageReference Include="Polly" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
<PackageReference Include="Microsoft.Extensions.Options" />
<PackageReference Include="YamlDotNet" />
</ItemGroup>

Copy link
Member Author

Choose a reason for hiding this comment

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

I started gradually to remove the depenencies, or at least with those non microsoft first, hope we can get to a point when Core is dependency free*.

For now I want to get this one to a point when the build passes and then we can prepare a beta.4

@arturcic
Copy link
Member Author

Closing this one for now, will open a new PR from a feature branch, not forked main

@arturcic arturcic closed this Nov 27, 2023
@arturcic arturcic removed this from the 6.x milestone Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants