Skip to content

Commit

Permalink
Fix empty file resolution on MacOs (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Apr 7, 2020
1 parent c9278b4 commit eb83c36
Show file tree
Hide file tree
Showing 24 changed files with 98 additions and 25 deletions.
4 changes: 4 additions & 0 deletions docs/diff-tool.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ This behavior is currently supported on Windows. On Linux and OSX, diff tool ins

* `%ProgramFiles%\JetBrains\JetBrains Rider *\bin\rider64.exe`

### OSX scanned paths:

* `/Applications/Rider*/Contents/MacOS/rider`

## [VisualStudio](https://docs.microsoft.com/en-us/visualstudio/ide/reference/diff)

* IsMdi: True
Expand Down
5 changes: 4 additions & 1 deletion src/DiffEngine.Tests/DiffEngine.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net48</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
<TargetFrameworks>netcoreapp3.1;net48</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
Expand Down
4 changes: 4 additions & 0 deletions src/DiffEngine.Tests/DiffToolsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public void WriteFoundTools()
writer.WriteLine($@" * `{path}`");
}
}

if (!tool.BinaryExtensions.Any())
{
continue;
Expand Down Expand Up @@ -114,6 +115,8 @@ public void ExtensionLookup()
Debug.WriteLine($"{tool.Key}: {tool.Value.Name}");
}
}

#if DEBUG
[Fact]
public void TryFind()
{
Expand All @@ -132,6 +135,7 @@ public void TryFind()
Assert.False(DiffTools.TryFind(DiffTool.Kaleidoscope, "txt", out resolved));
Assert.Null(resolved);
}
#endif

public DiffToolsTest(ITestOutputHelper output) :
base(output)
Expand Down
6 changes: 4 additions & 2 deletions src/DiffEngine.Tests/ProcessCleanupTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Diagnostics;
#if DEBUG
using System.Diagnostics;
using System.Linq;
using DiffEngine;
using VerifyXunit;
Expand All @@ -22,4 +23,5 @@ public ProcessCleanupTests(ITestOutputHelper output) :
base(output)
{
}
}
}
#endif
4 changes: 4 additions & 0 deletions src/DiffEngine.Tests/diffTools.include.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

* `%ProgramFiles%\JetBrains\JetBrains Rider *\bin\rider64.exe`

### OSX scanned paths:

* `/Applications/Rider*/Contents/MacOS/rider`

## [VisualStudio](https://docs.microsoft.com/en-us/visualstudio/ide/reference/diff)

* IsMdi: True
Expand Down
5 changes: 4 additions & 1 deletion src/DiffEngine/DiffEngine.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
<TargetFrameworks>netstandard2.0;netstandard2.1;net461</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Verify\Helpers\Guard.cs" Link="Guard.cs" />
<PackageReference Include="EmptyFiles" Version="1.0.0" PrivateAssets="None" />
<PackageReference Include="EmptyFiles" Version="1.0.1" PrivateAssets="None" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" Condition="$(Configuration) == 'Release'" />
<PackageReference Include="ProjectDefaults" Version="1.0.42" PrivateAssets="All" />
<PackageReference Include="Nullable" Version="1.2.1" PrivateAssets="All" />
Expand Down
1 change: 0 additions & 1 deletion src/DiffEngine/ProcessCleanup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ static ProcessCleanup()

public static void Refresh()
{
Thread.Sleep(100);
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
commands = FindAll().ToList();
Expand Down
3 changes: 2 additions & 1 deletion src/DiffEngine/ToolDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class ToolDefinition
public string[] OsxExePaths { get; }
public bool SupportsText { get; }

public ToolDefinition(DiffTool name,
public ToolDefinition(
DiffTool name,
string url,
bool supportsAutoRefresh,
bool isMdi,
Expand Down
2 changes: 1 addition & 1 deletion src/FakeDiffTool/FakeDiffTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<AppendTargetFrameworkToOutputPath >false</AppendTargetFrameworkToOutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>bin</OutputPath>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Verify.Bunit/Verify.Bunit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ItemGroup>
<Content Include="buildMultiTargeting.targets" PackagePath="buildMultiTargeting\Verify.Bunit.targets" />
<Content Include="build.targets" PackagePath="build\Verify.Bunit.targets" />
<PackageReference Include="EmptyFiles" Version="1.0.0" PrivateAssets="None" />
<PackageReference Include="EmptyFiles" Version="1.0.1" PrivateAssets="None" />
<PackageReference Include="xunit.assert" Version="2.4.1" />
<PackageReference Include="XunitContext" Version="1.9.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
Expand Down
17 changes: 17 additions & 0 deletions src/Verify.Integration.Tests/AssemblyLocation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.IO;

static class AssemblyLocation
{
static AssemblyLocation()
{
var assembly = typeof(AssemblyLocation).Assembly;

var uri = new UriBuilder(assembly.CodeBase!);
var path = Uri.UnescapeDataString(uri.Path);

CurrentDirectory = Path.GetDirectoryName(path)!;
}

public static string CurrentDirectory;
}
8 changes: 5 additions & 3 deletions src/Verify.Integration.Tests/Tests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#if DEBUG
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
Expand All @@ -21,7 +22,7 @@ public partial class Tests :
static Tests()
{
BuildServerDetector.Detected = false;
var diffToolPath = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, "../../../../FakeDiffTool/bin/FakeDiffTool.exe"));
var diffToolPath = Path.GetFullPath(Path.Combine(AssemblyLocation.CurrentDirectory, "../../../../FakeDiffTool/bin/FakeDiffTool.exe"));
tool = new ResolvedDiffTool(
name: DiffTool.VisualStudio,
exePath: diffToolPath,
Expand Down Expand Up @@ -131,4 +132,5 @@ public Tests(ITestOutputHelper output) :
{
ClipboardCapture.Clear();
}
}
}
#endif
6 changes: 4 additions & 2 deletions src/Verify.Integration.Tests/Tests_Single.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#if DEBUG
using System;
using System.IO;
using System.Threading.Tasks;
using DiffEngine;
Expand Down Expand Up @@ -132,4 +133,5 @@ async Task InitialVerify(Func<object> target, bool hasMatchingDiffTool, VerifySe
AssertExists(pair.Received);
}
}
}
}
#endif
7 changes: 5 additions & 2 deletions src/Verify.Integration.Tests/Tests_Split.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.IO;
#if DEBUG

using System.IO;
using System.Threading.Tasks;
using DiffEngine;
using Verify;
Expand Down Expand Up @@ -122,4 +124,5 @@ async Task InitialVerifySplit(TypeToSplit target, bool hasMatchingDiffTool, Veri
AssertExists(file2.Received);
}
}
}
}
#endif
5 changes: 4 additions & 1 deletion src/Verify.MSTest.Tests/Verify.MSTest.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net48</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
<TargetFrameworks>netcoreapp3.1;net48</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
Expand Down
7 changes: 5 additions & 2 deletions src/Verify.MSTest/Verify.MSTest.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net472</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<NoWarn>$(NoWarn);CS0436</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
<TargetFrameworks>netstandard2.0;netstandard2.1;net472</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<Content Include="buildMultiTargeting.targets" PackagePath="buildMultiTargeting\Verify.MSTest.targets" />
<Content Include="build.targets" PackagePath="build\Verify.MSTest.targets" />
<Compile Include="..\Shared\*.cs" />
<PackageReference Include="EmptyFiles" Version="1.0.0" PrivateAssets="None" />
<PackageReference Include="EmptyFiles" Version="1.0.1" PrivateAssets="None" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ProjectDefaults" Version="1.0.42" PrivateAssets="All" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.1" />
Expand Down
5 changes: 4 additions & 1 deletion src/Verify.NUnit.Tests/Verify.NUnit.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net48</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
<TargetFrameworks>netcoreapp3.1;net48</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
Expand Down
5 changes: 4 additions & 1 deletion src/Verify.NUnit/Verify.NUnit.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
<TargetFrameworks>netstandard2.0;netstandard2.1;net472</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<Content Include="build.targets" PackagePath="build\Verify.NUnit.targets" />
<Content Include="buildMultiTargeting.targets" PackagePath="buildMultiTargeting\Verify.NUnit.targets" />
<Compile Include="..\Shared\*.cs" />
<PackageReference Include="EmptyFiles" Version="1.0.0" PrivateAssets="None" />
<PackageReference Include="EmptyFiles" Version="1.0.1" PrivateAssets="None" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ProjectDefaults" Version="1.0.42" PrivateAssets="All" />
Expand Down
2 changes: 1 addition & 1 deletion src/Verify.Tests/Converters/ExtensionConverterTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if(NETCOREAPP3_1)
#if(NETCOREAPP3_1 && DEBUG)
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
Expand Down
8 changes: 7 additions & 1 deletion src/Verify.Tests/Verify.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net48</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<NoWarn>CS8002</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
<TargetFrameworks>netcoreapp3.1;net48</TargetFrameworks>
</PropertyGroup>
<ItemGroup Condition=" '$(OS)' != 'Windows_NT' ">
<Compile Remove="Converters\TypeConverterTests.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Shipwreck.Phash.Bitmaps" Version="0.5.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
Expand Down
5 changes: 4 additions & 1 deletion src/Verify.Xunit.Tests/Verify.Xunit.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net48</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
<TargetFrameworks>netcoreapp3.1;net48</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
Expand Down
5 changes: 4 additions & 1 deletion src/Verify.Xunit/Verify.Xunit.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
<TargetFrameworks>netstandard2.0;netstandard2.1;net472</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<Content Include="build.targets" PackagePath="build\Verify.Xunit.targets" />
<Content Include="buildMultiTargeting.targets" PackagePath="buildMultiTargeting\Verify.Xunit.targets" />
<PackageReference Include="EmptyFiles" Version="1.0.0" PrivateAssets="None" />
<PackageReference Include="EmptyFiles" Version="1.0.1" PrivateAssets="None" />
<PackageReference Include="xunit.assert" Version="2.4.1" />
<PackageReference Include="XunitContext" Version="1.9.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
Expand Down
3 changes: 3 additions & 0 deletions src/Verify/Verify.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
<TargetFrameworks>netstandard2.0;netstandard2.1;net472</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
Expand Down
4 changes: 3 additions & 1 deletion src/appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
image: Visual Studio 2019
image:
- macos
- Visual Studio 2019
skip_commits:
message: /doco|Merge pull request.*/
build_script:
Expand Down

0 comments on commit eb83c36

Please sign in to comment.