зеркало из https://github.com/microsoft/scalar.git
Gather all of the under construction flags into one class
This commit is contained in:
Родитель
81341f1518
Коммит
cd12c2b6a5
|
@ -10,9 +10,10 @@ namespace GVFS.Common
|
|||
{
|
||||
public abstract class GVFSPlatform
|
||||
{
|
||||
public GVFSPlatform(string executableExtension, string installerExtension)
|
||||
public GVFSPlatform(string executableExtension, string installerExtension, UnderConstructionFlags underConstruction)
|
||||
{
|
||||
this.Constants = new GVFSPlatformConstants(executableExtension, installerExtension);
|
||||
this.UnderConstruction = underConstruction;
|
||||
}
|
||||
|
||||
public static GVFSPlatform Instance { get; private set; }
|
||||
|
@ -21,12 +22,9 @@ namespace GVFS.Common
|
|||
public abstract IGitInstallation GitInstallation { get; }
|
||||
public abstract IDiskLayoutUpgradeData DiskLayoutUpgrade { get; }
|
||||
public abstract IPlatformFileSystem FileSystem { get; }
|
||||
public virtual bool SupportsGVFSService { get; } = true;
|
||||
public virtual bool SupportsGVFSUpgrade { get; } = true;
|
||||
public virtual bool SupportsGVFSConfig { get; } = true;
|
||||
public virtual bool SupportsKernelLogs { get; } = true;
|
||||
public virtual bool UsesGitHooksLoader { get; } = false;
|
||||
|
||||
public GVFSPlatformConstants Constants { get; }
|
||||
public UnderConstructionFlags UnderConstruction { get; }
|
||||
|
||||
public static void Register(GVFSPlatform platform)
|
||||
{
|
||||
|
@ -130,5 +128,23 @@ namespace GVFS.Common
|
|||
get { return "GVFS.Upgrader" + this.ExecutableExtension; }
|
||||
}
|
||||
}
|
||||
|
||||
public class UnderConstructionFlags
|
||||
{
|
||||
public UnderConstructionFlags(
|
||||
bool supportsGVFSService = true,
|
||||
bool supportsGVFSUpgrade = true,
|
||||
bool supportsGVFSConfig = true,
|
||||
bool supportsKernelLogs = true,
|
||||
bool usesGitHooksLoader = false)
|
||||
{
|
||||
}
|
||||
|
||||
public bool SupportsGVFSService { get; }
|
||||
public bool SupportsGVFSUpgrade { get; }
|
||||
public bool SupportsGVFSConfig { get; }
|
||||
public bool SupportsKernelLogs { get; }
|
||||
public bool UsesGitHooksLoader { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,14 @@ namespace GVFS.Platform.Mac
|
|||
public partial class MacPlatform : GVFSPlatform
|
||||
{
|
||||
public MacPlatform()
|
||||
: base(executableExtension: string.Empty, installerExtension: ".dmg")
|
||||
: base(
|
||||
executableExtension: string.Empty,
|
||||
installerExtension: ".dmg",
|
||||
underConstruction: new UnderConstructionFlags(
|
||||
supportsGVFSService: false,
|
||||
supportsGVFSUpgrade: false,
|
||||
supportsGVFSConfig: false,
|
||||
supportsKernelLogs: false))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -20,10 +27,6 @@ namespace GVFS.Platform.Mac
|
|||
public override IGitInstallation GitInstallation { get; } = new MacGitInstallation();
|
||||
public override IDiskLayoutUpgradeData DiskLayoutUpgrade { get; } = new MacDiskLayoutUpgradeData();
|
||||
public override IPlatformFileSystem FileSystem { get; } = new MacFileSystem();
|
||||
public override bool SupportsGVFSService { get; } = false;
|
||||
public override bool SupportsGVFSUpgrade { get; } = false;
|
||||
public override bool SupportsGVFSConfig { get; } = false;
|
||||
public override bool SupportsKernelLogs { get; } = false;
|
||||
|
||||
public override void ConfigureVisualStudio(string gitBinPath, ITracer tracer)
|
||||
{
|
||||
|
|
|
@ -24,7 +24,10 @@ namespace GVFS.Platform.Windows
|
|||
private const string BuildLabExRegistryValue = "BuildLabEx";
|
||||
|
||||
public WindowsPlatform()
|
||||
: base(executableExtension: ".exe", installerExtension: ".exe")
|
||||
: base(
|
||||
executableExtension: ".exe",
|
||||
installerExtension: ".exe",
|
||||
underConstruction: new UnderConstructionFlags(usesGitHooksLoader: true))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -33,8 +36,6 @@ namespace GVFS.Platform.Windows
|
|||
public override IDiskLayoutUpgradeData DiskLayoutUpgrade { get; } = new WindowsDiskLayoutUpgradeData();
|
||||
public override IPlatformFileSystem FileSystem { get; } = new WindowsFileSystem();
|
||||
|
||||
public override bool UsesGitHooksLoader { get; } = true;
|
||||
|
||||
public static string GetStringFromRegistry(string key, string valueName)
|
||||
{
|
||||
object value = GetValueFromRegistry(RegistryHive.LocalMachine, key, valueName);
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace GVFS.UnitTests.Mock.Common
|
|||
public class MockPlatform : GVFSPlatform
|
||||
{
|
||||
public MockPlatform()
|
||||
: base(executableExtension: ".mockexe", installerExtension: ".mockexe")
|
||||
: base(executableExtension: ".mockexe", installerExtension: ".mockexe", underConstruction: new UnderConstructionFlags())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace GVFS.CommandLine
|
|||
|
||||
public override void Execute()
|
||||
{
|
||||
if (!GVFSPlatform.Instance.SupportsGVFSConfig)
|
||||
if (!GVFSPlatform.Instance.UnderConstruction.SupportsGVFSConfig)
|
||||
{
|
||||
this.ReportErrorAndExit("`gvfs config` is not yet implemented on this operating system.");
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace GVFS.CommandLine
|
|||
// .gvfs
|
||||
this.CopyAllFiles(enlistment.EnlistmentRoot, archiveFolderPath, GVFSConstants.DotGVFS.Root, copySubFolders: false);
|
||||
|
||||
if (GVFSPlatform.Instance.SupportsKernelLogs)
|
||||
if (GVFSPlatform.Instance.UnderConstruction.SupportsKernelLogs)
|
||||
{
|
||||
// driver
|
||||
this.FlushKernelDriverLogs();
|
||||
|
@ -118,7 +118,7 @@ namespace GVFS.CommandLine
|
|||
// corrupt objects
|
||||
this.CopyAllFiles(enlistment.DotGVFSRoot, Path.Combine(archiveFolderPath, GVFSConstants.DotGVFS.Root), GVFSConstants.DotGVFS.CorruptObjectsName, copySubFolders: false);
|
||||
|
||||
if (GVFSPlatform.Instance.SupportsGVFSService)
|
||||
if (GVFSPlatform.Instance.UnderConstruction.SupportsGVFSService)
|
||||
{
|
||||
// service
|
||||
this.CopyAllFiles(
|
||||
|
@ -128,7 +128,7 @@ namespace GVFS.CommandLine
|
|||
copySubFolders: true);
|
||||
}
|
||||
|
||||
if (GVFSPlatform.Instance.SupportsGVFSUpgrade)
|
||||
if (GVFSPlatform.Instance.UnderConstruction.SupportsGVFSUpgrade)
|
||||
{
|
||||
// upgrader
|
||||
this.CopyAllFiles(
|
||||
|
|
|
@ -1070,7 +1070,7 @@ You can specify a URL, a name of a configured cache server, or the special names
|
|||
}
|
||||
|
||||
string hooksPath = null;
|
||||
if (GVFSPlatform.Instance.UsesGitHooksLoader)
|
||||
if (GVFSPlatform.Instance.UnderConstruction.UsesGitHooksLoader)
|
||||
{
|
||||
// On Windows, the soon-to-be deprecated GitHooksLoader tries to call out to the hooks process without
|
||||
// its full path, so we have to pass the path along to our background git processes via the PATH
|
||||
|
|
|
@ -117,7 +117,7 @@ namespace GVFS.CommandLine
|
|||
|
||||
if (!GVFSPlatform.Instance.KernelDriver.IsReady(tracer, enlistment.EnlistmentRoot, out errorMessage))
|
||||
{
|
||||
if (GVFSPlatform.Instance.SupportsGVFSService)
|
||||
if (GVFSPlatform.Instance.UnderConstruction.SupportsGVFSService)
|
||||
{
|
||||
tracer.RelatedEvent(
|
||||
EventLevel.Informational,
|
||||
|
@ -214,7 +214,7 @@ namespace GVFS.CommandLine
|
|||
}
|
||||
|
||||
if (!this.Unattended &&
|
||||
GVFSPlatform.Instance.SupportsGVFSService)
|
||||
GVFSPlatform.Instance.UnderConstruction.SupportsGVFSService)
|
||||
{
|
||||
if (!this.ShowStatusWhileRunning(
|
||||
() => { return this.RegisterMount(enlistment, out errorMessage); },
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace GVFS.CommandLine
|
|||
|
||||
if (!this.Unattended &&
|
||||
!this.SkipUnregister &&
|
||||
GVFSPlatform.Instance.SupportsGVFSService)
|
||||
GVFSPlatform.Instance.UnderConstruction.SupportsGVFSService)
|
||||
{
|
||||
if (!this.ShowStatusWhileRunning(
|
||||
() => { return this.UnregisterRepo(root, out errorMessage); },
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace GVFS.CommandLine
|
|||
|
||||
private bool TryInitializeUpgrader()
|
||||
{
|
||||
if (GVFSPlatform.Instance.SupportsGVFSUpgrade)
|
||||
if (GVFSPlatform.Instance.UnderConstruction.SupportsGVFSUpgrade)
|
||||
{
|
||||
if (this.upgrader == null)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче