Skip to content

Commit

Permalink
Optimized/simplified the Build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
slxdy committed Oct 20, 2024
1 parent 7b98436 commit f05c252
Show file tree
Hide file tree
Showing 14 changed files with 195 additions and 485 deletions.
363 changes: 171 additions & 192 deletions .github/workflows/build.yml

Large diffs are not rendered by default.

27 changes: 0 additions & 27 deletions .github/workflows/nuget.yml

This file was deleted.

5 changes: 0 additions & 5 deletions Dependencies/SupportModules/Il2Cpp/Il2Cpp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@

<RestoreAdditionalProjectSources>https://nuget.bepinex.dev/v3/index.json</RestoreAdditionalProjectSources>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Libs\**" />
<EmbeddedResource Remove="Libs\**" />
<None Remove="Libs\**" />
</ItemGroup>
<ItemGroup>
<Reference Include="Il2Cppmscorlib">
<HintPath>Libs\Il2Cppmscorlib.dll</HintPath>
Expand Down
7 changes: 1 addition & 6 deletions Dependencies/SupportModules/Mono/Mono.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@
<TargetFramework>net35</TargetFramework>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>$(SolutionDir)\Output\$(Configuration)\MelonLoader\Dependencies\SupportModules\</OutputPath>
<OutputPath>$(SolutionDir)Output\$(Configuration)\MelonLoader\Dependencies\SupportModules\</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>embedded</DebugType>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Libs\**" />
<EmbeddedResource Remove="Libs\**" />
<None Remove="Libs\**" />
</ItemGroup>
<ItemGroup>
<Reference Include="UnityEngine" HintPath="Libs\UnityEngine.dll" Private="False" />
</ItemGroup>
Expand Down
34 changes: 19 additions & 15 deletions Dependencies/SupportModules/Preload/Preload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,30 @@ private static void Initialize()
if (Environment.Version >= new Version("3.0.0.0"))
return;

string managedFolder = string.Copy(GetManagedDirectory());
var ownDir = typeof(Preload).Assembly.Location;
if (string.IsNullOrEmpty(ownDir))
return;

WriteResource(Properties.Resources.System, Path.Combine(managedFolder, "System.dll"));
WriteResource(Properties.Resources.System_Core, Path.Combine(managedFolder, "System.Core.dll"));
WriteResource(Properties.Resources.System_Drawing, Path.Combine(managedFolder, "System.Drawing.dll"));
}
ownDir = Path.GetDirectoryName(ownDir);

[MethodImpl(MethodImplOptions.InternalCall)]
[return: MarshalAs(UnmanagedType.LPStr)]
private static extern string GetManagedDirectory();
var managedFolder = GetManagedDirectory();

private static void WriteResource(byte[] data, string destination)
{
try
var patchesDir = Path.Combine(ownDir, "NetStandardPatches");
if (!Directory.Exists(patchesDir))
return;

foreach (var patch in Directory.GetFiles(patchesDir))
{
if (File.Exists(destination))
File.Delete(destination);
File.WriteAllBytes(destination, data);
try
{
File.Copy(patch, Path.Combine(managedFolder, Path.GetFileName(patch)), true);
}
catch { }
}
catch { }
}

[MethodImpl(MethodImplOptions.InternalCall)]
[return: MarshalAs(UnmanagedType.LPStr)]
private static extern string GetManagedDirectory();
}
}
15 changes: 1 addition & 14 deletions Dependencies/SupportModules/Preload/Preload.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,6 @@
<DefineConstants />
</PropertyGroup>
<ItemGroup>
<None Remove="Resources\**" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="NetStandardPatches\**" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
</Project>

This file was deleted.

130 changes: 0 additions & 130 deletions Dependencies/SupportModules/Preload/Properties/Resources.resx

This file was deleted.

1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<Company>discord.gg/2Wn3N2P</Company>
<Copyright>Copyright (c) 2022 Lava Gang</Copyright>
<LangVersion>Latest</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>
</Project>

2 changes: 0 additions & 2 deletions MelonLoader.sln
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,11 @@ Global
{762D7545-6F6B-441A-B040-49CC31A1713B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{762D7545-6F6B-441A-B040-49CC31A1713B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{762D7545-6F6B-441A-B040-49CC31A1713B}.Debug|Windows - x64.ActiveCfg = Debug|Any CPU
{762D7545-6F6B-441A-B040-49CC31A1713B}.Debug|Windows - x64.Build.0 = Debug|Any CPU
{762D7545-6F6B-441A-B040-49CC31A1713B}.Debug|Windows - x86.ActiveCfg = Debug|Any CPU
{762D7545-6F6B-441A-B040-49CC31A1713B}.Debug|Windows - x86.Build.0 = Debug|Any CPU
{762D7545-6F6B-441A-B040-49CC31A1713B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{762D7545-6F6B-441A-B040-49CC31A1713B}.Release|Any CPU.Build.0 = Release|Any CPU
{762D7545-6F6B-441A-B040-49CC31A1713B}.Release|Windows - x64.ActiveCfg = Release|Any CPU
{762D7545-6F6B-441A-B040-49CC31A1713B}.Release|Windows - x64.Build.0 = Release|Any CPU
{762D7545-6F6B-441A-B040-49CC31A1713B}.Release|Windows - x86.ActiveCfg = Release|Any CPU
{762D7545-6F6B-441A-B040-49CC31A1713B}.Release|Windows - x86.Build.0 = Release|Any CPU
{542EC51D-E480-4802-B5AA-96EEC05AF19C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
Expand Down
3 changes: 2 additions & 1 deletion MelonLoader/MelonLoader.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net35;net6</TargetFrameworks>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
Expand All @@ -9,6 +9,7 @@
<EnableDynamicLoading>true</EnableDynamicLoading>
<DebugType>embedded</DebugType>

<IsPackable>true</IsPackable>
<PackageId>LavaGang.MelonLoader</PackageId>
<PackageTags>modding unity</PackageTags>
<RepositoryUrl>https://github.com/LavaGang/MelonLoader</RepositoryUrl>
Expand Down

0 comments on commit f05c252

Please sign in to comment.