Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas committed Dec 10, 2024
1 parent d2e35c8 commit 41da9a4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
mkdir -p regex/net45;
mkdir -p regex/net8.0;
mkdir -p regex/net9.0;
dotnet run --project PrismSharp.RegExProvider/PrismSharp.RegExProvider.csproj --configuration Release -- "$PWD/regex/netstandard2.0" netstandard2.0;
dotnet run --project PrismSharp.RegExProvider/PrismSharp.RegExProvider.csproj --configuration Release -- "$PWD/regex/net45" net45;
dotnet run --project PrismSharp.RegExProvider/PrismSharp.RegExProvider.csproj --configuration Release -- "$PWD/regex/net8.0" net8.0;
dotnet run --project PrismSharp.RegExProvider/PrismSharp.RegExProvider.csproj --configuration Release -- "$PWD/regex/net9.0" net9.0;
dotnet run --project PrismSharp.RegExProvider/PrismSharp.RegExProvider.csproj --configuration Release -f net9.0 -- "$PWD/regex/netstandard2.0" netstandard2.0;
dotnet run --project PrismSharp.RegExProvider/PrismSharp.RegExProvider.csproj --configuration Release -f net9.0 -- "$PWD/regex/net45" net45;
dotnet run --project PrismSharp.RegExProvider/PrismSharp.RegExProvider.csproj --configuration Release -f net8.0 -- "$PWD/regex/net8.0" net8.0;
dotnet run --project PrismSharp.RegExProvider/PrismSharp.RegExProvider.csproj --configuration Release -f net9.0 -- "$PWD/regex/net9.0" net9.0;
dotnet build PrismSharp.SourceGenerator/PrismSharp.SourceGenerator.csproj --configuration Release;
dotnet build PrismSharp.Core/PrismSharp.Core.csproj --configuration Release;
Expand Down
12 changes: 11 additions & 1 deletion PrismSharp.RegExProvider/PrismSharp.RegExProvider.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup Condition="$(TargetFramework) == 'net9.0'">
<PackageReference Include="Microsoft.NETCore.App.Ref" Version="9.0.0" PrivateAssets="all" IncludeAssets="none" GeneratePathProperty="true" />
<Reference Include="$(PkgMicrosoft_NETCore_App_Ref)\analyzers\dotnet\cs\System.Text.RegularExpressions.Generator.dll" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework) == 'net8.0'">
<PackageReference Include="Microsoft.NETCore.App.Ref" Version="8.0.0" PrivateAssets="all" IncludeAssets="none" GeneratePathProperty="true" />
<Reference Include="$(PkgMicrosoft_NETCore_App_Ref)\analyzers\dotnet\cs\System.Text.RegularExpressions.Generator.dll" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0" />

Expand Down
8 changes: 2 additions & 6 deletions PrismSharp.RegExProvider/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,7 @@ private static void CompileNET90(KeyValuePair<string, string>[] languageDefiniti
new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary));
//new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary).WithPlatform(Platform.AnyCpu).WithOptimizationLevel(OptimizationLevel.Release));

//var sourceGenDriver = CSharpGeneratorDriver.Create(new System.Text.RegularExpressions.Generator.RegexGenerator());
var type = ByName("System.Text.RegularExpressions.Generator.RegexGenerator")!;
var sourceGenDriver = CSharpGeneratorDriver.Create((IIncrementalGenerator)Activator.CreateInstance(type)!);
var sourceGenDriver = CSharpGeneratorDriver.Create(new System.Text.RegularExpressions.Generator.RegexGenerator());
sourceGenDriver.RunGeneratorsAndUpdateCompilation(compilation, out var outputCompilation, out var diagnostics);

using var dllStream = new MemoryStream();
Expand Down Expand Up @@ -241,9 +239,7 @@ private static void CompileNET80(KeyValuePair<string, string>[] languageDefiniti
new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary));
//new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary).WithPlatform(Platform.AnyCpu).WithOptimizationLevel(OptimizationLevel.Release));

//var sourceGenDriver = CSharpGeneratorDriver.Create(new System.Text.RegularExpressions.Generator.RegexGenerator());
var type = ByName("System.Text.RegularExpressions.Generator.RegexGenerator")!;
var sourceGenDriver = CSharpGeneratorDriver.Create((IIncrementalGenerator)Activator.CreateInstance(type)!);
var sourceGenDriver = CSharpGeneratorDriver.Create(new System.Text.RegularExpressions.Generator.RegexGenerator());
sourceGenDriver.RunGeneratorsAndUpdateCompilation(compilation, out var outputCompilation, out var diagnostics);

using var dllStream = new MemoryStream();
Expand Down

0 comments on commit 41da9a4

Please sign in to comment.