-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new project for building the Unity version of the library which c…
…onsists of a single DLL and the Vector2Int class is renamed to EdgarVector2Int to pravent ambiguous references
- Loading branch information
1 parent
9b7e9d3
commit 2ced5ce
Showing
3 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="ILRepack.MSBuild.Task" Version="2.0.13" /> | ||
<PackageReference Include="Mono.Cecil" Version="0.11.2" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Edgar\Edgar.csproj" /> | ||
</ItemGroup> | ||
|
||
<Target Name="CustomAfterBuild" AfterTargets="Build"> | ||
<ItemGroup> | ||
<CopyItems Include="$(SolutionDir)src\Edgar\bin\$(Configuration)\netstandard2.0\*.*" /> | ||
</ItemGroup> | ||
<RemoveDir Directories="$(TargetDir)\Edgar" /> | ||
<Copy SourceFiles="@(CopyItems)" DestinationFolder="$(TargetDir)\Edgar" /> | ||
|
||
<PropertyGroup> | ||
<WorkingDirectory>$(MSBuildThisFileDirectory)bin\$(Configuration)\$(TargetFramework)</WorkingDirectory> | ||
</PropertyGroup> | ||
|
||
<ILRepack | ||
OutputType="$(OutputType)" | ||
MainAssembly="$(WorkingDirectory)\Edgar\Edgar.dll" | ||
OutputAssembly="$(WorkingDirectory)\EdgarSingleFile\EdgarSingleFile.dll" | ||
InputAssemblies="$(WorkingDirectory)\Edgar\*.dll" | ||
WilcardInputAssemblies="true" | ||
WorkingDirectory="$(WorkingDirectory)" /> | ||
</Target> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using Mono.Cecil; | ||
|
||
namespace Edgar.UnityBuild | ||
{ | ||
class Program | ||
{ | ||
static void Main(string[] args) | ||
{ | ||
var assemblyName = "EdgarSingleFile.dll"; | ||
var sourceDir = "EdgarSingleFile"; | ||
var targetDir = "EdgarSingleFileModified"; | ||
|
||
Directory.Delete(targetDir, true); | ||
Directory.CreateDirectory(targetDir); | ||
|
||
CopyFilesRecursively(new DirectoryInfo(sourceDir), new DirectoryInfo(targetDir)); | ||
|
||
var moduleDefinition = ModuleDefinition.ReadModule(Path.Combine(sourceDir, assemblyName)); | ||
var vectorType = moduleDefinition.Types.Single(x => x.Name == "Vector2Int"); | ||
vectorType.Name = "EdgarVector2Int"; | ||
|
||
var stream = new FileStream(Path.Combine(targetDir, assemblyName), FileMode.Create); | ||
moduleDefinition.Write(stream); | ||
} | ||
|
||
public static void CopyFilesRecursively(DirectoryInfo source, DirectoryInfo target) { | ||
foreach (DirectoryInfo dir in source.GetDirectories()) | ||
CopyFilesRecursively(dir, target.CreateSubdirectory(dir.Name)); | ||
foreach (FileInfo file in source.GetFiles()) | ||
file.CopyTo(Path.Combine(target.FullName, file.Name)); | ||
} | ||
} | ||
} |