Skip to content

Commit

Permalink
initial build of GVFS provider for Linux
Browse files Browse the repository at this point in the history
We add the core GVFS.Platform.Linux classes, derived from their
GVFS.Platform.Mac equivalents but with appropriate changes for
syscall argument signatures and flag values, type definitions,
and structure fields (e.g., mode_t is a uint, and the layout of
struct stat is quite different).

In order to avoid conflicting with the GNOME Virtual FileSystem,
we use .vfsforgit as the name of our per-repository private
directories, instead of .gvfs, which is used on Windows and Mac.

The build tooling is largely a duplicate of the corresponding
Mac configuration, with some changes to ensure we build
successfully on Linux (e.g., testing for "!= Windows" is no longer
sufficient to determine that the platform is OS X, so we add
distinct IsLinux and IsOSX build conditions to the .csproj file
for GVFS.Upgrader, among other subprojects).

The GVFS.sln configuration changes should ensure that the
ProjFS.Linux.Managed and GVFS.Platform.Linux subprojects are
built on all platforms (and their Mac and Windows equivalents
are built on Linux), and that the GVFS.Service.Mac classes are
built on Linux, so as to allow the GVFS.UnitTests subproject
to build and run successfully on all three platforms.

We also build the GVFS.Hooks.Linux and GVFS.Mount.Linux
subprojects on both Linux and Windows, just as their Mac
counterparts are built on both Mac and Windows.

The GVFS.Service binary is, for the time being, only a stub
on Linux, as we have yet to determine how (or if) we should
handle auto-mounting repositories, and the GVFS.Upgrader
binary is also non-functional on Linux at present.

Note that for now the BuildGVFSForLinux.sh script does not
perform any installation or packaging.

Co-authored-by: Ashe Connor <ashe@kivikakk.ee>
  • Loading branch information
chrisd8088 and kivikakk committed Jul 29, 2020
1 parent 683dbbf commit b304cf7
Show file tree
Hide file tree
Showing 34 changed files with 2,106 additions and 9 deletions.
169 changes: 167 additions & 2 deletions GVFS.sln

Large diffs are not rendered by default.

17 changes: 15 additions & 2 deletions GVFS/FastFetch/FastFetch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
<Version>$(GVFSVersion)</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(MSBuildRuntimeType)' == 'Core'">
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux>
<IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\GVFS.Common\GVFS.Common.csproj" />
<ProjectReference Include="..\GVFS.Virtualization\GVFS.Virtualization.csproj" />
Expand All @@ -35,14 +40,22 @@
</Compile>
</ItemGroup>
</When>
<Otherwise>
<When Condition="'$(IsLinux)' == 'true'">
<ItemGroup>
<ProjectReference Include="..\GVFS.Platform.Linux\GVFS.Platform.Linux.csproj" />
<Compile Include="..\GVFS.PlatformLoader\PlatformLoader.Linux.cs">
<Link>PlatformLoader.Linux.cs</Link>
</Compile>
</ItemGroup>
</When>
<When Condition="'$(IsOSX)' == 'true'">
<ItemGroup>
<ProjectReference Include="..\GVFS.Platform.Mac\GVFS.Platform.Mac.csproj" />
<Compile Include="..\GVFS.PlatformLoader\PlatformLoader.Mac.cs">
<Link>PlatformLoader.Mac.cs</Link>
</Compile>
</ItemGroup>
</Otherwise>
</When>
</Choose>

<ItemGroup>
Expand Down
113 changes: 113 additions & 0 deletions GVFS/GVFS.Hooks/GVFS.Hooks.Linux.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\GVFS.Build\GVFS.cs.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<AssemblyName>GVFS.Hooks</AssemblyName>
<TargetFramework>netcoreapp2.1</TargetFramework>
<Platforms>x64</Platforms>
<RunTimeIdentifiers>linux-x64</RunTimeIdentifiers>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<PropertyGroup>
<RootNamespace>GVFS.Hooks</RootNamespace>
<AssemblyName>GVFS.Hooks</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Version>$(GVFSVersion)</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Version>$(GVFSVersion)</Version>
</PropertyGroup>
<ItemGroup>
<Compile Remove="HooksPlatform\GVFSHooksPlatform.Mac.cs" />
<Compile Remove="HooksPlatform\GVFSHooksPlatform.Windows.cs" />
</ItemGroup>

<ItemGroup>
<!--
Files from GVFS.Common included as links here to prevent adding
project reference. The project reference leads to performance degradation
due to the other dependencies that come along with GVFS.Common.
-->
<Compile Include="..\GVFS.Common\ConsoleHelper.cs">
<Link>Common\ConsoleHelper.cs</Link>
</Compile>
<Compile Include="..\GVFS.Common\Git\GitConfigHelper.cs">
<Link>Common\Git\GitConfigHelper.cs</Link>
</Compile>
<Compile Include="..\GVFS.Common\Git\GitConfigSetting.cs">
<Link>Common\Git\GitConfigSetting.cs</Link>
</Compile>
<Compile Include="..\GVFS.Common\Git\GitVersion.cs">
<Link>Common\Git\GitVersion.cs</Link>
</Compile>
<Compile Include="..\GVFS.Common\GVFSConstants.cs">
<Link>Common\GVFSConstants.cs</Link>
</Compile>
<Compile Include="..\GVFS.Common\GVFSEnlistment.Shared.cs">
<Link>Common\GVFSEnlistment.Shared.cs</Link>
</Compile>
<Compile Include="..\GVFS.Common\GVFSLock.Shared.cs">
<Link>Common\GVFSLock.Shared.cs</Link>
</Compile>
<Compile Include="..\GVFS.Common\NamedPipes\BrokenPipeException.cs">
<Link>Common\NamedPipes\BrokenPipeException.cs</Link>
</Compile>
<Compile Include="..\GVFS.Common\NamedPipes\LockNamedPipeMessages.cs">
<Link>Common\NamedPipes\LockNamedPipeMessages.cs</Link>
</Compile>
<Compile Include="..\GVFS.Common\NamedPipes\NamedPipeClient.cs">
<Link>Common\NamedPipes\NamedPipeClient.cs</Link>
</Compile>
<Compile Include="..\GVFS.Common\NamedPipes\NamedPipeStreamReader.cs">
<Link>Common\NamedPipes\NamedPipeStreamReader.cs</Link>
</Compile>
<Compile Include="..\GVFS.Common\NamedPipes\NamedPipeStreamWriter.cs">
<Link>Common\NamedPipes\NamedPipeStreamWriter.cs</Link>
</Compile>
<Compile Include="..\GVFS.Common\NativeMethods.Shared.cs">
<Link>Common\NativeMethods.Shared.cs</Link>
</Compile>
<Compile Include="..\GVFS.Common\Paths.Shared.cs">
<Link>Common\Paths.Shared.cs</Link>
</Compile>
<Compile Include="..\GVFS.Common\ProcessHelper.cs">
<Link>Common\ProcessHelper.cs</Link>
</Compile>
<Compile Include="..\GVFS.Common\ProcessResult.cs">
<Link>Common\ProcessResult.cs</Link>
</Compile>
<Compile Include="..\GVFS.Common\ProductUpgraderInfo.Shared.cs" Link="Common\ProductUpgraderInfo.Shared.cs" />
<Compile Include="..\GVFS.Common\Tracing\EventLevel.cs">
<Link>Common\Tracing\EventLevel.cs</Link>
</Compile>
<Compile Include="..\GVFS.Common\Tracing\EventMetadata.cs">
<Link>Common\Tracing\EventMetadata.cs</Link>
</Compile>
<Compile Include="..\GVFS.Common\Tracing\EventOpcode.cs">
<Link>Common\Tracing\EventOpcode.cs</Link>
</Compile>
<Compile Include="..\GVFS.Common\Tracing\ITracer.cs">
<Link>Common\Tracing\ITracer.cs</Link>
</Compile>
<Compile Include="..\GVFS.Common\Tracing\Keywords.cs">
<Link>Common\Tracing\Keywords.cs</Link>
</Compile>
<Compile Include="..\GVFS.Platform.Linux\LinuxPlatform.Shared.cs">
<Link>"LinuxPlatform.Shared.cs"</Link>
</Compile>
<Compile Include="..\GVFS.Platform.POSIX\POSIXFileSystem.Shared.cs">
<Link>POSIX\POSIXFileSystem.Shared.cs</Link>
</Compile>
<Compile Include="..\GVFS.Platform.POSIX\POSIXPlatform.Shared.cs">
<Link>POSIX\POSIXPlatform.Shared.cs</Link>
</Compile>
</ItemGroup>

<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions GVFS/GVFS.Hooks/GVFS.Hooks.Mac.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<Version>$(GVFSVersion)</Version>
</PropertyGroup>
<ItemGroup>
<Compile Remove="HooksPlatform\GVFSHooksPlatform.Linux.cs" />
<Compile Remove="HooksPlatform\GVFSHooksPlatform.Windows.cs" />
</ItemGroup>

Expand Down
32 changes: 32 additions & 0 deletions GVFS/GVFS.Hooks/HooksPlatform/GVFSHooksPlatform.Linux.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using GVFS.Platform.Linux;

namespace GVFS.Hooks.HooksPlatform
{
public static partial class GVFSHooksPlatform
{
public static string GetUpgradeHighestAvailableVersionDirectory()
{
return LinuxPlatform.GetUpgradeHighestAvailableVersionDirectoryImplementation();
}

public static bool TryGetGVFSEnlistmentRoot(string directory, out string enlistmentRoot, out string errorMessage)
{
return LinuxPlatform.TryGetGVFSEnlistmentRootImplementation(directory, out enlistmentRoot, out errorMessage);
}

public static string GetNamedPipeName(string enlistmentRoot)
{
return LinuxPlatform.GetNamedPipeNameImplementation(enlistmentRoot);
}

public static string GetGitGuiBlockedMessage()
{
return "git gui is not supported in VFS for Git repos on Linux";
}

public static string GetUpgradeReminderNotification()
{
return LinuxPlatform.GetUpgradeReminderNotificationImplementation();
}
}
}
35 changes: 35 additions & 0 deletions GVFS/GVFS.Mount/GVFS.Mount.Linux.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\GVFS.Build\GVFS.cs.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<AssemblyName>GVFS.Mount</AssemblyName>
<TargetFramework>netcoreapp2.1</TargetFramework>
<Platforms>x64</Platforms>
<RunTimeIdentifiers>linux-x64</RunTimeIdentifiers>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Version>$(GVFSVersion)</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Version>$(GVFSVersion)</Version>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\GVFS.PlatformLoader\PlatformLoader.Linux.cs">
<Link>PlatformLoader.Linux.cs</Link>
</Compile>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\GVFS.Platform.Linux\GVFS.Platform.Linux.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.1.1-beta" />
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

</Project>
34 changes: 34 additions & 0 deletions GVFS/GVFS.Platform.Linux/GVFS.Platform.Linux.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\GVFS.Build\GVFS.cs.props" />
<PropertyGroup>
<TargetFrameworks>netcoreapp2.1;netstandard2.0</TargetFrameworks>
<Platforms>x64</Platforms>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Version>$(GVFSVersion)</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Version>$(GVFSVersion)</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Version)' == ''">
<Version>$(GVFSVersion)</Version>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\ProjFS.Linux\PrjFSLib.Linux.Managed\PrjFSLib.Linux.Managed.csproj" />
<ProjectReference Include="..\GVFS.Virtualization\GVFS.Virtualization.csproj" />
<ProjectReference Include="..\GVFS.Common\GVFS.Common.csproj" />
<ProjectReference Include="..\GVFS.Platform.POSIX\GVFS.Platform.POSIX.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.1.1-beta" />
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>
27 changes: 27 additions & 0 deletions GVFS/GVFS.Platform.Linux/LinuxDiskLayoutUpgradeData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using GVFS.Common;
using GVFS.DiskLayoutUpgrades;

namespace GVFS.Platform.Linux
{
public class LinuxDiskLayoutUpgradeData : IDiskLayoutUpgradeData
{
public DiskLayoutUpgrade[] Upgrades
{
get
{
return new DiskLayoutUpgrade[0];
}
}

public DiskLayoutVersion Version => new DiskLayoutVersion(
currentMajorVersion: 19,
currentMinorVersion: 0,
minimumSupportedMajorVersion: 19);

public bool TryParseLegacyDiskLayoutVersion(string dotGVFSPath, out int majorVersion)
{
majorVersion = 0;
return false;
}
}
}
Loading

0 comments on commit b304cf7

Please sign in to comment.