Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prism Avalonia Toolkit #193

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Replaced with NotifyableAttribute with CodeGenerator skeleton
DamianSuess committed Aug 18, 2024
commit d5988a5985bbccae97cf1984fa814b013e0c0628
3 changes: 3 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -27,6 +27,9 @@
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" />
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.6.133" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.11.0" />
</ItemGroup>
<!-- Tests -->
<ItemGroup>
10 changes: 0 additions & 10 deletions src/Prism.Avalonia.Toolkit/Attributes/NotifyableAttribute.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;

namespace Prism.Avalonia.Toolkit;

/// <summary>NotifyableGenerator.</summary>
public partial class NotifyableGenerator
{
private const string GeneratedCode = "global::System.CodeDom.Compiler.GeneratedCode";
private const string ExcludeFromCodeCoverage = "global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage";

internal static class Execute
{
}
}
27 changes: 27 additions & 0 deletions src/Prism.Avalonia.Toolkit/Notifyable/NotifyableGenerator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Text;
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;

namespace Prism.Avalonia.Toolkit;

/// <summary>Source generator for notifiable property.</summary>
[Generator(LanguageNames.CSharp)]
public partial class NotifyableGenerator
{
private const string NotifyableAttribute = "Prism.Avalonia.Generators.NotifyableAttribute";

/// <inheritdoc/>
public void Initialize(IncrementalGeneratorInitializationContext context)
{
context.RegisterPostInitializationOutput(callback =>
callback.AddSource($"{NotifyableAttribute}.g.cs", SourceText.From(AttributeDefinitions.NotifyableAttribute, Encoding.UTF8)));
}
}
18 changes: 15 additions & 3 deletions src/Prism.Avalonia.Toolkit/Prism.Avalonia.Toolkit.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="../../build/AvaloniaDependency.props" />
<Import Project="../../build/Library.props" />

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Description>This extension is used to build Prism.Avalonia applications based on DryIoc. Users must install the Prism.Avalonia NuGet package as well.</Description>
<Description>
Prism.Avalonia.Generators is source code generator so you can quickly and easily design and build rich, flexible, and easy to maintain cross-platform Avalonia desktop applications with less code.
Users must install the Prism.Avalonia NuGet package as well.
</Description>
<Authors>Damian Suess</Authors>
<Copyright>Copyright (c) 2024 Avalonia Community</Copyright>
<Title>Prism.Avalonia.Toolkit</Title>
@@ -27,4 +30,13 @@
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" />
</ItemGroup>

</Project>