-
Notifications
You must be signed in to change notification settings - Fork 1
Updates in prep for code gen #20
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>[!IMPORTANT]
> Some of these changes are breaking changes that require a major version bump.
## General repository updates
* Moved editorconfig and global.json to same folder as the solution.
- Despite what is implied in the docs, these are only recognized when they exist at the same level of the directory structure as the solution it applies to.
* Added `GeneratePathProperty` to all packagereferences so that is automatic now.
- It appears that it is the default whether that is set or not. The default behavior in the project system might handle explicitly setting it to `false`. This makes it consistently on even if the default is normally off.
* Updated `NuGet.config` to leverage source mapping and force all generated packages to come from the build output location and never from nuget.org or any other source.
## Ubiquity.NET.CodeAnalysis.Utils
* [Potentially Breaking Change] Added reference from `Ubiquity.NET.CodeAnalysis.Utils` to `Ubiquity.NET.Extensions`
* Added `AttributeDataExtensions` to provide common usage extensions for `AttributeData`
* Cleaned up implementation of `BaseTypeDeclarationSyntaxExtensions.GetNestedClassName`
* Added DebugAssert extension to validate the size of a struct is within the recommended limits.
- If a struct is too large there's a very good chance that it has more overhead than if it was a class.
* [Breaking change] Updated `DiagnosticInfo` to use an ImmutableArray as the member and apply structural equality on it.
- This ensures that two instances that have the same contents are considered equal. Previously it was only a shallow compare so tow diagnostics with the same contents for `Params` ended up comparing as not equal even though they were equal.
* [Breaking Change] Added Structural equality behavior to EquatableArray.
- Also clarified docs that use of this type is rather limited. It's primary goal is to add structural equatability as the behavior behind `IEquatable<T>` which is normally just a shallow equality or reference equality. When an array is captured as a member of something else, than an `ImmutableArray<T>` should be used directly. The primary reason this isn't obsolete is for a top level array that is a direct result of a parse/analysis. Capturing it into `EquatableArray<T>` ensures correct caching behavior.
* Added EquatableAttributeData to capture attribute data in the analysis phase.
* Added `EquatableAttributeDataCollection`
* This is essentially a `KeyedCollection<EquatableAttributeData>` that uses the `EquatableAttributeData.Name` as the key AND supports structural equality.
* Added `EquatableDictionary<TKey,TValue>` that is a struct to wrap a `Dictionary<TKey,TValue>` with structural equality. This is a simple struct that consume no size beyond that of the managed ref to the wrapped dictionary. It is only providing alternate behavior.
* Added `NamespaceQualifiedNameFormatter` as a general type to handle custom formatting of `NamespaceWualifiedName`.
- This type is generalized to allow language specific implementations with only the global prefix and alias maps as unique per language.
- Added static CSharp, using singleton pattern for the language as only one actual instance is needed.
* [Breaking Change] Added Structural Equality support to `NestedClassName`
* [Breaking Change] Changed type of `Result<T>.Diagnostics` to `ImmutableArray<DiagnosticInfo>`
* Added `StructurallyEquatableTypedConstant`
- This is a simple wrapper around `TypedConstant` to provide structural equality for array constants. These are most likely used in the constructor or named arguments of an Attribute.
* Added `StructuralTypedConstantComparer` to perform structural comparisons of `TypedConstant` values.
* Added `SymbolExtensions` utility class to host extension methods for an `ISymbol`. Particularly around finding/capturing attribute data attached to a symbol.
* Added `TypedConstantExtensions` utility class to host extension methods for `TypedConstant`.
- Specifically to test if a given constant is a non-null array.
* Added `TypeSymbolExtensions` utility class to host extensions for a `ITypeSymbol`.
- Specifically to gather or determine the name elements.
- Reverse walk of the hierarchy is NOT performed until the sequence of namespace names is enumerated. This helps reduce the cost until it is needed.
## Ubiquity.NET.CommandLine
* [Breaking Change] changed the name of `CmdLineSettings` to `CommandLineSettings` for consistency.
* [Breaking Change] - Split `ICommandLineOptions<T>` into two distinct interfaces.
- `ICommandBinder` provides binding support of the results of a parse
- `IRootCommandBuilder` provides support for building the application root command.
- This paves the way for generators and, in particular, that every sub-command is NOT a root command. That is, a sub-command, when supported,
does not implement IRooCommandBuilder as it isn't a root command.
* Obsoleted the `ArgsParsing.TryParse<T>` as the use of this with it's odd return code behavior was sub-optimal leading to confusion and incorrect use that was difficult to understand. Callers should use the `RootCommandExtensions.ParseAndInvokeResult` overloads instead.
## Ubiquity.NET.Extensions
* Added `ICustomFormatter<T>` interface to the extensions support.
- This provides an explicit type formatter that custom formatting can query of an `IFormatter` instance to know that a particular type format is available
* Added `ImmutableArrayExtensions` utility class to host extension to `ImmutableArray<T>`
## Ubiquity.NET.SrcGeneration
* Added AsLiteral methods to the `CSharpLanguage` type to allow formatting a string or bool as a literal appropriate for the language.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Updates in prep for code gen
Important
Some of these changes are breaking changes that require a major version bump.
General repository updates
GeneratePathPropertyto all packagereferences so that is automatic now.false. This makes it consistently on even if the default is normally off.NuGet.configto leverage source mapping and force all generated packages to come from the build output location and never from nuget.org or any other source.Ubiquity.NET.CodeAnalysis.Utils
[Potentially Breaking Change] Added reference from
Ubiquity.NET.CodeAnalysis.UtilstoUbiquity.NET.ExtensionsAdded
AttributeDataExtensionsto provide common usage extensions forAttributeDataCleaned up implementation of
BaseTypeDeclarationSyntaxExtensions.GetNestedClassNameAdded DebugAssert extension to validate the size of a struct is within the recommended limits.
[Breaking change] Updated
DiagnosticInfoto use an ImmutableArray as the member and apply structural equality on it.Paramsended up comparing as not equal even though they were equal.[Breaking Change] Added Structural equality behavior to EquatableArray.
IEquatable<T>which is normally just a shallow equality or reference equality. When an array is captured as a member of something else, than anImmutableArray<T>should be used directly. The primary reason this isn't obsolete is for a top level array that is a direct result of a parse/analysis. Capturing it intoEquatableArray<T>ensures correct caching behavior.Added EquatableAttributeData to capture attribute data in the analysis phase.
Added
EquatableAttributeDataCollectionKeyedCollection<EquatableAttributeData>that uses theEquatableAttributeData.Nameas the key AND supports structural equality.Added
EquatableDictionary<TKey,TValue>that is a struct to wrap aDictionary<TKey,TValue>with structural equality. This is a simple struct that consume no size beyond that of the managed ref to the wrapped dictionary. It is only providing alternate behavior.Added
NamespaceQualifiedNameFormatteras a general type to handle custom formatting ofNamespaceWualifiedName.[Breaking Change] Added Structural Equality support to
NestedClassName[Breaking Change] Changed type of
Result<T>.DiagnosticstoImmutableArray<DiagnosticInfo>Added
StructurallyEquatableTypedConstantTypedConstantto provide structural equality for array constants. These are most likely used in the constructor or named arguments of an Attribute.Added
StructuralTypedConstantComparerto perform structural comparisons ofTypedConstantvalues.Added
SymbolExtensionsutility class to host extension methods for anISymbol. Particularly around finding/capturing attribute data attached to a symbol.Added
TypedConstantExtensionsutility class to host extension methods forTypedConstant.Added
TypeSymbolExtensionsutility class to host extensions for aITypeSymbol.Ubiquity.NET.CommandLine
CmdLineSettingstoCommandLineSettingsfor consistency.ICommandLineOptions<T>into two distinct interfaces.ICommandBinderprovides binding support of the results of a parseIRootCommandBuilderprovides support for building the application root command.does not implement IRooCommandBuilder as it isn't a root command.
ArgsParsing.TryParse<T>as the use of this with it's odd return code behavior was sub-optimal leading to confusion and incorrect use that was difficult to understand. Callers should use theRootCommandExtensions.ParseAndInvokeResultoverloads instead.Ubiquity.NET.Extensions
ICustomFormatter<T>interface to the extensions support.IFormatterinstance to know that a particular type format is availableImmutableArrayExtensionsutility class to host extension toImmutableArray<T>Ubiquity.NET.SrcGeneration
CSharpLanguagetype to allow formatting a string or bool as a literal appropriate for the language.