mirror of
https://github.com/NuclearPowered/Reactor.git
synced 2026-10-19 15:51:54 +00:00
Migrate to Reactor.MSBuild
This commit is contained in:
11 files changed
+82
-187
No files matched your search
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"isRoot": true,
|
||||||
|
"tools": {
|
||||||
|
"cake.tool": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"commands": [
|
||||||
|
"dotnet-cake"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
on:
|
on: [ "push", "pull_request" ]
|
||||||
push:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -15,19 +14,19 @@ jobs:
|
|||||||
- name: Setup .NET
|
- name: Setup .NET
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v1
|
||||||
with:
|
with:
|
||||||
dotnet-version: 5.0.101
|
dotnet-version: 5.0.300
|
||||||
|
|
||||||
- name: Cake Action
|
- name: Run the Cake script
|
||||||
run: sh build.sh
|
uses: cake-build/cake-action@v1
|
||||||
env:
|
with:
|
||||||
STEAM: ${{ secrets.STEAM }}
|
verbosity: Diagnostic
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: Reactor.dll
|
name: Reactor.dll
|
||||||
path: Reactor/bin/Release/netstandard2.1/reobfuscated/Reactor-*.dll
|
path: Reactor/bin/Release/netstandard2.1/Reactor.dll
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: Reactor.Debugger.dll
|
name: Reactor.Debugger.dll
|
||||||
path: Reactor.Debugger/bin/Release/netstandard2.1/reobfuscated/Reactor.Debugger-*.dll
|
path: Reactor.Debugger/bin/Release/netstandard2.1/Reactor.Debugger.dll
|
||||||
@@ -4,3 +4,5 @@ obj/
|
|||||||
riderModule.iml
|
riderModule.iml
|
||||||
/_ReSharper.Caches/
|
/_ReSharper.Caches/
|
||||||
.idea
|
.idea
|
||||||
|
/tools
|
||||||
|
.vscode
|
||||||
+13
-8
@@ -1,18 +1,23 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup Condition="'$(GamePlatform)' == 'Steam'">
|
<PropertyGroup>
|
||||||
<GameVersion>2021.4.14s</GameVersion>
|
<GamePlatform Condition="'$(GamePlatform)' == ''">Steam</GamePlatform>
|
||||||
<DefineConstants>$(DefineConstants);STEAM</DefineConstants>
|
<GameVersion Condition="'$(GamePlatform)' == 'Steam'">2021.5.25.2s</GameVersion>
|
||||||
|
<GameVersion Condition="'$(GamePlatform)' == 'Itch'">2021.5.10i</GameVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
|
||||||
<Mappings>NuclearPowered/Mappings:0.4.0</Mappings>
|
<GameProvider>$(GamePlatform)</GameProvider>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||||
|
<GameProvider>Github</GameProvider>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Reactor.OxygenFilter.MSBuild" Version="0.3.0" />
|
<PackageReference Include="Reactor.MSBuild" Version="0.1.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="Copy" AfterTargets="Reobfuscate">
|
<Target Name="Copy" AfterTargets="Build" Condition="'$(AmongUs)' != ''">
|
||||||
<Copy SourceFiles="$(OutputPath)reobfuscated/$(AssemblyName)-$(GameVersion).dll" DestinationFolder="$(AmongUs)/BepInEx/plugins/" Condition="'$(Configuration)' == 'Debug'" />
|
<Copy SourceFiles="$(OutputPath)$(AssemblyName).dll;$(OutputPath)$(AssemblyName).pdb" DestinationFolder="$(AmongUs)/BepInEx/plugins/" Condition="'$(Configuration)' == 'Debug'" />
|
||||||
</Target>
|
</Target>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -3,10 +3,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Reactor", "Reactor\Reactor.
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Reactor.Debugger", "Reactor.Debugger\Reactor.Debugger.csproj", "{68589B4D-9EF5-40DD-8D6D-10977ED07259}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Reactor.Debugger", "Reactor.Debugger\Reactor.Debugger.csproj", "{68589B4D-9EF5-40DD-8D6D-10977ED07259}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build", "build\Build.csproj", "{58AC4924-AC3D-45EA-80D7-E9F860FD1DD2}"
|
|
||||||
EndProject
|
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{E2F4DAFA-E98C-4A7D-BA47-AAB0271A769D}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Reactor.Example", "Reactor.Example\Reactor.Example.csproj", "{26A83466-26FE-4383-A35C-B8629902F909}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Reactor.Example", "Reactor.Example\Reactor.Example.csproj", "{26A83466-26FE-4383-A35C-B8629902F909}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Reactor.Shared", "Reactor.Shared\Reactor.Shared.shproj", "{8C1EEFE9-EF8A-47C4-810E-6D9BA1E7218B}"
|
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Reactor.Shared", "Reactor.Shared\Reactor.Shared.shproj", "{8C1EEFE9-EF8A-47C4-810E-6D9BA1E7218B}"
|
||||||
@@ -25,14 +21,11 @@ Global
|
|||||||
{68589B4D-9EF5-40DD-8D6D-10977ED07259}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{68589B4D-9EF5-40DD-8D6D-10977ED07259}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{68589B4D-9EF5-40DD-8D6D-10977ED07259}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{68589B4D-9EF5-40DD-8D6D-10977ED07259}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{68589B4D-9EF5-40DD-8D6D-10977ED07259}.Release|Any CPU.Build.0 = Release|Any CPU
|
{68589B4D-9EF5-40DD-8D6D-10977ED07259}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{58AC4924-AC3D-45EA-80D7-E9F860FD1DD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{58AC4924-AC3D-45EA-80D7-E9F860FD1DD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{26A83466-26FE-4383-A35C-B8629902F909}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{26A83466-26FE-4383-A35C-B8629902F909}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{26A83466-26FE-4383-A35C-B8629902F909}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{26A83466-26FE-4383-A35C-B8629902F909}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{26A83466-26FE-4383-A35C-B8629902F909}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{26A83466-26FE-4383-A35C-B8629902F909}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{26A83466-26FE-4383-A35C-B8629902F909}.Release|Any CPU.Build.0 = Release|Any CPU
|
{26A83466-26FE-4383-A35C-B8629902F909}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{58AC4924-AC3D-45EA-80D7-E9F860FD1DD2} = {E2F4DAFA-E98C-4A7D-BA47-AAB0271A769D}
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<TargetFramework>netstandard2.1</TargetFramework>
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
|
|
||||||
<VersionPrefix>0.4.0</VersionPrefix>
|
<VersionPrefix>1.0.0</VersionPrefix>
|
||||||
<VersionSuffix>dev</VersionSuffix>
|
<VersionSuffix>dev</VersionSuffix>
|
||||||
<Description>Core mod and API for Among Us</Description>
|
<Description>Core mod and API for Among Us</Description>
|
||||||
<Authors>NuclearPowered</Authors>
|
<Authors>NuclearPowered</Authors>
|
||||||
|
|||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
var target = Argument("target", "Build");
|
||||||
|
|
||||||
|
var buildId = EnvironmentVariable("GITHUB_RUN_NUMBER");
|
||||||
|
|
||||||
|
var @ref = EnvironmentVariable("GITHUB_REF");
|
||||||
|
const string prefix = "refs/tags/";
|
||||||
|
var tag = !string.IsNullOrEmpty(@ref) && @ref.StartsWith(prefix) ? @ref.Substring(prefix.Length) : null;
|
||||||
|
|
||||||
|
Task("Build")
|
||||||
|
.Does(() =>
|
||||||
|
{
|
||||||
|
var settings = new DotNetCoreBuildSettings
|
||||||
|
{
|
||||||
|
Configuration = "Release",
|
||||||
|
MSBuildSettings = new DotNetCoreMSBuildSettings()
|
||||||
|
};
|
||||||
|
|
||||||
|
if (tag != null)
|
||||||
|
{
|
||||||
|
settings.MSBuildSettings.Properties["Version"] = new[] { tag };
|
||||||
|
}
|
||||||
|
else if (buildId != null)
|
||||||
|
{
|
||||||
|
settings.VersionSuffix = "ci." + buildId;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var gamePlatform in new[] { "Steam", "Itch" })
|
||||||
|
{
|
||||||
|
settings.MSBuildSettings.Properties["GamePlatform"] = new[] { gamePlatform };
|
||||||
|
DotNetCoreBuild(".", settings);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
RunTarget(target);
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
dotnet run --project build/Build.csproj -- $args
|
|
||||||
exit $LASTEXITCODE;
|
|
||||||
@@ -1 +1,12 @@
|
|||||||
dotnet run --project ./build/Build.csproj -- "$@"
|
#!/usr/bin/env bash
|
||||||
|
set -euox pipefail
|
||||||
|
|
||||||
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||||
|
|
||||||
|
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||||
|
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||||
|
export DOTNET_NOLOGO=1
|
||||||
|
|
||||||
|
dotnet tool restore
|
||||||
|
|
||||||
|
dotnet cake "$@"
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
|
||||||
<RunWorkingDirectory>$(MSBuildProjectDirectory)/..</RunWorkingDirectory>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Cake.Frosting" Version="1.1.0" />
|
|
||||||
<PackageReference Include="DepotDownloader.Library" Version="0.1.2" />
|
|
||||||
<PackageReference Include="Reactor.OxygenFilter" Version="0.1.1" />
|
|
||||||
<PackageReference Include="Il2CppDumper" Version="6.5.4" />
|
|
||||||
<PackageReference Include="NuclearPowered.AssemblyUnhollower" Version="0.4.15" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,145 +0,0 @@
|
|||||||
using System.IO;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using AssemblyUnhollower;
|
|
||||||
using Cake.Common;
|
|
||||||
using Cake.Common.Diagnostics;
|
|
||||||
using Cake.Common.IO;
|
|
||||||
using Cake.Common.Net;
|
|
||||||
using Cake.Common.Tools.DotNetCore;
|
|
||||||
using Cake.Common.Tools.DotNetCore.Build;
|
|
||||||
using Cake.Core;
|
|
||||||
using Cake.Frosting;
|
|
||||||
using DepotDownloader;
|
|
||||||
|
|
||||||
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 const ulong ManifestId = 1328515537648622656; // 2021.4.14s
|
|
||||||
|
|
||||||
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, ManifestId);
|
|
||||||
ContentDownloader.ShutdownSteam3();
|
|
||||||
|
|
||||||
var bepinexZip = context.DownloadFile("https://github.com/NuclearPowered/BepInEx/releases/download/6.0.0-reactor.18%2Bstructfix/BepInEx-6.0.0-reactor.18+structfix.zip");
|
|
||||||
context.Unzip(bepinexZip, 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
|
|
||||||
{
|
|
||||||
GenerateStruct = 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 Il2CppUnhollower generator");
|
|
||||||
|
|
||||||
UnhollowerBaseLib.LogSupport.InfoHandler += context.Information;
|
|
||||||
UnhollowerBaseLib.LogSupport.WarningHandler += context.Warning;
|
|
||||||
UnhollowerBaseLib.LogSupport.TraceHandler += context.Debug;
|
|
||||||
UnhollowerBaseLib.LogSupport.ErrorHandler += context.Error;
|
|
||||||
|
|
||||||
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 = Path.Combine(context.AmongUsPath, "BepInEx", "unity-libs"),
|
|
||||||
NoCopyUnhollowerLibs = true
|
|
||||||
};
|
|
||||||
|
|
||||||
AssemblyUnhollower.Program.Main(unhollowerOptions);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TaskName("Clean")]
|
|
||||||
public sealed class CleanTask : FrostingTask<BuildContext>
|
|
||||||
{
|
|
||||||
public override void Run(BuildContext context)
|
|
||||||
{
|
|
||||||
context.CleanDirectory("bin");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[TaskName("Build")]
|
|
||||||
[IsDependentOn(typeof(CleanTask))]
|
|
||||||
[IsDependentOn(typeof(GenerateProxyAssemblyTask))]
|
|
||||||
public sealed class BuildTask : FrostingTask<BuildContext>
|
|
||||||
{
|
|
||||||
private void Build(BuildContext context, string project)
|
|
||||||
{
|
|
||||||
var buildId = context.EnvironmentVariable<string>("GITHUB_RUN_NUMBER", null);
|
|
||||||
|
|
||||||
context.DotNetCoreBuild(project, new DotNetCoreBuildSettings
|
|
||||||
{
|
|
||||||
Configuration = "Release",
|
|
||||||
VersionSuffix = buildId == null ? "dev" : "ci." + buildId,
|
|
||||||
EnvironmentVariables =
|
|
||||||
{
|
|
||||||
["GamePlatform"] = "Steam",
|
|
||||||
["AmongUs"] = Path.GetFullPath(context.AmongUsPath)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Run(BuildContext context)
|
|
||||||
{
|
|
||||||
Build(context, "Reactor/Reactor.csproj");
|
|
||||||
Build(context, "Reactor.Debugger/Reactor.Debugger.csproj");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[IsDependentOn(typeof(BuildTask))]
|
|
||||||
public sealed class Default : FrostingTask<BuildContext>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user