Skip to content

Commit

Permalink
WIP Windowing 3.0 for real this time
Browse files Browse the repository at this point in the history
  • Loading branch information
Perksey committed Aug 31, 2024
1 parent 56af8e1 commit 8bfba2b
Show file tree
Hide file tree
Showing 60 changed files with 2,693 additions and 3,287 deletions.
41 changes: 41 additions & 0 deletions sources/Core/Analyzers/Helpers.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Reflection;
using Microsoft.CodeAnalysis;

namespace Silk.NET.Core.Analyzers;

/// <summary>
/// Helpers used in the construction of Silk.NET's analyzers and generators.
/// </summary>
public static class Helpers
{
/// <summary>
/// Registers sources embedded in the calling assembly with the given embedded resource names as post-initialization
/// output.
/// </summary>
/// <param name="ctx">The generator context.</param>
/// <param name="embeddedResourceNames">The embedded resource names.</param>
public static void RegisterPostInitializationEmbeddedSource(
this IncrementalGeneratorInitializationContext ctx,
params string[] embeddedResourceNames
)
{
var caller = Assembly.GetCallingAssembly();
ctx.RegisterPostInitializationOutput(x =>
{
foreach (var res in embeddedResourceNames)
{
using var stream = caller.GetManifestResourceStream(res);
if (stream is null)
{
continue;
}
using var sr = new StreamReader(stream);
x.AddSource(res, sr.ReadToEnd());
}
});
}
}
1,030 changes: 0 additions & 1,030 deletions sources/Core/Analyzers/HluSourceGenerator.Hosts.cs

This file was deleted.

842 changes: 0 additions & 842 deletions sources/Core/Analyzers/HluSourceGenerator.Registries.cs

This file was deleted.

122 changes: 0 additions & 122 deletions sources/Core/Analyzers/HluSourceGenerator.cs

This file was deleted.

9 changes: 9 additions & 0 deletions sources/Core/Analyzers/MockStaticAbstractAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace Silk.NET.Core.Analyzers;

/// <summary>
/// An attribute that triggers <c>StaticAbstractInterfaceMocking</c> to generate a mock.
/// </summary>
internal class MockStaticAbstractAttribute : Attribute;
5 changes: 5 additions & 0 deletions sources/Core/Analyzers/Silk.NET.Core.Analyzers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,10 @@

<!-- Package the generator in the analyzer directory of the nuget package -->
<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<EmbeddedResource Include="*Attribute.cs" />
</ItemGroup>

<ItemGroup>
<Content Include="Properties\launchsettings.json" />
</ItemGroup>
</Project>
Loading

0 comments on commit 8bfba2b

Please sign in to comment.