mirror of
https://github.com/BepInEx/BepInEx.git
synced 2026-10-20 01:46:13 +00:00
Merge with master
This commit is contained in:
commit
76e423aa78
6 files changed
+73
-132
No files matched your search
@@ -34,17 +34,19 @@ namespace BepInEx.Preloader
|
||||
{
|
||||
AllocateConsole();
|
||||
|
||||
Utility.TryDo(() =>
|
||||
bool bridgeInitialized = Utility.TryDo(() =>
|
||||
{
|
||||
if (ConfigShimHarmony.Value)
|
||||
HarmonyDetourBridge.Init();
|
||||
}, out var harmonyBridgeException);
|
||||
|
||||
Utility.TryDo(() =>
|
||||
{
|
||||
if (ConfigApplyRuntimePatches.Value)
|
||||
UnityPatches.Apply();
|
||||
}, out var runtimePatchException);
|
||||
Exception runtimePatchException = null;
|
||||
if(bridgeInitialized)
|
||||
Utility.TryDo(() =>
|
||||
{
|
||||
if (ConfigApplyRuntimePatches.Value)
|
||||
UnityPatches.Apply();
|
||||
}, out runtimePatchException);
|
||||
|
||||
Logger.Sources.Add(TraceLogSource.CreateSource());
|
||||
|
||||
@@ -100,6 +102,7 @@ namespace BepInEx.Preloader
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
File.WriteAllText("err.log", ex.ToString());
|
||||
try
|
||||
{
|
||||
Logger.LogFatal("Could not run preloader!");
|
||||
|
||||
@@ -8,14 +8,13 @@ namespace BepInEx.Preloader.RuntimeFixes
|
||||
{
|
||||
internal static class UnityPatches
|
||||
{
|
||||
public static HarmonyLib.Harmony HarmonyInstance { get; } = new HarmonyLib.Harmony("com.bepinex.unitypatches");
|
||||
private static HarmonyLib.Harmony HarmonyInstance { get; set; }
|
||||
|
||||
public static Dictionary<string, string> AssemblyLocations { get; } =
|
||||
new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
|
||||
public static Dictionary<string, string> AssemblyLocations { get; } = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
|
||||
|
||||
public static void Apply()
|
||||
{
|
||||
HarmonyWrapper.PatchAll(typeof(UnityPatches), HarmonyInstance);
|
||||
HarmonyInstance = HarmonyWrapper.PatchAll(typeof(UnityPatches), HarmonyInstance);
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -71,7 +71,9 @@ namespace BepInEx.Bootstrap
|
||||
}
|
||||
|
||||
Logger.Listeners.Add(new UnityLogListener());
|
||||
Logger.Listeners.Add(new DiskLogListener());
|
||||
|
||||
if (ConfigDiskLogging.Value)
|
||||
Logger.Listeners.Add(new DiskLogListener("LogOutput.log", ConfigDiskConsoleDisplayedLevel.Value, ConfigDiskAppend.Value, ConfigDiskWriteUnityLog.Value));
|
||||
|
||||
if (!TraceLogSource.IsListening)
|
||||
Logger.Sources.Add(TraceLogSource.CreateSource());
|
||||
@@ -304,16 +306,31 @@ namespace BepInEx.Bootstrap
|
||||
|
||||
#region Config
|
||||
|
||||
private static readonly ConfigWrapper<string> ConfigPluginsDirectory = ConfigFile.CoreConfig.Wrap<string>(
|
||||
"Paths", "PluginsDirectory",
|
||||
"plugins",
|
||||
new ConfigDescription("The relative directory to the BepInEx folder where plugins are loaded."));
|
||||
|
||||
private static readonly ConfigWrapper<bool> ConfigUnityLogging = ConfigFile.CoreConfig.Wrap(
|
||||
"Logging", "UnityLogListening",
|
||||
true,
|
||||
new ConfigDescription("Enables showing unity log messages in the BepInEx logging system."));
|
||||
|
||||
private static readonly ConfigWrapper<bool> ConfigDiskWriteUnityLog = ConfigFile.CoreConfig.Wrap(
|
||||
"Logging.Disk", "WriteUnityLog",
|
||||
false,
|
||||
new ConfigDescription("Include unity log messages in log file output."));
|
||||
|
||||
private static readonly ConfigWrapper<bool> ConfigDiskAppend = ConfigFile.CoreConfig.Wrap(
|
||||
"Logging.Disk", "AppendLog",
|
||||
false,
|
||||
new ConfigDescription("Appends to the log file instead of overwriting, on game startup."));
|
||||
|
||||
private static readonly ConfigWrapper<bool> ConfigDiskLogging = ConfigFile.CoreConfig.Wrap(
|
||||
"Logging.Disk", "Enabled",
|
||||
true,
|
||||
new ConfigDescription("Enables writing log messages to disk."));
|
||||
|
||||
private static readonly ConfigWrapper<LogLevel> ConfigDiskConsoleDisplayedLevel = ConfigFile.CoreConfig.Wrap(
|
||||
"Logging.Disk", "DisplayedLogLevel",
|
||||
LogLevel.Info,
|
||||
new ConfigDescription("Only displays the specified log level and above in the console output."));
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using BepInEx.Configuration;
|
||||
|
||||
namespace BepInEx.Logging
|
||||
{
|
||||
@@ -10,18 +9,24 @@ namespace BepInEx.Logging
|
||||
/// </summary>
|
||||
public class DiskLogListener : ILogListener
|
||||
{
|
||||
protected TextWriter LogWriter { get; set; }
|
||||
public LogLevel DisplayedLogLevel { get; set; }
|
||||
|
||||
protected Timer FlushTimer { get; set; }
|
||||
public TextWriter LogWriter { get; protected set; }
|
||||
|
||||
public DiskLogListener()
|
||||
public Timer FlushTimer { get; protected set; }
|
||||
|
||||
public bool WriteFromUnityLog { get; set; }
|
||||
|
||||
public DiskLogListener(string localPath, LogLevel displayedLogLevel = LogLevel.Info, bool appendLog = false, bool includeUnityLog = false)
|
||||
{
|
||||
WriteFromUnityLog = includeUnityLog;
|
||||
DisplayedLogLevel = displayedLogLevel;
|
||||
|
||||
int counter = 1;
|
||||
string localPath = "LogOutput.log";
|
||||
|
||||
FileStream fileStream;
|
||||
|
||||
while (!Utility.TryOpenFileStream(Path.Combine(Paths.BepInExRootPath, localPath), ConfigAppendLog.Value ? FileMode.Append : FileMode.Create, out fileStream, share: FileShare.Read))
|
||||
while (!Utility.TryOpenFileStream(Path.Combine(Paths.BepInExRootPath, localPath), appendLog ? FileMode.Append : FileMode.Create, out fileStream, share: FileShare.Read))
|
||||
{
|
||||
if (counter == 5)
|
||||
{
|
||||
@@ -43,10 +48,10 @@ namespace BepInEx.Logging
|
||||
|
||||
public void LogEvent(object sender, LogEventArgs eventArgs)
|
||||
{
|
||||
if (!ConfigWriteUnityLog.Value && eventArgs.Source is UnityLogSource)
|
||||
if (!WriteFromUnityLog && eventArgs.Source is UnityLogSource)
|
||||
return;
|
||||
|
||||
if (eventArgs.Level.GetHighestLevel() > ConfigConsoleDisplayedLevel.Value)
|
||||
if (eventArgs.Level.GetHighestLevel() > DisplayedLogLevel)
|
||||
return;
|
||||
|
||||
LogWriter.WriteLine($"[{eventArgs.Level,-7}:{((ILogSource)sender).SourceName,10}] {eventArgs.Data}");
|
||||
@@ -63,20 +68,5 @@ namespace BepInEx.Logging
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
private static readonly ConfigWrapper<LogLevel> ConfigConsoleDisplayedLevel = ConfigFile.CoreConfig.Wrap(
|
||||
"Logging.Disk", "DisplayedLogLevel",
|
||||
LogLevel.Info,
|
||||
new ConfigDescription("Only displays the specified log level and above in the console output."));
|
||||
|
||||
private static readonly ConfigWrapper<bool> ConfigWriteUnityLog = ConfigFile.CoreConfig.Wrap(
|
||||
"Logging.Disk", "WriteUnityLog",
|
||||
false,
|
||||
new ConfigDescription("Include unity log messages in log file output."));
|
||||
|
||||
private static readonly ConfigWrapper<bool> ConfigAppendLog = ConfigFile.CoreConfig.Wrap(
|
||||
"Logging.Disk", "AppendLog",
|
||||
false,
|
||||
new ConfigDescription("Appends to the log file instead of overwriting, on game startup."));
|
||||
}
|
||||
}
|
||||
+6
-1
@@ -22,13 +22,18 @@ namespace BepInEx
|
||||
{
|
||||
try
|
||||
{
|
||||
var m = new DynamicMethod("SRE_Test", null, null);
|
||||
CLRSupportsDynamicAssemblies = true;
|
||||
// ReSharper disable once AssignNullToNotNullAttribute
|
||||
var m = new CustomAttributeBuilder(null, new object[0]);
|
||||
}
|
||||
catch (PlatformNotSupportedException)
|
||||
{
|
||||
CLRSupportsDynamicAssemblies = false;
|
||||
}
|
||||
catch (ArgumentNullException)
|
||||
{
|
||||
// Suppress ArgumentNullException
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -79,48 +79,31 @@ Changes since ${latestTag}:
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build Legacy BepInEx') {
|
||||
stage('Build BepInEx') {
|
||||
steps {
|
||||
sh 'cp -f Unity/5.6/UnityEngine.dll BepInEx/lib/UnityEngine.dll'
|
||||
dir('BepInEx') {
|
||||
sh 'msbuild /p:Configuration=Legacy /t:Build /p:DebugType=none BepInEx.sln'
|
||||
sh 'msbuild /p:Configuration=Release /t:Build /p:DebugType=none BepInEx.sln'
|
||||
}
|
||||
|
||||
dir('Build/Legacy/bin') {
|
||||
sh 'cp -fr ../../../BepInEx/bin/* .'
|
||||
dir('Build/bin') {
|
||||
sh 'cp -fr ../../BepInEx/bin/* .'
|
||||
}
|
||||
dir('BepInEx/bin') {
|
||||
deleteDir()
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build 2018 BepInEx') {
|
||||
stage('Package') {
|
||||
steps {
|
||||
// sh 'cp -f Unity/2018/UnityEngine.CoreModule.dll BepInEx/lib/UnityEngine.CoreModule.dll'
|
||||
// TODO: Switch to 2018 version of UnityEngine.dll?
|
||||
sh 'cp -f Unity/5.6/UnityEngine.dll BepInEx/lib/UnityEngine.dll'
|
||||
dir('BepInEx') {
|
||||
sh 'msbuild /p:Configuration=v2018 /t:Build /p:DebugType=none BepInEx.sln'
|
||||
}
|
||||
|
||||
dir('Build/v2018/bin') {
|
||||
sh 'cp -fr ../../../BepInEx/bin/* .'
|
||||
}
|
||||
dir('BepInEx/bin') {
|
||||
deleteDir()
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Package Legacy') {
|
||||
steps {
|
||||
dir('Build/Legacy/dist') {
|
||||
dir('Build/dist') {
|
||||
sh 'mkdir -p BepInEx/core BepInEx/patchers BepInEx/plugins'
|
||||
sh 'cp -fr -t BepInEx/core ../bin/*'
|
||||
sh 'rm -f BepInEx/core/UnityEngine.dll'
|
||||
sh 'rm -rf BepInEx/core/patcher'
|
||||
|
||||
sh 'cp -f ../../../BepInEx/doorstop/doorstop_config.ini doorstop_config.ini'
|
||||
sh 'cp -f ../../../Doorstop/x86/version.dll version.dll'
|
||||
sh 'cp -f ../../BepInEx/doorstop/doorstop_config.ini doorstop_config.ini'
|
||||
sh 'cp -f ../../Doorstop/x86/version.dll version.dll'
|
||||
|
||||
script {
|
||||
if(params.IS_BE) {
|
||||
@@ -132,18 +115,17 @@ Changes since ${latestTag}:
|
||||
commitPrefix = "_"
|
||||
}
|
||||
|
||||
sh "zip -r9 BepInEx_Legacy_x86${commitPrefix}${versionNumber}.zip ./*"
|
||||
sh "zip -r9 BepInEx_x86${commitPrefix}${versionNumber}.zip ./*"
|
||||
|
||||
sh 'cp -f ../../../Doorstop/x64/version.dll version.dll'
|
||||
sh 'cp -f ../../Doorstop/x64/version.dll version.dll'
|
||||
|
||||
sh 'unix2dos doorstop_config.ini'
|
||||
|
||||
|
||||
sh "zip -r9 BepInEx_Legacy_x64${commitPrefix}${versionNumber}.zip ./* -x \\*.zip"
|
||||
sh "zip -r9 BepInEx_x64${commitPrefix}${versionNumber}.zip ./* -x \\*.zip"
|
||||
|
||||
archiveArtifacts "*.zip"
|
||||
}
|
||||
dir('Build/Legacy/patcher') {
|
||||
dir('Build/patcher') {
|
||||
sh 'cp -fr ../bin/patcher/* .'
|
||||
script {
|
||||
if(params.IS_BE) {
|
||||
@@ -151,83 +133,28 @@ Changes since ${latestTag}:
|
||||
sh 'unix2dos changelog.txt'
|
||||
}
|
||||
}
|
||||
sh "zip -r9 BepInEx_Legacy_Patcher${commitPrefix}${versionNumber}.zip ./*"
|
||||
|
||||
archiveArtifacts "*.zip"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Package v2018') {
|
||||
steps {
|
||||
dir('Build/v2018/dist') {
|
||||
sh 'mkdir -p BepInEx/core BepInEx/patchers BepInEx/plugins'
|
||||
sh 'cp -fr -t BepInEx/core ../bin/*'
|
||||
sh 'rm -rf BepInEx/core/patcher'
|
||||
sh 'rm -f BepInEx/core/UnityEngine.dll'
|
||||
sh 'rm -f BepInEx/core/UnityEngine.CoreModule.dll'
|
||||
|
||||
sh 'cp -f ../../../BepInEx/doorstop/doorstop_config.ini doorstop_config.ini'
|
||||
sh 'cp -f ../../../Doorstop/x86/version.dll version.dll'
|
||||
|
||||
script {
|
||||
if(params.IS_BE) {
|
||||
writeFile encoding: 'UTF-8', file: 'changelog.txt', text: changelog
|
||||
sh 'unix2dos changelog.txt'
|
||||
commitPrefix = "_${shortCommit}_"
|
||||
}
|
||||
else
|
||||
commitPrefix = "_"
|
||||
}
|
||||
|
||||
sh "zip -r9 BepInEx_v2018_x86${commitPrefix}${versionNumber}.zip ./*"
|
||||
|
||||
sh 'cp -f ../../../Doorstop/x64/version.dll version.dll'
|
||||
|
||||
sh 'unix2dos doorstop_config.ini'
|
||||
|
||||
sh "zip -r9 BepInEx_v2018_x64${commitPrefix}${versionNumber}.zip ./* -x \\*.zip"
|
||||
|
||||
archiveArtifacts "*.zip"
|
||||
}
|
||||
dir('Build/v2018/patcher') {
|
||||
sh 'cp -fr ../bin/patcher/* .'
|
||||
script {
|
||||
if(params.IS_BE) {
|
||||
writeFile encoding: 'UTF-8', file: 'changelog.txt', text: changelog
|
||||
sh 'unix2dos changelog.txt'
|
||||
}
|
||||
}
|
||||
sh "zip -r9 BepInEx_v2018_Patcher${commitPrefix}${versionNumber}.zip ./*"
|
||||
sh "zip -r9 BepInEx_Patcher${commitPrefix}${versionNumber}.zip ./*"
|
||||
|
||||
archiveArtifacts "*.zip"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
post {
|
||||
success {
|
||||
script {
|
||||
if(params.IS_BE) {
|
||||
// Write built BepInEx into bepisbuilds
|
||||
dir('Build/Legacy/dist') {
|
||||
sh "cp BepInEx_Legacy_x86_${shortCommit}_${versionNumber}.zip /var/www/bepisbuilds/builds/bepinex_be"
|
||||
sh "cp BepInEx_Legacy_x64_${shortCommit}_${versionNumber}.zip /var/www/bepisbuilds/builds/bepinex_be"
|
||||
dir('Build/dist') {
|
||||
sh "cp BepInEx_x86_${shortCommit}_${versionNumber}.zip /var/www/bepisbuilds/builds/bepinex_be"
|
||||
sh "cp BepInEx_x64_${shortCommit}_${versionNumber}.zip /var/www/bepisbuilds/builds/bepinex_be"
|
||||
}
|
||||
|
||||
dir('Build/Legacy/patcher') {
|
||||
sh "cp BepInEx_Legacy_Patcher_${shortCommit}_${versionNumber}.zip /var/www/bepisbuilds/builds/bepinex_be"
|
||||
}
|
||||
|
||||
dir('Build/v2018/dist') {
|
||||
sh "cp BepInEx_v2018_x86_${shortCommit}_${versionNumber}.zip /var/www/bepisbuilds/builds/bepinex_be"
|
||||
sh "cp BepInEx_v2018_x64_${shortCommit}_${versionNumber}.zip /var/www/bepisbuilds/builds/bepinex_be"
|
||||
}
|
||||
|
||||
/*
|
||||
dir('Build/v2018/patcher') {
|
||||
sh "cp BepInEx_v2018_Patcher_${shortCommit}_${versionNumber}.zip /var/www/bepisbuilds/builds/bepinex_be"
|
||||
}
|
||||
|
||||
sh "echo \"`date -Iseconds -u`;${env.BUILD_NUMBER};${shortCommit};BepInEx_Legacy_x86_${shortCommit}_${versionNumber}.zip;BepInEx_Legacy_x64_${shortCommit}_${versionNumber}.zip;BepInEx_v2018_x86_${shortCommit}_${versionNumber}.zip;BepInEx_v2018_x64_${shortCommit}_${versionNumber}.zip;BepInEx_Legacy_Patcher_${shortCommit}_${versionNumber}.zip;BepInEx_v2018_Patcher_${shortCommit}_${versionNumber}.zip\" >> /var/www/bepisbuilds/builds/bepinex_be/artifacts_list"
|
||||
*/
|
||||
sh "echo \"`date -Iseconds -u`;${env.BUILD_NUMBER};${shortCommit};BepInEx_x86_${shortCommit}_${versionNumber}.zip;BepInEx_x64_${shortCommit}_${versionNumber}.zip\" >> /var/www/bepisbuilds/builds/bepinex_be/artifacts_list"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user