Skip to content

Commit

Permalink
Move attributes used for authoring (#1234)
Browse files Browse the repository at this point in the history
* move authoirng attribute to winrt.runtime
  • Loading branch information
j0shuams authored Aug 3, 2022
1 parent a59ba54 commit fda23ea
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
15 changes: 0 additions & 15 deletions src/Authoring/WinRT.SourceGenerator/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,6 @@ namespace Generator
{
public class ComponentGenerator
{
private static readonly string ArrayAttributes = @"
namespace System.Runtime.InteropServices.WindowsRuntime
{
[global::System.AttributeUsage(System.AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
internal sealed class ReadOnlyArrayAttribute : global::System.Attribute
{
}
[global::System.AttributeUsage(System.AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
internal sealed class WriteOnlyArrayAttribute : global::System.Attribute
{
}
}";

private Logger Logger { get; }
private readonly GeneratorExecutionContext context;
private string tempFolder;
Expand Down Expand Up @@ -159,7 +145,6 @@ public void Generate()

try
{
context.AddSource("System.Runtime.InteropServices.WindowsRuntime", SourceText.From(ArrayAttributes, Encoding.UTF8));
string assembly = context.GetAssemblyName();
string version = context.GetAssemblyVersion();
MetadataBuilder metadataBuilder = new MetadataBuilder();
Expand Down
23 changes: 23 additions & 0 deletions src/WinRT.Runtime/Attributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,26 @@ public WindowsRuntimeHelperTypeAttribute(
public Type HelperType { get; }
}
}

namespace System.Runtime.InteropServices.WindowsRuntime
{
[AttributeUsage(System.AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
#if EMBED
internal
#else
public
#endif
sealed class ReadOnlyArrayAttribute : Attribute
{
}

[AttributeUsage(System.AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
#if EMBED
internal
#else
public
#endif
sealed class WriteOnlyArrayAttribute : Attribute
{
}
}
4 changes: 3 additions & 1 deletion src/WinRT.Runtime/MatchingRefApiCompatBaseline.net5.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,6 @@ CannotRemoveAttribute : Attribute 'WinRT.WindowsRuntimeHelperTypeAttribute' exis
CannotRemoveAttribute : Attribute 'WinRT.WindowsRuntimeHelperTypeAttribute' exists on 'WinRT.Interop.IAgileObject' in the implementation but not the reference.
TypesMustExist : Type 'WinRT.Interop.IWeakReference' does not exist in the reference but it does exist in the implementation.
TypesMustExist : Type 'WinRT.Interop.IWeakReferenceSource' does not exist in the reference but it does exist in the implementation.
Total Issues: 62
TypesMustExist : Type 'System.Runtime.InteropServices.WindowsRuntime.ReadOnlyArrayAttribute' does not exist in the reference but it does exist in the implementation.
TypesMustExist : Type 'System.Runtime.InteropServices.WindowsRuntime.WriteOnlyArrayAttribute' does not exist in the reference but it does exist in the implementation.
Total Issues: 64

0 comments on commit fda23ea

Please sign in to comment.