2017-11-19 06:19:49 +00:00
#tool nuget:?package=NUnit.ConsoleRunner
#addin nuget:?package=Cake.Git
2017-11-11 06:14:14 +00:00
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
2018-06-10 02:34:37 +00:00
var configuration = Argument("configuration", "Debug");
2017-11-11 06:14:14 +00:00
//////////////////////////////////////////////////////////////////////
// PREPARATION
//////////////////////////////////////////////////////////////////////
// Define directories.
var workingDir = MakeAbsolute(Directory("./"));
2019-03-03 04:01:07 +00:00
string artifactsDirName = "Artifacts";
string testResultsDirName = "TestResults";
2019-10-14 17:51:33 +00:00
string netCoreFramework = "netcoreapp3.0";
2019-03-03 04:01:07 +00:00
string serverProjectPath = "./src/Jackett.Server/Jackett.Server.csproj";
string updaterProjectPath = "./src/Jackett.Updater/Jackett.Updater.csproj";
2017-11-11 06:14:14 +00:00
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Info")
.Does(() =>
{
Information(@"Jackett Cake build script starting...");
2019-10-14 17:51:33 +00:00
Information(@"Requires InnoSetup and C:\msys64 to be present for packaging (Pre-installed on AppVeyor) on Windows");
2017-11-11 06:14:14 +00:00
Information(@"Working directory is: " + workingDir);
2019-01-19 06:23:56 +00:00
if (IsRunningOnWindows())
{
Information("Platform is Windows");
}
else
{
Information("Platform is Linux, Windows builds will be skipped");
}
2017-11-11 06:14:14 +00:00
});
Task("Clean")
.IsDependentOn("Info")
.Does(() =>
{
2018-06-10 02:34:37 +00:00
CleanDirectories("./src/**/obj");
CleanDirectories("./src/**/bin");
2017-11-11 06:14:14 +00:00
CleanDirectories("./BuildOutput");
CleanDirectories("./" + artifactsDirName);
CleanDirectories("./" + testResultsDirName);
2019-01-19 06:23:56 +00:00
CreateDirectory("./" + artifactsDirName);
2017-11-12 00:01:05 +00:00
Information("Clean completed");
2017-11-11 06:14:14 +00:00
});
2018-08-16 09:41:42 +00:00
Task("Build-Full-Framework")
2017-11-11 06:14:14 +00:00
.IsDependentOn("Clean")
.Does(() =>
{
NuGetRestore("./src/Jackett.sln");
2018-06-24 01:32:22 +00:00
var buildSettings = new MSBuildSettings()
.SetConfiguration(configuration)
2019-10-14 17:51:33 +00:00
.UseToolVersion(MSBuildToolVersion.VS2019);
2018-06-24 01:32:22 +00:00
MSBuild("./src/Jackett.sln", buildSettings);
2017-11-11 06:14:14 +00:00
});
Task("Run-Unit-Tests")
2018-08-16 09:41:42 +00:00
.IsDependentOn("Build-Full-Framework")
2017-11-12 00:01:05 +00:00
.Does(() =>
2017-11-11 06:14:14 +00:00
{
CreateDirectory("./" + testResultsDirName);
var resultsFile = $"./{testResultsDirName}/JackettTestResult.xml";
2017-11-12 00:01:05 +00:00
NUnit3("./src/**/bin/" + configuration + "/**/*.Test.dll", new NUnit3Settings
2017-11-11 06:14:14 +00:00
{
Results = new[] { new NUnit3Result { FileName = resultsFile } }
});
2019-01-19 06:23:56 +00:00
if (AppVeyor.IsRunningOnAppVeyor && IsRunningOnWindows())
2017-11-11 06:14:14 +00:00
{
AppVeyor.UploadTestResults(resultsFile, AppVeyorTestResultsType.NUnit3);
}
});
2018-08-16 09:41:42 +00:00
Task("Package-Windows-Full-Framework")
2019-01-19 06:23:56 +00:00
.IsDependentOn("Run-Unit-Tests")
2018-06-14 09:18:17 +00:00
.Does(() =>
{
2019-01-19 22:56:38 +00:00
string buildOutputPath = "./BuildOutput/net461/win7-x86/Jackett";
2018-06-14 09:18:17 +00:00
2019-01-24 09:17:01 +00:00
DotNetCorePublish(serverProjectPath, "net461", "win7-x86", buildOutputPath);
2018-06-24 02:13:33 +00:00
CopyFiles("./src/Jackett.Service/bin/" + configuration + "/JackettService.*", buildOutputPath);
CopyFiles("./src/Jackett.Tray/bin/" + configuration + "/JackettTray.*", buildOutputPath);
CopyFiles("./src/Jackett.Updater/bin/" + configuration + "/net461" + "/JackettUpdater.*", buildOutputPath); //builds against multiple frameworks
2019-01-19 22:56:38 +00:00
Zip("./BuildOutput/net461/win7-x86", $"./{artifactsDirName}/Jackett.Binaries.Windows.zip");
2018-06-24 02:13:33 +00:00
//InnoSetup
string sourceFolder = MakeAbsolute(Directory(buildOutputPath)).ToString();
2018-06-02 07:33:26 +00:00
2018-06-24 02:13:33 +00:00
InnoSetupSettings settings = new InnoSetupSettings();
settings.OutputDirectory = workingDir + "/" + artifactsDirName;
2019-10-14 17:51:33 +00:00
//Can remove below line once Cake is updated for InnoSetup 6 - https://github.com/cake-build/cake/pull/2565
settings.ToolPath = @"C:\Program Files (x86)\Inno Setup 6\ISCC.exe";
2018-06-24 02:13:33 +00:00
settings.Defines = new Dictionary<string, string>
{
{ "MyFileForVersion", sourceFolder + "/Jackett.Common.dll" },
{ "MySourceFolder", sourceFolder },
2018-07-11 09:37:19 +00:00
{ "MyOutputFilename", "Jackett.Installer.Windows" },
2018-06-24 02:13:33 +00:00
};
InnoSetup("./Installer.iss", settings);
2018-06-14 09:18:17 +00:00
});
2018-08-16 09:41:42 +00:00
Task("Package-Mono-Full-Framework")
2019-01-19 06:23:56 +00:00
.IsDependentOn("Run-Unit-Tests")
2018-06-14 09:18:17 +00:00
.Does(() =>
{
2019-01-19 22:56:38 +00:00
string buildOutputPath = "./BuildOutput/net461/linux-x64/Jackett";
2018-06-14 09:18:17 +00:00
2019-01-24 09:17:01 +00:00
DotNetCorePublish(serverProjectPath, "net461", "linux-x64", buildOutputPath);
2018-06-24 02:13:33 +00:00
CopyFiles("./src/Jackett.Updater/bin/" + configuration + "/net461" + "/JackettUpdater.*", buildOutputPath); //builds against multiple frameworks
2018-06-14 09:18:17 +00:00
2019-03-10 01:11:53 +00:00
CopyFileToDirectory("./install_service_systemd_mono.sh", buildOutputPath);
2019-01-19 22:56:38 +00:00
CopyFileToDirectory("./Upstart.config", buildOutputPath);
2018-06-14 09:18:17 +00:00
//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
2018-06-24 02:13:33 +00:00
DeleteFile(buildOutputPath + "/System.Net.Http.dll");
2018-06-14 09:18:17 +00:00
2018-06-24 02:13:33 +00:00
var configFile = File(buildOutputPath + "/JackettConsole.exe.config");
2018-06-14 09:18:17 +00:00
XmlPoke(configFile, "configuration/runtime/*[name()='assemblyBinding']/*[name()='dependentAssembly']/*[name()='assemblyIdentity'][@name='System.Net.Http']/../*[name()='bindingRedirect']/@newVersion", "4.0.0.0");
2018-08-12 06:49:52 +00:00
//Mono on FreeBSD doesn't like the bundled System.Runtime.InteropServices.RuntimeInformation
//https://github.com/dotnet/corefx/issues/23989
//https://github.com/Jackett/Jackett/issues/3547
DeleteFile(buildOutputPath + "/System.Runtime.InteropServices.RuntimeInformation.dll");
2019-10-14 17:51:33 +00:00
InstallMsysTar();
2019-01-19 22:56:38 +00:00
Gzip("./BuildOutput/net461/linux-x64", $"./{artifactsDirName}", "Jackett", "Jackett.Binaries.Mono.tar.gz");
2018-06-14 09:18:17 +00:00
});
2019-01-19 22:56:38 +00:00
Task("Package-DotNetCore-macOS")
.IsDependentOn("Clean")
.Does(() =>
{
string runtimeId = "osx-x64";
2019-01-19 23:14:31 +00:00
string buildOutputPath = $"./BuildOutput/{netCoreFramework}/{runtimeId}/Jackett";
2019-03-03 04:01:07 +00:00
string updaterOutputPath = buildOutputPath + "/Updater";
2019-01-19 22:56:38 +00:00
2019-01-24 09:17:01 +00:00
DotNetCorePublish(serverProjectPath, netCoreFramework, runtimeId, buildOutputPath);
2019-01-19 22:56:38 +00:00
2019-03-03 04:01:07 +00:00
DotNetCorePublish(updaterProjectPath, netCoreFramework, runtimeId, updaterOutputPath);
CopyFiles(updaterOutputPath + "/JackettUpdater*", buildOutputPath);
2019-03-10 01:11:53 +00:00
DeleteDirectory(updaterOutputPath, new DeleteDirectorySettings {Recursive = true, Force = true});
2019-03-03 04:01:07 +00:00
2019-01-19 22:56:38 +00:00
CopyFileToDirectory("./install_service_macos", buildOutputPath);
2019-03-24 05:01:33 +00:00
Gzip($"./BuildOutput/{netCoreFramework}/{runtimeId}", $"./{artifactsDirName}", "Jackett", "Jackett.Binaries.macOS.tar.gz");
2019-01-19 22:56:38 +00:00
});
2019-03-05 10:25:37 +00:00
Task("Package-DotNetCore-LinuxAMDx64")
2019-01-19 22:56:38 +00:00
.IsDependentOn("Clean")
.Does(() =>
{
string runtimeId = "linux-x64";
2019-01-19 23:14:31 +00:00
string buildOutputPath = $"./BuildOutput/{netCoreFramework}/{runtimeId}/Jackett";
2019-03-04 06:44:05 +00:00
string updaterOutputPath = buildOutputPath + "/Updater";
2019-01-19 22:56:38 +00:00
2019-01-24 09:17:01 +00:00
DotNetCorePublish(serverProjectPath, netCoreFramework, runtimeId, buildOutputPath);
2019-03-04 06:52:17 +00:00
DotNetCorePublish(updaterProjectPath, netCoreFramework, runtimeId, updaterOutputPath);
2019-03-04 06:44:05 +00:00
CopyFiles(updaterOutputPath + "/JackettUpdater*", buildOutputPath);
2019-03-10 01:11:53 +00:00
DeleteDirectory(updaterOutputPath, new DeleteDirectorySettings {Recursive = true, Force = true});
2019-01-19 22:56:38 +00:00
CopyFileToDirectory("./install_service_systemd.sh", buildOutputPath);
2019-10-30 01:58:11 +00:00
CopyFileToDirectory("./jackett_launcher.sh", buildOutputPath);
2019-01-19 22:56:38 +00:00
2019-03-06 10:18:28 +00:00
Gzip($"./BuildOutput/{netCoreFramework}/{runtimeId}", $"./{artifactsDirName}", "Jackett", "Jackett.Binaries.LinuxAMDx64.tar.gz");
2019-01-19 22:56:38 +00:00
});
Task("Package-DotNetCore-LinuxARM32")
.IsDependentOn("Clean")
.Does(() =>
{
string runtimeId = "linux-arm";
2019-01-19 23:14:31 +00:00
string buildOutputPath = $"./BuildOutput/{netCoreFramework}/{runtimeId}/Jackett";
2019-03-04 06:44:05 +00:00
string updaterOutputPath = buildOutputPath + "/Updater";
2019-01-19 22:56:38 +00:00
2019-01-24 09:17:01 +00:00
DotNetCorePublish(serverProjectPath, netCoreFramework, runtimeId, buildOutputPath);
2019-03-04 06:52:17 +00:00
DotNetCorePublish(updaterProjectPath, netCoreFramework, runtimeId, updaterOutputPath);
2019-03-04 06:44:05 +00:00
CopyFiles(updaterOutputPath + "/JackettUpdater*", buildOutputPath);
2019-03-10 01:11:53 +00:00
DeleteDirectory(updaterOutputPath, new DeleteDirectorySettings {Recursive = true, Force = true});
2019-01-19 22:56:38 +00:00
CopyFileToDirectory("./install_service_systemd.sh", buildOutputPath);
2019-10-30 01:58:11 +00:00
CopyFileToDirectory("./jackett_launcher.sh", buildOutputPath);
2019-01-19 22:56:38 +00:00
2019-03-07 10:11:06 +00:00
Gzip($"./BuildOutput/{netCoreFramework}/{runtimeId}", $"./{artifactsDirName}", "Jackett", "Jackett.Binaries.LinuxARM32.tar.gz");
2019-01-19 22:56:38 +00:00
});
Task("Package-DotNetCore-LinuxARM64")
2019-01-19 06:23:56 +00:00
.IsDependentOn("Clean")
2018-06-24 02:13:33 +00:00
.Does(() =>
{
2019-01-19 22:56:38 +00:00
string runtimeId = "linux-arm64";
2019-01-19 23:14:31 +00:00
string buildOutputPath = $"./BuildOutput/{netCoreFramework}/{runtimeId}/Jackett";
2019-03-04 06:44:05 +00:00
string updaterOutputPath = buildOutputPath + "/Updater";
2019-01-19 22:56:38 +00:00
2019-01-24 09:17:01 +00:00
DotNetCorePublish(serverProjectPath, netCoreFramework, runtimeId, buildOutputPath);
2019-03-04 06:52:17 +00:00
DotNetCorePublish(updaterProjectPath, netCoreFramework, runtimeId, updaterOutputPath);
2019-03-04 06:44:05 +00:00
CopyFiles(updaterOutputPath + "/JackettUpdater*", buildOutputPath);
2019-03-10 01:11:53 +00:00
DeleteDirectory(updaterOutputPath, new DeleteDirectorySettings {Recursive = true, Force = true});
2019-03-04 06:44:05 +00:00
2019-01-19 22:56:38 +00:00
CopyFileToDirectory("./install_service_systemd.sh", buildOutputPath);
2019-10-30 01:58:11 +00:00
CopyFileToDirectory("./jackett_launcher.sh", buildOutputPath);
2019-01-19 22:56:38 +00:00
2019-03-07 10:11:06 +00:00
Gzip($"./BuildOutput/{netCoreFramework}/{runtimeId}", $"./{artifactsDirName}", "Jackett", "Jackett.Binaries.LinuxARM64.tar.gz");
2018-06-24 02:13:33 +00:00
});
2018-06-14 09:18:17 +00:00
2017-11-11 06:14:14 +00:00
Task("Appveyor-Push-Artifacts")
2019-01-19 06:23:56 +00:00
.IsDependentOn("Clean")
2017-11-12 00:01:05 +00:00
.Does(() =>
2017-11-11 06:14:14 +00:00
{
2019-03-03 04:51:59 +00:00
if (AppVeyor.IsRunningOnAppVeyor)
2017-11-12 00:01:05 +00:00
{
foreach (var file in GetFiles(workingDir + $"/{artifactsDirName}/*"))
2017-11-11 06:14:14 +00:00
{
2017-11-12 00:01:05 +00:00
AppVeyor.UploadArtifact(file.FullPath);
2017-11-11 06:14:14 +00:00
}
2017-11-12 00:01:05 +00:00
}
2017-11-11 06:14:14 +00:00
else
{
2019-01-19 06:23:56 +00:00
Information(@"Skipping artifact push as not running in AppVeyor Windows Environment");
2017-11-11 06:14:14 +00:00
}
});
2018-03-10 08:28:59 +00:00
Task("Release-Notes")
2019-01-19 06:23:56 +00:00
.IsDependentOn("Clean")
2017-11-19 06:19:49 +00:00
.Does(() =>
{
2017-11-19 07:37:47 +00:00
string latestTag = GitDescribe(".", false, GitDescribeStrategy.Tags, 0);
Information($"Latest tag is: {latestTag}" + Environment.NewLine);
List<GitCommit> relevantCommits = new List<GitCommit>();
2017-11-19 06:19:49 +00:00
2017-11-19 07:37:47 +00:00
var commitCollection = GitLog("./", 50);
2017-11-19 06:19:49 +00:00
2017-11-19 07:37:47 +00:00
foreach(GitCommit commit in commitCollection)
{
var commitTag = GitDescribe(".", commit.Sha, false, GitDescribeStrategy.Tags, 0);
2017-11-19 06:19:49 +00:00
2017-11-19 07:37:47 +00:00
if (commitTag == latestTag)
2017-11-19 06:19:49 +00:00
{
relevantCommits.Add(commit);
}
2017-11-19 07:37:47 +00:00
else
2017-11-19 06:19:49 +00:00
{
2017-11-19 07:37:47 +00:00
break;
}
}
2017-11-19 06:19:49 +00:00
2017-11-19 07:37:47 +00:00
relevantCommits = relevantCommits.AsEnumerable().Reverse().Skip(1).ToList();
2017-11-19 06:19:49 +00:00
2017-11-19 07:37:47 +00:00
if (relevantCommits.Count() > 0)
{
List<string> notesList = new List<string>();
foreach(GitCommit commit in relevantCommits)
2017-11-19 06:19:49 +00:00
{
2017-11-19 07:37:47 +00:00
notesList.Add($"{commit.MessageShort} (Thank you @{commit.Author.Name})");
2017-11-19 06:19:49 +00:00
}
2017-11-19 07:37:47 +00:00
string buildNote = String.Join(Environment.NewLine, notesList);
Information(buildNote);
2019-01-19 06:23:56 +00:00
System.IO.File.WriteAllLines(workingDir + "/BuildOutput/ReleaseNotes.txt", notesList.ToArray());
2017-11-19 06:19:49 +00:00
}
2017-11-19 07:37:47 +00:00
else
{
Information($"No commit messages found to create release notes");
}
2017-11-19 06:19:49 +00:00
});
2019-03-24 05:22:12 +00:00
Task("Windows-Environment-Dev")
.IsDependentOn("Package-Windows-Full-Framework")
.IsDependentOn("Package-Mono-Full-Framework")
.IsDependentOn("Package-DotNetCore-macOS")
.IsDependentOn("Package-DotNetCore-LinuxAMDx64")
.IsDependentOn("Package-DotNetCore-LinuxARM32")
.IsDependentOn("Package-DotNetCore-LinuxARM64")
.IsDependentOn("Appveyor-Push-Artifacts")
.IsDependentOn("Release-Notes")
.Does(() =>
{
Information("Windows-Environment Task Completed");
});
Task("Windows-Environment-Appveyor")
2019-01-19 06:23:56 +00:00
.IsDependentOn("Package-Windows-Full-Framework")
.IsDependentOn("Package-Mono-Full-Framework")
.IsDependentOn("Appveyor-Push-Artifacts")
.IsDependentOn("Release-Notes")
.Does(() =>
{
Information("Windows-Environment Task Completed");
});
Task("Linux-Environment")
2019-01-19 22:56:38 +00:00
.IsDependentOn("Package-DotNetCore-macOS")
2019-03-05 10:25:37 +00:00
.IsDependentOn("Package-DotNetCore-LinuxAMDx64")
2019-01-19 22:56:38 +00:00
.IsDependentOn("Package-DotNetCore-LinuxARM32")
.IsDependentOn("Package-DotNetCore-LinuxARM64")
2019-01-19 06:23:56 +00:00
.IsDependentOn("Appveyor-Push-Artifacts")
.IsDependentOn("Release-Notes")
.Does(() =>
{
Information("Linux-Environment Task Completed");
});
2017-11-19 06:19:49 +00:00
2019-10-14 17:51:33 +00:00
private void RunMsysCommand(string utility, string utilityArguments)
2017-11-11 06:14:14 +00:00
{
2019-10-14 17:51:33 +00:00
var msysDir = @"C:\msys64\usr\bin\";
var utilityProcess = msysDir + utility + ".exe";
2017-11-11 06:14:14 +00:00
2019-10-14 17:51:33 +00:00
Information("MSYS2 Utility: " + utility);
Information("MSYS2 Directory: " + msysDir);
2017-11-11 06:14:14 +00:00
Information("Utility Location: " + utilityProcess);
Information("Utility Arguments: " + utilityArguments);
IEnumerable<string> redirectedStandardOutput;
IEnumerable<string> redirectedErrorOutput;
var exitCodeWithArgument =
StartProcess(
utilityProcess,
new ProcessSettings {
Arguments = utilityArguments,
2019-10-14 17:51:33 +00:00
WorkingDirectory = msysDir,
2017-11-11 06:14:14 +00:00
RedirectStandardOutput = true
},
out redirectedStandardOutput,
out redirectedErrorOutput
);
Information(utility + " output:" + Environment.NewLine + string.Join(Environment.NewLine, redirectedStandardOutput.ToArray()));
// Throw exception if anything was written to the standard error.
if (redirectedErrorOutput != null && redirectedErrorOutput.Any())
{
throw new Exception(
string.Format(
utility + " Errors ocurred: {0}",
string.Join(", ", redirectedErrorOutput)));
}
Information(utility + " Exit code: {0}", exitCodeWithArgument);
}
2019-10-14 17:51:33 +00:00
private string RelativeWinPathToFullPath(string relativePath)
2017-11-11 06:14:14 +00:00
{
2019-10-14 17:51:33 +00:00
return (workingDir + relativePath.TrimStart('.'));
2017-11-11 06:14:14 +00:00
}
2019-01-19 06:23:56 +00:00
private void RunLinuxCommand(string file, string arg)
{
var startInfo = new System.Diagnostics.ProcessStartInfo()
{
Arguments = arg,
FileName = file,
UseShellExecute = true
};
var process = System.Diagnostics.Process.Start(startInfo);
process.WaitForExit();
}
2018-06-02 07:33:26 +00:00
private void Gzip(string sourceFolder, string outputDirectory, string tarCdirectoryOption, string outputFileName)
{
var tarFileName = outputFileName.Remove(outputFileName.Length - 3, 3);
2019-01-19 06:23:56 +00:00
if (IsRunningOnWindows())
{
2019-10-14 17:51:33 +00:00
var fullSourcePath = RelativeWinPathToFullPath(sourceFolder);
var tarArguments = @"--force-local -cvf " + fullSourcePath + "/" + tarFileName + " -C " + fullSourcePath + $" {tarCdirectoryOption} --mode ='755'";
var gzipArguments = @"-k " + fullSourcePath + "/" + tarFileName;
2018-06-02 07:33:26 +00:00
2019-10-14 17:51:33 +00:00
RunMsysCommand("tar", tarArguments);
RunMsysCommand("gzip", gzipArguments);
2019-01-19 06:23:56 +00:00
MoveFile($"{sourceFolder}/{tarFileName}.gz", $"{outputDirectory}/{tarFileName}.gz");
}
else
{
RunLinuxCommand("find", MakeAbsolute(Directory(sourceFolder)) + @" -type d -exec chmod 755 {} \;");
RunLinuxCommand("find", MakeAbsolute(Directory(sourceFolder)) + @" -type f -exec chmod 644 {} \;");
2019-03-03 05:53:40 +00:00
RunLinuxCommand("chmod", $"755 {MakeAbsolute(Directory(sourceFolder))}/Jackett/jackett");
RunLinuxCommand("chmod", $"755 {MakeAbsolute(Directory(sourceFolder))}/Jackett/JackettUpdater");
2019-03-15 09:59:00 +00:00
2019-10-30 01:58:11 +00:00
string macOsServiceScript = MakeAbsolute(Directory(sourceFolder)) + "/Jackett/install_service_macos";
if (FileExists(macOsServiceScript))
{
RunLinuxCommand("chmod", $"755 {macOsServiceScript}");
}
string systemdMonoScript = MakeAbsolute(Directory(sourceFolder)) + "/Jackett/install_service_systemd_mono.sh";
if (FileExists(systemdMonoScript))
{
RunLinuxCommand("chmod", $"755 {systemdMonoScript}");
}
2019-03-15 09:59:00 +00:00
string systemdScript = MakeAbsolute(Directory(sourceFolder)) + "/Jackett/install_service_systemd.sh";
if (FileExists(systemdScript))
{
RunLinuxCommand("chmod", $"755 {systemdScript}");
}
2019-10-30 01:58:11 +00:00
string launcherScript = MakeAbsolute(Directory(sourceFolder)) + "/Jackett/jackett_launcher.sh";
if (FileExists(launcherScript))
2019-03-15 09:59:00 +00:00
{
2019-10-30 01:58:11 +00:00
RunLinuxCommand("chmod", $"755 {launcherScript}");
2019-03-15 09:59:00 +00:00
}
2019-01-19 22:56:38 +00:00
RunLinuxCommand("tar", $"-C {sourceFolder} -zcvf {outputDirectory}/{tarFileName}.gz {tarCdirectoryOption}");
2019-01-19 06:23:56 +00:00
}
2018-06-02 07:33:26 +00:00
}
2019-10-14 17:51:33 +00:00
private void InstallMsysTar()
2018-06-02 07:33:26 +00:00
{
2019-10-14 17:51:33 +00:00
//Gzip is included by default with MSYS2, but not tar. Use the package manager to install tar
var startInfo = new System.Diagnostics.ProcessStartInfo()
2019-01-19 06:23:56 +00:00
{
2019-10-14 17:51:33 +00:00
Arguments = "-S --noconfirm tar",
FileName = @"C:\msys64\usr\bin\pacman.exe",
UseShellExecute = false
2019-01-19 06:23:56 +00:00
};
2018-06-02 07:33:26 +00:00
2019-10-14 17:51:33 +00:00
var process = System.Diagnostics.Process.Start(startInfo);
process.WaitForExit();
if (FileExists(@"C:\msys64\usr\bin\tar.exe") && FileExists(@"C:\msys64\usr\bin\gzip.exe"))
{
Information("tar.exe and gzip.exe were found");
}
else
{
throw new Exception("tar.exe and gzip.exe were NOT found");
}
}
private void DotNetCorePublish(string projectPath, string framework, string runtime, string outputPath)
{
bool publishSingleFile = false;
if (publishSingleFile && framework != "net461")
{
var settings = new DotNetCorePublishSettings
{
Framework = framework,
Runtime = runtime,
OutputDirectory = outputPath,
ArgumentCustomization = args=>args.Append("/p:PublishSingleFile=true")
};
DotNetCorePublish(projectPath, settings);
}
else
{
var settings = new DotNetCorePublishSettings
{
Framework = framework,
Runtime = runtime,
OutputDirectory = outputPath
};
DotNetCorePublish(projectPath, settings);
}
2018-06-02 07:33:26 +00:00
}
2017-11-11 06:14:14 +00:00
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
2019-03-24 05:22:12 +00:00
.IsDependentOn("Windows-Environment-Dev")
2017-11-12 00:01:05 +00:00
.Does(() =>
{
Information("Default Task Completed");
});
2017-11-11 06:14:14 +00:00
2019-03-24 05:22:12 +00:00
Task("Windows-Appveyor")
.IsDependentOn("Windows-Environment-Appveyor")
.Does(() =>
{
Information("Windows Appveyor Task Completed");
});
2019-01-19 06:23:56 +00:00
Task("Linux")
.IsDependentOn("Linux-Environment")
.Does(() =>
{
Information("Linux Task Completed");
});
2017-11-11 06:14:14 +00:00
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);