Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>preview</LangVersion>
<NoWarn>$(NoWarn);MAUIAI0001</NoWarn>
<MauiXamlInflator>SourceGen</MauiXamlInflator>
<!-- Disable multi-RID builds to workaround a parallel build issue -->
<RuntimeIdentifier Condition="$(TargetFramework.Contains('-maccatalyst'))">maccatalyst-x64</RuntimeIdentifier>
Expand Down
24 changes: 24 additions & 0 deletions src/AI/src/Essentials.AI/DiagnosticIds.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace Microsoft.Maui.Essentials.AI;

/// <summary>
/// Diagnostic IDs for the Microsoft.Maui.Essentials.AI package.
/// </summary>
internal static class DiagnosticIds
{
/// <summary>
/// Experimental API diagnostic IDs.
/// </summary>
/// <remarks>
/// All Essentials.AI experiments share a single diagnostic ID so consumers
/// only need one suppression to opt in: <c>&lt;NoWarn&gt;MAUIAI0001&lt;/NoWarn&gt;</c>.
/// Individual constants exist per feature area so that APIs can be graduated
/// to stable independently in the future by assigning distinct IDs.
/// </remarks>
internal static class Experiments
{
internal const string EssentialsAI = "MAUIAI0001";
}
}
9 changes: 8 additions & 1 deletion src/AI/src/Essentials.AI/Essentials.AI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,15 @@
</PropertyGroup>
<PropertyGroup>
<!-- NuGet package information -->
<IsPackable>false</IsPackable>
<IsPackable>true</IsPackable>
<PackageId>Microsoft.Maui.Essentials.AI</PackageId>
<!-- Keep this package always preview — it is experimental and should not ship stable
even when the rest of the repo stabilizes. Bump PreReleaseVersionIteration for new previews.
The label/iteration only activate during stable builds (DotNetFinalVersionKind=release).
During preview builds, the AI package uses the same label as the rest of the repo. -->
<SuppressFinalPackageVersion>true</SuppressFinalPackageVersion>
<PreReleaseVersionLabel Condition="'$(DotNetFinalVersionKind)' == 'release'">preview</PreReleaseVersionLabel>
<PreReleaseVersionIteration Condition="'$(DotNetFinalVersionKind)' == 'release'">1</PreReleaseVersionIteration>
<PackageTags>$(DefaultPackageTags);essentials;ai</PackageTags>
<Description>.NET Multi-platform App UI (.NET MAUI) is a cross-platform framework for creating native mobile and desktop apps with C# and XAML. This package contains a collection of cross-platform APIs for working with device AI and local models.</Description>
</PropertyGroup>
Expand Down
46 changes: 46 additions & 0 deletions src/AI/src/Essentials.AI/Polyfills/ExperimentalAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#if !NET8_0_OR_GREATER

namespace System.Diagnostics.CodeAnalysis;

/// <summary>
/// Indicates that an API element is experimental and subject to change without notice.
/// </summary>
[AttributeUsage(
AttributeTargets.Class |
AttributeTargets.Struct |
AttributeTargets.Enum |
AttributeTargets.Interface |
AttributeTargets.Delegate |
AttributeTargets.Method |
AttributeTargets.Constructor |
AttributeTargets.Property |
AttributeTargets.Field |
AttributeTargets.Event |
AttributeTargets.Assembly)]
internal sealed class ExperimentalAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="ExperimentalAttribute"/> class.
/// </summary>
/// <param name="diagnosticId">The diagnostic ID associated with this experimental API.</param>
public ExperimentalAttribute(string diagnosticId)
{
DiagnosticId = diagnosticId;
}

/// <summary>
/// Gets the ID that the compiler will use when reporting a use of the API the attribute applies to.
/// </summary>
public string DiagnosticId { get; }

/// <summary>
/// Gets or sets the URL for corresponding documentation.
/// The API accepts a format string instead of an actual URL, creating a generic URL that includes the diagnostic ID.
/// </summary>
public string? UrlFormat { get; set; }
}

#endif
7 changes: 7 additions & 0 deletions src/AI/src/Essentials.AI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;
using Microsoft.Maui.Essentials.AI;

[assembly: Experimental(DiagnosticIds.Experiments.EssentialsAI)]
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<AssemblyName>Essentials.AI.Benchmarks</AssemblyName>
<RootNamespace>Microsoft.Maui.Essentials.AI.Benchmarks</RootNamespace>
<IsPackable>false</IsPackable>
<NoWarn>$(NoWarn);MAUIAI0001</NoWarn>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<ExcludeMicrosoftNetTestSdk>true</ExcludeMicrosoftNetTestSdk>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<NoWarn>$(NoWarn);MAUIAI0001</NoWarn>
<UserSecretsId>808cc184-141a-409e-addd-565c973dbce6</UserSecretsId>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<RootNamespace>Microsoft.Maui.Essentials.AI.UnitTests</RootNamespace>
<IsPackable>false</IsPackable>
<MauiTestProject>true</MauiTestProject>
<NoWarn>$(NoWarn);MAUIAI0001</NoWarn>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Loading