Skip to content

Commit

Permalink
Make Avalonia UI the default on all platforms and move in-process (#1207
Browse files Browse the repository at this point in the history
)

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`.
  • Loading branch information
mjcheetham authored Apr 24, 2023
2 parents 318ec35 + 56d540f commit d6a4cf3
Show file tree
Hide file tree
Showing 166 changed files with 1,380 additions and 2,478 deletions.
171 changes: 0 additions & 171 deletions Git-Credential-Manager.sln

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions src/linux/Packaging.Linux/Packaging.Linux.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@

<ItemGroup>
<ProjectReference Include="../../shared/Git-Credential-Manager/Git-Credential-Manager.csproj" ReferenceOutputAssembly="false" />
<ProjectReference Include="../../shared/Atlassian.Bitbucket.UI.Avalonia/Atlassian.Bitbucket.UI.Avalonia.csproj" ReferenceOutputAssembly="false" />
<ProjectReference Include="../../shared/GitHub.UI.Avalonia/GitHub.UI.Avalonia.csproj" ReferenceOutputAssembly="false" />
<ProjectReference Include="../../shared/GitLab.UI.Avalonia/GitLab.UI.Avalonia.csproj" ReferenceOutputAssembly="false" />
<ProjectReference Include="../../shared/Core.UI.Avalonia/Core.UI.Avalonia.csproj" ReferenceOutputAssembly="false" />
</ItemGroup>

<!-- Implicit SDK targets import (so we can override the default targets below) -->
Expand Down
40 changes: 0 additions & 40 deletions src/linux/Packaging.Linux/layout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ ROOT="$( cd "$THISDIR"/../../.. ; pwd -P )"
SRC="$ROOT/src"
OUT="$ROOT/out"
GCM_SRC="$SRC/shared/Git-Credential-Manager"
GCM_UI_SRC="$SRC/shared/Git-Credential-Manager.UI.Avalonia"
BITBUCKET_UI_SRC="$SRC/shared/Atlassian.Bitbucket.UI.Avalonia"
GITHUB_UI_SRC="$SRC/shared/GitHub.UI.Avalonia"
GITLAB_UI_SRC="$SRC/shared/GitLab.UI.Avalonia"
PROJ_OUT="$OUT/linux/Packaging.Linux"

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

echo "Publishing core UI helper..."
$DOTNET_ROOT/dotnet publish "$GCM_UI_SRC" \
--configuration="$CONFIGURATION" \
--framework="$FRAMEWORK" \
--runtime="$RUNTIME" \
--self-contained \
-p:PublishSingleFile=true \
--output="$(make_absolute "$PAYLOAD")" || exit 1

echo "Publishing Bitbucket UI helper..."
$DOTNET_ROOT/dotnet publish "$BITBUCKET_UI_SRC" \
--configuration="$CONFIGURATION" \
--framework="$FRAMEWORK" \
--runtime="$RUNTIME" \
--self-contained \
-p:PublishSingleFile=true \
--output="$(make_absolute "$PAYLOAD")" || exit 1

echo "Publishing GitHub UI helper..."
$DOTNET_ROOT/dotnet publish "$GITHUB_UI_SRC" \
--configuration="$CONFIGURATION" \
--framework="$FRAMEWORK" \
--runtime="$RUNTIME" \
--self-contained \
-p:PublishSingleFile=true \
--output="$(make_absolute "$PAYLOAD")" || exit 1

echo "Publishing GitLab UI helper..."
$DOTNET_ROOT/dotnet publish "$GITLAB_UI_SRC" \
--configuration="$CONFIGURATION" \
--framework="$FRAMEWORK" \
--runtime="$RUNTIME" \
--self-contained=true \
-p:PublishSingleFile=true \
--output="$(make_absolute "$PAYLOAD")" || exit 1

# Collect symbols
echo "Collecting managed symbols..."
mv "$PAYLOAD"/*.pdb "$SYMBOLOUT" || exit 1
Expand Down
4 changes: 0 additions & 4 deletions src/osx/Installer.Mac/Installer.Mac.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@

<ItemGroup>
<ProjectReference Include="../../shared/Git-Credential-Manager/Git-Credential-Manager.csproj" ReferenceOutputAssembly="false" />
<ProjectReference Include="../../shared/Atlassian.Bitbucket.UI.Avalonia/Atlassian.Bitbucket.UI.Avalonia.csproj" ReferenceOutputAssembly="false" />
<ProjectReference Include="../../shared/GitHub.UI.Avalonia/GitHub.UI.Avalonia.csproj" ReferenceOutputAssembly="false" />
<ProjectReference Include="../../shared/GitLab.UI.Avalonia/GitLab.UI.Avalonia.csproj" ReferenceOutputAssembly="false" />
<ProjectReference Include="../../shared/Core.UI.Avalonia/Core.UI.Avalonia.csproj" ReferenceOutputAssembly="false" />
</ItemGroup>

<!-- Implicit SDK targets import (so we can override the default targets below) -->
Expand Down
35 changes: 0 additions & 35 deletions src/osx/Installer.Mac/layout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ OUT="$ROOT/out"
INSTALLER_SRC="$SRC/osx/Installer.Mac"
GCM_SRC="$SRC/shared/Git-Credential-Manager"
GCM_UI_SRC="$SRC/shared/Git-Credential-Manager.UI.Avalonia"
BITBUCKET_UI_SRC="$SRC/shared/Atlassian.Bitbucket.UI.Avalonia"
GITHUB_UI_SRC="$SRC/shared/GitHub.UI.Avalonia"
GITLAB_UI_SRC="$SRC/shared/GitLab.UI.Avalonia"

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

echo "Publishing core UI helper..."
dotnet publish "$GCM_UI_SRC" \
--configuration="$CONFIGURATION" \
--framework="$FRAMEWORK" \
--runtime="$RUNTIME" \
--self-contained \
--output="$(make_absolute "$PAYLOAD")" || exit 1

echo "Publishing Bitbucket UI helper..."
dotnet publish "$BITBUCKET_UI_SRC" \
--configuration="$CONFIGURATION" \
--framework="$FRAMEWORK" \
--runtime="$RUNTIME" \
--self-contained \
--output="$(make_absolute "$PAYLOAD")" || exit 1

echo "Publishing GitHub UI helper..."
dotnet publish "$GITHUB_UI_SRC" \
--configuration="$CONFIGURATION" \
--framework="$FRAMEWORK" \
--runtime="$RUNTIME" \
--self-contained \
--output="$(make_absolute "$PAYLOAD")" || exit 1

echo "Publishing GitLab UI helper..."
dotnet publish "$GITLAB_UI_SRC" \
--configuration="$CONFIGURATION" \
--framework="$FRAMEWORK" \
--runtime="$RUNTIME" \
--self-contained \
--output="$(make_absolute "$PAYLOAD")" || exit 1

# Collect symbols
echo "Collecting managed symbols..."
mv "$PAYLOAD"/*.pdb "$SYMBOLOUT" || exit 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public async Task BitbucketAuthentication_GetCredentialsAsync_All_ShowsMenu_OAut
{
var context = new TestCommandContext();
context.SessionManager.IsDesktopSession = true; // Allow OAuth mode
context.Settings.IsGuiPromptsEnabled = false; // Force text prompts
context.Terminal.Prompts["option (enter for default)"] = "1";
Uri targetUri = null;

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

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

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

77 changes: 0 additions & 77 deletions src/shared/Atlassian.Bitbucket.UI.Avalonia/Program.cs

This file was deleted.

15 changes: 0 additions & 15 deletions src/shared/Atlassian.Bitbucket.UI/Atlassian.Bitbucket.UI.csproj

This file was deleted.

Loading

0 comments on commit d6a4cf3

Please sign in to comment.