Skip to content

Commit

Permalink
Upgrade SDK to 2024.2 (#110)
Browse files Browse the repository at this point in the history
* Update code style and upgrade SDK version

This commit introduces an updated code style in TemplateParameterNameAttributeProvider.cs and _build.csproj.DotSettings. The style of the code has been simplified to a more straightforward and cleaner format.

* Update ShellComponent attribute in StructuredLoggingWikiDataProvider

The ShellComponent attribute in the StructuredLoggingWikiDataProvider.cs file has been updated. The instantiation was changed to DemandAnyThreadSafe to ensure the component's safety across various threads. This change is important to maintain thread safety and avoid potential race conditions or deadlocks.

* Update SdkVersion in Directory.Build.props

The SdkVersion property in Directory.Build.props file has been updated. The version has been changed from 2024.2.0-eap06 to 2024.2.0-eap07. This update is a part of the regular sdk upgrade process.

* Update SDK version in Directory.Build.props

Changed the SDK version from 2024.2.0-eap07 to 2024.2.0-eap09. This ensures the project uses the latest SDK features and bug fixes.

* Update SDK version to 2024.2.0-rc01

Updated the SDK version in Directory.Build.props from 2024.2.0-eap09 to 2024.2.0-rc01. This update ensures we are using the release candidate version for better stability and compatibility.

* Update SdkVersion to the stable release version

The SdkVersion has been changed from a release candidate (2024.2.0-rc01) to the stable version (2024.2.0) in the project properties. This ensures more reliability and stability for the builds.
  • Loading branch information
olsh authored Aug 15, 2024
1 parent f5a6297 commit 4e24490
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SdkVersion>2024.1.4</SdkVersion>
<SdkVersion>2024.2.0</SdkVersion>
</PropertyGroup>
<!-- https://jetbrains.slack.com/archives/CBZ36NH7C/p1628090127002200 -->
<PropertyGroup>
Expand Down
5 changes: 4 additions & 1 deletion build/_build.csproj.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ANONYMOUSMETHOD_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=4a98fdf6_002D7d98_002D4f5a_002Dafeb_002Dea44ad98c70c/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;Kind Name="READONLY_FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=f9fce829_002De6f4_002D4cb2_002D80f1_002D5497c44f51df/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
Expand All @@ -24,4 +26,5 @@
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,44 @@
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.CodeAnnotations;

namespace ReSharper.Structured.Logging.Caching
namespace ReSharper.Structured.Logging.Caching;

[CodeAnnotationProvider]
public class TemplateParameterNameAttributeProvider(
AttributeInstancesProvider attributeInstancesProvider,
CodeAnnotationsConfiguration codeAnnotationsConfiguration)
: CodeAnnotationInfoProvider<ITypeMember, string>(attributeInstancesProvider, codeAnnotationsConfiguration, true)
{
[CodeAnnotationProvider]
public class TemplateParameterNameAttributeProvider : CodeAnnotationInfoProvider<ITypeMember, string>
private const string MessageTemplateFormatMethodAttribute = "MessageTemplateFormatMethodAttribute";

protected override string CalculateInfo(ITypeMember attributesOwner, IEnumerable<IAttributeInstance> attributeInstances)
{
private const string MessageTemplateFormatMethodAttribute = "MessageTemplateFormatMethodAttribute";
var templateFormatAttribute = attributeInstances
.FirstOrDefault(a => string.Equals(a.GetAttributeShortName(), MessageTemplateFormatMethodAttribute, StringComparison.Ordinal));

public TemplateParameterNameAttributeProvider(
AttributeInstancesProvider attributeInstancesProvider,
CodeAnnotationsConfiguration codeAnnotationsConfiguration)
: base(attributeInstancesProvider, codeAnnotationsConfiguration, true)
if (templateFormatAttribute != null)
{
return templateFormatAttribute.PositionParameters()
.FirstOrDefault()
?.ConstantValue.StringValue;
}

protected override string CalculateInfo(ITypeMember attributesOwner, IEnumerable<IAttributeInstance> attributeInstances)
var className = attributesOwner.ContainingType?.GetClrName().FullName;
if (className == "Microsoft.Extensions.Logging.LoggerExtensions")
{
var templateFormatAttribute = attributeInstances
.FirstOrDefault(a => string.Equals(a.GetAttributeShortName(), MessageTemplateFormatMethodAttribute, StringComparison.Ordinal));

if (templateFormatAttribute != null)
{
return templateFormatAttribute.PositionParameters()
.FirstOrDefault()
?.ConstantValue.StringValue;
}

var className = attributesOwner.ContainingType?.GetClrName().FullName;
if (className == "Microsoft.Extensions.Logging.LoggerExtensions")
{
return attributesOwner.ShortName == "BeginScope" ? "messageFormat" : "message";
}

if (className == "ZLogger.ZLoggerExtensions")
{
return "format";
}

return null;
return attributesOwner.ShortName == "BeginScope" ? "messageFormat" : "message";
}

protected override string GetDefaultInfo(ITypeMember attributesOwner)
if (className == "ZLogger.ZLoggerExtensions")
{
return null;
return "format";
}

public override string[] AttributeShortNames { get; } = { MessageTemplateFormatMethodAttribute };
return null;
}

protected override string GetDefaultInfo(ITypeMember attributesOwner)
{
return null;
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
using System.Collections.Generic;

using JetBrains.Application;
using JetBrains.Application.Parts;
using JetBrains.ReSharper.Feature.Services.Explanatory;

using ReSharper.Structured.Logging.Highlighting;

namespace ReSharper.Structured.Logging.Wiki
{
[ShellComponent]
[ShellComponent(Instantiation.DemandAnyThreadSafe)]
public class StructuredLoggingWikiDataProvider : ICodeInspectionWikiDataProvider
{
private static readonly IDictionary<string, string> AttributeUrlMap = new Dictionary<string, string>
Expand Down

0 comments on commit 4e24490

Please sign in to comment.