(cherry picked from commit fb130fd0e916262651a8ce97f4263f05117b91cc)pull/2307/head
parent
f1ba8a0d27
commit
2cc114c037
@ -1,11 +1,4 @@
|
||||
<Project>
|
||||
<!-- below net4.7.1 the new portable pdb format has no line numbers, pdb to mdb probably doesn't like it either -->
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'net462'">
|
||||
<DebugType>full</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="Targets/PublishAllRids.targets" />
|
||||
<Import Project="Targets/FixBindingRedirects.targets" />
|
||||
<Import Project="Targets/MonoFacades.targets" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and !$(RuntimeIdentifier.StartsWith('win'))" />
|
||||
<Import Project="Targets/CopyRuntimes.targets" />
|
||||
</Project>
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,3 +0,0 @@
|
||||
Copied from mono/4.5/Facades of the mono 5.4 release.
|
||||
These are the mono version of the dotnet Core TypeForwardedTo assemblies.
|
||||
Using these assemblies is no longer necessary once we reach mono 5.18 as minimum version
|
@ -1,63 +0,0 @@
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Core.HealthCheck.Checks;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
using static NzbDrone.Core.HealthCheck.Checks.MonoDebugCheck;
|
||||
|
||||
namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||
{
|
||||
[TestFixture]
|
||||
public class MonoDebugCheckFixture : CoreTest<MonoDebugCheck>
|
||||
{
|
||||
private void GivenHasStackFrame(bool hasStackFrame)
|
||||
{
|
||||
Mocker.GetMock<StackFrameHelper>()
|
||||
.Setup(f => f.HasStackFrameInfo())
|
||||
.Returns(hasStackFrame);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_ok_if_not_mono()
|
||||
{
|
||||
if (PlatformInfo.IsMono)
|
||||
{
|
||||
throw new IgnoreException("non mono specific test");
|
||||
}
|
||||
|
||||
Subject.Check().ShouldBeOk();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_ok_if_not_debug()
|
||||
{
|
||||
MonoOnly();
|
||||
|
||||
GivenHasStackFrame(false);
|
||||
|
||||
Subject.Check().ShouldBeOk();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_log_warning_if_not_debug()
|
||||
{
|
||||
MonoOnly();
|
||||
|
||||
GivenHasStackFrame(false);
|
||||
|
||||
Subject.Check();
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_ok_if_debug()
|
||||
{
|
||||
MonoOnly();
|
||||
|
||||
GivenHasStackFrame(true);
|
||||
|
||||
Subject.Check().ShouldBeOk();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Processes;
|
||||
using NzbDrone.Core.HealthCheck.Checks;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||
{
|
||||
[TestFixture]
|
||||
public class MonoNotNetCoreCheckFixture : CoreTest<MonoNotNetCoreCheck>
|
||||
{
|
||||
[Test]
|
||||
[Platform(Exclude = "Mono")]
|
||||
public void should_return_ok_if_net_core()
|
||||
{
|
||||
Subject.Check().ShouldBeOk();
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Platform("Mono")]
|
||||
public void should_log_warning_if_mono()
|
||||
{
|
||||
Subject.Check().ShouldBeWarning();
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Platform("Mono")]
|
||||
public void should_return_ok_if_bsd()
|
||||
{
|
||||
Mocker.GetMock<IProcessProvider>()
|
||||
.Setup(x => x.StartAndCapture("uname", null, null))
|
||||
.Returns(new ProcessOutput
|
||||
{
|
||||
Lines = new List<ProcessOutputLine>
|
||||
{
|
||||
new ProcessOutputLine(ProcessOutputLevel.Standard, "FreeBSD")
|
||||
}
|
||||
});
|
||||
Subject.Check().ShouldBeOk();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Core.HealthCheck.Checks;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||
{
|
||||
[TestFixture]
|
||||
public class MonoVersionCheckFixture : CoreTest<MonoVersionCheck>
|
||||
{
|
||||
private void GivenOutput(string version)
|
||||
{
|
||||
MonoOnly();
|
||||
|
||||
Mocker.GetMock<IPlatformInfo>()
|
||||
.SetupGet(s => s.Version)
|
||||
.Returns(new Version(version));
|
||||
}
|
||||
|
||||
[TestCase("5.18")]
|
||||
[TestCase("5.20")]
|
||||
public void should_return_ok(string version)
|
||||
{
|
||||
GivenOutput(version);
|
||||
|
||||
Subject.Check().ShouldBeOk();
|
||||
}
|
||||
|
||||
[TestCase("5.16")]
|
||||
public void should_return_notice(string version)
|
||||
{
|
||||
GivenOutput(version);
|
||||
|
||||
Subject.Check().ShouldBeNotice();
|
||||
}
|
||||
|
||||
[TestCase("5.4")]
|
||||
[TestCase("5.8")]
|
||||
public void should_return_warning(string version)
|
||||
{
|
||||
GivenOutput(version);
|
||||
|
||||
Subject.Check().ShouldBeWarning();
|
||||
}
|
||||
|
||||
[TestCase("2.10.2")]
|
||||
[TestCase("2.10.8.1")]
|
||||
[TestCase("3.0.0.1")]
|
||||
[TestCase("3.2.0.1")]
|
||||
[TestCase("3.2.1")]
|
||||
[TestCase("3.2.7")]
|
||||
[TestCase("3.6.1")]
|
||||
[TestCase("3.8")]
|
||||
[TestCase("3.10")]
|
||||
[TestCase("4.0.0.0")]
|
||||
[TestCase("4.2")]
|
||||
[TestCase("4.4.0")]
|
||||
[TestCase("4.4.1")]
|
||||
public void should_return_error(string version)
|
||||
{
|
||||
GivenOutput(version);
|
||||
|
||||
Subject.Check().ShouldBeError();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
using System.Diagnostics;
|
||||
using NLog;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Extensions;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
public class MonoDebugCheck : HealthCheckBase
|
||||
{
|
||||
private readonly Logger _logger;
|
||||
private readonly StackFrameHelper _stackFrameHelper;
|
||||
|
||||
public override bool CheckOnSchedule => false;
|
||||
|
||||
public MonoDebugCheck(Logger logger, StackFrameHelper stackFrameHelper)
|
||||
{
|
||||
_logger = logger;
|
||||
_stackFrameHelper = stackFrameHelper;
|
||||
}
|
||||
|
||||
public class StackFrameHelper
|
||||
{
|
||||
public virtual bool HasStackFrameInfo()
|
||||
{
|
||||
var stackTrace = new StackTrace(true);
|
||||
|
||||
return stackTrace.FrameCount > 0 && stackTrace.GetFrame(0).GetFileName().IsNotNullOrWhiteSpace();
|
||||
}
|
||||
}
|
||||
|
||||
public override HealthCheck Check()
|
||||
{
|
||||
if (!PlatformInfo.IsMono)
|
||||
{
|
||||
return new HealthCheck(GetType());
|
||||
}
|
||||
|
||||
if (!_stackFrameHelper.HasStackFrameInfo())
|
||||
{
|
||||
_logger.Warn("Mono is not running with --debug switch");
|
||||
return new HealthCheck(GetType());
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
using System;
|
||||
using NLog;
|
||||
using NLog.Fluent;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Instrumentation.Extensions;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
public class MonoTlsCheck : HealthCheckBase
|
||||
{
|
||||
private readonly IPlatformInfo _platformInfo;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public MonoTlsCheck(IPlatformInfo platformInfo, Logger logger)
|
||||
{
|
||||
_platformInfo = platformInfo;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public override HealthCheck Check()
|
||||
{
|
||||
if (!PlatformInfo.IsMono)
|
||||
{
|
||||
return new HealthCheck(GetType());
|
||||
}
|
||||
|
||||
var monoVersion = _platformInfo.Version;
|
||||
|
||||
if (monoVersion >= new Version("5.8.0") && Environment.GetEnvironmentVariable("MONO_TLS_PROVIDER") == "legacy")
|
||||
{
|
||||
_logger.Debug()
|
||||
.Message("Mono version {0} and legacy TLS provider is selected, recommending user to switch to btls.", monoVersion)
|
||||
.WriteSentryDebug("LegacyTlsProvider", monoVersion.ToString())
|
||||
.Write();
|
||||
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Lidarr Mono 4.x tls workaround still enabled, consider removing MONO_TLS_PROVIDER=legacy environment option");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType());
|
||||
}
|
||||
|
||||
public override bool CheckOnSchedule => false;
|
||||
}
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
using System;
|
||||
using NLog;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
public class MonoVersionCheck : HealthCheckBase
|
||||
{
|
||||
private readonly IPlatformInfo _platformInfo;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public MonoVersionCheck(IPlatformInfo platformInfo, Logger logger)
|
||||
{
|
||||
_platformInfo = platformInfo;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public override HealthCheck Check()
|
||||
{
|
||||
if (!PlatformInfo.IsMono)
|
||||
{
|
||||
return new HealthCheck(GetType());
|
||||
}
|
||||
|
||||
var monoVersion = _platformInfo.Version;
|
||||
|
||||
// Known buggy Mono versions
|
||||
if (monoVersion == new Version("4.4.0") || monoVersion == new Version("4.4.1"))
|
||||
{
|
||||
_logger.Debug("Mono version {0}", monoVersion);
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
$"Currently installed Mono version {monoVersion} has a bug that causes issues connecting to indexers/download clients. You should upgrade to a higher version",
|
||||
"#currently_installed_mono_version_is_old_and_unsupported");
|
||||
}
|
||||
|
||||
// Currently best stable Mono version (5.18 gets us .net 4.7.2 support)
|
||||
var bestVersion = new Version("5.20");
|
||||
var targetVersion = new Version("5.18");
|
||||
if (monoVersion >= targetVersion)
|
||||
{
|
||||
_logger.Debug("Mono version is {0} or better: {1}", targetVersion, monoVersion);
|
||||
return new HealthCheck(GetType());
|
||||
}
|
||||
|
||||
// Stable Mono versions
|
||||
var stableVersion = new Version("5.16");
|
||||
if (monoVersion >= stableVersion)
|
||||
{
|
||||
_logger.Debug("Mono version is {0} or better: {1}", stableVersion, monoVersion);
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Notice,
|
||||
$"Currently installed Mono version {monoVersion} is supported but upgrading to {bestVersion} is recommended.",
|
||||
"#currently_installed_mono_version_is_supported_but_upgrading_is_recommended");
|
||||
}
|
||||
|
||||
// Old but supported Mono versions, there are known bugs
|
||||
var supportedVersion = new Version("5.4");
|
||||
if (monoVersion >= supportedVersion)
|
||||
{
|
||||
_logger.Debug("Mono version is {0} or better: {1}", supportedVersion, monoVersion);
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Warning,
|
||||
$"Currently installed Mono version {monoVersion} is supported but has some known issues. Please upgrade Mono to version {bestVersion}.",
|
||||
"#currently_installed_mono_version_is_supported_but_upgrading_is_recommended");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType(),
|
||||
HealthCheckResult.Error,
|
||||
$"Currently installed Mono version {monoVersion} is old and unsupported. Please upgrade Mono to version {bestVersion}.",
|
||||
"#currently_installed_mono_version_is_old_and_unsupported");
|
||||
}
|
||||
|
||||
public override bool CheckOnSchedule => false;
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
<Project>
|
||||
|
||||
<Target Name="FixBindingRedirects"
|
||||
AfterTargets="ResolveAssemblyReferences"
|
||||
BeforeTargets="GenerateBindingRedirects">
|
||||
|
||||
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and '$(RuntimeIdentifier)' == 'linux-x64'">
|
||||
<SuggestedBindingRedirects Remove="System.Net.Http, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and $(RuntimeIdentifier.StartsWith('win'))">
|
||||
<SuggestedBindingRedirects Remove="System.Runtime.InteropServices.RuntimeInformation, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</ItemGroup>
|
||||
|
||||
</Target>
|
||||
|
||||
</Project>
|
@ -1,52 +0,0 @@
|
||||
<Project>
|
||||
|
||||
<!--
|
||||
When compiling without mono, but targeting mono we need to replace some assemblies with facades to make it run on mono.
|
||||
This MonoFacades.targets file should only be included if not targeting windows and targeting net4x.
|
||||
|
||||
Warning: We ONLY support facades that reside directly in MonoFacadesPath, otherwise the joining of items becomes complicated.
|
||||
|
||||
Any MonoFacade listed that doesn't exist on disk will be removed instead of replaced.
|
||||
|
||||
See: https://github.com/mono/mono/blob/master/tools/nuget-hash-extractor/download.sh
|
||||
That list defines assemblies that are prohibited from being loaded from the appdir, instead loading from mono GAC.
|
||||
-->
|
||||
|
||||
<PropertyGroup>
|
||||
<MonoFacadesPath>$(MSBuildThisFileDirectory)..\Libraries\Mono\</MonoFacadesPath>
|
||||
<ResolveReferencesDependsOn>
|
||||
$(ResolveReferencesDependsOn);
|
||||
SubstituteMonoFacadesBuild
|
||||
</ResolveReferencesDependsOn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<MonoFacade Include="$(MonoFacadesPath)*.dll" />
|
||||
<MonoFacade Include="System.IO.Compression.dll" />
|
||||
<MonoFacade Include="System.Net.Http.dll" />
|
||||
|
||||
<!-- List of MonoFacade by FileName -->
|
||||
<MonoFacade_Facade Include="@(MonoFacade->'%(Filename)%(Extension)')" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="SubstituteMonoFacadesBuild"
|
||||
AfterTargets="ResolveAssemblyReferences"
|
||||
BeforeTargets="GenerateBindingRedirects">
|
||||
|
||||
<ItemGroup>
|
||||
<!-- List of ReferenceCopyLocalPaths by FileName and filter out those without Facades -->
|
||||
<MonoFacade_Resolved Include="@(ReferenceCopyLocalPaths->'%(Filename)%(Extension)')">
|
||||
<OriginalIdentity>%(ReferenceCopyLocalPaths.Identity)</OriginalIdentity>
|
||||
<MonoFacadeIdentity>$(MonoFacadesPath)%(Filename)%(Extension)</MonoFacadeIdentity>
|
||||
</MonoFacade_Resolved>
|
||||
<MonoFacade_Unrelated Include="@(MonoFacade_Resolved)" />
|
||||
<MonoFacade_Unrelated Remove="@(MonoFacade_Facade)" />
|
||||
<MonoFacade_Resolved Remove="@(MonoFacade_Unrelated)" />
|
||||
|
||||
<!-- Modify the actual copy list -->
|
||||
<ReferenceCopyLocalPaths Remove="@(MonoFacade_Resolved->'%(OriginalIdentity)')" />
|
||||
<ReferenceCopyLocalPaths Include="@(MonoFacade_Resolved->'%(MonoFacadeIdentity)')" Condition="Exists('%(MonoFacade_Resolved.MonoFacadeIdentity)')" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
</Project>
|
Loading…
Reference in new issue