Skip to content

Commit

Permalink
Make Orleans version centralized, add missing part attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
kzu committed Aug 2, 2024
1 parent f89795a commit ddb41a9
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/CloudActors.CodeAnalysis/ActorMessageGenerator.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis;

Expand Down Expand Up @@ -64,7 +64,6 @@ namespace {{ns}}
}
""";


ctx.AddSource($"{message.ToFileName()}.Serializable.cs", output);

// This supports the scenario where the actor and messages exist in the server project itself,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<ItemGroup>
<!-- See: https://github.com/NuGet/Home/issues/6279. For now, ExcludeAssets doesn't work for analyzers/generators, so we ARE running
the Orleans source generator in this analyzer project itself, even if we don't want/need to. -->
<PackageReference Include="Microsoft.Orleans.CodeGenerator" Version="8.2.0" ExcludeAssets="all" PrivateAssets="all" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.Orleans.CodeGenerator" Version="$(OrleansVersion)" ExcludeAssets="all" PrivateAssets="all" GeneratePathProperty="true" />
<PackageReference Include="NuGetizer" Version="1.2.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Pack="false" Version="4.5.0" />
<PackageReference Include="PolySharp" PrivateAssets="All" Version="1.14.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,15 @@ static void GenerateCode(SourceProductionContext ctx, (ImmutableArray<IAssemblyS
"""
// <auto-generated/>
using Orleans;

""");

foreach (var assembly in assemblies)
{
//[assembly: global::Orleans.ApplicationPartAttribute("TestDomain")]
output.AppendLine($"[assembly: global::Orleans.ApplicationPartAttribute(\"{assembly.Name}\")]");
}

foreach (var type in assemblies.Select(x => x.GetAllTypes()
.FirstOrDefault(x => x.ContainingType == null && options.Compilation.IsSymbolAccessibleWithin(x, options.Compilation.Assembly))))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<ItemGroup>
<!-- See: https://github.com/NuGet/Home/issues/6279. For now, ExcludeAssets doesn't work for analyzers/generators, so we ARE running
the Orleans source generator in this analyzer project itself, even if we don't want/need to. -->
<PackageReference Include="Microsoft.Orleans.CodeGenerator" Version="8.2.0" ExcludeAssets="all" PrivateAssets="all" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.Orleans.CodeGenerator" Version="$(OrleansVersion)" ExcludeAssets="all" PrivateAssets="all" GeneratePathProperty="true" />
<PackageReference Include="NuGetizer" Version="1.2.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Pack="false" Version="4.5.0" />
<PackageReference Include="PolySharp" PrivateAssets="All" Version="1.14.1" />
Expand Down
3 changes: 2 additions & 1 deletion src/CloudActors.Server.CodeAnalysis/OrleansGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
context.RegisterImplementationSourceOutput(options, (ctx, orleans) =>
{
var options = CreateGeneratorOptions(orleans);
var generator = new CodeGenerator(orleans.Compilation, options);
var generator = new CodeGenerator(
orleans.Compilation.WithAssemblyName($"{orleans.Compilation.AssemblyName}.OrleansGenerator"), options);
var syntax = generator.GenerateCode(ctx.CancellationToken);
var code = syntax.NormalizeWhitespace().ToFullString();
var text = SourceText.From(code, Encoding.UTF8);
Expand Down
2 changes: 1 addition & 1 deletion src/CloudActors.Server/CloudActors.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="NuGetizer" Version="1.2.2" />
<PackageReference Include="Microsoft.Orleans.Server" Version="8.2.0" />
<PackageReference Include="Microsoft.Orleans.Server" Version="$(OrleansVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/CloudActors.Streamstone/CloudActors.Streamstone.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="Devlooped.CloudStorageAccount" Version="1.2.0" />
<PackageReference Include="Microsoft.Orleans.Runtime" Version="8.2.0" />
<PackageReference Include="Microsoft.Orleans.Runtime" Version="$(OrleansVersion)" />
<PackageReference Include="NuGetizer" Version="1.2.2" />
<PackageReference Include="Streamstone" Version="3.0.0" />
</ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions src/Directory.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
<RootNamespace>Devlooped.CloudActors</RootNamespace>
<SignAssembly>false</SignAssembly>
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
<OrleansVersion>8.2.0</OrleansVersion>
</PropertyGroup>

<PropertyGroup Condition="Exists('C:\Code\oss\orleans\Artifacts\Debug')">
<RestoreSources>C:\Code\oss\orleans\Artifacts\Debug;https://api.nuget.org/v3/index.json</RestoreSources>
<OrleansVersion>8.0.0-devs</OrleansVersion>
</PropertyGroup>

</Project>
2 changes: 1 addition & 1 deletion src/TestDomain/TestDomain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageReference Include="Moq" Version="4.20.70" />
<!-- See: https://github.com/NuGet/Home/issues/6279. For now, ExcludeAssets doesn't work for analyzers/generators, so we ARE running
the Orleans source generator in this analyzer project itself, even if we don't want/need to. -->
<PackageReference Include="Microsoft.Orleans.CodeGenerator" Version="8.2.0" IncludeAssets="analyers" PrivateAssets="all" />
<PackageReference Include="Microsoft.Orleans.CodeGenerator" Version="$(OrleansVersion)" IncludeAssets="analyers" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing" Version="1.1.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing" Version="1.1.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.10.0" />
<PackageReference Include="Microsoft.Orleans.TestingHost" Version="8.2.0" />
<PackageReference Include="Microsoft.Orleans.Server" Version="8.2.0" />
<PackageReference Include="Microsoft.Orleans.TestingHost" Version="$(OrleansVersion)" />
<PackageReference Include="Microsoft.Orleans.Server" Version="$(OrleansVersion)" />
</ItemGroup>

<ItemGroup>
Expand All @@ -37,6 +37,6 @@
<ProjectReference Include="..\TestDomain\TestDomain.csproj" />
</ItemGroup>

<Import Project="..\CloudActors.Server.CodeAnalysis\Devlooped.CloudActors.Server.targets"/>
<Import Project="..\CloudActors.Server.CodeAnalysis\Devlooped.CloudActors.Server.targets" />

</Project>
25 changes: 25 additions & 0 deletions src/Tests/Tests.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests.csproj", "{70849754-C1F6-4191-8E39-06E3E838D0B9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{70849754-C1F6-4191-8E39-06E3E838D0B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{70849754-C1F6-4191-8E39-06E3E838D0B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{70849754-C1F6-4191-8E39-06E3E838D0B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{70849754-C1F6-4191-8E39-06E3E838D0B9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C3471A9B-9FF3-4E3A-BC60-0F14D5B4A808}
EndGlobalSection
EndGlobal

0 comments on commit ddb41a9

Please sign in to comment.