Browse Source

Added [PrivateApi]

pull/11062/head
Nikita Tsukanov 3 years ago
parent
commit
30064443b1
  1. 16
      nukebuild/RefAssemblyGenerator.cs
  2. 9
      src/Avalonia.Base/Metadata/PrivateApiAttribute.cs
  3. 2
      src/Avalonia.Base/Platform/ICursorFactory.cs
  4. 4
      src/Avalonia.Base/Platform/IPlatformRenderInterface.cs
  5. 2
      src/Avalonia.Controls/Platform/IPlatformIconLoader.cs
  6. 2
      src/Avalonia.Controls/Platform/IWindowingPlatform.cs

16
nukebuild/RefAssemblyGenerator.cs

@ -39,10 +39,13 @@ public class RefAssemblyGenerator
ProcessType(nested, obsoleteCtor);
if (type.IsInterface)
{
var hideMethods = type.Name.EndsWith("Impl");
var hideMethods = type.Name.EndsWith("Impl")
|| (type.HasCustomAttributes && type.CustomAttributes.Any(a =>
a.AttributeType.FullName == "Avalonia.Metadata.PrivateApiAttribute"));
var injectMethod = hideMethods
|| type.CustomAttributes.Any(a =>
a.AttributeType.FullName.EndsWith("NotClientImplementableAttribute"));
a.AttributeType.FullName == "Avalonia.Metadata.NotClientImplementableAttribute");
if (hideMethods)
{
@ -65,7 +68,7 @@ public class RefAssemblyGenerator
}
var forceUnstable = type.CustomAttributes.Any(a =>
a.AttributeType.FullName.EndsWith("UnstableAttribute"));
a.AttributeType.FullName == "Avalonia.Metadata.UnstableAttribute");
foreach (var m in type.Methods)
MarkAsUnstable(m, obsoleteCtor, forceUnstable);
@ -81,11 +84,10 @@ public class RefAssemblyGenerator
{
if (!force
|| def.HasCustomAttributes == false
|| !def.CustomAttributes.Any(a =>
a.AttributeType.FullName.EndsWith("UnstableAttribute")))
|| def.CustomAttributes.All(a => a.AttributeType.FullName != "Avalonia.Metadata.UnstableAttribute"))
return;
if (def.CustomAttributes.Any(a => a.TypeFullName.EndsWith("ObsoleteAttribute")))
if (def.CustomAttributes.Any(a => a.TypeFullName == "System.ObsoleteAttribute"))
return;
def.CustomAttributes.Add(new CustomAttribute(obsoleteCtor, new CAArgument[]

9
src/Avalonia.Base/Metadata/PrivateApiAttribute.cs

@ -0,0 +1,9 @@
using System;
namespace Avalonia.Metadata;
[AttributeUsage(AttributeTargets.Interface)]
public sealed class PrivateApiAttribute : Attribute
{
}

2
src/Avalonia.Base/Platform/ICursorFactory.cs

@ -1,9 +1,11 @@
using Avalonia.Input;
using Avalonia.Metadata;
#nullable enable
namespace Avalonia.Platform
{
[PrivateApi]
public interface ICursorFactory
{
ICursorImpl GetCursor(StandardCursorType cursorType);

4
src/Avalonia.Base/Platform/IPlatformRenderInterface.cs

@ -11,7 +11,7 @@ namespace Avalonia.Platform
/// <summary>
/// Defines the main platform-specific interface for the rendering subsystem.
/// </summary>
[Unstable]
[Unstable, PrivateApi]
public interface IPlatformRenderInterface
{
/// <summary>
@ -201,7 +201,7 @@ namespace Avalonia.Platform
bool IsSupportedBitmapPixelFormat(PixelFormat format);
}
[Unstable]
[Unstable, PrivateApi]
public interface IPlatformRenderInterfaceContext : IOptionalFeatureProvider, IDisposable
{
/// <summary>

2
src/Avalonia.Controls/Platform/IPlatformIconLoader.cs

@ -3,7 +3,7 @@ using Avalonia.Metadata;
namespace Avalonia.Platform
{
[Unstable]
[Unstable, PrivateApi]
public interface IPlatformIconLoader
{
IWindowIconImpl LoadIcon(string fileName);

2
src/Avalonia.Controls/Platform/IWindowingPlatform.cs

@ -2,7 +2,7 @@ using Avalonia.Metadata;
namespace Avalonia.Platform
{
[Unstable]
[Unstable, PrivateApi]
public interface IWindowingPlatform
{
IWindowImpl CreateWindow();

Loading…
Cancel
Save