Browse Source
* Remove netstandard2.0 from almost all projects * Fix duplicated target frameworks in unit tests * Fix DesignerSupport tests * Fix Designer.HostApp packaging * Build ControlCatalog.Desktop on CI * Fix another bad auto merge * Fix LeakTests duplicated target frameworks * Don't hardcode target framework in DesignerSupportTestspull/18827/head
committed by
GitHub
62 changed files with 260 additions and 320 deletions
@ -1,22 +1,41 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
<PropertyGroup> |
<PropertyGroup> |
||||
<OutputType>Exe</OutputType> |
<OutputType>WinExe</OutputType> |
||||
<TargetFramework>net461</TargetFramework> |
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework> |
||||
<PlatformTarget>x64</PlatformTarget> |
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> |
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
||||
<ApplicationManifest>../ControlCatalog.NetCore/app.manifest</ApplicationManifest> |
|
||||
</PropertyGroup> |
</PropertyGroup> |
||||
|
|
||||
<ItemGroup> |
<ItemGroup> |
||||
<ProjectReference Include="..\ControlCatalog\ControlCatalog.csproj" /> |
<Compile Include="..\..\src\Avalonia.X11\NativeDialogs\Gtk.cs" Link="NativeControls\Gtk\Gtk.cs" /> |
||||
<ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj" /> |
<Compile Include="..\..\src\Avalonia.X11\Interop\Glib.cs" Link="NativeControls\Gtk\Glib.cs" /> |
||||
|
<Compile Include="..\..\src\Avalonia.Base\Platform\Interop\Utf8Buffer.cs" Link="NativeControls\Utf8Buffer.cs" /> |
||||
|
</ItemGroup> |
||||
|
|
||||
|
<ItemGroup> |
||||
|
<Content Include="NativeControls\Gtk\nodes.mp4"> |
||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
||||
|
</Content> |
||||
</ItemGroup> |
</ItemGroup> |
||||
|
|
||||
<ItemGroup> |
<ItemGroup> |
||||
<Compile Include="..\ControlCatalog.NetCore\NativeControls\Win\*.cs" Link="NativeControls\*" /> |
<ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Headless\Avalonia.Headless.Vnc\Avalonia.Headless.Vnc.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.Dialogs\Avalonia.Dialogs.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj" /> |
||||
|
<ProjectReference Include="..\ControlCatalog\ControlCatalog.csproj" /> |
||||
|
<ProjectReference Include="..\..\src\Avalonia.X11\Avalonia.X11.csproj" /> |
||||
|
<!-- For native controls test --> |
||||
|
<PackageReference Include="MonoMac.NetStandard" Version="0.0.4" /> |
||||
</ItemGroup> |
</ItemGroup> |
||||
|
|
||||
|
<PropertyGroup> |
||||
|
<!-- For Microsoft.CodeAnalysis --> |
||||
|
<SatelliteResourceLanguages>en</SatelliteResourceLanguages> |
||||
|
<ApplicationManifest>app.manifest</ApplicationManifest> |
||||
|
</PropertyGroup> |
||||
|
|
||||
<Import Project="..\..\build\SampleApp.props" /> |
<Import Project="..\..\build\SampleApp.props" /> |
||||
<Import Project="..\..\build\NetFX.props" /> |
<Import Project="..\..\build\ReferenceCoreLibraries.props" /> |
||||
</Project> |
</Project> |
||||
|
|||||
@ -1,7 +1,7 @@ |
|||||
using System; |
using System; |
||||
using System.Runtime.InteropServices; |
using System.Runtime.InteropServices; |
||||
|
|
||||
namespace ControlCatalog.NetCore; |
namespace ControlCatalog.Desktop; |
||||
|
|
||||
internal unsafe class WinApi |
internal unsafe class WinApi |
||||
{ |
{ |
||||
@ -1,38 +1,180 @@ |
|||||
using System; |
using System; |
||||
|
using System.Diagnostics; |
||||
|
using System.Globalization; |
||||
|
using System.Linq; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
using Avalonia; |
using Avalonia; |
||||
using Avalonia.Platform; |
using Avalonia.Controls; |
||||
using ControlCatalog.NetCore; |
using Avalonia.Controls.ApplicationLifetimes; |
||||
|
using Avalonia.Fonts.Inter; |
||||
|
using Avalonia.Headless; |
||||
|
using Avalonia.LinuxFramebuffer.Output; |
||||
|
using Avalonia.LogicalTree; |
||||
|
using Avalonia.Rendering.Composition; |
||||
|
using Avalonia.Threading; |
||||
|
using Avalonia.Vulkan; |
||||
using ControlCatalog.Pages; |
using ControlCatalog.Pages; |
||||
|
|
||||
namespace ControlCatalog |
namespace ControlCatalog.Desktop |
||||
{ |
{ |
||||
internal class Program |
static class Program |
||||
{ |
{ |
||||
|
private static bool s_useFramebuffer; |
||||
|
|
||||
[STAThread] |
[STAThread] |
||||
public static int Main(string[] args) |
static int Main(string[] args) |
||||
=> BuildAvaloniaApp().StartWithClassicDesktopLifetime(args); |
{ |
||||
|
if (args.Contains("--fbdev")) |
||||
|
{ |
||||
|
s_useFramebuffer = true; |
||||
|
} |
||||
|
|
||||
|
if (args.Contains("--wait-for-attach")) |
||||
|
{ |
||||
|
Console.WriteLine("Attach debugger and use 'Set next statement'"); |
||||
|
while (true) |
||||
|
{ |
||||
|
Thread.Sleep(100); |
||||
|
if (Debugger.IsAttached) |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
var builder = BuildAvaloniaApp(); |
||||
|
|
||||
|
double GetScaling() |
||||
|
{ |
||||
|
var idx = Array.IndexOf(args, "--scaling"); |
||||
|
if (idx != 0 && args.Length > idx + 1 && |
||||
|
double.TryParse(args[idx + 1], NumberStyles.Any, CultureInfo.InvariantCulture, out var scaling)) |
||||
|
return scaling; |
||||
|
return 1; |
||||
|
} |
||||
|
if (s_useFramebuffer) |
||||
|
{ |
||||
|
SilenceConsole(); |
||||
|
return builder.StartLinuxFbDev(args, new FbDevOutputOptions() |
||||
|
{ |
||||
|
Scaling = GetScaling() |
||||
|
}); |
||||
|
} |
||||
|
else if (args.Contains("--vnc")) |
||||
|
{ |
||||
|
return builder.StartWithHeadlessVncPlatform(null, 5901, args, ShutdownMode.OnMainWindowClose); |
||||
|
} |
||||
|
else if (args.Contains("--full-headless")) |
||||
|
{ |
||||
|
return builder |
||||
|
.UseHeadless(new AvaloniaHeadlessPlatformOptions |
||||
|
{ |
||||
|
UseHeadlessDrawing = true |
||||
|
}) |
||||
|
.AfterSetup(_ => |
||||
|
{ |
||||
|
DispatcherTimer.RunOnce(async () => |
||||
|
{ |
||||
|
var window = ((IClassicDesktopStyleApplicationLifetime)Application.Current.ApplicationLifetime) |
||||
|
.MainWindow; |
||||
|
var tc = window.GetLogicalDescendants().OfType<TabControl>().First(); |
||||
|
foreach (var page in tc.Items.Cast<TabItem>().ToList()) |
||||
|
{ |
||||
|
if (page.Header.ToString() == "DatePicker" || page.Header.ToString() == "TreeView") |
||||
|
continue; |
||||
|
Console.WriteLine("Selecting " + page.Header); |
||||
|
tc.SelectedItem = page; |
||||
|
await Task.Delay(50); |
||||
|
} |
||||
|
Console.WriteLine("Selecting the first page"); |
||||
|
tc.SelectedItem = tc.Items.OfType<object>().First(); |
||||
|
await Task.Delay(500); |
||||
|
Console.WriteLine("Clicked through all pages, triggering GC"); |
||||
|
for (var c = 0; c < 3; c++) |
||||
|
{ |
||||
|
GC.Collect(2, GCCollectionMode.Forced); |
||||
|
await Task.Delay(50); |
||||
|
} |
||||
|
|
||||
|
void FormatMem(string metric, long bytes) |
||||
|
{ |
||||
|
Console.WriteLine(metric + ": " + bytes / 1024 / 1024 + "MB"); |
||||
|
} |
||||
|
|
||||
|
FormatMem("GC allocated bytes", GC.GetTotalMemory(true)); |
||||
|
FormatMem("WorkingSet64", Process.GetCurrentProcess().WorkingSet64); |
||||
|
}, TimeSpan.FromSeconds(1)); |
||||
|
}) |
||||
|
.StartWithClassicDesktopLifetime(args); |
||||
|
} |
||||
|
else if (args.Contains("--drm")) |
||||
|
{ |
||||
|
SilenceConsole(); |
||||
|
return builder.StartLinuxDrm(args, scaling: GetScaling()); |
||||
|
} |
||||
|
else if (args.Contains("--dxgi")) |
||||
|
{ |
||||
|
builder.With(new Win32PlatformOptions() |
||||
|
{ |
||||
|
CompositionMode = new [] { Win32CompositionMode.LowLatencyDxgiSwapChain } |
||||
|
}); |
||||
|
return builder.StartWithClassicDesktopLifetime(args); |
||||
|
} |
||||
|
else |
||||
|
return builder.StartWithClassicDesktopLifetime(args); |
||||
|
} |
||||
|
|
||||
/// <summary>
|
/// <summary>
|
||||
/// This method is needed for IDE previewer infrastructure
|
/// This method is needed for IDE previewer infrastructure
|
||||
/// </summary>
|
/// </summary>
|
||||
public static AppBuilder BuildAvaloniaApp() |
public static AppBuilder BuildAvaloniaApp() |
||||
=> AppBuilder.Configure<App>() |
=> AppBuilder.Configure<App>() |
||||
.LogToTrace() |
.UsePlatformDetect() |
||||
|
.With(new X11PlatformOptions |
||||
|
{ |
||||
|
EnableMultiTouch = true, |
||||
|
UseDBusMenu = true, |
||||
|
EnableIme = true, |
||||
|
}) |
||||
|
|
||||
|
.With(new VulkanOptions |
||||
|
{ |
||||
|
VulkanInstanceCreationOptions = new () |
||||
|
{ |
||||
|
UseDebug = true |
||||
|
} |
||||
|
}) |
||||
|
.With(new CompositionOptions() |
||||
|
{ |
||||
|
UseRegionDirtyRectClipping = true |
||||
|
}) |
||||
|
.UseSkia() |
||||
|
.WithInterFont() |
||||
.AfterSetup(builder => |
.AfterSetup(builder => |
||||
|
{ |
||||
|
if (!s_useFramebuffer) |
||||
{ |
{ |
||||
builder.Instance!.AttachDevTools(new Avalonia.Diagnostics.DevToolsOptions() |
builder.Instance!.AttachDevTools(new Avalonia.Diagnostics.DevToolsOptions() |
||||
{ |
{ |
||||
StartupScreenIndex = 1, |
StartupScreenIndex = 1, |
||||
}); |
}); |
||||
|
} |
||||
|
|
||||
EmbedSample.Implementation = new EmbedSampleWin(); |
EmbedSample.Implementation = OperatingSystem.IsWindows() ? (INativeDemoControl)new EmbedSampleWin() |
||||
|
: OperatingSystem.IsMacOS() ? new EmbedSampleMac() |
||||
|
: OperatingSystem.IsLinux() ? new EmbedSampleGtk() |
||||
|
: null; |
||||
}) |
}) |
||||
.UseWin32() |
.LogToTrace(); |
||||
.UseSkia(); |
|
||||
|
|
||||
private static void ConfigureAssetAssembly(AppBuilder builder) |
static void SilenceConsole() |
||||
|
{ |
||||
|
new Thread(() => |
||||
{ |
{ |
||||
AssetLoader.SetDefaultAssembly(typeof(App).Assembly); |
Console.CursorVisible = false; |
||||
|
while (true) |
||||
|
Console.ReadKey(true); |
||||
|
}) |
||||
|
{ IsBackground = true }.Start(); |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|||||
@ -1,6 +1,6 @@ |
|||||
{ |
{ |
||||
"profiles": { |
"profiles": { |
||||
"ControlCatalog.NetCore": { |
"ControlCatalog.Desktop": { |
||||
"commandName": "Project" |
"commandName": "Project" |
||||
}, |
}, |
||||
"Dxgi": { |
"Dxgi": { |
||||
@ -1,41 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<OutputType>WinExe</OutputType> |
|
||||
<TargetFramework>$(AvsCurrentTargetFramework)</TargetFramework> |
|
||||
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> |
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<Compile Include="..\..\src\Avalonia.X11\NativeDialogs\Gtk.cs" Link="NativeControls\Gtk\Gtk.cs" /> |
|
||||
<Compile Include="..\..\src\Avalonia.X11\Interop\Glib.cs" Link="NativeControls\Gtk\Glib.cs" /> |
|
||||
<Compile Include="..\..\src\Avalonia.Base\Platform\Interop\Utf8Buffer.cs" Link="NativeControls\Utf8Buffer.cs" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<Content Include="NativeControls\Gtk\nodes.mp4"> |
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
|
||||
</Content> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj" /> |
|
||||
<ProjectReference Include="..\..\src\Headless\Avalonia.Headless.Vnc\Avalonia.Headless.Vnc.csproj" /> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.Dialogs\Avalonia.Dialogs.csproj" /> |
|
||||
<ProjectReference Include="..\..\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj" /> |
|
||||
<ProjectReference Include="..\ControlCatalog\ControlCatalog.csproj" /> |
|
||||
<ProjectReference Include="..\..\src\Avalonia.X11\Avalonia.X11.csproj" /> |
|
||||
<!-- For native controls test --> |
|
||||
<PackageReference Include="MonoMac.NetStandard" Version="0.0.4" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<!-- For Microsoft.CodeAnalysis --> |
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages> |
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<Import Project="..\..\build\SampleApp.props" /> |
|
||||
<Import Project="..\..\build\ReferenceCoreLibraries.props" /> |
|
||||
</Project> |
|
||||
@ -1,180 +0,0 @@ |
|||||
using System; |
|
||||
using System.Diagnostics; |
|
||||
using System.Globalization; |
|
||||
using System.Linq; |
|
||||
using System.Threading; |
|
||||
using System.Threading.Tasks; |
|
||||
using Avalonia; |
|
||||
using Avalonia.Controls; |
|
||||
using Avalonia.Controls.ApplicationLifetimes; |
|
||||
using Avalonia.Fonts.Inter; |
|
||||
using Avalonia.Headless; |
|
||||
using Avalonia.LinuxFramebuffer.Output; |
|
||||
using Avalonia.LogicalTree; |
|
||||
using Avalonia.Rendering.Composition; |
|
||||
using Avalonia.Threading; |
|
||||
using Avalonia.Vulkan; |
|
||||
using ControlCatalog.Pages; |
|
||||
|
|
||||
namespace ControlCatalog.NetCore |
|
||||
{ |
|
||||
static class Program |
|
||||
{ |
|
||||
private static bool s_useFramebuffer; |
|
||||
|
|
||||
[STAThread] |
|
||||
static int Main(string[] args) |
|
||||
{ |
|
||||
if (args.Contains("--fbdev")) |
|
||||
{ |
|
||||
s_useFramebuffer = true; |
|
||||
} |
|
||||
|
|
||||
if (args.Contains("--wait-for-attach")) |
|
||||
{ |
|
||||
Console.WriteLine("Attach debugger and use 'Set next statement'"); |
|
||||
while (true) |
|
||||
{ |
|
||||
Thread.Sleep(100); |
|
||||
if (Debugger.IsAttached) |
|
||||
break; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
var builder = BuildAvaloniaApp(); |
|
||||
|
|
||||
double GetScaling() |
|
||||
{ |
|
||||
var idx = Array.IndexOf(args, "--scaling"); |
|
||||
if (idx != 0 && args.Length > idx + 1 && |
|
||||
double.TryParse(args[idx + 1], NumberStyles.Any, CultureInfo.InvariantCulture, out var scaling)) |
|
||||
return scaling; |
|
||||
return 1; |
|
||||
} |
|
||||
if (s_useFramebuffer) |
|
||||
{ |
|
||||
SilenceConsole(); |
|
||||
return builder.StartLinuxFbDev(args, new FbDevOutputOptions() |
|
||||
{ |
|
||||
Scaling = GetScaling() |
|
||||
}); |
|
||||
} |
|
||||
else if (args.Contains("--vnc")) |
|
||||
{ |
|
||||
return builder.StartWithHeadlessVncPlatform(null, 5901, args, ShutdownMode.OnMainWindowClose); |
|
||||
} |
|
||||
else if (args.Contains("--full-headless")) |
|
||||
{ |
|
||||
return builder |
|
||||
.UseHeadless(new AvaloniaHeadlessPlatformOptions |
|
||||
{ |
|
||||
UseHeadlessDrawing = true |
|
||||
}) |
|
||||
.AfterSetup(_ => |
|
||||
{ |
|
||||
DispatcherTimer.RunOnce(async () => |
|
||||
{ |
|
||||
var window = ((IClassicDesktopStyleApplicationLifetime)Application.Current.ApplicationLifetime) |
|
||||
.MainWindow; |
|
||||
var tc = window.GetLogicalDescendants().OfType<TabControl>().First(); |
|
||||
foreach (var page in tc.Items.Cast<TabItem>().ToList()) |
|
||||
{ |
|
||||
if (page.Header.ToString() == "DatePicker" || page.Header.ToString() == "TreeView") |
|
||||
continue; |
|
||||
Console.WriteLine("Selecting " + page.Header); |
|
||||
tc.SelectedItem = page; |
|
||||
await Task.Delay(50); |
|
||||
} |
|
||||
Console.WriteLine("Selecting the first page"); |
|
||||
tc.SelectedItem = tc.Items.OfType<object>().First(); |
|
||||
await Task.Delay(500); |
|
||||
Console.WriteLine("Clicked through all pages, triggering GC"); |
|
||||
for (var c = 0; c < 3; c++) |
|
||||
{ |
|
||||
GC.Collect(2, GCCollectionMode.Forced); |
|
||||
await Task.Delay(50); |
|
||||
} |
|
||||
|
|
||||
void FormatMem(string metric, long bytes) |
|
||||
{ |
|
||||
Console.WriteLine(metric + ": " + bytes / 1024 / 1024 + "MB"); |
|
||||
} |
|
||||
|
|
||||
FormatMem("GC allocated bytes", GC.GetTotalMemory(true)); |
|
||||
FormatMem("WorkingSet64", Process.GetCurrentProcess().WorkingSet64); |
|
||||
}, TimeSpan.FromSeconds(1)); |
|
||||
}) |
|
||||
.StartWithClassicDesktopLifetime(args); |
|
||||
} |
|
||||
else if (args.Contains("--drm")) |
|
||||
{ |
|
||||
SilenceConsole(); |
|
||||
return builder.StartLinuxDrm(args, scaling: GetScaling()); |
|
||||
} |
|
||||
else if (args.Contains("--dxgi")) |
|
||||
{ |
|
||||
builder.With(new Win32PlatformOptions() |
|
||||
{ |
|
||||
CompositionMode = new [] { Win32CompositionMode.LowLatencyDxgiSwapChain } |
|
||||
}); |
|
||||
return builder.StartWithClassicDesktopLifetime(args); |
|
||||
} |
|
||||
else |
|
||||
return builder.StartWithClassicDesktopLifetime(args); |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// This method is needed for IDE previewer infrastructure
|
|
||||
/// </summary>
|
|
||||
public static AppBuilder BuildAvaloniaApp() |
|
||||
=> AppBuilder.Configure<App>() |
|
||||
.UsePlatformDetect() |
|
||||
.With(new X11PlatformOptions |
|
||||
{ |
|
||||
EnableMultiTouch = true, |
|
||||
UseDBusMenu = true, |
|
||||
EnableIme = true, |
|
||||
}) |
|
||||
|
|
||||
.With(new VulkanOptions |
|
||||
{ |
|
||||
VulkanInstanceCreationOptions = new () |
|
||||
{ |
|
||||
UseDebug = true |
|
||||
} |
|
||||
}) |
|
||||
.With(new CompositionOptions() |
|
||||
{ |
|
||||
UseRegionDirtyRectClipping = true |
|
||||
}) |
|
||||
.UseSkia() |
|
||||
.WithInterFont() |
|
||||
.AfterSetup(builder => |
|
||||
{ |
|
||||
if (!s_useFramebuffer) |
|
||||
{ |
|
||||
builder.Instance!.AttachDevTools(new Avalonia.Diagnostics.DevToolsOptions() |
|
||||
{ |
|
||||
StartupScreenIndex = 1, |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
EmbedSample.Implementation = OperatingSystem.IsWindows() ? (INativeDemoControl)new EmbedSampleWin() |
|
||||
: OperatingSystem.IsMacOS() ? new EmbedSampleMac() |
|
||||
: OperatingSystem.IsLinux() ? new EmbedSampleGtk() |
|
||||
: null; |
|
||||
}) |
|
||||
.LogToTrace(); |
|
||||
|
|
||||
static void SilenceConsole() |
|
||||
{ |
|
||||
new Thread(() => |
|
||||
{ |
|
||||
Console.CursorVisible = false; |
|
||||
while (true) |
|
||||
Console.ReadKey(true); |
|
||||
}) |
|
||||
{ IsBackground = true }.Start(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue