-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/project-source-scanning
- Loading branch information
Showing
32 changed files
with
623 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...iveUI.Avalonia.ViewToViewModelBindings/ReactiveUI.Avalonia.ViewToViewModelBindings.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net8.0-windows10.0.19041</TargetFramework> | ||
<LangVersion>9</LangVersion> | ||
<DebugType>full</DebugType> | ||
<DebugSymbols>True</DebugSymbols> | ||
<!-- | ||
If you're seeing CS8032 warnings, it can be because the upstream source generator dll has been rebuilt or you've changed the | ||
target frameworks in this project. Visual Studio seems to have a cache that invalidates. Reloading Visual Studio can | ||
solve the issue. | ||
--> | ||
<!--<WarningsAsErrors>8032,8785</WarningsAsErrors>--> | ||
<TreatWarningsAsErrors /> | ||
<IsPackable>False</IsPackable> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.10" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Vetuviem.Avalonia.SourceGenerator\Vetuviem.Avalonia.SourceGenerator.csproj" OutputItemType="Analyzer" /> | ||
<ProjectReference Include="..\Vetuviem.Core\Vetuviem.Core.csproj" /> | ||
</ItemGroup> | ||
|
||
<Import Project="..\Vetuviem.SourceGenerator\Vetuviem-SourceGenerator.props" /> | ||
<PropertyGroup> | ||
<Vetuviem_Make_Classes_Public>true</Vetuviem_Make_Classes_Public> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/Vetuviem.Avalonia.SourceGenerator/AvaloniaControlBindingModelSourceGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) 2022 DPVreony and Contributors. All rights reserved. | ||
// DPVreony and Contributors licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for full license information. | ||
|
||
using Microsoft.CodeAnalysis; | ||
using Vetuviem.SourceGenerator; | ||
using Vetuviem.SourceGenerator.Features.Core; | ||
|
||
namespace Vetuviem.Avalonia.SourceGenerator | ||
{ | ||
/// <summary> | ||
/// Control Binding Model Source Generator for Blazor. | ||
/// </summary> | ||
[Generator] | ||
public sealed class AvaloniaControlBindingModelSourceGenerator : AbstractControlBindingModelSourceGenerator | ||
{ | ||
/// <inheritdoc /> | ||
protected override MetadataReference? CheckIfShouldAddMissingAssemblyReference(string assemblyOfInterest) | ||
{ | ||
return null; | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override IPlatformResolver GetPlatformResolver() | ||
{ | ||
return new AvaloniaPlatformResolver(); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override string GetPlatformName() | ||
{ | ||
return "Avalonia"; | ||
} | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
src/Vetuviem.Avalonia.SourceGenerator/AvaloniaPlatformResolver.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (c) 2022 DPVreony and Contributors. All rights reserved. | ||
// DPVreony and Contributors licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for full license information. | ||
|
||
using Vetuviem.SourceGenerator.Features.Core; | ||
|
||
namespace Vetuviem.Avalonia.SourceGenerator | ||
{ | ||
/// <summary> | ||
/// UI Platform resolver for Blazor. | ||
/// </summary> | ||
public sealed class AvaloniaPlatformResolver : IPlatformResolver | ||
{ | ||
/// <inheritdoc /> | ||
public string[] GetAssemblyNames() | ||
{ | ||
return new[] | ||
{ | ||
"Avalonia.Base.dll", | ||
"Avalonia.Controls.dll", | ||
"Avalonia.ReactiveUI.dll" | ||
}; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public string GetBaseUiElement() | ||
{ | ||
return "global::Avalonia.Visual"; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public string? GetCommandSourceInterface() | ||
{ | ||
return "global::Avalonia.Input.ICommandSource"; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public string GetCommandInterface() | ||
{ | ||
return "global::Avalonia.Input.ICommand"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
src/Vetuviem.IntegrationTests/ReactiveUI/Avalonia/AvaloniaViewBindingModelGeneratorTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// Copyright (c) 2022 DPVreony and Contributors. All rights reserved. | ||
// DPVreony and Contributors licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using Microsoft.CodeAnalysis; | ||
using Microsoft.CodeAnalysis.Diagnostics; | ||
using Vetuviem.Avalonia.SourceGenerator; | ||
using Vetuviem.SourceGenerator.Features.ControlBindingModels; | ||
using Vetuviem.Testing; | ||
using Vetuviem.Winforms.SourceGenerator; | ||
using Xunit.Abstractions; | ||
|
||
namespace Vetuviem.IntegrationTests.ReactiveUI.Avalonia | ||
{ | ||
/// <summary> | ||
/// Unit Tests for the ViewBinding Model Source Generator. | ||
/// </summary> | ||
public static class AvaloniaViewBindingModelGeneratorTests | ||
{ | ||
/// <inheritdoc /> | ||
public sealed class ExecuteMethod : BaseGeneratorTests.BaseExecuteMethod<AvaloniaControlBindingModelSourceGenerator, ControlBindingModelGeneratorProcessor> | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ExecuteMethod"/> class. | ||
/// </summary> | ||
/// <param name="output">Test Output Helper.</param> | ||
public ExecuteMethod(ITestOutputHelper output) | ||
: base(output) | ||
{ | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override AnalyzerConfigOptionsProvider? GetAnalyzerConfigOptionsProvider() | ||
{ | ||
return null; | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void AddReferenceAssemblies(IList<MetadataReference> metadataReferences) | ||
{ | ||
if (metadataReferences == null) | ||
{ | ||
throw new ArgumentNullException(nameof(metadataReferences)); | ||
} | ||
|
||
var trustedAssembliesPaths = GetPlatformAssemblyPaths(); | ||
if (trustedAssembliesPaths == null) | ||
{ | ||
return; | ||
} | ||
|
||
foreach (string trustedAssembliesPath in trustedAssembliesPaths) | ||
{ | ||
var metadataReference = MetadataReference.CreateFromFile(trustedAssembliesPath); | ||
metadataReferences.Add(metadataReference); | ||
} | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override Func<AvaloniaControlBindingModelSourceGenerator> GetFactory() | ||
{ | ||
return () => new AvaloniaControlBindingModelSourceGenerator(); | ||
} | ||
|
||
private static string[]? GetPlatformAssemblyPaths() | ||
{ | ||
if (AppContext.GetData("TRUSTED_PLATFORM_ASSEMBLIES") is string trustedPlatformAssemblies) | ||
{ | ||
return trustedPlatformAssemblies.Split(Path.PathSeparator); | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/Vetuviem.IntegrationTests/ReactiveUI/WPF/MahAppsMetroViewBindingModelGeneratorTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Vetuviem.IntegrationTests/ReactiveUI/Winforms/WinformsViewBindingModelGeneratorTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.