Skip to content

Commit

Permalink
refactor: Properly symlink assets during build
Browse files Browse the repository at this point in the history
  • Loading branch information
psyGamer committed Oct 26, 2024
1 parent 38bc8ac commit 904deb7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
cat CelesteTAS-EverestInterop/Source/EverestInterop/StudioHelper.cs
- name: Build
run: dotnet build CelesteTAS-EverestInterop -c Debug -p:DefineConstants=INSTALL_STUDIO
run: dotnet build CelesteTAS-EverestInterop -c Debug -p:DefineConstants=INSTALL_STUDIO -p:UseSymlinks=false

- name: Upload Artifact
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Build
run: |
dotnet build CelesteTAS-EverestInterop -c Release -p:DefineConstants=INSTALL_STUDIO
dotnet build CelesteTAS-EverestInterop -c Release -p:DefineConstants=INSTALL_STUDIO -p:UseSymlinks=false
- name: Create release
uses: marvinpinto/action-automatic-releases@latest
Expand Down
3 changes: 0 additions & 3 deletions CelesteTAS-EverestInterop.sln
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,10 @@ Global
{21DF3C27-EF12-45E4-9211-56D7AE0D6BD8}.Release|Any CPU.Build.0 = Release|Any CPU
{EC404784-4D2E-4A49-AA0E-F19400998C69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EC404784-4D2E-4A49-AA0E-F19400998C69}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EC404784-4D2E-4A49-AA0E-F19400998C69}.Release|Any CPU.Build.0 = Release|Any CPU
{FA6B0E7D-C70A-4ED5-99E2-019C9B60E52C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA6B0E7D-C70A-4ED5-99E2-019C9B60E52C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA6B0E7D-C70A-4ED5-99E2-019C9B60E52C}.Release|Any CPU.Build.0 = Release|Any CPU
{95582142-D687-4D70-9933-7FF6B2E52B3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{95582142-D687-4D70-9933-7FF6B2E52B3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{95582142-D687-4D70-9933-7FF6B2E52B3A}.Release|Any CPU.Build.0 = Release|Any CPU
{38937A93-618F-4C67-9437-5F1A2AE2C74D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{38937A93-618F-4C67-9437-5F1A2AE2C74D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{38937A93-618F-4C67-9437-5F1A2AE2C74D}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
35 changes: 24 additions & 11 deletions CelesteTAS-EverestInterop/CelesteTAS-EverestInterop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,8 @@
<PackageReference Include="JetBrains.Profiler.Api" Version="1.1.8" Condition="'$(Configuration)' == 'Debug'" />
</ItemGroup>

<ItemGroup>
<CelesteAssets Include="everest.yaml" />
<CelesteAssets Include="Dialog\**\*" />
<CelesteAssets Include="Graphics\**\*" />
</ItemGroup>

<Target Name="CopyFiles" AfterTargets="Build">
<!-- Assemblies -->
<!-- Assemblies -->
<Target Name="CopyAssemblies" AfterTargets="Build">
<Copy SourceFiles="$(OutputPath)$(AssemblyName).dll" DestinationFolder="..\bin" />
<Copy SourceFiles="$(OutputPath)$(AssemblyName).pdb" DestinationFolder="..\bin" />
<Copy SourceFiles="$(OutputPath)StudioCommunication.dll" DestinationFolder="..\bin" />
Expand All @@ -62,11 +56,30 @@
<Copy SourceFiles="$(OutputPath)ICSharpCode.SharpZipLib.dll" DestinationFolder="..\bin" />
<Copy SourceFiles="$(OutputPath)MemoryPack.Core.dll" DestinationFolder="..\bin" />
<Copy SourceFiles="$(OutputPath)JetBrains.Profiler.Api.dll" DestinationFolder="..\bin" Condition="'$(Configuration)' == 'Debug'" />
</Target>

<!-- Assets (use symlinks in debug builds on POSIX, since MSBuild is useless) -->
<Target Name="LinkAssets" AfterTargets="Build" Condition="'$(Configuration)' == 'Debug' and '$(OS)' == 'Unix' and $(UseSymlinks) != false">
<Copy SourceFiles="" DestinationFiles="..\bin\env.lua" UseSymboliclinksIfPossible="true" />

<Exec Command="rm -rf ../bin/env.lua &amp;&amp; ln -s CelesteTAS-EverestInterop/Source/EverestInterop/Lua/env.lua ../bin/env.lua"/>

<Exec Command="rm -rf ../everest.yaml &amp;&amp; ln -s CelesteTAS-EverestInterop/everest.yaml ../everest.yaml"/>
<Exec Command="rm -rf ../Dialog &amp;&amp; ln -s CelesteTAS-EverestInterop/Dialog ../Dialog"/>
<Exec Command="rm -rf ../Graphics &amp;&amp; ln -s CelesteTAS-EverestInterop/Graphics ../Graphics"/>
</Target>
<Target Name="CopyAssets" AfterTargets="Build" Condition="'$(Configuration)' != 'Debug' or '$(OS)' != 'Unix' or $(UseSymlinks) == false">
<ItemGroup>
<CelesteAssets Include="everest.yaml" />
<CelesteAssets Include="Dialog\**\*" />
<CelesteAssets Include="Graphics\**\*" />
</ItemGroup>

<!-- Clean-up potential symlinks -->
<RemoveDir Directories="..\Dialog;..\Graphics"/>

<!-- Assets -->
<Message Text="@(CelesteAssets)" />
<Copy SourceFiles="Source\EverestInterop\Lua\env.lua" DestinationFiles="..\bin\env.lua" />
<Copy SourceFiles="@(CelesteAssets)" DestinationFiles="..\%(Identity)" UseSymboliclinksIfPossible="'$(Configuration)' == 'Debug'" />
<Copy SourceFiles="@(CelesteAssets)" DestinationFiles="..\%(Identity)"/>
</Target>

<Target Name="PackageMod" AfterTargets="CopyFiles" Condition="'$(Configuration)' == 'Release'">
Expand Down

0 comments on commit 904deb7

Please sign in to comment.