mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-19 06:17:43 +01:00
Download CoreLoad on Install
This commit is contained in:
parent
693babc1e3
commit
67f4795cf6
3 changed files with 50 additions and 16 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -332,3 +332,5 @@ ASALocalRun/
|
||||||
|
|
||||||
# MFractors (Xamarin productivity tool) working folder
|
# MFractors (Xamarin productivity tool) working folder
|
||||||
.mfractor/
|
.mfractor/
|
||||||
|
|
||||||
|
/lib/*
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,18 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
<NoWarn>CS0649;CS0169</NoWarn>
|
<NoWarn>CS0649;CS0169</NoWarn>
|
||||||
<NukeRootDirectory>..</NukeRootDirectory>
|
<NukeRootDirectory>..</NukeRootDirectory>
|
||||||
<NukeScriptDirectory>..</NukeScriptDirectory>
|
<NukeScriptDirectory>..</NukeScriptDirectory>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Nuke.Common" Version="0.24.4" />
|
<PackageReference Include="Nuke.Common" Version="0.24.4" />
|
||||||
<PackageDownload Include="GitVersion.Tool" Version="[5.1.1]" />
|
<PackageDownload Include="GitVersion.Tool" Version="[5.1.1]" />
|
||||||
</ItemGroup>
|
<PackageReference Include="Flurl" Version="2.8.2" />
|
||||||
|
<PackageReference Include="Flurl.Http" Version="2.4.2" />
|
||||||
</Project>
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.IO.Compression;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Flurl;
|
||||||
|
using Flurl.Http;
|
||||||
using Nuke.Common;
|
using Nuke.Common;
|
||||||
using Nuke.Common.Execution;
|
using Nuke.Common.Execution;
|
||||||
using Nuke.Common.Git;
|
using Nuke.Common.Git;
|
||||||
|
|
@ -15,6 +18,7 @@ using static Nuke.Common.IO.FileSystemTasks;
|
||||||
using static Nuke.Common.IO.PathConstruction;
|
using static Nuke.Common.IO.PathConstruction;
|
||||||
using static Nuke.Common.Tools.DotNet.DotNetTasks;
|
using static Nuke.Common.Tools.DotNet.DotNetTasks;
|
||||||
using static Nuke.Common.Logger;
|
using static Nuke.Common.Logger;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
[CheckBuildProjectConfigurations]
|
[CheckBuildProjectConfigurations]
|
||||||
[UnsetVisualStudioEnvironmentVariables]
|
[UnsetVisualStudioEnvironmentVariables]
|
||||||
|
|
@ -39,6 +43,8 @@ class DalamudBuild : NukeBuild
|
||||||
|
|
||||||
AbsolutePath DefaultInstallDirectory => (AbsolutePath)Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) / "Dalamud" / "bin" / GitVersion.SemVer;
|
AbsolutePath DefaultInstallDirectory => (AbsolutePath)Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) / "Dalamud" / "bin" / GitVersion.SemVer;
|
||||||
|
|
||||||
|
AbsolutePath CoreHookBinaryDirectory => RootDirectory / "lib" / "CoreHookBinary";
|
||||||
|
|
||||||
Target Clean => _ => _
|
Target Clean => _ => _
|
||||||
.Before(Restore)
|
.Before(Restore)
|
||||||
.Executes(() =>
|
.Executes(() =>
|
||||||
|
|
@ -66,11 +72,35 @@ class DalamudBuild : NukeBuild
|
||||||
.EnableNoRestore());
|
.EnableNoRestore());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Target DownloadCoreHookBinary => _ => _
|
||||||
|
.Executes(() =>
|
||||||
|
{
|
||||||
|
// Download pre-compiled binary of CoreHook.Hooking and CoreLoad (these are prerequisite)
|
||||||
|
var corehookTask = ExtractZip($"https://github.com/unknownv2/CoreHook.Hooking/releases/download/1.0.9/corehook-{Configuration}-x64.zip", CoreHookBinaryDirectory);
|
||||||
|
var coreloadTask = ExtractZip($"https://github.com/unknownv2/CoreHook.Host/releases/download/2.0.5/coreload-{Configuration}-x64.zip", CoreHookBinaryDirectory);
|
||||||
|
|
||||||
|
Task.WaitAll(corehookTask, coreloadTask);
|
||||||
|
});
|
||||||
|
|
||||||
Target Install => _ => _
|
Target Install => _ => _
|
||||||
|
.DependsOn(DownloadCoreHookBinary) // prolly can be skipped if prerequisites are already there?
|
||||||
.DependsOn(Compile)
|
.DependsOn(Compile)
|
||||||
.Executes(() =>
|
.Executes(() =>
|
||||||
{
|
{
|
||||||
Info($"Installing Dalamud to {DefaultInstallDirectory}");
|
Info($"Installing Dalamud to {DefaultInstallDirectory}");
|
||||||
// TODO
|
// TODO
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async Task ExtractZip(string uri, string directory)
|
||||||
|
{
|
||||||
|
EnsureExistingDirectory(directory);
|
||||||
|
|
||||||
|
Info($"Downloading {uri}");
|
||||||
|
|
||||||
|
var tempDir = Path.GetTempPath();
|
||||||
|
var zipFilePath = await uri.DownloadFileAsync(tempDir);
|
||||||
|
|
||||||
|
Info($"Extracting {zipFilePath}");
|
||||||
|
ZipFile.ExtractToDirectory(zipFilePath, directory);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue