Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions app/MindWork AI Studio/MindWork AI Studio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,9 @@
<ItemGroup>
<ProjectReference Include="..\SharedTools\SharedTools.csproj" />
<ProjectReference Include="..\SourceCodeRules\SourceCodeRules\SourceCodeRules.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
<ProjectReference Include="..\SourceGeneratedMappings\SourceGeneratedMappings.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
</ItemGroup>

<PropertyGroup>
<SourceGeneratedMappingsProject>..\SourceGeneratedMappings\SourceGeneratedMappings.csproj</SourceGeneratedMappingsProject>
<SourceGeneratedMappingsAssembly>..\SourceGeneratedMappings\bin\$(Configuration)\net9.0\SourceGeneratedMappings.dll</SourceGeneratedMappingsAssembly>
</PropertyGroup>

<Target Name="BuildSourceGeneratedMappings" BeforeTargets="CoreCompile">
<MSBuild Projects="$(SourceGeneratedMappingsProject)" Targets="Restore;Build" Properties="Configuration=$(Configuration);RestoreIgnoreFailedSources=true" />

<ItemGroup>
<Analyzer Include="$(SourceGeneratedMappingsAssembly)" Condition="Exists('$(SourceGeneratedMappingsAssembly)')" />
</ItemGroup>
</Target>

<ItemGroup>
<Folder Include="Plugins\assistants\assets\" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion app/MindWork AI Studio/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,6 @@
"type": "Project"
}
},
"net9.0/win-x64": {}
"net9.0/osx-arm64": {}
}
}
8 changes: 8 additions & 0 deletions app/SourceGeneratedMappings/AnalyzerReleases.Shipped.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Release 1.0

### New Rules

Rule ID | Category | Severity | Notes
---------|------------------|----------|--------------------------
MBI001 | SourceGeneration | Info | MappingRegistryGenerator
MBI002 | SourceGeneration | Warning | MappingRegistryGenerator
4 changes: 4 additions & 0 deletions app/SourceGeneratedMappings/AnalyzerReleases.Unshipped.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
; Unshipped analyzer release
; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md

### New Rules
15 changes: 11 additions & 4 deletions app/SourceGeneratedMappings/MappingRegistryGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
namespace SourceGeneratedMappings;

[Generator]
#pragma warning disable RS1036
public sealed class MappingRegistryGenerator : IIncrementalGenerator
#pragma warning restore RS1036
{
private const string GENERATED_NAMESPACE = "AIStudio.Tools.PluginSystem.Assistants.Icons";
private const string ROOT_TYPE_NAME = "MudBlazor.Icons";
Expand All @@ -26,7 +28,7 @@ public sealed class MappingRegistryGenerator : IIncrementalGenerator
private static readonly DiagnosticDescriptor NO_ICONS_FOUND = new(
id: "MBI002",
title: "No MudBlazor icons were discovered",
messageFormat: "The generator found '{0}', but no nested icon constants were discovered below it.",
messageFormat: "The generator found '{0}', but no nested icon constants were discovered below it",
category: "SourceGeneration",
DiagnosticSeverity.Warning,
isEnabledByDefault: true);
Expand Down Expand Up @@ -80,8 +82,8 @@ private static void CollectIcons(INamedTypeSymbol currentType, List<string> path
continue;

icons.Add(new IconDefinition(
QualifiedName: $"Icons.{groupPath}.{field.Name}",
Svg: svg));
$"Icons.{groupPath}.{field.Name}",
svg));
}
}

Expand Down Expand Up @@ -126,5 +128,10 @@ private static string ToLiteral(string value)
return Microsoft.CodeAnalysis.CSharp.SymbolDisplay.FormatLiteral(value, quote: true);
}

private sealed record IconDefinition(string QualifiedName, string Svg);
private sealed class IconDefinition(string qualifiedName, string svg)
{
public string QualifiedName { get; } = qualifiedName;

public string Svg { get; } = svg;
}
}
16 changes: 6 additions & 10 deletions app/SourceGeneratedMappings/SourceGeneratedMappings.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
Expand All @@ -16,14 +16,10 @@
</PropertyGroup>

<ItemGroup>
<Reference Include="Microsoft.CodeAnalysis">
<HintPath>$(MSBuildSDKsPath)\..\Roslyn\bincore\Microsoft.CodeAnalysis.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp">
<HintPath>$(MSBuildSDKsPath)\..\Roslyn\bincore\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
<Private>false</Private>
</Reference>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0" />
</ItemGroup>

</Project>