Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features/incremental source generator #4039

Commits on Jun 15, 2024

  1. Refactor and update serialization approach

    - Updated Target Frameworks in Csla.Generators.CSharp.Tests.csproj to net8.0.
    - Removed AutoSerializableSyntaxReceiver.cs, indicating a shift in serialization strategy.
    - Refactored DefinitionExtractionContext.cs to use SemanticModel directly.
    - Introduced IncrementalSerializationPartialsGenerator.cs for efficient incremental generation.
    - Removed SerializationPartialGenerator.cs and SerializationPartialsGenerator.cs, consolidating functionality.
    - Updated Csla.Generators.CSharp.csproj with stricter code analysis and removed unnecessary folder inclusion.
    - Modified ExceptionExtensions.cs for consistent exception message formatting.
    luizfbicalho committed Jun 15, 2024
    Configuration menu
    Copy the full SHA
    78e3ac9 View commit details
    Browse the repository at this point in the history

Commits on Jun 16, 2024

  1. Refine attribute discovery and optimize builder

    - Added `Microsoft.CodeAnalysis.CSharp` namespace to `IncrementalSerializationPartialsGenerator.cs` for enhanced C# syntax manipulation.
    - Refined the predicate in `Initialize` for attribute discovery to target only partial classes or structs with `AutoSerializableAttribute`.
    - Simplified type definition extraction in `Initialize` by directly returning the method call's result, removing unnecessary variable declaration.
    - Optimized `SerializationPartialBuilder` instantiation by reusing a single instance for all classes in the loop, reducing object creation overhead.
    - Streamlined `generationResults` declaration and assignment in `Initialize` for conciseness.
    luizfbicalho committed Jun 16, 2024
    Configuration menu
    Copy the full SHA
    41aeac7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3d51c93 View commit details
    Browse the repository at this point in the history
  3. Enhanced nullability and serialization handling

    Enabled Nullable Reference Types in the project file to improve null value handling across the codebase. Updated property types in `AddressPOCO.cs` and related POCO classes to support nullable reference types, ensuring properties can explicitly be null. Initialized properties with default values to avoid null issues. Cleaned up unused `using` directives in several files for better readability. Enhanced code generation to detect nullable fields/properties and adjusted serialization logic to comply with nullable reference types, including refined child object serialization and improved deserialization handling for nullable types. This comprehensive update enhances code maintainability and adopts modern C# practices.
    luizfbicalho committed Jun 16, 2024
    Configuration menu
    Copy the full SHA
    016e284 View commit details
    Browse the repository at this point in the history
  4. Enhance nullable support in SerializationBuilder

    This commit introduces several changes aimed at improving the handling of nullable reference types in the `SerializationPartialBuilder` class across different files. Specifically, the changes include:
    
    - Modification of the `SerializationPartialBuilder` constructor in `IncrementalSerializationPartialsGenerator.cs` to accept a new boolean parameter indicating whether nullable context options annotations are enabled. This allows the builder to generate code that respects the project's nullable settings.
    
    - Update to the `SerializationPartialBuilder` class in `SerializationPartialBuilder.cs` to include a new `nullable` parameter in its constructor. This parameter enables the generated code to correctly handle nullable reference types according to the project's settings.
    
    - The `BuildPartialTypeDefinition` method in `SerializationPartialBuilder.cs` has been modified to conditionally add the `#nullable enable` directive at the beginning of the generated file, based on the `nullable` parameter. This ensures that the generated code respects the nullable settings of the project.
    
    - Modification of the `AppendDeserializeChildFragment` method in `SerializationPartialBuilder.cs` to conditionally append a null-coalescing operation when deserializing non-nullable member types. This adjustment is made based on the `nullable` parameter and ensures that the deserialized value does not violate the type's nullability constraints.
    luizfbicalho committed Jun 16, 2024
    Configuration menu
    Copy the full SHA
    5cced59 View commit details
    Browse the repository at this point in the history
  5. Refactor and document type handling

    - Refactored `GetFieldTypeNullable` in `FieldDefinitionExtractor.cs` and `PropertyDefinitionExtractor.cs` for more concise nullable type checks.
    - Added documentation to `GetFieldTypeNullable` method in both files, improving clarity on its purpose and usage.
    - Corrected a spelling error in `ExtractedMemberTypeDefinition.cs` for the `IsAutoSerializable` property comment.
    - Introduced a `Nullable` property in `ExtractedMemberTypeDefinition.cs` to explicitly track type nullability.
    - Removed unused, commented-out code in `SerializationPartialBuilder.cs` to clean up the codebase.
    luizfbicalho committed Jun 16, 2024
    Configuration menu
    Copy the full SHA
    183acf3 View commit details
    Browse the repository at this point in the history
  6. Enhance nullable annotations handling

    This commit refactors the incremental generator to directly integrate nullable context options into its initialization and generation processes. A key addition is the extraction of nullable context options from the compilation provider, storing this information in a variable for later use. The process of combining compilation provider data with class declarations now includes nullable context information, streamlining the inclusion of nullable annotations in the generation process. Adjustments to the source output registration and `SerializationPartialBuilder` instantiation reflect this integration, simplifying the handling of nullable annotations and enhancing the generator's overall efficiency in dealing with nullable contexts.
    luizfbicalho committed Jun 16, 2024
    Configuration menu
    Copy the full SHA
    a0f372b View commit details
    Browse the repository at this point in the history

Commits on Jun 18, 2024

  1. Configuration menu
    Copy the full SHA
    39063ae View commit details
    Browse the repository at this point in the history

Commits on Jun 19, 2024

  1. Configuration menu
    Copy the full SHA
    0af8f1f View commit details
    Browse the repository at this point in the history

Commits on Jun 20, 2024

  1. Configuration menu
    Copy the full SHA
    8156d6f View commit details
    Browse the repository at this point in the history

Commits on Jun 21, 2024

  1. Configuration menu
    Copy the full SHA
    165b11a View commit details
    Browse the repository at this point in the history
  2. Improve exception message formatting

    Enhanced the GenerateSingleLineExceptionMessage method in ExceptionExtensions.cs to better handle newline characters across Windows and Unix systems. The method now correctly replaces both `\r\n` and `\n` with semicolon separators, ensuring consistent single-line exception messages across different operating environments.
    luizfbicalho committed Jun 21, 2024
    Configuration menu
    Copy the full SHA
    b7146fe View commit details
    Browse the repository at this point in the history

Commits on Jun 26, 2024

  1. Configuration menu
    Copy the full SHA
    dabde3c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e73abff View commit details
    Browse the repository at this point in the history

Commits on Jun 28, 2024

  1. Configuration menu
    Copy the full SHA
    6e733b6 View commit details
    Browse the repository at this point in the history

Commits on Jul 1, 2024

  1. Configuration menu
    Copy the full SHA
    61dfbc0 View commit details
    Browse the repository at this point in the history

Commits on Jul 3, 2024

  1. Configuration menu
    Copy the full SHA
    d8b29ec View commit details
    Browse the repository at this point in the history

Commits on Jul 5, 2024

  1. Configuration menu
    Copy the full SHA
    f5d4135 View commit details
    Browse the repository at this point in the history

Commits on Jul 6, 2024

  1. Add guide for CSLA.NET source generator

    Added a new section to the `readme.md` file titled "Using the Source Generator with AddressPOCO in CSLA.NET". This section provides a detailed guide on leveraging the CSLA.NET framework's source generator feature, focusing on the `AddressPOCO.cs` class. It includes prerequisites, a step-by-step guide on defining a POCO class with the `[AutoSerializable]` attribute, an explanation of the attribute and source generators, the process and benefits of using this approach for serialization, and an example of generated source code. This comprehensive guide aims to assist developers in utilizing source generators for efficient code generation and serialization within the CSLA.NET framework.
    luizfbicalho committed Jul 6, 2024
    Configuration menu
    Copy the full SHA
    70b2b3c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    db7ce4b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b49a45d View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    bbf8670 View commit details
    Browse the repository at this point in the history
  5. Update project configuration and metadata

    - Imported `Directory.Package.props` for centralized package management.
    - Removed `GeneratePackageOnBuild` to disable auto NuGet package generation.
    - Added `AssemblyName`, `RootNamespace`, and `PackageId` as `Csla.Generators.CSharp` for standardization.
    - Introduced project `Description` and `Title` for NuGet metadata.
    - Configured assembly signing with `SignAssembly` and specified `AssemblyOriginatorKeyFile`.
    - Enabled XML documentation file generation with `GenerateDocumentationFile`.
    - Added `PackageTags` "CSLA;Roslyn;Generator" for better NuGet discoverability.
    - Disabled automatic generation of various assembly attributes to allow manual specification or because they are unnecessary.
    luizfbicalho committed Jul 6, 2024
    Configuration menu
    Copy the full SHA
    30e9a7c View commit details
    Browse the repository at this point in the history
  6. Restore AutoSerializableAttribute.cs content

    Re-added the entire content of AutoSerializableAttribute.cs that was previously removed, including file header comments, namespace declaration, and the class definition. This restoration marks the class with the AttributeUsage attribute for automatic serialization of types, reinstating the file's original state with copyright notice and summary description.
    luizfbicalho committed Jul 6, 2024
    Configuration menu
    Copy the full SHA
    7b99d12 View commit details
    Browse the repository at this point in the history