Migrate asm publicization to msbuild (#132)
* Make publish-release workflow fail on missing build artifacts * Remove assembly publicization step from CI * Add AssemblyPublicizer MSBuild task * Add explanation for SatelliteResourceLanguages prop * Move and document workaround for duplicate-file-on-publish OSX issue * Move the Luatrauma.props import to the bottom of project files, this should give us a chance to override properties/items defined in the project file.
This commit is contained in:
50
.github/workflows/publish-release.yml
vendored
50
.github/workflows/publish-release.yml
vendored
@@ -8,7 +8,6 @@ on:
|
||||
|
||||
env:
|
||||
ARTIFACTS_DIR: 2049ef39-42a2-46d2-b513-ee6d2e3a7b15
|
||||
TOOLS_DIR: c1c0ee3b-b22f-451f-b330-8f6337a38fd7
|
||||
RELEASES: |
|
||||
windows:Barotrauma/bin/ReleaseWindows/net6.0/win-x64/publish
|
||||
linux:Barotrauma/bin/ReleaseLinux/net6.0/linux-x64/publish
|
||||
@@ -16,13 +15,11 @@ env:
|
||||
ARCHIVE_BASE_NAME: luacsforbarotrauma
|
||||
# XXX: these file names are subject to shell expansion.
|
||||
# Be careful when using special characters.
|
||||
PUBLICIZED_ASSEMBLIES: |
|
||||
Barotrauma.dll
|
||||
DedicatedServer.dll
|
||||
ARCHIVE_FILES_SERVER: |
|
||||
DedicatedServer.deps.json
|
||||
DedicatedServer.dll
|
||||
DedicatedServer.pdb
|
||||
Publicized/DedicatedServer.dll
|
||||
ARCHIVE_FILES_CLIENT: |
|
||||
Barotrauma.deps.json
|
||||
Barotrauma.dll
|
||||
@@ -30,6 +27,8 @@ env:
|
||||
DedicatedServer.deps.json
|
||||
DedicatedServer.dll
|
||||
DedicatedServer.pdb
|
||||
Publicized/Barotrauma.dll
|
||||
Publicized/DedicatedServer.dll
|
||||
ARCHIVE_FILES_SHARED: |
|
||||
0Harmony.dll
|
||||
Sigil.dll
|
||||
@@ -49,7 +48,6 @@ env:
|
||||
System.Runtime.CompilerServices.Unsafe.dll
|
||||
mscordaccore_amd64_amd64_*
|
||||
Lua
|
||||
Publicized
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -82,42 +80,6 @@ jobs:
|
||||
- name: "Build: MacClient"
|
||||
run: dotnet publish Barotrauma/BarotraumaClient/MacClient.csproj -c Release -clp:"ErrorsOnly;Summary" --self-contained -r osx-x64 \/p:Platform="x64"
|
||||
|
||||
- name: Publicize assemblies
|
||||
run: |
|
||||
set -e
|
||||
shopt -s globstar nullglob
|
||||
shopt -u dotglob
|
||||
|
||||
# This converts a newline-separated (LF) list into a Bash array
|
||||
# NOTE: this doesn't discard the trailing LF that GitHub actions
|
||||
# append (which results in an extra entry in the array).
|
||||
lines_to_array() {
|
||||
IFS=$'\n' readarray -td $'\n' "$1" <<< "${!1}"
|
||||
}
|
||||
|
||||
lines_to_array RELEASES
|
||||
|
||||
tools_dir="$(realpath -m "$TOOLS_DIR")"
|
||||
mkdir -p "$tools_dir"
|
||||
|
||||
dotnet tool install --tool-path "$tools_dir/asmpub" BepInEx.AssemblyPublicizer.Cli --version 0.4.1
|
||||
|
||||
for i in "${!RELEASES[@]}"; do
|
||||
[[ -z "${RELEASES[i]}" ]] && continue
|
||||
(
|
||||
IFS=':' read platform publish_dir _rest <<< "${RELEASES[i]}"
|
||||
cd "$publish_dir"
|
||||
echo "Publicizing assemblies for $platform build"
|
||||
mkdir Publicized
|
||||
# XXX: assembly-publicizer supports processing assemblies in
|
||||
# parallel, but it aborts the entire process if it encounters
|
||||
# an invalid .NET assembly.
|
||||
parallel "$tools_dir/asmpub/assembly-publicizer" \
|
||||
{} -f --strip -o Publicized \
|
||||
::: ${PUBLICIZED_ASSEMBLIES[@]}
|
||||
)
|
||||
done
|
||||
|
||||
- name: Create archives
|
||||
run: |
|
||||
set -e
|
||||
@@ -145,13 +107,13 @@ jobs:
|
||||
IFS=':' read platform publish_dir _rest <<< "${RELEASES[i]}"
|
||||
cd "$publish_dir"
|
||||
echo "Creating build_${platform}.zip"
|
||||
zip -qr "${artifacts_dir}/${ARCHIVE_BASE_NAME}_build_${platform}.zip" *
|
||||
zip --must-match -qr "${artifacts_dir}/${ARCHIVE_BASE_NAME}_build_${platform}.zip" *
|
||||
echo "Creating patch_${platform}_client.zip"
|
||||
zip -qr "${artifacts_dir}/${ARCHIVE_BASE_NAME}_patch_${platform}_client.zip" \
|
||||
zip --must-match -qr "${artifacts_dir}/${ARCHIVE_BASE_NAME}_patch_${platform}_client.zip" \
|
||||
${ARCHIVE_FILES_SHARED[@]} \
|
||||
${ARCHIVE_FILES_CLIENT[@]}
|
||||
echo "Creating patch_${platform}_server.zip"
|
||||
zip -qr "${artifacts_dir}/${ARCHIVE_BASE_NAME}_patch_${platform}_server.zip" \
|
||||
zip --must-match -qr "${artifacts_dir}/${ARCHIVE_BASE_NAME}_patch_${platform}_server.zip" \
|
||||
${ARCHIVE_FILES_SHARED[@]} \
|
||||
${ARCHIVE_FILES_SERVER[@]}
|
||||
)
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\BarotraumaShared\Luatrauma.props" />
|
||||
<ItemGroup>
|
||||
<None Include="..\BarotraumaShared\Luatrauma.props" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
@@ -209,4 +204,9 @@
|
||||
</PropertyGroup>
|
||||
<Import Project="../BarotraumaShared/DeployGameAnalytics.props" />
|
||||
|
||||
<Import Project="../BarotraumaShared/Luatrauma.props" />
|
||||
<ItemGroup>
|
||||
<None Include="../BarotraumaShared/Luatrauma.props" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\BarotraumaShared\Luatrauma.props" />
|
||||
<ItemGroup>
|
||||
<None Include="..\BarotraumaShared\Luatrauma.props" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
@@ -19,7 +14,6 @@
|
||||
<Configurations>Debug;Release;Unstable</Configurations>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<WarningsAsErrors>;NU1605;CS0114;CS0108;CS8597;CS8600;CS8601;CS8602;CS8603;CS8604;CS8605;CS8606;CS8607;CS8608;CS8609;CS8610;CS8611;CS8612;CS8613;CS8614;CS8615;CS8616;CS8617;CS8618;CS8619;CS8620;CS8621;CS8622;CS8624;CS8625;CS8626;CS8629;CS8631;CS8632;CS8633;CS8634;CS8638;CS8643;CS8644;CS8645;CS8653;CS8654;CS8655;CS8667;CS8669;CS8670;CS8714;CS8717;CS8765</WarningsAsErrors>
|
||||
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
@@ -220,4 +214,9 @@
|
||||
</PropertyGroup>
|
||||
<Import Project="../BarotraumaShared/DeployGameAnalytics.props" />
|
||||
|
||||
<Import Project="../BarotraumaShared/Luatrauma.props" />
|
||||
<ItemGroup>
|
||||
<None Include="../BarotraumaShared/Luatrauma.props" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\BarotraumaShared\Luatrauma.props" />
|
||||
<ItemGroup>
|
||||
<None Include="..\BarotraumaShared\Luatrauma.props" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
@@ -241,4 +236,9 @@
|
||||
</PropertyGroup>
|
||||
<Import Project="../BarotraumaShared/DeployGameAnalytics.props" />
|
||||
|
||||
</Project>
|
||||
<Import Project="../BarotraumaShared/Luatrauma.props" />
|
||||
<ItemGroup>
|
||||
<None Include="../BarotraumaShared/Luatrauma.props" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\BarotraumaShared\Luatrauma.props" />
|
||||
<ItemGroup>
|
||||
<None Include="..\BarotraumaShared\Luatrauma.props" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
@@ -149,4 +144,9 @@
|
||||
<WriteCodeFragment Language="C#" OutputFile="$(CustomAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" />
|
||||
</Target>
|
||||
|
||||
<Import Project="../BarotraumaShared/Luatrauma.props" />
|
||||
<ItemGroup>
|
||||
<None Include="../BarotraumaShared/Luatrauma.props" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\BarotraumaShared\Luatrauma.props" />
|
||||
<ItemGroup>
|
||||
<None Include="..\BarotraumaShared\Luatrauma.props" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
@@ -161,4 +156,9 @@
|
||||
<WriteCodeFragment Language="C#" OutputFile="$(CustomAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" />
|
||||
</Target>
|
||||
|
||||
<Import Project="../BarotraumaShared/Luatrauma.props" />
|
||||
<ItemGroup>
|
||||
<None Include="../BarotraumaShared/Luatrauma.props" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\BarotraumaShared\Luatrauma.props" />
|
||||
<ItemGroup>
|
||||
<None Include="..\BarotraumaShared\Luatrauma.props" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
@@ -156,4 +151,9 @@
|
||||
<WriteCodeFragment Language="C#" OutputFile="$(CustomAssemblyInfoFile)" AssemblyAttributes="@(AssemblyAttributes)" />
|
||||
</Target>
|
||||
|
||||
<Import Project="../BarotraumaShared/Luatrauma.props" />
|
||||
<ItemGroup>
|
||||
<None Include="../BarotraumaShared/Luatrauma.props" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<Project>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Luatrauma.Internal.AssemblyPublicizer.MSBuild" Version="0.1.4" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.1.0" />
|
||||
<PackageReference Include="Lib.Harmony" Version="2.2.2" />
|
||||
<PackageReference Include="Sigil" Version="5.0.0" />
|
||||
@@ -7,7 +8,21 @@
|
||||
<ProjectReference Include="$(MSBuildThisFileDirectory)..\..\Libraries\moonsharp\MoonSharp.VsCodeDebugger\MoonSharp.VsCodeDebugger.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<!--
|
||||
The `Microsoft.CodeAnalysis.CSharp.Scripting` package includes satellites
|
||||
assemblies, which end up polluting the build folder.
|
||||
This suppresses the extra satellite assemblies.
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||
</PropertyGroup>
|
||||
|
||||
<!--
|
||||
Upstream ships vendored OpenAL and SDL2 dylibs, which clobber the ones
|
||||
defined in Libraries/MonoGame.Framework/DesktopGL/MonoGame.Framework.dll.config
|
||||
This lets us work around the (otherwise fatal) error.
|
||||
-->
|
||||
<PropertyGroup Condition="'$(MSBuildProjectName)' == 'MacClient'">
|
||||
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user