Skip to content

Commit

Permalink
Fully move to new sdk csproj format; Generate zips on release build
Browse files Browse the repository at this point in the history
  • Loading branch information
ManlyMarco committed Jan 19, 2025
1 parent 6946000 commit dc09cbd
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 73 deletions.
25 changes: 19 additions & 6 deletions BepInEx.KeyboardShortcut/BepInEx.KeyboardShortcut.IL2CPP.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<RootNamespace>BepInEx.KeyboardShortcut</RootNamespace>

<RootNamespace>BepInEx.Configuration</RootNamespace>
<AssemblyName>BepInEx.KeyboardShortcut</AssemblyName>
<DebugType>embedded</DebugType>

<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<GenerateDependencyFile>false</GenerateDependencyFile>
<GenerateDocumentationFile>True</GenerateDocumentationFile>

<DefineConstants>$(DefineConstants);IL2CPP</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DefineConstants>$(DefineConstants);TRACE;DEBUG</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
<Optimize>true</Optimize>
</PropertyGroup>

<ItemGroup>
Expand All @@ -17,9 +28,11 @@
</PackageReference>
<PackageReference Include="IllusionLibs.HoneyCome.Il2Cppmscorlib" Version="2023.99.12.15">
<IncludeAssets>compile</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="IllusionLibs.HoneyCome.UnityEngine" Version="2021.3.14.3">
<IncludeAssets>compile</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

Expand Down
4 changes: 4 additions & 0 deletions BepInEx.KeyboardShortcut/KeyboardShortcut.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// This is copied from BepInEx 5 and modified to work with BepInEx 6 nightlies where this type is missing
// This is a temporary fix until this struct is added to BepInEx 6 proper

using System;
using System.Collections.Generic;
using System.Linq;
using BepInEx.Logging;
using System.Reflection;
using UnityEngine;
Expand Down
38 changes: 33 additions & 5 deletions ConfigurationManager.IL2CPP/ConfigurationManager.IL2CPP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,60 @@

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>

<RootNamespace>ConfigurationManager</RootNamespace>
<AssemblyName>ConfigurationManager</AssemblyName>

<OutputPath>D:\SVN\BepInEx.ConfigurationManager\bin\IL2CPP</OutputPath>
<OutputPath>..\bin\IL2CPP</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>

<GenerateDependencyFile>false</GenerateDependencyFile>
<GenerateDocumentationFile>True</GenerateDocumentationFile>

<DebugType>embedded</DebugType>
<DefineConstants>$(DefineConstants);IL2CPP</DefineConstants>

<ZipPostfix>_IL2CPP</ZipPostfix>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DefineConstants>$(DefineConstants);TRACE;DEBUG</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
<Optimize>true</Optimize>
</PropertyGroup>

<ItemGroup>
<None Include="..\LICENSE">
<Link>LICENSE</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="..\README.md">
<Link>README.md</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="..\ConfigurationManagerAttributes.cs">
<Link>ConfigurationManagerAttributes.cs</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.664">
<IncludeAssets>compile</IncludeAssets>
</PackageReference>
<PackageReference Include="IllusionLibs.HoneyCome.Il2Cppmscorlib" Version="2023.99.12.15">
<IncludeAssets>compile</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="IllusionLibs.HoneyCome.UnityEngine" Version="2021.3.14.3">
<IncludeAssets>compile</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="IllusionLibs.HoneyCome.UnityEngine.UI" Version="2021.3.14.3">
<IncludeAssets>compile</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

Expand Down
15 changes: 0 additions & 15 deletions ConfigurationManager.Shared/AssemblyInfo.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<Import_RootNamespace>ConfigurationManager.Shared</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)AssemblyInfo.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ConfigSettingEntry.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ConfigurationManager.cs" />
<Compile Include="$(MSBuildThisFileDirectory)PropertySettingEntry.cs" />
Expand Down
2 changes: 1 addition & 1 deletion ConfigurationManager.Shared/ConfigurationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace ConfigurationManager
/// An easy way to let user configure how a plugin behaves without the need to make your own GUI. The user can change any of the settings you expose, even keyboard shortcuts.
/// https://github.com/ManlyMarco/BepInEx.ConfigurationManager
/// </summary>
[BepInPlugin(GUID, "Configuration Manager", Version)]
[BepInPlugin(GUID, "Configuration Manager", Constants.Version)]
[Browsable(false)]
public class ConfigurationManager : BaseUnityPlugin
{
Expand Down
5 changes: 3 additions & 2 deletions ConfigurationManager.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ VisualStudioVersion = 17.8.34309.116
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConfigurationManager", "ConfigurationManager\ConfigurationManager.csproj", "{22EDD399-1CC6-47C8-B8B8-A95FF2999901}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Templates", "Templates", "{F28F879D-0FA8-488C-A696-BDCCD27099B9}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Solution", "_Solution", "{F28F879D-0FA8-488C-A696-BDCCD27099B9}"
ProjectSection(SolutionItems) = preProject
ConfigurationManagerAttributes.cs = ConfigurationManagerAttributes.cs
Directory.Build.props = Directory.Build.props
README.md = README.md
ConfigurationManagerAttributes.cs = ConfigurationManagerAttributes.cs
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConfigurationManager.IL2CPP", "ConfigurationManager.IL2CPP\ConfigurationManager.IL2CPP.csproj", "{1144B70F-5FF8-4C60-9862-87698157EE1D}"
Expand Down
39 changes: 34 additions & 5 deletions ConfigurationManager/ConfigurationManager.csproj
Original file line number Diff line number Diff line change
@@ -1,20 +1,46 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net35</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>

<RootNamespace>ConfigurationManager</RootNamespace>
<AssemblyName>ConfigurationManager</AssemblyName>

<OutputPath>D:\SVN\BepInEx.ConfigurationManager\bin\BepInEx5</OutputPath>
<OutputPath>..\bin\BepInEx5</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>

<GenerateDependencyFile>false</GenerateDependencyFile>
<GenerateDocumentationFile>True</GenerateDocumentationFile>

<DebugType>embedded</DebugType>
<DefineConstants>$(DefineConstants);Mono</DefineConstants>

<ZipPostfix>_BepInEx5</ZipPostfix>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DefineConstants>$(DefineConstants);TRACE;DEBUG</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
<Optimize>true</Optimize>
</PropertyGroup>

<ItemGroup>
<None Include="..\LICENSE">
<Link>LICENSE</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="..\README.md">
<Link>README.md</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="..\ConfigurationManagerAttributes.cs">
<Link>ConfigurationManagerAttributes.cs</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="BepInEx.Analyzers" Version="1.0.8">
<PrivateAssets>all</PrivateAssets>
Expand All @@ -25,9 +51,11 @@
</PackageReference>
<PackageReference Include="Unity.InputSystem" Version="1.5.0">
<IncludeAssets>compile</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="UnityEngine" Version="5.6.1">
<IncludeAssets>compile</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

Expand All @@ -37,4 +65,5 @@
</ItemGroup>

<Import Project="..\ConfigurationManager.Shared\ConfigurationManager.Shared.projitems" Label="Shared" />

</Project>
57 changes: 46 additions & 11 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,56 @@
<PropertyGroup>
<!-- This is the master version, only change this one -->
<Version>18.4</Version>

<!-- Sets the 'Product name' field on the dll file -->
<Product>BepInEx.ConfigurationManager</Product>
<!-- Sets the 'File description' field on the dll file -->
<AssemblyTitle>Universal in-game configuration manager for BepInEx plugins</AssemblyTitle>
<!-- Sets the 'Company' field on the dll file -->
<Authors>https://github.com/BepInEx/BepInEx.ConfigurationManager</Authors>
<!-- Sets the 'Copyright' field on the dll file -->
<Copyright>Copyright © 2019 / LGPL-3.0</Copyright>

<Deterministic>true</Deterministic>
<DebugSymbols>true</DebugSymbols>
<DebugType>embedded</DebugType>
<FileAlignment>512</FileAlignment>

<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
</PropertyGroup>

<Target Name="AddGeneratedFile" BeforeTargets="BeforeCompile;CoreCompile" Inputs="$(MSBuildAllProjects)" Outputs="$(IntermediateOutputPath)GeneratedFile.cs">
<!-- Create a release zip file (after successful Release build) -->
<Target Name="CreateReleaseZip" AfterTargets="Build" Condition="'$(Configuration)' == 'Release' And '$(AssemblyName)' == 'ConfigurationManager'">
<PropertyGroup>
<CopyDir>$(OutputPath)\..\TEMP_COPY_$(AssemblyName)</CopyDir>
</PropertyGroup>
<ItemGroup>
<BuildFiles Include="$(OutputPath)\*"/>
</ItemGroup>

<RemoveDir Directories="$(CopyDir)" />
<Copy DestinationFolder="$(CopyDir)\BepInEx\plugins\ConfigurationManager" SourceFiles="@(BuildFiles)" />
<!-- https://learn.microsoft.com/en-us/visualstudio/msbuild/zipdirectory-task?view=vs-2022 -->
<ZipDirectory SourceDirectory="$(CopyDir)" DestinationFile="$(OutputPath)\..\BepInEx.ConfigurationManager$(ZipPostfix)_v$(Version).zip" Overwrite="true" />
<RemoveDir Directories="$(CopyDir)" />
</Target>

<!-- Allow using of the csproj properties defined above in the code itself -->
<Target Name="AddGeneratedConstantsFile" BeforeTargets="BeforeCompile;CoreCompile" Inputs="$(MSBuildAllProjects)" Outputs="$(IntermediateOutputPath)GeneratedConstantsFile.cs">
<PropertyGroup>
<BepInExPluginVersion Condition="'$(BepInExPluginVersion)' == ''">$(Version)</BepInExPluginVersion>
<GeneratedText><![CDATA[
namespace $(RootNamespace)
{
internal static class Constants
{
public const string Version = "$(BepInExPluginVersion)"%3B
<GeneratedText>
<![CDATA[namespace $(RootNamespace) {
internal static class Constants {
public const string Version = "$(Version)"%3B
public const string Name = "$(Product)"%3B
public const string Description = "$(AssemblyTitle)"%3B
public const string Website = "$(Authors)"%3B
public const string Copyright = "$(Copyright)"%3B
}
}
]]></GeneratedText>
<GeneratedFilePath>$(IntermediateOutputPath)Constants.cs</GeneratedFilePath>
}]]>
</GeneratedText>
<GeneratedFilePath>$(IntermediateOutputPath)GeneratedConstantsFile.cs</GeneratedFilePath>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(GeneratedFilePath)" />
Expand Down
27 changes: 0 additions & 27 deletions release.ps1

This file was deleted.

0 comments on commit dc09cbd

Please sign in to comment.