Skip to content

Commit d6a4cf3

Browse files
authored
Make Avalonia UI the default on all platforms and move in-process (#1207)
Today GCM has an architecture that delegates all GUI prompting to (bundled) external executables, using WPF-based helpers on Windows and Avalonia UI helpers on Mac and Linux. Each host provider has its own GUI helper executable, meaning we currently bundle four (GitHub.UI, GitLab.UI, Atlassian.Bitbucket.UI, git-credential-manager.ui [for generic auth]) helpers in addition to the core git-credential-manager CLI executable. On Linux we use the "publish as a single-file" model for each of these executables, meaning we have a copy of the CLR included for each executable! That means five CLRs! Now that the Avalonia UI-based GUI helpers have matured, we can look at dropping the WPF helpers and reduce the effort required to ship new GUI by 50% (we no longer need to do everything twice: once with WPF and once with Avalonia UI). In addition, in a recent spike, I found that it may be possible to bring the Avalonia UI helpers in-process, with nearly zero net-new code. This would help reduce our installation footprint on Linux down to approximately 1/4 of the current size. The single executable model would also help decrease build times, and increase end-user performance since we no longer pay the process startup costs using external processes! We need to be mindful that this change may result in a small increase in the Windows installation as we now bring in extra libraries used to support Avalonia UI, whereas previously we relied on WPF libraries as included with Windows 'for free'. This is expected to be minimal. As for the current GUI extensibility model, we are not aware of any consumers, but it would not be much effort to keep the existing external process model, but now just default to using our in-process GUI options in the absence of external configuration. This still gives tools like VS or VSCode options to integrate native UI for GCM in the future. Initially, we are still keeping the WPF helpers around on Windows but disabled by default. We can drop these after at least one release using the in-proc Avalonia helpers. To switch back to the WPF helpers, use `credential.devUseLegacyUIHelpers` or `GCM_DEV_USELEGACYUIHELPERS`.
2 parents 318ec35 + 56d540f commit d6a4cf3

File tree

166 files changed

+1380
-2478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+1380
-2478
lines changed

Git-Credential-Manager.sln

-171
Large diffs are not rendered by default.

src/linux/Packaging.Linux/Packaging.Linux.csproj

-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717

1818
<ItemGroup>
1919
<ProjectReference Include="../../shared/Git-Credential-Manager/Git-Credential-Manager.csproj" ReferenceOutputAssembly="false" />
20-
<ProjectReference Include="../../shared/Atlassian.Bitbucket.UI.Avalonia/Atlassian.Bitbucket.UI.Avalonia.csproj" ReferenceOutputAssembly="false" />
21-
<ProjectReference Include="../../shared/GitHub.UI.Avalonia/GitHub.UI.Avalonia.csproj" ReferenceOutputAssembly="false" />
22-
<ProjectReference Include="../../shared/GitLab.UI.Avalonia/GitLab.UI.Avalonia.csproj" ReferenceOutputAssembly="false" />
23-
<ProjectReference Include="../../shared/Core.UI.Avalonia/Core.UI.Avalonia.csproj" ReferenceOutputAssembly="false" />
2420
</ItemGroup>
2521

2622
<!-- Implicit SDK targets import (so we can override the default targets below) -->

src/linux/Packaging.Linux/layout.sh

-40
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ ROOT="$( cd "$THISDIR"/../../.. ; pwd -P )"
3535
SRC="$ROOT/src"
3636
OUT="$ROOT/out"
3737
GCM_SRC="$SRC/shared/Git-Credential-Manager"
38-
GCM_UI_SRC="$SRC/shared/Git-Credential-Manager.UI.Avalonia"
39-
BITBUCKET_UI_SRC="$SRC/shared/Atlassian.Bitbucket.UI.Avalonia"
40-
GITHUB_UI_SRC="$SRC/shared/GitHub.UI.Avalonia"
41-
GITLAB_UI_SRC="$SRC/shared/GitLab.UI.Avalonia"
4238
PROJ_OUT="$OUT/linux/Packaging.Linux"
4339

4440
# Build parameters
@@ -81,42 +77,6 @@ $DOTNET_ROOT/dotnet publish "$GCM_SRC" \
8177
-p:PublishSingleFile=true \
8278
--output="$(make_absolute "$PAYLOAD")" || exit 1
8379

84-
echo "Publishing core UI helper..."
85-
$DOTNET_ROOT/dotnet publish "$GCM_UI_SRC" \
86-
--configuration="$CONFIGURATION" \
87-
--framework="$FRAMEWORK" \
88-
--runtime="$RUNTIME" \
89-
--self-contained \
90-
-p:PublishSingleFile=true \
91-
--output="$(make_absolute "$PAYLOAD")" || exit 1
92-
93-
echo "Publishing Bitbucket UI helper..."
94-
$DOTNET_ROOT/dotnet publish "$BITBUCKET_UI_SRC" \
95-
--configuration="$CONFIGURATION" \
96-
--framework="$FRAMEWORK" \
97-
--runtime="$RUNTIME" \
98-
--self-contained \
99-
-p:PublishSingleFile=true \
100-
--output="$(make_absolute "$PAYLOAD")" || exit 1
101-
102-
echo "Publishing GitHub UI helper..."
103-
$DOTNET_ROOT/dotnet publish "$GITHUB_UI_SRC" \
104-
--configuration="$CONFIGURATION" \
105-
--framework="$FRAMEWORK" \
106-
--runtime="$RUNTIME" \
107-
--self-contained \
108-
-p:PublishSingleFile=true \
109-
--output="$(make_absolute "$PAYLOAD")" || exit 1
110-
111-
echo "Publishing GitLab UI helper..."
112-
$DOTNET_ROOT/dotnet publish "$GITLAB_UI_SRC" \
113-
--configuration="$CONFIGURATION" \
114-
--framework="$FRAMEWORK" \
115-
--runtime="$RUNTIME" \
116-
--self-contained=true \
117-
-p:PublishSingleFile=true \
118-
--output="$(make_absolute "$PAYLOAD")" || exit 1
119-
12080
# Collect symbols
12181
echo "Collecting managed symbols..."
12282
mv "$PAYLOAD"/*.pdb "$SYMBOLOUT" || exit 1

src/osx/Installer.Mac/Installer.Mac.csproj

-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313

1414
<ItemGroup>
1515
<ProjectReference Include="../../shared/Git-Credential-Manager/Git-Credential-Manager.csproj" ReferenceOutputAssembly="false" />
16-
<ProjectReference Include="../../shared/Atlassian.Bitbucket.UI.Avalonia/Atlassian.Bitbucket.UI.Avalonia.csproj" ReferenceOutputAssembly="false" />
17-
<ProjectReference Include="../../shared/GitHub.UI.Avalonia/GitHub.UI.Avalonia.csproj" ReferenceOutputAssembly="false" />
18-
<ProjectReference Include="../../shared/GitLab.UI.Avalonia/GitLab.UI.Avalonia.csproj" ReferenceOutputAssembly="false" />
19-
<ProjectReference Include="../../shared/Core.UI.Avalonia/Core.UI.Avalonia.csproj" ReferenceOutputAssembly="false" />
2016
</ItemGroup>
2117

2218
<!-- Implicit SDK targets import (so we can override the default targets below) -->

src/osx/Installer.Mac/layout.sh

-35
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ OUT="$ROOT/out"
2222
INSTALLER_SRC="$SRC/osx/Installer.Mac"
2323
GCM_SRC="$SRC/shared/Git-Credential-Manager"
2424
GCM_UI_SRC="$SRC/shared/Git-Credential-Manager.UI.Avalonia"
25-
BITBUCKET_UI_SRC="$SRC/shared/Atlassian.Bitbucket.UI.Avalonia"
26-
GITHUB_UI_SRC="$SRC/shared/GitHub.UI.Avalonia"
27-
GITLAB_UI_SRC="$SRC/shared/GitLab.UI.Avalonia"
2825

2926
# Build parameters
3027
FRAMEWORK=net6.0
@@ -103,38 +100,6 @@ dotnet publish "$GCM_SRC" \
103100
--self-contained \
104101
--output="$(make_absolute "$PAYLOAD")" || exit 1
105102

106-
echo "Publishing core UI helper..."
107-
dotnet publish "$GCM_UI_SRC" \
108-
--configuration="$CONFIGURATION" \
109-
--framework="$FRAMEWORK" \
110-
--runtime="$RUNTIME" \
111-
--self-contained \
112-
--output="$(make_absolute "$PAYLOAD")" || exit 1
113-
114-
echo "Publishing Bitbucket UI helper..."
115-
dotnet publish "$BITBUCKET_UI_SRC" \
116-
--configuration="$CONFIGURATION" \
117-
--framework="$FRAMEWORK" \
118-
--runtime="$RUNTIME" \
119-
--self-contained \
120-
--output="$(make_absolute "$PAYLOAD")" || exit 1
121-
122-
echo "Publishing GitHub UI helper..."
123-
dotnet publish "$GITHUB_UI_SRC" \
124-
--configuration="$CONFIGURATION" \
125-
--framework="$FRAMEWORK" \
126-
--runtime="$RUNTIME" \
127-
--self-contained \
128-
--output="$(make_absolute "$PAYLOAD")" || exit 1
129-
130-
echo "Publishing GitLab UI helper..."
131-
dotnet publish "$GITLAB_UI_SRC" \
132-
--configuration="$CONFIGURATION" \
133-
--framework="$FRAMEWORK" \
134-
--runtime="$RUNTIME" \
135-
--self-contained \
136-
--output="$(make_absolute "$PAYLOAD")" || exit 1
137-
138103
# Collect symbols
139104
echo "Collecting managed symbols..."
140105
mv "$PAYLOAD"/*.pdb "$SYMBOLOUT" || exit 1

src/shared/Atlassian.Bitbucket.Tests/BitbucketAuthenticationTest.cs

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public async Task BitbucketAuthentication_GetCredentialsAsync_All_ShowsMenu_OAut
5151
{
5252
var context = new TestCommandContext();
5353
context.SessionManager.IsDesktopSession = true; // Allow OAuth mode
54+
context.Settings.IsGuiPromptsEnabled = false; // Force text prompts
5455
context.Terminal.Prompts["option (enter for default)"] = "1";
5556
Uri targetUri = null;
5657

@@ -71,6 +72,7 @@ public async Task BitbucketAuthentication_GetCredentialsAsync_All_ShowsMenu_Basi
7172

7273
var context = new TestCommandContext();
7374
context.SessionManager.IsDesktopSession = true; // Allow OAuth mode
75+
context.Settings.IsGuiPromptsEnabled = false; // Force text prompts
7476
context.Terminal.Prompts["option (enter for default)"] = "2";
7577
context.Terminal.Prompts["Username"] = username;
7678
context.Terminal.SecretPrompts["Password"] = password;

src/shared/Atlassian.Bitbucket.UI.Avalonia/Atlassian.Bitbucket.UI.Avalonia.csproj

-24
This file was deleted.

src/shared/Atlassian.Bitbucket.UI.Avalonia/Commands/CredentialsCommandImpl.cs

-19
This file was deleted.

src/shared/Atlassian.Bitbucket.UI.Avalonia/Controls/TesterWindow.axaml

-29
This file was deleted.

src/shared/Atlassian.Bitbucket.UI.Avalonia/Controls/TesterWindow.axaml.cs

-71
This file was deleted.

src/shared/Atlassian.Bitbucket.UI.Avalonia/Program.cs

-77
This file was deleted.

src/shared/Atlassian.Bitbucket.UI/Atlassian.Bitbucket.UI.csproj

-15
This file was deleted.

0 commit comments

Comments
 (0)