mirror of
https://github.com/NuclearPowered/Reactor.git
synced 2026-10-20 01:46:21 +00:00
Add CI
This commit is contained in:
14 files changed
+301
-26
No files matched your search
@@ -0,0 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<RunWorkingDirectory>$(MSBuildProjectDirectory)/..</RunWorkingDirectory>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Cake.Frosting" Version="1.0.0-rc0002" />
|
||||
<PackageReference Include="DepotDownloader.Library" Version="0.1.2" />
|
||||
<Reference Include="Il2CppDumper">
|
||||
<HintPath>..\lib\Il2CppDumper.dll</HintPath>
|
||||
</Reference>
|
||||
<ProjectReference Include="..\Reactor.OxygenFilter\Reactor.OxygenFilter.csproj" />
|
||||
<ProjectReference Include="..\lib\Il2CppAssemblyUnhollower\AssemblyUnhollower\AssemblyUnhollower.csproj" />
|
||||
<ProjectReference Include="..\lib\Il2CppAssemblyUnhollower\UnhollowerBaseLib\UnhollowerBaseLib.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,141 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using AssemblyUnhollower;
|
||||
using Cake.Common;
|
||||
using Cake.Common.Diagnostics;
|
||||
using Cake.Common.IO;
|
||||
using Cake.Common.Tools.DotNetCore;
|
||||
using Cake.Common.Tools.DotNetCore.Build;
|
||||
using Cake.Common.Tools.DotNetCore.Run;
|
||||
using Cake.Core;
|
||||
using Cake.Frosting;
|
||||
using DepotDownloader;
|
||||
using Reactor.OxygenFilter;
|
||||
|
||||
public static class Program
|
||||
{
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
return new CakeHost()
|
||||
.UseContext<BuildContext>()
|
||||
.Run(args);
|
||||
}
|
||||
}
|
||||
|
||||
public class BuildContext : FrostingContext
|
||||
{
|
||||
public string TempPath { get; } = "bin/temp";
|
||||
public string AmongUsPath { get; } = "bin/Among Us";
|
||||
|
||||
public BuildContext(ICakeContext context) : base(context)
|
||||
{
|
||||
context.CreateDirectory(TempPath);
|
||||
context.CreateDirectory(AmongUsPath);
|
||||
}
|
||||
}
|
||||
|
||||
[TaskName("SetupAmongUs")]
|
||||
public sealed class SetupAmongUsTask : AsyncFrostingTask<BuildContext>
|
||||
{
|
||||
public const uint AppId = 945360;
|
||||
public const uint DepotId = 945361;
|
||||
|
||||
public override async Task RunAsync(BuildContext context)
|
||||
{
|
||||
AccountSettingsStore.LoadFromFile("account.config");
|
||||
var steam = context.EnvironmentVariable<string>("STEAM", null).Split(":");
|
||||
|
||||
context.Information("Logging into steam");
|
||||
ContentDownloader.InitializeSteam3(steam[0], steam[1]);
|
||||
|
||||
ContentDownloader.Config.InstallDirectory = context.AmongUsPath;
|
||||
|
||||
context.Information("Downloading the game from steam");
|
||||
await ContentDownloader.DownloadAppAsync(AppId, DepotId);
|
||||
ContentDownloader.ShutdownSteam3();
|
||||
|
||||
context.Unzip(context.GetFiles("BepInEx_UnityIL2CPP_x86_*.zip").Single(), Path.Combine(context.AmongUsPath));
|
||||
}
|
||||
}
|
||||
|
||||
[TaskName("GenerateProxyAssembly")]
|
||||
[IsDependentOn(typeof(SetupAmongUsTask))]
|
||||
public sealed class GenerateProxyAssemblyTask : FrostingTask<BuildContext>
|
||||
{
|
||||
public override void Run(BuildContext context)
|
||||
{
|
||||
var dumperConfig = new Il2CppDumper.Config
|
||||
{
|
||||
GenerateScript = false,
|
||||
GenerateDummyDll = true
|
||||
};
|
||||
|
||||
context.Information("Generating Il2CppDumper intermediate assemblies");
|
||||
|
||||
var gameAssemblyPath = Path.Combine(context.AmongUsPath, "GameAssembly.dll");
|
||||
|
||||
Il2CppDumper.Il2CppDumper.PerformDump(
|
||||
gameAssemblyPath,
|
||||
Path.Combine(context.AmongUsPath, "Among Us_Data", "il2cpp_data", "Metadata", "global-metadata.dat"),
|
||||
context.TempPath, dumperConfig, context.Debug
|
||||
);
|
||||
|
||||
context.Information("Executing Reactor.Greenhouse");
|
||||
|
||||
context.DotNetCoreRun(".", "steam", new DotNetCoreRunSettings
|
||||
{
|
||||
WorkingDirectory = "Reactor.Greenhouse"
|
||||
});
|
||||
|
||||
context.Information("Executing Reactor.OxygenFilter");
|
||||
|
||||
var oxygenFilter = new OxygenFilter();
|
||||
|
||||
var dumpedDll = new FileInfo(Path.Combine(context.TempPath, "DummyDll", "Assembly-CSharp.dll"));
|
||||
oxygenFilter.Start(new FileInfo(Path.Combine("Reactor.Greenhouse", "work", "2020.12.9s.json")), dumpedDll, dumpedDll);
|
||||
|
||||
context.Information("Executing Il2CppUnhollower generator");
|
||||
|
||||
UnhollowerBaseLib.LogSupport.InfoHandler += context.Information;
|
||||
UnhollowerBaseLib.LogSupport.WarningHandler += context.Warning;
|
||||
UnhollowerBaseLib.LogSupport.TraceHandler += context.Debug;
|
||||
UnhollowerBaseLib.LogSupport.ErrorHandler += context.Error;
|
||||
|
||||
var unityBaseLibDir = Path.Combine(context.AmongUsPath, "BepInEx", "unhollowed", "base");
|
||||
|
||||
var unhollowerOptions = new UnhollowerOptions
|
||||
{
|
||||
GameAssemblyPath = gameAssemblyPath,
|
||||
MscorlibPath = Path.Combine(context.AmongUsPath, "mono", "Managed", "mscorlib.dll"),
|
||||
SourceDir = Path.Combine(context.TempPath, "DummyDll"),
|
||||
OutputDir = Path.Combine(context.AmongUsPath, "BepInEx", "unhollowed"),
|
||||
UnityBaseLibsDir = unityBaseLibDir,
|
||||
NoCopyUnhollowerLibs = true
|
||||
};
|
||||
|
||||
AssemblyUnhollower.Program.Main(unhollowerOptions);
|
||||
}
|
||||
}
|
||||
|
||||
[TaskName("Build")]
|
||||
[IsDependentOn(typeof(GenerateProxyAssemblyTask))]
|
||||
public sealed class BuildTask : FrostingTask<BuildContext>
|
||||
{
|
||||
public override void Run(BuildContext context)
|
||||
{
|
||||
context.DotNetCoreBuild("./Reactor/Reactor.csproj", new DotNetCoreBuildSettings
|
||||
{
|
||||
Configuration = "Release",
|
||||
EnvironmentVariables =
|
||||
{
|
||||
["AmongUs"] = Path.GetFullPath(context.AmongUsPath)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[IsDependentOn(typeof(BuildTask))]
|
||||
public sealed class Default : FrostingTask<BuildContext>
|
||||
{
|
||||
}
|
||||
Reference in new issue
Block a user