Skip to content

Commit

Permalink
Merge pull request #5816 from bdukes/remove-source-generator-reference
Browse files Browse the repository at this point in the history
Move DnnDeprecatedAttribute to Abstractions
  • Loading branch information
valadas committed Sep 20, 2023
2 parents 7c9c29f + 89bd59a commit a8316d0
Show file tree
Hide file tree
Showing 39 changed files with 653 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information
namespace DotNetNuke.Internal.SourceGenerators;

using System;
using System.Diagnostics;

/// <summary>Marks a type or member as deprecated.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
</PropertyGroup>
<PropertyGroup>
<Deterministic>true</Deterministic>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" OutputItemType="Analyzer" />
<ProjectReference Include="..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</ProjectReference>
<ProjectReference Include="..\DotNetNuke.Instrumentation\DotNetNuke.Instrumentation.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,14 @@
<Analyzer Include="..\..\packages\StyleCop.Analyzers.1.1.118\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" OutputItemType="Analyzer">
<ProjectReference Include="..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer">
<Project>{5FE5D021-9C8D-47A6-BD34-F328BA3E709C}</Project>
<Name>DotNetNuke.Internal.SourceGenerators</Name>
</ProjectReference>
<ProjectReference Include="..\DotNetNuke.Abstractions\DotNetNuke.Abstractions.csproj">
<Project>{6928a9b1-f88a-4581-a132-d3eb38669bb0}</Project>
<Name>DotNetNuke.Abstractions</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,14 @@
<Analyzer Include="..\..\packages\StyleCop.Analyzers.1.1.118\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" OutputItemType="Analyzer">
<ProjectReference Include="..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer">
<Project>{5FE5D021-9C8D-47A6-BD34-F328BA3E709C}</Project>
<Name>DotNetNuke.Internal.SourceGenerators</Name>
</ProjectReference>
<ProjectReference Include="..\DotNetNuke.Abstractions\DotNetNuke.Abstractions.csproj">
<Project>{6928a9b1-f88a-4581-a132-d3eb38669bb0}</Project>
<Name>DotNetNuke.Abstractions</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion DNN Platform/DotNetNuke.Web.Mvc/DotNetNuke.Web.Mvc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" OutputItemType="Analyzer">
<ProjectReference Include="..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer">
<Project>{5fe5d021-9c8d-47a6-bd34-f328ba3e709c}</Project>
<Name>DotNetNuke.Internal.SourceGenerators</Name>
</ProjectReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" OutputItemType="Analyzer">
<ProjectReference Include="..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer">
<Project>{5fe5d021-9c8d-47a6-bd34-f328ba3e709c}</Project>
<Name>DotNetNuke.Internal.SourceGenerators</Name>
</ProjectReference>
Expand Down
2 changes: 1 addition & 1 deletion DNN Platform/DotNetNuke.Web/DotNetNuke.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" OutputItemType="Analyzer">
<ProjectReference Include="..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer">
<Project>{5fe5d021-9c8d-47a6-bd34-f328ba3e709c}</Project>
<Name>DotNetNuke.Internal.SourceGenerators</Name>
</ProjectReference>
Expand Down
2 changes: 1 addition & 1 deletion DNN Platform/HttpModules/DotNetNuke.HttpModules.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
<Compile Include="Users Online\UsersOnlineModule.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" OutputItemType="Analyzer">
<ProjectReference Include="..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer">
<Project>{5FE5D021-9C8D-47A6-BD34-F328BA3E709C}</Project>
<Name>DotNetNuke.Internal.SourceGenerators</Name>
</ProjectReference>
Expand Down
2 changes: 1 addition & 1 deletion DNN Platform/Library/DotNetNuke.Library.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -1918,7 +1918,7 @@
<Folder Include="UI\Internal\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" OutputItemType="Analyzer">
<ProjectReference Include="..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer">
<Project>{5fe5d021-9c8d-47a6-bd34-f328ba3e709c}</Project>
<Name>DotNetNuke.Internal.SourceGenerators</Name>
</ProjectReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
<Folder Include="Packages\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" OutputItemType="Analyzer">
<ProjectReference Include="..\..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer">
<Project>{5FE5D021-9C8D-47A6-BD34-F328BA3E709C}</Project>
<Name>DotNetNuke.Internal.SourceGenerators</Name>
</ProjectReference>
Expand Down
6 changes: 5 additions & 1 deletion DNN Platform/Modules/DnnExportImport/DnnExportImport.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,14 @@
<Content Include="Module.build" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" OutputItemType="Analyzer">
<ProjectReference Include="..\..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer">
<Project>{5FE5D021-9C8D-47A6-BD34-F328BA3E709C}</Project>
<Name>DotNetNuke.Internal.SourceGenerators</Name>
</ProjectReference>
<ProjectReference Include="..\..\DotNetNuke.Abstractions\DotNetNuke.Abstractions.csproj">
<Project>{6928a9b1-f88a-4581-a132-d3eb38669bb0}</Project>
<Name>DotNetNuke.Abstractions</Name>
</ProjectReference>
<ProjectReference Include="..\..\DotNetNuke.Instrumentation\DotNetNuke.Instrumentation.csproj">
<Project>{3cd5f6b8-8360-4862-80b6-f402892db7dd}</Project>
<Name>DotNetNuke.Instrumentation</Name>
Expand Down
2 changes: 1 addition & 1 deletion DNN Platform/Modules/HTML/DotNetNuke.Modules.Html.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
<Content Include="web.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" OutputItemType="Analyzer">
<ProjectReference Include="..\..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer">
<Project>{5FE5D021-9C8D-47A6-BD34-F328BA3E709C}</Project>
<Name>DotNetNuke.Internal.SourceGenerators</Name>
</ProjectReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
<Content Include="App_LocalResources\ProviderConfiguration.ascx.resx" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" OutputItemType="Analyzer">
<ProjectReference Include="..\..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer">
<Project>{5FE5D021-9C8D-47A6-BD34-F328BA3E709C}</Project>
<Name>DotNetNuke.Internal.SourceGenerators</Name>
</ProjectReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" OutputItemType="Analyzer">
<ProjectReference Include="..\..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer">
<Project>{5FE5D021-9C8D-47A6-BD34-F328BA3E709C}</Project>
<Name>DotNetNuke.Internal.SourceGenerators</Name>
</ProjectReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
<Content Include="web.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" OutputItemType="Analyzer">
<ProjectReference Include="..\..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer">
<Project>{5FE5D021-9C8D-47A6-BD34-F328BA3E709C}</Project>
<Name>DotNetNuke.Internal.SourceGenerators</Name>
</ProjectReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" OutputItemType="Analyzer">
<ProjectReference Include="..\..\..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer">
<Project>{5FE5D021-9C8D-47A6-BD34-F328BA3E709C}</Project>
<Name>DotNetNuke.Internal.SourceGenerators</Name>
</ProjectReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,14 @@
<Compile Include="WebApiException.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" OutputItemType="Analyzer">
<ProjectReference Include="..\..\..\DotNetNuke.Internal.SourceGenerators\DotNetNuke.Internal.SourceGenerators.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer">
<Project>{5FE5D021-9C8D-47A6-BD34-F328BA3E709C}</Project>
<Name>DotNetNuke.Internal.SourceGenerators</Name>
</ProjectReference>
<ProjectReference Include="..\..\DotNetNuke.Abstractions\DotNetNuke.Abstractions.csproj">
<Project>{6928a9b1-f88a-4581-a132-d3eb38669bb0}</Project>
<Name>DotNetNuke.Abstractions</Name>
</ProjectReference>
<ProjectReference Include="..\..\Library\DotNetNuke.Library.csproj">
<Project>{6b29aded-7b56-4484-bea5-c0e09079535b}</Project>
<Name>DotNetNuke.Library</Name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ private static async Task Verify(string source)
AppDomain.CurrentDomain.GetAssemblies()
.Where(a => !a.IsDynamic && !string.IsNullOrEmpty(a.Location))
.Select(a => MetadataReference.CreateFromFile(a.Location))
.Append(MetadataReference.CreateFromFile(typeof(DnnDeprecatedAttribute).Assembly.Location));
.Append(MetadataReference.CreateFromFile(typeof(DnnDeprecatedGenerator).Assembly.Location));
var compilation = CSharpCompilation.Create(
"AnAssemblyName",
new[] { CSharpSyntaxTree.ParseText(source), },
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//HintName: DnnDeprecatedAttribute.g.cs
namespace DotNetNuke.Internal.SourceGenerators;

using System;
using System.Diagnostics;

/// <summary>Marks a type or member as deprecated.</summary>
[Conditional("DNN_SOURCE_GENERATOR")]
internal class DnnDeprecatedAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="DnnDeprecatedAttribute"/> class.</summary>
/// <param name="majorVersion">The major version in which the type or member was deprecated.</param>
/// <param name="minorVersion">The minor version in which the type or member was deprecated.</param>
/// <param name="patchVersion">The patch version in which the type or member was deprecated.</param>
/// <param name="replacement">The suggested replacement or alternative.</param>
public DnnDeprecatedAttribute(int majorVersion, int minorVersion, int patchVersion, string replacement)
{
this.MajorVersion = majorVersion;
this.MinorVersion = minorVersion;
this.PatchVersion = patchVersion;
this.Replacement = replacement;
this.RemovalVersion = majorVersion + 2;
}

/// <summary>Gets the major version in which the type or member was deprecated.</summary>
public int MajorVersion { get; }

/// <summary>Gets the minor version in which the type or member was deprecated.</summary>
public int MinorVersion { get; }

/// <summary>Gets the patch version in which the type or member was deprecated.</summary>
public int PatchVersion { get; }

/// <summary>Gets the suggested replacement or alternative.</summary>
public string Replacement { get; }

/// <summary>Gets or sets the major version in which the type or member will be removed.</summary>
public int RemovalVersion { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//HintName: DnnDeprecatedAttribute.g.cs
namespace DotNetNuke.Internal.SourceGenerators;

using System;
using System.Diagnostics;

/// <summary>Marks a type or member as deprecated.</summary>
[Conditional("DNN_SOURCE_GENERATOR")]
internal class DnnDeprecatedAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="DnnDeprecatedAttribute"/> class.</summary>
/// <param name="majorVersion">The major version in which the type or member was deprecated.</param>
/// <param name="minorVersion">The minor version in which the type or member was deprecated.</param>
/// <param name="patchVersion">The patch version in which the type or member was deprecated.</param>
/// <param name="replacement">The suggested replacement or alternative.</param>
public DnnDeprecatedAttribute(int majorVersion, int minorVersion, int patchVersion, string replacement)
{
this.MajorVersion = majorVersion;
this.MinorVersion = minorVersion;
this.PatchVersion = patchVersion;
this.Replacement = replacement;
this.RemovalVersion = majorVersion + 2;
}

/// <summary>Gets the major version in which the type or member was deprecated.</summary>
public int MajorVersion { get; }

/// <summary>Gets the minor version in which the type or member was deprecated.</summary>
public int MinorVersion { get; }

/// <summary>Gets the patch version in which the type or member was deprecated.</summary>
public int PatchVersion { get; }

/// <summary>Gets the suggested replacement or alternative.</summary>
public string Replacement { get; }

/// <summary>Gets or sets the major version in which the type or member will be removed.</summary>
public int RemovalVersion { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//HintName: DnnDeprecatedAttribute.g.cs
namespace DotNetNuke.Internal.SourceGenerators;

using System;
using System.Diagnostics;

/// <summary>Marks a type or member as deprecated.</summary>
[Conditional("DNN_SOURCE_GENERATOR")]
internal class DnnDeprecatedAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="DnnDeprecatedAttribute"/> class.</summary>
/// <param name="majorVersion">The major version in which the type or member was deprecated.</param>
/// <param name="minorVersion">The minor version in which the type or member was deprecated.</param>
/// <param name="patchVersion">The patch version in which the type or member was deprecated.</param>
/// <param name="replacement">The suggested replacement or alternative.</param>
public DnnDeprecatedAttribute(int majorVersion, int minorVersion, int patchVersion, string replacement)
{
this.MajorVersion = majorVersion;
this.MinorVersion = minorVersion;
this.PatchVersion = patchVersion;
this.Replacement = replacement;
this.RemovalVersion = majorVersion + 2;
}

/// <summary>Gets the major version in which the type or member was deprecated.</summary>
public int MajorVersion { get; }

/// <summary>Gets the minor version in which the type or member was deprecated.</summary>
public int MinorVersion { get; }

/// <summary>Gets the patch version in which the type or member was deprecated.</summary>
public int PatchVersion { get; }

/// <summary>Gets the suggested replacement or alternative.</summary>
public string Replacement { get; }

/// <summary>Gets or sets the major version in which the type or member will be removed.</summary>
public int RemovalVersion { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//HintName: DnnDeprecatedAttribute.g.cs
namespace DotNetNuke.Internal.SourceGenerators;

using System;
using System.Diagnostics;

/// <summary>Marks a type or member as deprecated.</summary>
[Conditional("DNN_SOURCE_GENERATOR")]
internal class DnnDeprecatedAttribute : Attribute
{
/// <summary>Initializes a new instance of the <see cref="DnnDeprecatedAttribute"/> class.</summary>
/// <param name="majorVersion">The major version in which the type or member was deprecated.</param>
/// <param name="minorVersion">The minor version in which the type or member was deprecated.</param>
/// <param name="patchVersion">The patch version in which the type or member was deprecated.</param>
/// <param name="replacement">The suggested replacement or alternative.</param>
public DnnDeprecatedAttribute(int majorVersion, int minorVersion, int patchVersion, string replacement)
{
this.MajorVersion = majorVersion;
this.MinorVersion = minorVersion;
this.PatchVersion = patchVersion;
this.Replacement = replacement;
this.RemovalVersion = majorVersion + 2;
}

/// <summary>Gets the major version in which the type or member was deprecated.</summary>
public int MajorVersion { get; }

/// <summary>Gets the minor version in which the type or member was deprecated.</summary>
public int MinorVersion { get; }

/// <summary>Gets the patch version in which the type or member was deprecated.</summary>
public int PatchVersion { get; }

/// <summary>Gets the suggested replacement or alternative.</summary>
public string Replacement { get; }

/// <summary>Gets or sets the major version in which the type or member will be removed.</summary>
public int RemovalVersion { get; set; }
}
Loading

0 comments on commit a8316d0

Please sign in to comment.