-
-
Notifications
You must be signed in to change notification settings - Fork 403
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
Features/incremental source generator #4039
Commits on Jun 15, 2024
-
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.
Configuration menu - View commit details
-
Copy full SHA for 78e3ac9 - Browse repository at this point
Copy the full SHA 78e3ac9View commit details
Commits on Jun 16, 2024
-
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.
Configuration menu - View commit details
-
Copy full SHA for 41aeac7 - Browse repository at this point
Copy the full SHA 41aeac7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3d51c93 - Browse repository at this point
Copy the full SHA 3d51c93View commit details -
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.
Configuration menu - View commit details
-
Copy full SHA for 016e284 - Browse repository at this point
Copy the full SHA 016e284View commit details -
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.
Configuration menu - View commit details
-
Copy full SHA for 5cced59 - Browse repository at this point
Copy the full SHA 5cced59View commit details -
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.
Configuration menu - View commit details
-
Copy full SHA for 183acf3 - Browse repository at this point
Copy the full SHA 183acf3View commit details -
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.
Configuration menu - View commit details
-
Copy full SHA for a0f372b - Browse repository at this point
Copy the full SHA a0f372bView commit details
Commits on Jun 18, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 39063ae - Browse repository at this point
Copy the full SHA 39063aeView commit details
Commits on Jun 19, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 0af8f1f - Browse repository at this point
Copy the full SHA 0af8f1fView commit details
Commits on Jun 20, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 8156d6f - Browse repository at this point
Copy the full SHA 8156d6fView commit details
Commits on Jun 21, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 165b11a - Browse repository at this point
Copy the full SHA 165b11aView commit details -
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.
Configuration menu - View commit details
-
Copy full SHA for b7146fe - Browse repository at this point
Copy the full SHA b7146feView commit details
Commits on Jun 26, 2024
-
Configuration menu - View commit details
-
Copy full SHA for dabde3c - Browse repository at this point
Copy the full SHA dabde3cView commit details -
Configuration menu - View commit details
-
Copy full SHA for e73abff - Browse repository at this point
Copy the full SHA e73abffView commit details
Commits on Jun 28, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 6e733b6 - Browse repository at this point
Copy the full SHA 6e733b6View commit details
Commits on Jul 1, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 61dfbc0 - Browse repository at this point
Copy the full SHA 61dfbc0View commit details
Commits on Jul 3, 2024
-
Configuration menu - View commit details
-
Copy full SHA for d8b29ec - Browse repository at this point
Copy the full SHA d8b29ecView commit details
Commits on Jul 5, 2024
-
Configuration menu - View commit details
-
Copy full SHA for f5d4135 - Browse repository at this point
Copy the full SHA f5d4135View commit details
Commits on Jul 6, 2024
-
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.
Configuration menu - View commit details
-
Copy full SHA for 70b2b3c - Browse repository at this point
Copy the full SHA 70b2b3cView commit details -
Merge branch 'features/incremental-source-generator' of https://githu…
…b.com/luizfbicalho/csla into features/incremental-source-generator
Configuration menu - View commit details
-
Copy full SHA for db7ce4b - Browse repository at this point
Copy the full SHA db7ce4bView commit details -
Configuration menu - View commit details
-
Copy full SHA for b49a45d - Browse repository at this point
Copy the full SHA b49a45dView commit details -
Configuration menu - View commit details
-
Copy full SHA for bbf8670 - Browse repository at this point
Copy the full SHA bbf8670View commit details -
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.
Configuration menu - View commit details
-
Copy full SHA for 30e9a7c - Browse repository at this point
Copy the full SHA 30e9a7cView commit details -
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.
Configuration menu - View commit details
-
Copy full SHA for 7b99d12 - Browse repository at this point
Copy the full SHA 7b99d12View commit details