2025-03-07 16:31:40 +00:00
2025-02-22 03:56:27 +00:00
2025-03-04 11:58:14 +00:00
2025-03-07 16:31:40 +00:00
2025-03-04 12:26:15 +00:00
2025-03-07 16:31:40 +00:00
2025-02-05 11:49:13 +00:00

Polonium.Generators

Project Description
Polonium.Generators is a C# source generator suite specifically built for the Polonium ecosystem. By analyzing attributes like [ProxyNode], [AutoPatch], [RegistryEntity], and [RegistryPassThrough], it generates boilerplate code that ties together key features in Polonium, reducing repetitive tasks and ensuring consistency.


Code Generation Highlights

  1. [ProxyNode]
    When a class is annotated with [ProxyNode] (and optionally [ProxyProperty] for properties or [ProxyMethod] for methods), Polonium.Generators automatically creates partial classes or methods, simplifying script bridging and property handling. This is primarily used in Poloniums embedded classes, but it can also be extended.

  2. [AutoPatch] & [PatchableProperty]
    If an interface is marked with [AutoPatch] and contains at most one [PatchableProperty] (with a getter and setter), Polonium.Generators will create a corresponding Patch class. This allows you to apply changes ("patches") to classes implementing that interface without direct references, greatly simplifying state synchronization.

  3. [RegistryEntity]
    Classes annotated with [RegistryEntity] trigger a code generation step that adds a property for that class in GlobalRegistry, enabling you to easily access and manage instances across your entire project.

  4. [RegistryPassThrough]
    Properties marked with [RegistryPassThrough] are automatically bridged so that getting or setting them references the central PoloniumRegistry. While primarily used by Poloniums own embedded classes, it can be adapted for larger multi-module scenarios.


Installation

  1. Ensure youre targeting .NET 6 or higher (or the same version Polonium requires).
  2. Install via NuGet:
    dotnet add package Polonium.Generators
    
  3. Add <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles> in your .csproj if you want to inspect the generated sources.

License

This project is licensed under the MIT License.

Description
No description provided
Readme 98 KiB
Languages
C# 98.9%
Shell 1.1%