From e82b54994e4a2900594f738ed5c19b1c16da798a Mon Sep 17 00:00:00 2001 From: flightlevel Date: Thu, 14 Jun 2018 19:18:17 +1000 Subject: [PATCH] Update build for Mono --- build.cake | 44 ++++++++++++++++++-- src/Jackett.Server/Jackett.Server.csproj | 12 ++++++ src/Jackett.Server/Services/ServerService.cs | 5 ++- 3 files changed, 56 insertions(+), 5 deletions(-) diff --git a/build.cake b/build.cake index eb33d2f37..43b3115b5 100644 --- a/build.cake +++ b/build.cake @@ -149,12 +149,11 @@ Task("Package-Full-Framework") Information("Full Framwork Packaging Completed"); }); -Task("Experimental") +Task("Experimental-DotNetCore") .IsDependentOn("Clean") .Does(() => { string serverProjectPath = "./src/Jackett.Server/Jackett.Server.csproj"; - string serviceProjectPath = "./src/Jackett.Service.Windows/Jackett.Service.Windows.csproj"; DotNetCorePublish(serverProjectPath, "netcoreapp2.1", "win-x86"); DotNetCorePublish(serverProjectPath, "netcoreapp2.1", "linux-x64"); @@ -163,12 +162,49 @@ Task("Experimental") Zip("./BuildOutput/Experimental/netcoreapp2.1/win-x86", $"./{artifactsDirName}/Experimental.netcoreapp.win-x86.zip"); Zip("./BuildOutput/Experimental/netcoreapp2.1/osx-x64", $"./{artifactsDirName}/Experimental.netcoreapp.osx-x64.zip"); Gzip("./BuildOutput/Experimental/netcoreapp2.1/linux-x64", $"./{artifactsDirName}", "Jackett", "Experimental.netcoreapp.linux-x64.tar.gz"); + }); +Task("Experimental-Kestrel-Windows-Full-Framework") + .IsDependentOn("Clean") + .Does(() => + { + string serviceProjectPath = "./src/Jackett.Service.Windows/Jackett.Service.Windows.csproj"; + DotNetCorePublish(serviceProjectPath, "net461", "win7-x86"); - DotNetCorePublish(serverProjectPath, "net461", "linux-x64"); Zip("./BuildOutput/Experimental/net461/win7-x86", $"./{artifactsDirName}/Experimental.net461.win7-x86.zip"); - Gzip("./BuildOutput/Experimental/net461/linux-x64", $"./{artifactsDirName}", "Jackett", "Experimental.mono.linux-x64.tar.gz"); + }); + +Task("Experimental-Kestrel-Mono-FullFramework") + .IsDependentOn("Clean") + .Does(() => + { + string serverProjectPath = "./src/Jackett.Server/Jackett.Server.csproj"; + string buildOutputPath = "./BuildOutput/Experimental/net461/linux-x64"; + + DotNetCorePublish(serverProjectPath, "net461", "linux-x64"); + CopyFiles("./src/Jackett.Updater/bin/" + configuration + "/JackettUpdater.*", buildOutputPath + "/Jackett"); + + //There is an issue with Mono 5.8 (fixed in Mono 5.12) where its expecting to use its own patched version of System.Net.Http.dll, instead of the version supplied in folder + //https://github.com/dotnet/corefx/issues/19914 + //https://bugzilla.xamarin.com/show_bug.cgi?id=60315 + //The workaround is to delete System.Net.Http.dll and patch the .exe.config file + + DeleteFile(buildOutputPath + "/Jackett/System.Net.Http.dll"); + + var configFile = File(buildOutputPath + "/Jackett/JackettConsole.exe.config"); + XmlPoke(configFile, "configuration/runtime/*[name()='assemblyBinding']/*[name()='dependentAssembly']/*[name()='assemblyIdentity'][@name='System.Net.Http']/../*[name()='bindingRedirect']/@newVersion", "4.0.0.0"); + + Gzip("./BuildOutput/Experimental/net461/linux-x64", $"./{artifactsDirName}", "Jackett", "Experimental.Jackett.Binaries.Mono.tar.gz"); + }); + +Task("Experimental") + .IsDependentOn("Experimental-DotNetCore") + .IsDependentOn("Experimental-Kestrel-Windows-Full-Framework") + .IsDependentOn("Experimental-Kestrel-Mono-FullFramework") + .Does(() => + { + Information("Experimental builds completed"); }); Task("Appveyor-Push-Artifacts") diff --git a/src/Jackett.Server/Jackett.Server.csproj b/src/Jackett.Server/Jackett.Server.csproj index 623f93167..12cb6b32a 100644 --- a/src/Jackett.Server/Jackett.Server.csproj +++ b/src/Jackett.Server/Jackett.Server.csproj @@ -42,4 +42,16 @@ + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + diff --git a/src/Jackett.Server/Services/ServerService.cs b/src/Jackett.Server/Services/ServerService.cs index 6bb933294..60973a540 100644 --- a/src/Jackett.Server/Services/ServerService.cs +++ b/src/Jackett.Server/Services/ServerService.cs @@ -135,8 +135,11 @@ namespace Jackett.Server.Services var monoVersionO = new Version(monoVersion.Split(' ')[0]); - if (monoVersionO.Major < 5 || (monoVersionO.Major == 5 && monoVersionO.Minor < 4)) + if (monoVersionO.Major < 5 || (monoVersionO.Major == 5 && monoVersionO.Minor < 8)) { + //Hard minimum of 5.8 + //5.4 throws a SIGABRT, looks related to this which was fixed in 5.8 https://bugzilla.xamarin.com/show_bug.cgi?id=60625 + logger.Error("Your mono version is too old. Please update to the latest version from http://www.mono-project.com/download/"); Environment.Exit(2); }