Skip to content

Commit

Permalink
Merge pull request #24 from koder-man/autogenerate
Browse files Browse the repository at this point in the history
#19: Add comment // <auto-generated> to IgnoresAccessChecksToAttribute
  • Loading branch information
aelij authored Nov 20, 2024
2 parents 9d69bcc + 2f741d7 commit a47ca91
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
<LangVersion>latest</LangVersion>
<PackageId>IgnoresAccessChecksToGenerator</PackageId>
<Version>0.7.0</Version>
<Version>0.7.1</Version>
<DevelopmentDependency>true</DevelopmentDependency>
<Authors>Eli Arbel</Authors>
<RepositoryUrl>https://github.com/aelij/IgnoresAccessChecksToGenerator</RepositoryUrl>
Expand Down
15 changes: 13 additions & 2 deletions src/IgnoresAccessChecksToGenerator.Tasks/PublicizeInternals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,17 @@ private void GenerateAttributes(string path, IEnumerable<string> assemblyNames)
var attributes = string.Join(Environment.NewLine,
assemblyNames.Select(a => $@"[assembly: System.Runtime.CompilerServices.IgnoresAccessChecksTo(""{a}"")]"));

var content = attributes + @"
var content = $$"""
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
{{attributes}}
namespace System.Runtime.CompilerServices
{
Expand All @@ -86,7 +96,8 @@ public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}";
}
""";
File.WriteAllText(GeneratedCodeFilePath, content, System.Text.Encoding.UTF8);

Log.LogMessageFromText("Generated IgnoresAccessChecksTo attributes", MessageImportance.Low);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="IgnoresAccessChecksToGenerator" Version="0.7.0" PrivateAssets="all" />
<PackageReference Include="IgnoresAccessChecksToGenerator" Version="0.7.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
</ItemGroup>

Expand Down

0 comments on commit a47ca91

Please sign in to comment.