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

[WIP] Upgrade to Avalonia 11.0 + add Browser project #645

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft
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
12 changes: 12 additions & 0 deletions MSBuildStructuredLog.Avalonia.sln
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TaskRunner", "src\TaskRunne
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StructuredLogViewer.Core", "src\StructuredLogViewer.Core\StructuredLogViewer.Core.csproj", "{3C655C5D-22C3-4B8D-969C-3FC497294703}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructuredLogViewer.Avalonia.Desktop", "src\StructuredLogViewer.Avalonia.Desktop\StructuredLogViewer.Avalonia.Desktop.csproj", "{4143B4F2-1FC3-469C-A91C-2721705820AC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructuredLogViewer.Avalonia.Browser", "src\StructuredLogViewer.Avalonia.Browser\StructuredLogViewer.Avalonia.Browser.csproj", "{95215092-37BB-4ED1-91D4-A96535508C12}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Mixed Platforms = Debug|Mixed Platforms
Expand All @@ -48,6 +52,14 @@ Global
{B8DB3798-1636-417D-B57A-25C51C574F1E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{B8DB3798-1636-417D-B57A-25C51C574F1E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{B8DB3798-1636-417D-B57A-25C51C574F1E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{4143B4F2-1FC3-469C-A91C-2721705820AC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{4143B4F2-1FC3-469C-A91C-2721705820AC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{4143B4F2-1FC3-469C-A91C-2721705820AC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{4143B4F2-1FC3-469C-A91C-2721705820AC}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{95215092-37BB-4ED1-91D4-A96535508C12}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{95215092-37BB-4ED1-91D4-A96535508C12}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{95215092-37BB-4ED1-91D4-A96535508C12}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{95215092-37BB-4ED1-91D4-A96535508C12}.Release|Mixed Platforms.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
12 changes: 12 additions & 0 deletions MSBuildStructuredLog.sln
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ResourcesGenerator", "src\R
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BinlogTool", "src\BinlogTool\BinlogTool.csproj", "{35F44EA6-7259-43CC-8C17-E058F3EB86D3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructuredLogViewer.Avalonia.Desktop", "src\StructuredLogViewer.Avalonia.Desktop\StructuredLogViewer.Avalonia.Desktop.csproj", "{BA82B344-6C38-4449-A318-BF1AEF33D7D8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StructuredLogViewer.Avalonia.Browser", "src\StructuredLogViewer.Avalonia.Browser\StructuredLogViewer.Avalonia.Browser.csproj", "{E16075FD-60E4-430B-BBCF-61692C6A3157}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Mixed Platforms = Debug|Mixed Platforms
Expand Down Expand Up @@ -66,6 +70,14 @@ Global
{35F44EA6-7259-43CC-8C17-E058F3EB86D3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{35F44EA6-7259-43CC-8C17-E058F3EB86D3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{35F44EA6-7259-43CC-8C17-E058F3EB86D3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{BA82B344-6C38-4449-A318-BF1AEF33D7D8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{BA82B344-6C38-4449-A318-BF1AEF33D7D8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{BA82B344-6C38-4449-A318-BF1AEF33D7D8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{BA82B344-6C38-4449-A318-BF1AEF33D7D8}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{E16075FD-60E4-430B-BBCF-61692C6A3157}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{E16075FD-60E4-430B-BBCF-61692C6A3157}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{E16075FD-60E4-430B-BBCF-61692C6A3157}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{E16075FD-60E4-430B-BBCF-61692C6A3157}.Release|Mixed Platforms.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
6 changes: 4 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ install:
- choco upgrade chocolatey # Need at least 0.10.8 to avoid packaging error
- dotnet tool install --global Cake.Tool --version 1.0.0
- ps: Invoke-WebRequest -Uri 'https://dot.net/v1/dotnet-install.ps1' -UseBasicParsing -OutFile "$env:temp\dotnet-install.ps1"
- ps: '& $env:temp\dotnet-install.ps1 -Version "6.0.303"'
build_script:
- ps: '& $env:temp\dotnet-install.ps1 -Version "7.0.0"'
build_script:
- cmd: >-
dotnet workload restore

dotnet msbuild /r /m /p:Configuration=Release /clp:v=m MSBuildStructuredLog.sln /bl /logger:"C:\Program Files\AppVeyor\BuildAgent\dotnetcore\Appveyor.MSBuildLogger.dll"

dotnet cake ./build-macos.cake --settings_skippackageversioncheck=true
Expand Down
52 changes: 52 additions & 0 deletions src/StructuredLogViewer.Avalonia.Browser/AppBundle/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/* HTML styles for the splash screen */

.highlight {
color: white;
font-size: 2.5rem;
display: block;
}

.purple {
color: #8b44ac;
}

#avalonia-splash a {
color: whitesmoke;
text-decoration: none;
}

.center {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}

#avalonia-splash {
position: relative;
height: 100%;
width: 100%;
color: whitesmoke;
background-color: #1b2a4e;
font-family: 'Nunito', sans-serif;
background-position: center;
background-size: cover;
background-repeat: no-repeat;
justify-content: center;
align-items: center;
}

.splash-close {
animation: fadeout 0.25s linear forwards;
}

@keyframes fadeout {
0% {
opacity: 100%;
}

100% {
opacity: 0;
visibility: collapse;
}
}
Binary file not shown.
30 changes: 30 additions & 0 deletions src/StructuredLogViewer.Avalonia.Browser/AppBundle/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>

<head>
<title>StructuredLogViewer</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="/" />
<link rel="modulepreload" href="./main.js" />
<link rel="modulepreload" href="./dotnet.js" />
<link rel="modulepreload" href="./avalonia.js" />
<link rel="stylesheet" href="./app.css" />
<link rel="preconnect" href="https://fonts.googleapis.com">
</head>

<body style="margin: 0px; overflow: hidden">
<div id="out">
<div id="avalonia-splash">
<div class="center">
<h2 class="purple">
Powered by
<a class="highlight" href="https://www.avaloniaui.net/" target="_blank">Avalonia UI</a>
</h2>
</div>
</div>
</div>
<script type='module' src="./main.js"></script>
</body>

</html>
16 changes: 16 additions & 0 deletions src/StructuredLogViewer.Avalonia.Browser/AppBundle/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { dotnet } from './dotnet.js'
import { registerAvaloniaModule } from './avalonia.js';

const is_browser = typeof window != "undefined";
if (!is_browser) throw new Error(`Expected to be running in a browser`);

const dotnetRuntime = await dotnet
.withDiagnosticTracing(false)
.withApplicationArgumentsFromQuery()
.create();

await registerAvaloniaModule(dotnetRuntime);

const config = dotnetRuntime.getConfig();

await dotnetRuntime.runMainAndExit(config.mainAssemblyName, [window.location.search]);
15 changes: 15 additions & 0 deletions src/StructuredLogViewer.Avalonia.Browser/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Runtime.Versioning;
using Avalonia;
using Avalonia.Browser;
using StructuredLogViewer.Avalonia;

[assembly: SupportedOSPlatform("browser")]

internal partial class Program
{
private static void Main(string[] args) => BuildAvaloniaApp()
.SetupBrowserApp("out");

public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
<WasmMainJSPath>AppBundle\main.js</WasmMainJSPath>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
<WasmExtraFilesToDeploy Include="AppBundle\**" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Browser" Version="11.0-preview5" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\StructuredLogViewer.Avalonia\StructuredLogViewer.Avalonia.csproj" />
</ItemGroup>

<ItemGroup>
<AvaloniaResource Include="AppBundle\favicon.ico" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"wasmHostProperties": {
"perHostConfig": [
{
"name": "browser",
"html-path": "index.html",
"Host": "browser"
}
]
}
}
20 changes: 20 additions & 0 deletions src/StructuredLogViewer.Avalonia.Desktop/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Avalonia;
using System;

namespace StructuredLogViewer.Avalonia.Desktop;

class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
public static void Main(string[] args) => BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);

// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.LogToTrace();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<RuntimeIdentifiers>win7-x64;ubuntu.14.04-x64;osx.10.12-x64;osx-arm64</RuntimeIdentifiers>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationIcon>StructuredLogger.ico</ApplicationIcon>
<PublishAot>true</PublishAot>
</PropertyGroup>

<ItemGroup Condition="$(NETCoreSdkRuntimeIdentifier.StartsWith('osx'))">
<Content Include="StructuredLogViewer.icns">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Info.plist">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<PropertyGroup Condition="$(NETCoreSdkRuntimeIdentifier.StartsWith('win'))">
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="11.0-preview5" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\StructuredLogViewer.Avalonia\StructuredLogViewer.Avalonia.csproj" />
</ItemGroup>
</Project>
Binary file not shown.
18 changes: 18 additions & 0 deletions src/StructuredLogViewer.Avalonia.Desktop/app.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- This manifest is used on Windows only.
Don't remove it as it might cause problems with window transparency and embeded controls.
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
<assemblyIdentity version="1.0.0.0" name="StructuredLogViewer"/>

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on
and is designed to work with. Uncomment the appropriate elements
and Windows will automatically select the most compatible environment. -->

<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
</assembly>
34 changes: 17 additions & 17 deletions src/StructuredLogViewer.Avalonia/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
xmlns:l="clr-namespace:Microsoft.Build.Logging.StructuredLogger;assembly=StructuredLogger"
xmlns:common="clr-namespace:Microsoft.Build.Logging.StructuredLogger;assembly=StructuredLogViewer.Core"
xmlns:s="clr-namespace:StructuredLogViewer.Avalonia.Controls;assembly=StructuredLogViewer.Avalonia"
x:Class="StructuredLogViewer.Avalonia.App">
x:Class="StructuredLogViewer.Avalonia.App"
RequestedThemeVariant="Light">

<Application.Resources>
<ResourceDictionary>
Expand All @@ -16,13 +17,12 @@
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>

<Application.Styles>
<StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml" />
<StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseLight.xaml"/>
<SimpleTheme />
<StyleInclude Source="avares://AvaloniaEdit/AvaloniaEdit.xaml" />
<StyleInclude Source="/Styles.xaml" />

<Style Selector="Rectangle.nodeIcon">
<Setter Property="Width" Value="14" />
<Setter Property="Height" Value="12" />
Expand Down Expand Up @@ -214,27 +214,27 @@
Text="{Binding ShortenedValue}" />
</StackPanel>
</DataTemplate>

<TreeDataTemplate DataType="{x:Type l:EvaluationProfileEntry}"
ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal">
<ProgressBar Width="40"
Height="9"
Margin="2,1,6,0"
<ProgressBar Width="40"
Height="9"
Margin="2,1,6,0"
Minimum="0"
Maximum="100"
Value="{Binding Value}"
VerticalAlignment="Center" />
<TextBlock Name="label"
<TextBlock Name="label"
VerticalAlignment="Center"
Text="{Binding Title, Mode=OneTime}" />
<TextBlock Name="hits"
<TextBlock Name="hits"
VerticalAlignment="Center"
Margin="6,0,0,0"
Text="{Binding DurationText, Mode=OneTime}"
Foreground="{Binding IsSelected, Converter={StaticResource LabelColorConverter}, ConverterParameter={x:Static Brushes.Blue}}" />
<TextBlock Name="code"
Text="{Binding ShortenedElementDescription}"
Text="{Binding ShortenedElementDescription}"
VerticalAlignment="Center"
Margin="12,0,0,0"
FontFamily="Consolas"
Expand Down Expand Up @@ -283,7 +283,7 @@
Opacity="{Binding IsLowRelevance, Converter={StaticResource RelevanceConverter}}" />
</StackPanel>
</DataTemplate>

<TreeDataTemplate DataType="{x:Type l:Import}"
ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal"
Expand Down Expand Up @@ -342,7 +342,7 @@
Foreground="{Binding IsSelected, Converter={StaticResource LabelColorConverter}, ConverterParameter={x:Static Brushes.DarkGoldenrod}}" />
</StackPanel>
</TreeDataTemplate>

<DataTemplate DataType="{x:Type common:ButtonNode}">
<StackPanel Orientation="Horizontal">
<Button x:Name="button"
Expand All @@ -352,7 +352,7 @@
Padding="4,2,4,2" />
</StackPanel>
</DataTemplate>

<DataTemplate DataType="{x:Type l:Error}">
<StackPanel Orientation="Horizontal">
<Rectangle Name="icon"
Expand Down Expand Up @@ -585,11 +585,11 @@
ToolTip.Tip="Disable virtualization if you're experiencing hangs or deadlocks when scrolling the tree" />
<!--<CheckBox Content="Display all targets directly under the project (flattened in temporal order)"
Margin="10,0,10,10"
IsChecked="{Binding ParentAllTargetsUnderProject}"
IsChecked="{Binding ParentAllTargetsUnderProject}"
ToolTip.Tip="Linearize/flatten all targets under the project instead of parenting targets under their dependency target"/>-->
<CheckBox Content="Mark search results with a dot in the main tree"
Margin="10,0,10,10"
IsChecked="{Binding MarkResultsInTree}"
IsChecked="{Binding MarkResultsInTree}"
ToolTip.Tip="Mark tree nodes that appear in search results with a dot"/>
</StackPanel>
</Grid>
Expand Down
Loading