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
174 changes: 174 additions & 0 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
1 change: 1 addition & 0 deletions GVFS/GVFS.FunctionalTests/Categories.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public static class Categories
public const string GitCommands = "GitCommands";

public const string WindowsOnly = "WindowsOnly";
public const string LinuxOnly = "LinuxOnly";
public const string MacOnly = "MacOnly";

public static class MacTODO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ public abstract class FileSystemRunner
new object[] { new BashRunner() },
};

public static object[] AllLinuxRunners { get; } =
new[]
{
new object[] { new SystemIORunner() },
new object[] { new BashRunner() },
};

public static object[] AllMacRunners { get; } =
new[]
{
Expand Down
15 changes: 11 additions & 4 deletions GVFS/GVFS.FunctionalTests/FileSystemRunners/SystemIORunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public override void CreateHardLink(string newLinkFilePath, string existingFileP
}
else
{
MacCreateHardLink(existingFilePath, newLinkFilePath).ShouldEqual(0, $"Failed to create hard link: {Marshal.GetLastWin32Error()}");
POSIXCreateHardLink(existingFilePath, newLinkFilePath).ShouldEqual(0, $"Failed to create hard link: {Marshal.GetLastWin32Error()}");
}
}

Expand Down Expand Up @@ -214,20 +214,27 @@ public override void ChangeMode(string path, ushort mode)
{
throw new NotSupportedException();
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
LinuxChmod(path, (uint)mode).ShouldEqual(0, $"Failed to chmod: {Marshal.GetLastWin32Error()}");
}
else
{
Chmod(path, mode).ShouldEqual(0, $"Failed to chmod: {Marshal.GetLastWin32Error()}");
MacChmod(path, mode).ShouldEqual(0, $"Failed to chmod: {Marshal.GetLastWin32Error()}");
}
}

[DllImport("kernel32", SetLastError = true)]
private static extern bool MoveFileEx(string existingFileName, string newFileName, int flags);

[DllImport("libc", EntryPoint = "link", SetLastError = true)]
private static extern int MacCreateHardLink(string oldPath, string newPath);
private static extern int POSIXCreateHardLink(string oldPath, string newPath);

[DllImport("libc", EntryPoint = "chmod", SetLastError = true)]
private static extern int LinuxChmod(string pathname, uint mode);

[DllImport("libc", EntryPoint = "chmod", SetLastError = true)]
private static extern int Chmod(string pathname, ushort mode);
private static extern int MacChmod(string pathname, ushort mode);

[DllImport("libc", EntryPoint = "rename", SetLastError = true)]
private static extern int Rename(string oldPath, string newPath);
Expand Down
2 changes: 1 addition & 1 deletion GVFS/GVFS.FunctionalTests/GVFS.FunctionalTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<!-- see https://github.com/NuGet/Home/issues/4837 for reference to CopyLocalLockFileAssemblies -->
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<RuntimeIdentifiers>win-x64;osx-x64</RuntimeIdentifiers>
<RuntimeIdentifiers>win-x64;osx-x64;linux-x64</RuntimeIdentifiers>
</PropertyGroup>

<PropertyGroup>
Expand Down
13 changes: 13 additions & 0 deletions GVFS/GVFS.FunctionalTests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ public static void Main(string[] args)
{
GVFSTestConfig.FileSystemRunners = FileSystemRunners.FileSystemRunner.AllWindowsRunners;
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
GVFSTestConfig.FileSystemRunners = FileSystemRunners.FileSystemRunner.AllLinuxRunners;
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
GVFSTestConfig.FileSystemRunners = FileSystemRunners.FileSystemRunner.AllMacRunners;
Expand Down Expand Up @@ -84,6 +88,15 @@ public static void Main(string[] args)
includeCategories.Remove(Categories.ExtraCoverage);
}

if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
excludeCategories.Add(Categories.WindowsOnly);
}
else
{
excludeCategories.Add(Categories.LinuxOnly);
}

if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
excludeCategories.Add(Categories.MacTODO.FailsOnBuildAgent);
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
12 changes: 12 additions & 0 deletions GVFS/GVFS.Hooks/HooksPlatform/GVFSHooksPlatform.Linux.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using GVFS.Platform.Linux;

namespace GVFS.Hooks.HooksPlatform
{
public static partial class GVFSHooksPlatform
{
public static string GetDataRootForGVFS()
{
return LinuxPlatform.GetDataRootForGVFSImplementation();
}
}
}
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>
3 changes: 3 additions & 0 deletions GVFS/GVFS.NativeHooks.Common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#ifdef __APPLE__
typedef std::string PATH_STRING;
typedef int PIPE_HANDLE;
#elif __gnu_linux__
typedef std::string PATH_STRING;
typedef int PIPE_HANDLE;
#elif _WIN32
typedef std::wstring PATH_STRING;
typedef HANDLE PIPE_HANDLE;
Expand Down
40 changes: 40 additions & 0 deletions GVFS/GVFS.Platform.Linux/GVFS.Platform.Linux.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<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>

<!-- TODO(Linux):
<ItemGroup Condition="'$(OS)' != 'Windows_NT' And '$(CopyPrjFS)' == 'true'">
<None Include="$(BuildOutputDir)\ProjFS.Linux\Native\$(Configuration)\libprojfs.so" CopyToOutputDirectory="PreserveNewest" />
</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: 18,
currentMinorVersion: 0,
minimumSupportedMajorVersion: 18);

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