Skip to content
Closed
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
55 changes: 55 additions & 0 deletions build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,58 @@ dotnet publish -c Release -r $RUNTIME_IDENTIFIER -o $DESTINATION_FOLDER src/Sour
```
> [!NOTE]
> Please replace the `$RUNTIME_IDENTIFIER` with one of `win-x64`,`win-arm64`,`linux-x64`,`linux-arm64`,`osx-x64`,`osx-arm64`, and replace the `$DESTINATION_FOLDER` with the real path that will store the output executable files.


## Native AOT diagnostics

Release builds publish as Native AOT. A successful publish can still report AOT
analysis warnings from dependencies. To expand a third-party assembly warning
such as `IL3053`, publish with:

```sh
dotnet publish src/SourceGit.csproj -c Release -r linux-x64 -p:TrimmerSingleWarn=false
```

`SuppressTrimAnalysisWarnings` currently suppresses trimming diagnostics; it does
not suppress AOT diagnostics. The command above expands the existing AOT warnings
without disabling the analysis or changing their severity.

### DataGrid warnings

With Avalonia.Controls.DataGrid 12.1.2, the expanded `IL3053` consists of three
`IL3050` warnings:

* `TypeHelper.GetPropertyOrIndexer()` in `Utils/ReflectionHelper.cs` dynamically
constructs `IList<T>` and `IReadOnlyList<T>` with `Type.MakeGenericType`. These
two warnings also occur with DataGrid 11.3.13. This fallback is reached only for
an indexer path when no suitable default indexer was found and an element type
can be inferred.
* `DataGrid.GenerateColumn()` in `DataGridColumns.cs` creates a reflection-based
`Binding` for an automatically generated column. Avalonia 12 marks that
constructor as requiring dynamic code.

SourceGit's `HistoriesCommitList` sets `AutoGenerateColumns` and
`CanUserSortColumns` to `false`, sets `IsReadOnly` to `true`, and defines its
columns explicitly as `DataGridTemplateColumn` instances. It does not configure
indexed property paths for DataGrid's bound-column, sorting, or grouping helpers.
These usage constraints are the basis for accepting the audited warnings; they
are not proof of unreachability available to the AOT compiler.

Revisit this assessment when changing the DataGrid version, adding automatically
generated or bound columns, introducing indexed property paths, or enabling
property-based sorting or grouping. Setting a runtime DataGrid property does not
remove the corresponding implementation from AOT analysis. The current DataGrid
package has no feature switch to disable its indexer fallback.

Keep AOT warnings enabled. A global `NoWarn=IL3050` would also hide unrelated
warnings introduced by future changes. An `UnconditionalSuppressMessage` on a
SourceGit caller does not suppress warnings emitted inside a dependency method.
A dependency-level fix or suppression would require changes to that dependency;
suppression alone would not change its runtime behavior.

References:

* [IL3053: assembly produced AOT warnings](https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/warnings/il3053)
* [IL3050: calls requiring dynamic code](https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/warnings/il3050)
* [DataGrid 12.1.2 indexer fallback](https://github.com/AvaloniaUI/Avalonia.Controls.DataGrid/blob/1e12211eb0c52a09e314ca57a344147c37d0a26c/src/Avalonia.Controls.DataGrid/Utils/ReflectionHelper.cs#L342-L416)
* [DataGrid 12.1.2 automatic column generation](https://github.com/AvaloniaUI/Avalonia.Controls.DataGrid/blob/1e12211eb0c52a09e314ca57a344147c37d0a26c/src/Avalonia.Controls.DataGrid/DataGridColumns.cs#L1703-L1784)
2 changes: 1 addition & 1 deletion depends/AvaloniaEdit
Submodule AvaloniaEdit updated 129 files
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"version": "10.0.0",
"rollForward": "latestMajor",
"version": "10.0.100",
"rollForward": "latestFeature",
"allowPrerelease": false
}
}
6 changes: 2 additions & 4 deletions src/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Data.Core.Plugins;
using Avalonia.Markup.Xaml;
using Avalonia.Media;
using Avalonia.Media.Fonts;
using Avalonia.Platform;
using Avalonia.Styling;
using Avalonia.Threading;

Expand Down Expand Up @@ -54,6 +52,8 @@ public static AppBuilder BuildAvaloniaApp()
{
var builder = AppBuilder.Configure<App>();
builder.UsePlatformDetect();
if (OperatingSystem.IsLinux() && !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WAYLAND_DISPLAY")))
builder.UseWayland();
builder.LogToTrace();
builder.WithInterFont();
builder.With(new FontManagerOptions()
Expand Down Expand Up @@ -251,8 +251,6 @@ public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
BindingPlugins.DataValidators.RemoveAt(0);

// Disable tooltip if window is not active.
ToolTip.ToolTipOpeningEvent.AddClassHandler<Control>((c, e) =>
{
Expand Down
5 changes: 2 additions & 3 deletions src/Native/Linux.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

using Avalonia;
using Avalonia.Controls;
using Avalonia.Platform;

namespace SourceGit.Native
{
Expand All @@ -28,12 +27,12 @@ public void SetupWindow(Window window)

if (OS.UseSystemWindowFrame)
{
window.ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.Default;
window.WindowDecorations = WindowDecorations.Full;
window.ExtendClientAreaToDecorationsHint = false;
}
else
{
window.ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome;
window.WindowDecorations = WindowDecorations.None;
window.ExtendClientAreaToDecorationsHint = true;
window.Classes.Add("custom_window_frame");
}
Expand Down
3 changes: 1 addition & 2 deletions src/Native/MacOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

using Avalonia;
using Avalonia.Controls;
using Avalonia.Platform;

namespace SourceGit.Native
{
Expand Down Expand Up @@ -50,7 +49,7 @@ public void SetupApp(AppBuilder builder)

public void SetupWindow(Window window)
{
window.ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.SystemChrome;
window.WindowDecorations = WindowDecorations.Full;
window.ExtendClientAreaToDecorationsHint = true;
window.BorderThickness = new Thickness(0);
}
Expand Down
3 changes: 1 addition & 2 deletions src/Native/Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

using Avalonia;
using Avalonia.Controls;
using Avalonia.Platform;
using Avalonia.Threading;

namespace SourceGit.Native
Expand Down Expand Up @@ -48,7 +47,7 @@ public void SetupApp(AppBuilder builder)

public void SetupWindow(Window window)
{
window.ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome;
window.WindowDecorations = WindowDecorations.BorderOnly;
window.ExtendClientAreaToDecorationsHint = true;
window.BorderThickness = new Thickness(1);
window.Padding = new Thickness(0);
Expand Down
6 changes: 3 additions & 3 deletions src/Resources/Styles.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<Setter Property="Background" Value="{DynamicResource Brush.Window}"/>
<Setter Property="BorderBrush" Value="{DynamicResource Brush.WindowBorder}"/>
<Setter Property="SystemDecorations" Value="Full"/>
<Setter Property="WindowDecorations" Value="Full"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="TextElement.FontFamily" Value="{DynamicResource Fonts.Default}"/>
<Setter Property="TextElement.FontSize" Value="{Binding Source={x:Static vm:Preferences.Instance}, Path=DefaultFontSize}"/>
Expand Down Expand Up @@ -57,7 +57,7 @@
<Style Selector="Window.custom_window_frame">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="SystemDecorations" Value="None"/>
<Setter Property="WindowDecorations" Value="None"/>
<Setter Property="Padding" Value="12"/>
<Setter Property="CornerRadius" Value="8"/>

Expand Down Expand Up @@ -1487,7 +1487,7 @@
Padding="10">
<Grid RowDefinitions="Auto,Auto">
<StackPanel Grid.Row="0" Orientation="Horizontal">
<TextBox Watermark="{x:Static ae:SR.SearchLabel}"
<TextBox PlaceholderText="{x:Static ae:SR.SearchLabel}"
BorderBrush="{DynamicResource Brush.Border2}"
Name="PART_searchTextBox"
Width="265" Height="28"
Expand Down
13 changes: 7 additions & 6 deletions src/SourceGit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

<PropertyGroup Condition="'$(Configuration)' == 'Release' and '$(DisableAOT)' != 'true'">
<PublishAot>true</PublishAot>
<PublishAotUsingRuntimePack>true</PublishAotUsingRuntimePack>
<PublishTrimmed>true</PublishTrimmed>
<TrimMode>link</TrimMode>
</PropertyGroup>
Expand Down Expand Up @@ -48,12 +49,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia" Version="11.3.22" />
<PackageReference Include="Avalonia.Desktop" Version="11.3.22" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.22" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.22" />
<PackageReference Include="Avalonia.Diagnostics" Version="11.3.22" Condition="'$(Configuration)' == 'Debug'" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.3.13" />
<PackageReference Include="Avalonia" Version="12.1.3" />
<PackageReference Include="Avalonia.Desktop" Version="12.1.3" />
<PackageReference Include="Avalonia.Wayland" Version="12.1.3" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="12.1.3" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="12.1.3" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="12.1.2" />
<PackageReference Include="Azure.AI.OpenAI" Version="2.9.0-beta.1" />
<PackageReference Include="BitMiracle.LibTiff.NET" Version="2.4.660" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
Expand Down
1 change: 1 addition & 0 deletions src/Views/AIAssistant.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Media;

Expand Down
6 changes: 3 additions & 3 deletions src/Views/AddRemote.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
Height="26"
VerticalAlignment="Center"
CornerRadius="3"
Watermark="{DynamicResource Text.Remote.Name.Placeholder}"
PlaceholderText="{DynamicResource Text.Remote.Name.Placeholder}"
Text="{Binding Name, Mode=TwoWay}">
<TextBox.InnerLeftContent>
<Path Width="12" Height="12"
Expand All @@ -46,7 +46,7 @@
Height="26"
VerticalAlignment="Center"
CornerRadius="3"
Watermark="{DynamicResource Text.Remote.URL.Placeholder}"
PlaceholderText="{DynamicResource Text.Remote.URL.Placeholder}"
Text="{Binding Url, Mode=TwoWay}">
<TextBox.InnerLeftContent>
<Path Width="12" Height="12"
Expand All @@ -70,7 +70,7 @@
Height="28"
VerticalAlignment="Center"
CornerRadius="3"
Watermark="{DynamicResource Text.SSHKey.Placeholder}"
PlaceholderText="{DynamicResource Text.SSHKey.Placeholder}"
Text="{Binding SSHKey, Mode=TwoWay}">
<TextBox.InnerLeftContent>
<Path Width="12" Height="12"
Expand Down
4 changes: 2 additions & 2 deletions src/Views/AddSubmodule.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
Height="26"
VerticalAlignment="Center"
CornerRadius="3"
Watermark="{DynamicResource Text.RepositoryURL}"
PlaceholderText="{DynamicResource Text.RepositoryURL}"
Text="{Binding Url, Mode=TwoWay}">
<TextBox.InnerLeftContent>
<Path Width="12" Height="12"
Expand All @@ -49,7 +49,7 @@
Height="26"
VerticalAlignment="Center"
CornerRadius="3"
Watermark="{DynamicResource Text.Submodule.RelativePath.Placeholder}"
PlaceholderText="{DynamicResource Text.Submodule.RelativePath.Placeholder}"
Text="{Binding RelativePath, Mode=TwoWay}">
<TextBox.InnerLeftContent>
<Path Width="12" Height="12"
Expand Down
4 changes: 2 additions & 2 deletions src/Views/AddWorktree.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
Height="28"
CornerRadius="3"
Text="{Binding WorktreePath, Mode=TwoWay}"
Watermark="{DynamicResource Text.AddWorktree.Location.Placeholder}">
PlaceholderText="{DynamicResource Text.AddWorktree.Location.Placeholder}">
<TextBox.InnerRightContent>
<Button Classes="icon_button" Width="28" Height="28" Margin="4,0,0,0" Click="SelectLocation">
<Path Data="{StaticResource Icons.Folder.Open}" Fill="{DynamicResource Brush.FG1}"/>
Expand All @@ -45,7 +45,7 @@
VerticalAlignment="Center"
CornerRadius="3"
Text="{Binding BranchName, Mode=TwoWay}"
Watermark="{DynamicResource Text.AddWorktree.Name.Placeholder}"/>
PlaceholderText="{DynamicResource Text.AddWorktree.Name.Placeholder}"/>
</Grid>
</StackPanel>
</UserControl>
Expand Down
2 changes: 1 addition & 1 deletion src/Views/Apply.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
Height="28"
Margin="0,0,0,6"
CornerRadius="3"
Watermark="{DynamicResource Text.Apply.File.Placeholder}"
PlaceholderText="{DynamicResource Text.Apply.File.Placeholder}"
IsEnabled="{Binding !FromClipboard, Mode=OneWay}"
IsVisible="{Binding !FromClipboard, Mode=OneWay}"
Text="{Binding PatchFile, Mode=TwoWay}">
Expand Down
2 changes: 1 addition & 1 deletion src/Views/Archive.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
x:Name="TxtSaveFile"
Height="28"
CornerRadius="3"
Watermark="{DynamicResource Text.Archive.File.Placeholder}"
PlaceholderText="{DynamicResource Text.Archive.File.Placeholder}"
Text="{Binding SaveFile, Mode=TwoWay}">
<TextBox.InnerRightContent>
<Button Classes="icon_button" Width="30" Height="30" Click="SelectOutputFile">
Expand Down
13 changes: 5 additions & 8 deletions src/Views/Avatar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Data;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Media;
using Avalonia.Media.Imaging;
Expand Down Expand Up @@ -45,12 +46,8 @@ public Avatar()
{
RenderOptions.SetBitmapInterpolationMode(this, BitmapInterpolationMode.HighQuality);

Bind(UseGitHubStyleAvatarProperty, new Binding()
{
Mode = BindingMode.OneWay,
Source = ViewModels.Preferences.Instance,
Path = "UseGitHubStyleAvatar"
});
Bind(UseGitHubStyleAvatarProperty, CompiledBinding.Create((ViewModels.Preferences pref) => pref.UseGitHubStyleAvatar,
source: ViewModels.Preferences.Instance, mode: BindingMode.OneWay));
}

public override void Render(DrawingContext context)
Expand Down Expand Up @@ -246,7 +243,7 @@ private void OnContextRequested(object sender, ContextRequestedEventArgs e)
{
if (_img != null)
{
_img.Save(writer);
_img.Save(writer, PngBitmapEncoderOptions.Default);
}
else
{
Expand All @@ -257,7 +254,7 @@ private void OnContextRequested(object sender, ContextRequestedEventArgs e)
using (var ctx = rt.CreateDrawingContext())
{
Render(ctx);
rt.Save(writer);
rt.Save(writer, PngBitmapEncoderOptions.Default);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Views/BinaryFileViewer.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
CornerRadius="13"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
Watermark="{DynamicResource Text.File.HexViewer.GotoAddress}"
PlaceholderText="{DynamicResource Text.File.HexViewer.GotoAddress}"
TextChanged="OnGotoAddressTextChanged">
<TextBox.InnerLeftContent>
<Path Width="14" Height="14"
Expand Down
2 changes: 1 addition & 1 deletion src/Views/BranchTree.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ protected override async void OnAttachedToVisualTree(VisualTreeAttachmentEventAr
if (DataContext is not Models.Branch branch)
break;

if (e.Root is not PopupRoot { Parent: Popup { Parent: Border owner } })
if (TopLevel.GetTopLevel(this) is not PopupRoot { Parent: Popup { Parent: Border owner } })
break;

var tree = owner.FindAncestorOfType<BranchTree>();
Expand Down
2 changes: 1 addition & 1 deletion src/Views/ChangeSubmoduleUrl.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
Height="26"
VerticalAlignment="Center"
CornerRadius="3"
Watermark="{DynamicResource Text.RepositoryURL}"
PlaceholderText="{DynamicResource Text.RepositoryURL}"
Text="{Binding Url, Mode=TwoWay}">
<TextBox.InnerLeftContent>
<Path Width="12" Height="12"
Expand Down
2 changes: 1 addition & 1 deletion src/Views/CheckoutAsWorktree.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
Height="28"
CornerRadius="3"
Text="{Binding WorktreePath, Mode=TwoWay}"
Watermark="{DynamicResource Text.CheckoutAsWorktree.WorktreePath.Placeholder}">
PlaceholderText="{DynamicResource Text.CheckoutAsWorktree.WorktreePath.Placeholder}">
<TextBox.InnerRightContent>
<Button Classes="icon_button" Width="28" Height="28" Margin="4,0,0,0" Click="SelectLocation">
<Path Data="{StaticResource Icons.Folder.Open}" Fill="{DynamicResource Brush.FG1}"/>
Expand Down
4 changes: 2 additions & 2 deletions src/Views/CheckoutRemoteBranchAsWorktree.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
Height="28"
CornerRadius="3"
Text="{Binding WorktreePath, Mode=TwoWay}"
Watermark="{DynamicResource Text.CheckoutAsWorktree.WorktreePath.Placeholder}">
PlaceholderText="{DynamicResource Text.CheckoutAsWorktree.WorktreePath.Placeholder}">
<TextBox.InnerRightContent>
<Button Classes="icon_button" Width="28" Height="28" Margin="4,0,0,0" Click="SelectLocation">
<Path Data="{StaticResource Icons.Folder.Open}" Fill="{DynamicResource Brush.FG1}"/>
Expand All @@ -54,7 +54,7 @@
VerticalAlignment="Center"
CornerRadius="3"
Text="{Binding BranchName, Mode=TwoWay}"
Watermark="{DynamicResource Text.CheckoutAsWorktree.NewBranchName.Placeholder}"/>
PlaceholderText="{DynamicResource Text.CheckoutAsWorktree.NewBranchName.Placeholder}"/>

<CheckBox Grid.Row="3" Grid.Column="1"
Height="32"
Expand Down
Loading