+#addin "nuget:?package=SharpZipLib&Version=1.3.0"
+#addin "nuget:?package=Cake.Compression&Version=0.2.4"
#addin "nuget:?package=Cake.FileHelpers&Version=3.3.0"
+
var buildId = EnvironmentVariable("APPVEYOR_BUILD_VERSION") ?? "0";
var buildVersion = EnvironmentVariable("IMPOSTOR_VERSION") ?? "1.0.0";
var buildBranch = EnvironmentVariable("APPVEYOR_REPO_BRANCH") ?? "dev";
}
}
-private void ImpostorPublish(string name, string project, string runtime, bool selfContained = true) {
+private void ImpostorPublish(string name, string project, string runtime, bool isServer = false) {
var projBuildDir = buildDir.Combine(name + "_" + runtime);
- var projBuildZip = buildDir.CombineWithFilePath(name + "_" + buildVersion + "_" + runtime + ".zip");
+ var projBuildName = name + "_" + buildVersion + "_" + runtime;
DotNetCorePublish(project, new DotNetCorePublishSettings {
Configuration = configuration,
NoRestore = true,
Framework = "net5.0",
Runtime = runtime,
- SelfContained = selfContained,
+ SelfContained = false,
PublishSingleFile = true,
- PublishTrimmed = selfContained,
+ PublishTrimmed = false,
OutputDirectory = projBuildDir
});
ImpostorClean(projBuildDir.ToString());
- Zip(projBuildDir, projBuildZip);
+ if (isServer) {
+ CreateDirectory(projBuildDir.Combine("plugins"));
+ CreateDirectory(projBuildDir.Combine("libraries"));
+
+ if (runtime == "win-x64") {
+ FileWriteText(projBuildDir.CombineWithFilePath("run.bat"), "@echo off\r\nImpostor.Server.exe\r\npause");
+ }
+ }
+
+ if (runtime == "win-x64") {
+ Zip(projBuildDir, buildDir.CombineWithFilePath(projBuildName + ".zip"));
+ } else {
+ GZipCompress(projBuildDir, buildDir.CombineWithFilePath(projBuildName + ".tar.gz"));
+ }
}
private void ImpostorPublishNF(string name, string project) {
// Client.
ImpostorPublishNF("Impostor-Patcher", "./src/Impostor.Patcher/Impostor.Patcher.WinForms/Impostor.Patcher.WinForms.csproj");
- ImpostorPublish("Impostor-Patcher-Cli", "./src/Impostor.Patcher/Impostor.Patcher.Cli/Impostor.Patcher.Cli.csproj", "win-x64", false);
- ImpostorPublish("Impostor-Patcher-Cli", "./src/Impostor.Patcher/Impostor.Patcher.Cli/Impostor.Patcher.Cli.csproj", "osx-x64", false);
- ImpostorPublish("Impostor-Patcher-Cli", "./src/Impostor.Patcher/Impostor.Patcher.Cli/Impostor.Patcher.Cli.csproj", "linux-x64", false);
+ ImpostorPublish("Impostor-Patcher-Cli", "./src/Impostor.Patcher/Impostor.Patcher.Cli/Impostor.Patcher.Cli.csproj", "win-x64");
+ ImpostorPublish("Impostor-Patcher-Cli", "./src/Impostor.Patcher/Impostor.Patcher.Cli/Impostor.Patcher.Cli.csproj", "osx-x64");
+ ImpostorPublish("Impostor-Patcher-Cli", "./src/Impostor.Patcher/Impostor.Patcher.Cli/Impostor.Patcher.Cli.csproj", "linux-x64");
// Server.
- ImpostorPublish("Impostor-Server", "./src/Impostor.Server/Impostor.Server.csproj", "win-x64");
- ImpostorPublish("Impostor-Server", "./src/Impostor.Server/Impostor.Server.csproj", "osx-x64");
- ImpostorPublish("Impostor-Server", "./src/Impostor.Server/Impostor.Server.csproj", "linux-x64");
- ImpostorPublish("Impostor-Server", "./src/Impostor.Server/Impostor.Server.csproj", "linux-arm");
- ImpostorPublish("Impostor-Server", "./src/Impostor.Server/Impostor.Server.csproj", "linux-arm64");
+ ImpostorPublish("Impostor-Server", "./src/Impostor.Server/Impostor.Server.csproj", "win-x64", true);
+ ImpostorPublish("Impostor-Server", "./src/Impostor.Server/Impostor.Server.csproj", "osx-x64", true);
+ ImpostorPublish("Impostor-Server", "./src/Impostor.Server/Impostor.Server.csproj", "linux-x64", true);
+ ImpostorPublish("Impostor-Server", "./src/Impostor.Server/Impostor.Server.csproj", "linux-arm", true);
+ ImpostorPublish("Impostor-Server", "./src/Impostor.Server/Impostor.Server.csproj", "linux-arm64", true);
// API.
DotNetCorePack("./src/Impostor.Api/Impostor.Api.csproj", new DotNetCorePackSettings {
## Single server
### Without docker
-1. Find the [latest release](https://github.com/AeonLucid/Impostor/releases/latest).
-2. Download either the Windows or the Linux version.
-3. Extract the zip.
-4. Modify `config.json` to your liking.
-5. Run `Impostor.Server.exe` (Windows) / `Impostor.Server` (Linux)
+1. Install the **.NET 5.0 runtime**.
+ - [Windows x64](https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-aspnetcore-5.0.0-rc.2-windows-x64-binaries)
+ - [Linux x64](https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-aspnetcore-5.0.0-rc.2-linux-x64-binaries)
+ - [macOS x64](https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-aspnetcore-5.0.0-rc.2-macos-x64-binaries)
+2. Find the [latest release](https://github.com/AeonLucid/Impostor/releases/latest).
+3. Download either the Windows or the Linux version.
+4. Extract the zip.
+5. Modify `config.json` to your liking.
+6. Run `Impostor.Server.exe` (Windows) / `Impostor.Server` (Linux)
### Using docker
## Multiple servers
-**This is only in the `dev` branch at this moment so you will need to build it yourself.**
-
Follow the steps from the single server on two or more servers.
### Master server
public async Task StartAsync(CancellationToken cancellationToken)
{
+ _logger.LogInformation("Loading plugins.");
+
foreach (var plugin in _plugins)
{
- _logger.LogInformation("Enabling plugin {0}", plugin);
+ _logger.LogInformation("Enabling plugin {0}.", plugin);
// Create instance and inject services.
plugin.Instance = (IPlugin) ActivatorUtilities.CreateInstance(_serviceProvider, plugin.PluginType);
// Enable plugin.
await plugin.Instance.EnableAsync();
}
+
+ _logger.LogInformation(
+ _plugins.Count == 1
+ ? "Loaded {0} plugin."
+ : "Loaded {0} plugins.", _plugins.Count);
}
public async Task StopAsync(CancellationToken cancellationToken)
// In the case of a failed startup, some can be null.
foreach (var plugin in _plugins.Where(plugin => plugin.Instance != null))
{
- _logger.LogInformation("Disabling plugin {0}", plugin);
+ _logger.LogInformation("Disabling plugin {0}.", plugin);
// Disable plugin.
await plugin.Instance.DisableAsync();