Skip to content

Commit

Permalink
Bump to Orleans v9 which contains fix for externally defined records
Browse files Browse the repository at this point in the history
Now that [v9.0](https://github.com/dotnet/orleans/releases/tag/v9.0.0) is officially out with the fix, we can now move forward with recommending the split interfaces-only package as the only dependency a cloud actors project needs.
  • Loading branch information
kzu committed Nov 19, 2024
1 parent ddb41a9 commit a559f0c
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 25 deletions.
7 changes: 0 additions & 7 deletions CloudActors.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CloudActors.Server", "src\C
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CloudActors.Streamstone", "src\CloudActors.Streamstone\CloudActors.Streamstone.csproj", "{67E7E202-1AC7-477C-AE90-E7D7C04FF6DC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8A279BF7-3751-48D6-AA48-5DA9E4E79D23}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
src\Directory.props = src\Directory.props
readme.md = readme.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestDomain", "src\TestDomain\TestDomain.csproj", "{1D75C6E9-C4E9-44D8-B598-3A2D45C25EE6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CloudActors.Server.CodeAnalysis", "src\CloudActors.Server.CodeAnalysis\CloudActors.Server.CodeAnalysis.csproj", "{68823E7F-269E-4947-8E2B-9905F163C96B}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
a => "Devlooped.CloudActorsAttribute".Equals(a.AttributeClass?.ToDisplayString(FullName))))
.Select((x, _) => (IAssemblySymbol)x!)
.Collect();

context.RegisterImplementationSourceOutput(assemblies.Combine(options), GenerateCode);
}

Expand All @@ -48,8 +48,7 @@ static void GenerateCode(SourceProductionContext ctx, (ImmutableArray<IAssemblyS

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

foreach (var type in assemblies.Select(x => x.GetAllTypes()
Expand All @@ -58,12 +57,12 @@ static void GenerateCode(SourceProductionContext ctx, (ImmutableArray<IAssemblyS
if (type == null)
continue;

// [assembly: GenerateCodeForDeclaringAssembly(typeof(TestDomain.Account))]
output.AppendLine($"[assembly: GenerateCodeForDeclaringAssembly(typeof({type.ToDisplayString(FullName)}))]");
}

var orleans = OrleansGenerator.GenerateCode(options, output.ToString(), "References", ctx.CancellationToken);

ctx.AddSource($"CloudActors.cs", output.ToString());
ctx.AddSource($"CloudActors.orleans.cs", orleans);
}
}
2 changes: 1 addition & 1 deletion src/CloudActors.Server/ActorStateFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ state is not StateStorageBridge<TState> bridge ||
// However, the JournaledGrain base class overrides the OnActivateAsync method and
// forces a sync, so we're good since our generated grain does that too.
//bridge.OnRehydrate(new ActivationContext(new GrainState<TState>(actor)));

}

class ActorPersistentState<TState, TActor> : IActorPersistentState<TState, TActor>
Expand Down Expand Up @@ -116,6 +115,7 @@ class ActivationContext(object actor) : IRehydrationContext
{
public IEnumerable<string> Keys => throw new NotImplementedException();
public bool TryGetBytes(string key, out ReadOnlySequence<byte> value) => throw new NotImplementedException();

public bool TryGetValue<T>(string key, out T? value)
{
if (actor is T typed)
Expand Down
2 changes: 1 addition & 1 deletion src/CloudActors/CloudActors.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Orleans.Serialization.Abstractions" Version="8.2.0" />
<PackageReference Include="Microsoft.Orleans.Serialization.Abstractions" Version="$(OrleansVersion)" />
<PackageReference Include="NuGetizer" Version="1.2.2" />
<PackageReference Include="PolySharp" PrivateAssets="All" Version="1.14.1" />
</ItemGroup>
Expand Down
7 changes: 1 addition & 6 deletions src/Directory.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@
<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>
<OrleansVersion>9.0.0</OrleansVersion>
</PropertyGroup>

</Project>
5 changes: 4 additions & 1 deletion src/TestDomain/Accounting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
using System.Runtime.Serialization;
using Devlooped.CloudActors;
using Moq;
using Orleans;

namespace TestDomain;

// NOTE: there's NO references or dependencies to any Orleans concepts. Just
// pure CloudActors interfaces and attributes.


public partial record Deposit(decimal Amount) : IActorCommand;

public partial record Deposited(decimal Amount);
Expand Down
6 changes: 1 addition & 5 deletions src/TestDomain/TestDomain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<!-- CS8785: ignoring Orleans source generator being run due to https://github.com/NuGet/Home/issues/6279 -->
<NoWarn>RS1036;CS8785</NoWarn>
<NoWarn>RS1036</NoWarn>
</PropertyGroup>

<ItemGroup>
<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="$(OrleansVersion)" IncludeAssets="analyers" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit a559f0c

Please sign in to comment.