Skip to content

Commit

Permalink
Updating internal Pure.DI to 2.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayPianikov committed Mar 7, 2024
1 parent e9d256c commit 392fa7e
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 125 deletions.
2 changes: 1 addition & 1 deletion build/build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="CSharpInteractive" Version="1.0.7" />
<PackageReference Include="Pure.DI" Version="2.1.3">
<PackageReference Include="Pure.DI" Version="2.1.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
10 changes: 5 additions & 5 deletions samples/AvaloniaApp/AvaloniaApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
<ProjectReference Include="..\..\src\Pure.DI.Core\Pure.DI.Core.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
<ProjectReference Include="..\..\src\Pure.DI\Pure.DI.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
<ProjectReference Include="..\Clock\Clock.csproj"/>
<PackageReference Include="Avalonia" Version="11.0.9" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.9" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.9" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.9" />
<PackageReference Include="Avalonia" Version="11.0.10" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.10" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.10" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.10" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.9" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.10" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion samples/GrpcService/GrpcService.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ProjectReference Include="..\..\src\Pure.DI\Pure.DI.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
<Compile Include="..\..\src\Pure.DI.MS\any\Pure.DI\MS\*.cs" Link=""/>
<Protobuf Include="Protos\greet.proto" GrpcServices="Server"/>
<PackageReference Include="Grpc.AspNetCore" Version="2.60.0" />
<PackageReference Include="Grpc.AspNetCore" Version="2.61.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Pure.DI.Core/Components/Api.g.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// <auto-generated/>
#if !PUREDI_API_SUPPRESSION || PUREDI_API_V2
#if !PUREDI_API_SUPPRESSION || PUREDI_API_V1
#pragma warning disable

#if !NET40_OR_GREATER && !NETSTANDARD2_0_OR_GREATER && !NETCOREAPP2_0_OR_GREATER
Expand Down
2 changes: 1 addition & 1 deletion src/Pure.DI.Core/Components/GenericTypeArguments.g.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// <auto-generated/>
#if !PUREDI_API_SUPPRESSION || PUREDI_API_V2
#if !PUREDI_API_SUPPRESSION || PUREDI_API_V1
#pragma warning disable
namespace Pure.DI
{
Expand Down
2 changes: 1 addition & 1 deletion src/Pure.DI.Core/Components/GenericTypeArguments.g.tt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<#@ assembly name="netstandard" #>
<#@ import namespace="System.Collections.Generic" #>
// <auto-generated/>
#if !PUREDI_API_SUPPRESSION || PUREDI_API_V2
#if !PUREDI_API_SUPPRESSION || PUREDI_API_V1
#pragma warning disable
namespace Pure.DI
{
Expand Down
26 changes: 13 additions & 13 deletions src/Pure.DI.Core/Core/Code/ClassBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
namespace Pure.DI.Core.Code;

internal sealed class ClassBuilder(
[Tag(WellknownTag.UsingDeclarationsBuilder)] IBuilder<CompositionCode, CompositionCode> usingDeclarationsBuilder,
[Tag(WellknownTag.FieldsBuilder)] IBuilder<CompositionCode, CompositionCode> fieldsBuilder,
[Tag(WellknownTag.ArgFieldsBuilder)] IBuilder<CompositionCode, CompositionCode> argFieldsBuilder,
[Tag(WellknownTag.ParameterizedConstructorBuilder)] IBuilder<CompositionCode, CompositionCode> parameterizedConstructorBuilder,
[Tag(WellknownTag.DefaultConstructorBuilder)] IBuilder<CompositionCode, CompositionCode> defaultConstructorBuilder,
[Tag(WellknownTag.ScopeConstructorBuilder)] IBuilder<CompositionCode, CompositionCode> scopeConstructorBuilder,
[Tag(WellknownTag.RootMethodsBuilder)] IBuilder<CompositionCode, CompositionCode> rootPropertiesBuilder,
[Tag(WellknownTag.ApiMembersBuilder)] IBuilder<CompositionCode, CompositionCode> apiMembersBuilder,
[Tag(WellknownTag.DisposeMethodBuilder)] IBuilder<CompositionCode, CompositionCode> disposeMethodBuilder,
[Tag(WellknownTag.ToStringMethodBuilder)] IBuilder<CompositionCode, CompositionCode> toStringBuilder,
[Tag(WellknownTag.ResolversFieldsBuilder)] IBuilder<CompositionCode, CompositionCode> resolversFieldsBuilder,
[Tag(WellknownTag.StaticConstructorBuilder)] IBuilder<CompositionCode, CompositionCode> staticConstructorBuilder,
[Tag(WellknownTag.ResolverClassesBuilder)] IBuilder<CompositionCode, CompositionCode> resolversClassesBuilder,
[Tag(typeof(UsingDeclarationsBuilder))] IBuilder<CompositionCode, CompositionCode> usingDeclarationsBuilder,
[Tag(typeof(FieldsBuilder))] IBuilder<CompositionCode, CompositionCode> fieldsBuilder,
[Tag(typeof(ArgFieldsBuilder))] IBuilder<CompositionCode, CompositionCode> argFieldsBuilder,
[Tag(typeof(ParameterizedConstructorBuilder))] IBuilder<CompositionCode, CompositionCode> parameterizedConstructorBuilder,
[Tag(typeof(DefaultConstructorBuilder))] IBuilder<CompositionCode, CompositionCode> defaultConstructorBuilder,
[Tag(typeof(ScopeConstructorBuilder))] IBuilder<CompositionCode, CompositionCode> scopeConstructorBuilder,
[Tag(typeof(RootMethodsBuilder))] IBuilder<CompositionCode, CompositionCode> rootPropertiesBuilder,
[Tag(typeof(ApiMembersBuilder))] IBuilder<CompositionCode, CompositionCode> apiMembersBuilder,
[Tag(typeof(DisposeMethodBuilder))] IBuilder<CompositionCode, CompositionCode> disposeMethodBuilder,
[Tag(typeof(ToStringMethodBuilder))] IBuilder<CompositionCode, CompositionCode> toStringBuilder,
[Tag(typeof(ResolversFieldsBuilder))] IBuilder<CompositionCode, CompositionCode> resolversFieldsBuilder,
[Tag(typeof(StaticConstructorBuilder))] IBuilder<CompositionCode, CompositionCode> staticConstructorBuilder,
[Tag(typeof(ResolverClassesBuilder))] IBuilder<CompositionCode, CompositionCode> resolversClassesBuilder,
[Tag(typeof(ClassCommenter))] ICommenter<Unit> classCommenter,
IInformation information,
CancellationToken cancellationToken)
Expand Down
4 changes: 2 additions & 2 deletions src/Pure.DI.Core/Core/CodeBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ internal class CodeBuilder(
IBuilder<MdSetup, DependencyGraph?> dependencyGraphBuilder,
IValidator<DependencyGraph> dependencyGraphValidator,
IBuilder<DependencyGraph, IReadOnlyDictionary<Injection, Root>> rootsBuilder,
[Tag(WellknownTag.CompositionBuilder)] IBuilder<DependencyGraph, CompositionCode> compositionBuilder,
[Tag(WellknownTag.ClassBuilder)] IBuilder<CompositionCode, CompositionCode> classBuilder,
IBuilder<DependencyGraph, CompositionCode> compositionBuilder,
IBuilder<CompositionCode, CompositionCode> classBuilder,
IValidator<MdSetup> metadataValidator,
IGeneratorSources sources,
CancellationToken cancellationToken)
Expand Down
20 changes: 0 additions & 20 deletions src/Pure.DI.Core/Core/WellknownTag.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/Pure.DI.Core/Features/Default.g.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// <auto-generated/>
#if !PUREDI_API_SUPPRESSION || PUREDI_API_V2
#if !PUREDI_API_SUPPRESSION || PUREDI_API_V1
#pragma warning disable

namespace Pure.DI
Expand Down
153 changes: 76 additions & 77 deletions src/Pure.DI.Core/Generator.Composition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,104 +15,103 @@ public partial class Generator
[Conditional("DI")]
private static void Setup() => DI.Setup(nameof(Generator))
.Hint(Hint.Resolve, "Off")

.RootArg<IGeneratorOptions>("options")
.RootArg<IGeneratorSources>("sources")
.RootArg<IGeneratorDiagnostic>("diagnostic")
.RootArg<CancellationToken>("cancellationToken")

.Root<IEnumerable<Source>>("Api")
.Root<IObserversRegistry>("Observers")
.Root<IBuilder<IEnumerable<SyntaxUpdate>, Unit>>("CreateGenerator", kind: RootKinds.Private)
// Roots
.Root<IEnumerable<Source>>("Api")
.Root<IObserversRegistry>("Observers")
.Root<IBuilder<IEnumerable<SyntaxUpdate>, Unit>>("CreateGenerator", kind: RootKinds.Private)

.RootArg<IGeneratorOptions>("options")
.RootArg<IGeneratorSources>("sources")
.RootArg<IGeneratorDiagnostic>("diagnostic")
.RootArg<CancellationToken>("cancellationToken")

// Transient
.Bind<IApiInvocationProcessor>().To<ApiInvocationProcessor>()
.Bind<IMetadataSyntaxWalker>().To<MetadataSyntaxWalker>()
.Bind<IDependencyGraphBuilder>().To<DependencyGraphBuilder>()
.Bind<ITypeConstructor>().To<TypeConstructor>()
.Bind().To<ApiInvocationProcessor>()
.Bind().To<MetadataSyntaxWalker>()
.Bind().To<DependencyGraphBuilder>()
.Bind().To<TypeConstructor>()
.Bind<IEqualityComparer<string>>().To(_ => StringComparer.InvariantCultureIgnoreCase)

// Singleton
.DefaultLifetime(Singleton)
.Bind<ICache<TT1, TT2>>().To<Cache<TT1, TT2>>()
.Bind<IObserversRegistry>().Bind<IObserversProvider>().To<ObserversRegistry>()
.Bind<IEnumerable<Source>>().To(ctx =>
.Bind().To<Cache<TT1, TT2>>()
.Bind().To<ObserversRegistry>()
.Bind().To(ctx =>
{
ctx.Inject<IBuilder<Unit, IEnumerable<Source>>>(out var api);
return api.Build(Unit.Shared);
})

// PerBlock
.DefaultLifetime(PerBlock)
.Bind<IArguments>().To<Arguments>()
.Bind<IComments>().To<Comments>()
.Bind<IBuilder<IEnumerable<string>, Uri>>().To<MermaidUrlBuilder>()
.Bind<IBuildTools>().To<BuildTools>()
.Bind<ILogger<TT>>().To<Logger<TT>>()
.Bind<IResources>().To<Resources>()
.Bind<IInformation>().To<Information>()
.Bind<IGlobalOptions>().To<GlobalOptions>()
.Bind<IValidator<DependencyGraph>>().To<DependencyGraphValidator>()
.Bind<IValidator<MdSetup>>().To<MetadataValidator>()
.Bind<IMarker>().To<Marker>()
.Bind<IVariator<TT>>().To<Variator<TT>>()
.Bind<IProfiler>().To<Profiler>()
.Bind<IBaseSymbolsProvider>().To<BaseSymbolsProvider>()
.Bind().To<Arguments>()
.Bind().To<Comments>()
.Bind().To<BuildTools>()
.Bind().To<Logger<TT>>()
.Bind().To<Resources>()
.Bind().To<Information>()
.Bind().To<GlobalOptions>()
.Bind().To<DependencyGraphValidator>()
.Bind().To<MetadataValidator>()
.Bind().To<Marker>()
.Bind().To<Variator<TT>>()
.Bind().To<Profiler>()
.Bind().To<BaseSymbolsProvider>()

// Comments
.Bind<ICommenter<Unit>>(typeof(ClassCommenter)).To<ClassCommenter>()
.Bind<ICommenter<Unit>>(typeof(ParameterizedConstructorCommenter)).To<ParameterizedConstructorCommenter>()
.Bind<ICommenter<Root>>(typeof(RootMethodsCommenter)).To<RootMethodsCommenter>()
.Bind(Tag.Type).To<ClassCommenter>()
.Bind(Tag.Type).To<ParameterizedConstructorCommenter>()
.Bind(Tag.Type).To<RootMethodsCommenter>()

// Builders
.Bind<IBuilder<IEnumerable<SyntaxUpdate>, IEnumerable<MdSetup>>>().To<MetadataBuilder>()
.Bind<IBuilder<LogEntry, LogInfo>>().To<LogInfoBuilder>()
.Bind<IBuilder<ImmutableArray<Root>, IEnumerable<ResolverInfo>>>().To<ResolversBuilder>()
.Bind<IBuilder<ContractsBuildContext, ISet<Injection>>>().To<ContractsBuilder>()
.Bind<IBuilder<CompositionCode, LinesBuilder>>().To<ClassDiagramBuilder>()
.Bind<IBuilder<DependencyGraph, IReadOnlyDictionary<Injection, Root>>>().To<RootsBuilder>()
.Bind<IBuilder<MdSetup, IEnumerable<DependencyNode>>>(typeof(FactoryDependencyNodeBuilder)).To<FactoryDependencyNodeBuilder>()
.Bind<IBuilder<MdSetup, IEnumerable<DependencyNode>>>(typeof(ArgDependencyNodeBuilder)).To<ArgDependencyNodeBuilder>()
.Bind<IBuilder<MdSetup, IEnumerable<DependencyNode>>>(typeof(ConstructDependencyNodeBuilder)).To<ConstructDependencyNodeBuilder>()
.Bind<IBuilder<MdSetup, IEnumerable<DependencyNode>>>(typeof(ImplementationDependencyNodeBuilder)).To<ImplementationDependencyNodeBuilder>()
.Bind<IBuilder<MdSetup, IEnumerable<DependencyNode>>>(typeof(RootDependencyNodeBuilder)).To<RootDependencyNodeBuilder>()
.Bind<IBuilder<MdSetup, DependencyGraph?>>().To<VariationalDependencyGraphBuilder>()
.Bind<IBuilder<DpImplementation, IEnumerable<DpImplementation>>>().To<ImplementationVariantsBuilder>()
.Bind<IBuilder<Unit, IEnumerable<Source>>>().To<ApiBuilder>()
.Bind<IBuilder<MdSetup, Unit>>().To<CodeBuilder>()
.Bind<IBuilder<SyntaxUpdate, IEnumerable<MdSetup>>>().To<SetupsBuilder>()
.Bind<IBuilder<IEnumerable<SyntaxUpdate>, Unit>>().To<Core.Generator>()
.Bind<IBuilder<RewriterContext<MdFactory>, MdFactory>>().To<FactoryTypeRewriter>()
.Bind<IBuilder<DependencyGraph, CompositionCode>>(WellknownTag.CompositionBuilder).To<CompositionBuilder>()
.Bind<IVariablesBuilder>().To<VariablesBuilder>()
.Bind().To<MetadataBuilder>()
.Bind().To<LogInfoBuilder>()
.Bind().To<ResolversBuilder>()
.Bind().To<ContractsBuilder>()
.Bind().To<ClassDiagramBuilder>()
.Bind().To<RootsBuilder>()
.Bind(Tag.Unique).To<FactoryDependencyNodeBuilder>()
.Bind(Tag.Unique).To<ArgDependencyNodeBuilder>()
.Bind(Tag.Unique).To<ConstructDependencyNodeBuilder>()
.Bind(Tag.Unique).To<ImplementationDependencyNodeBuilder>()
.Bind(Tag.Unique).To<RootDependencyNodeBuilder>()
.Bind().To<VariationalDependencyGraphBuilder>()
.Bind().To<ImplementationVariantsBuilder>()
.Bind().To<ApiBuilder>()
.Bind().To<CodeBuilder>()
.Bind().To<SetupsBuilder>()
.Bind().To<Core.Generator>()
.Bind().To<FactoryTypeRewriter>()
.Bind().To<CompositionBuilder>()
.Bind().To<VariablesBuilder>()
.Bind().To<MermaidUrlBuilder>()

// Code builders
.Bind<ICodeBuilder<IStatement>>().To<StatementCodeBuilder>()
.Bind<ICodeBuilder<Block>>().To<BlockCodeBuilder>()
.Bind<ICodeBuilder<Variable>>().To<VariableCodeBuilder>()
.Bind<ICodeBuilder<DpImplementation>>().To<ImplementationCodeBuilder>()
.Bind<ICodeBuilder<DpFactory>>().To<FactoryCodeBuilder>()
.Bind<ICodeBuilder<DpConstruct>>().To<ConstructCodeBuilder>()

// Code
.Bind<IBuilder<CompositionCode, CompositionCode>>(WellknownTag.ClassBuilder).To<ClassBuilder>()
.Bind<IBuilder<CompositionCode, CompositionCode>>(WellknownTag.DisposeMethodBuilder).To<DisposeMethodBuilder>()
.Bind<IBuilder<CompositionCode, CompositionCode>>(WellknownTag.RootMethodsBuilder).To<RootMethodsBuilder>()
.Bind<IBuilder<CompositionCode, CompositionCode>>(WellknownTag.UsingDeclarationsBuilder).To<UsingDeclarationsBuilder>()
.Bind<IBuilder<CompositionCode, CompositionCode>>(WellknownTag.ArgFieldsBuilder).To<ArgFieldsBuilder>()
.Bind<IBuilder<CompositionCode, CompositionCode>>(WellknownTag.FieldsBuilder).To<FieldsBuilder>()
.Bind<IBuilder<CompositionCode, CompositionCode>>(WellknownTag.ScopeConstructorBuilder).To<ScopeConstructorBuilder>()
.Bind<IBuilder<CompositionCode, CompositionCode>>(WellknownTag.ParameterizedConstructorBuilder).To<ParameterizedConstructorBuilder>()
.Bind<IBuilder<CompositionCode, CompositionCode>>(WellknownTag.DefaultConstructorBuilder).To<DefaultConstructorBuilder>()
.Bind<IBuilder<CompositionCode, CompositionCode>>(WellknownTag.ResolverClassesBuilder).To<ResolverClassesBuilder>()
.Bind<IBuilder<CompositionCode, CompositionCode>>(WellknownTag.StaticConstructorBuilder).To<StaticConstructorBuilder>()
.Bind<IBuilder<CompositionCode, CompositionCode>>(WellknownTag.ApiMembersBuilder).To<ApiMembersBuilder>()
.Bind<IBuilder<CompositionCode, CompositionCode>>(WellknownTag.ResolversFieldsBuilder).To<ResolversFieldsBuilder>()
.Bind<IBuilder<CompositionCode, CompositionCode>>(WellknownTag.ToStringMethodBuilder).To<ToStringMethodBuilder>()
.Bind().To<StatementCodeBuilder>()
.Bind().To<BlockCodeBuilder>()
.Bind().To<VariableCodeBuilder>()
.Bind().To<ImplementationCodeBuilder>()
.Bind().To<FactoryCodeBuilder>()
.Bind().To<ConstructCodeBuilder>()
.Bind().To<ClassBuilder>()
.Bind(Tag.Type).To<DisposeMethodBuilder>()
.Bind(Tag.Type).To<RootMethodsBuilder>()
.Bind(Tag.Type).To<UsingDeclarationsBuilder>()
.Bind(Tag.Type).To<ArgFieldsBuilder>()
.Bind(Tag.Type).To<FieldsBuilder>()
.Bind(Tag.Type).To<ScopeConstructorBuilder>()
.Bind(Tag.Type).To<ParameterizedConstructorBuilder>()
.Bind(Tag.Type).To<DefaultConstructorBuilder>()
.Bind(Tag.Type).To<ResolverClassesBuilder>()
.Bind(Tag.Type).To<StaticConstructorBuilder>()
.Bind(Tag.Type).To<ApiMembersBuilder>()
.Bind(Tag.Type).To<ResolversFieldsBuilder>()
.Bind(Tag.Type).To<ToStringMethodBuilder>()

// PerResolve
.DefaultLifetime(PerResolve)
.Bind<IObserver<LogEntry>>().To<LogObserver>()
.Bind<IFilter>().To<Filter>()
.Bind<IIdGenerator>().To<IdGenerator>();
.Bind().To<LogObserver>()
.Bind().To<Filter>()
.Bind().To<IdGenerator>();
}
4 changes: 2 additions & 2 deletions src/Pure.DI.Core/Pure.DI.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

<PropertyGroup>
<RootNamespace>$(BasePackageId)</RootNamespace>
<DefineConstants>$(DefineConstants);PUREDI_API_SUPPRESSION;PUREDI_API_V2</DefineConstants>
<DefineConstants>$(DefineConstants);PUREDI_API_SUPPRESSION;PUREDI_API_V1</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Pure.DI" Version="2.1.3">
<PackageReference Include="Pure.DI" Version="2.1.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down

0 comments on commit 392fa7e

Please sign in to comment.