WIP Rework build scripts for main solution, now using `dotnet publish`

blindly rebased without checking results
This commit is contained in:
YoshiRulz 2024-04-05 06:18:25 +10:00
parent e1bbc73871
commit 5ff2fc24ff
7 changed files with 28 additions and 19 deletions

View File

@ -7,3 +7,4 @@ fi
config="$1"
shift
Dist/.InvokeCLIOnMainSln.sh "build" "$config" "$@"
Dist/.InvokeCLIOnMainSln.sh publish "$config" --no-build "$@"

View File

@ -5,7 +5,7 @@ cd "$(dirname "$0")/.."
rm -fr "$targetDir" && mkdir -p "$targetDir"
find "output" -type f \( -wholename "output/EmuHawk.exe" -o -wholename "output/DiscoHawk.exe" -o -wholename "output/*.config" -o -wholename "output/defctrl.json" -o -wholename "output/EmuHawkMono.sh" -o -wholename "output/dll/*" -o -wholename "output/Shaders/*" -o -wholename "output/gamedb/*" -o -wholename "output/Tools/*" -o -wholename "output/NES/Palettes/*" -o -wholename "output/Lua/*" -o -wholename "output/Gameboy/Palettes/*" -o -wholename "output/overlay/*" \) \
-not -name "*.pdb" -not -name "*.lib" -not -name "*.pgd" -not -name "*.ipdb" -not -name "*.iobj" -not -name "*.exp" -not -name "*.ilk" \
-not -wholename "output/dll/*.xml" -not -wholename "output/dll/libsneshawk-64*.exe" -not -wholename "output/dll/gpgx.elf" -not -wholename "output/dll/miniclient.*" \
-not -wholename "output/dll/libsneshawk-64*.exe" -not -wholename "output/dll/gpgx.elf" -not -wholename "output/dll/miniclient.*" \
-exec install -D -m644 "{}" "packaged_{}" \;
cd "$targetDir"
if [ "$1" = "windows-x64" ]; then

View File

@ -10,6 +10,7 @@ git --version > NUL
@if errorlevel 1 goto MISSINGGIT
dotnet build ..\BizHawk.sln -c Release --no-incremental
dotnet publish ..\BizHawk.sln -c Release --no-build
@if not errorlevel 0 goto DOTNETBUILDFAILED
rem -p:Platform="Any CPU"
rem -p:RunAnalyzersDuringBuild=true

24
after.BizHawk.sln.targets Normal file
View File

@ -0,0 +1,24 @@
<Project>
<PropertyGroup>
<FinalPublishDir>$(SolutionDir)output/</FinalPublishDir>
</PropertyGroup>
<Target Name="CombineOutputDirs" AfterTargets="Publish">
<ItemGroup>
<Assets Include="$(SolutionDir)Assets/**/*" />
<ExecProjFilesForPublication Include="$(SolutionDir)src/BizHawk.Client.DiscoHawk/bin/$(Configuration)/net48/publish/**/*" />
<ExecProjFilesForPublication Include="$(SolutionDir)src/BizHawk.Client.EmuHawk/bin/$(Configuration)/net48/publish/**/*" />
</ItemGroup>
<!-- what happens if there's a conflict? hopefully the first <Copy/> is executed first -->
<Copy SourceFiles="@(ExecProjFilesForPublication)" DestinationFolder="$(FinalPublishDir)dll" />
<Copy SourceFiles="@(Assets)" DestinationFolder="$(FinalPublishDir)%(RecursiveDir)" />
</Target>
<Target Name="FinalisePublication" AfterTargets="CombineOutputDirs">
<ItemGroup>
<ExecutablesAndSupplements Include="$(FinalPublishDir)dll/BizHawk.Client.DiscoHawk.*" />
<ExecutablesAndSupplements Include="$(FinalPublishDir)dll/BizHawk.Client.EmuHawk.*" />
</ItemGroup>
<Move SourceFiles="@(ExecutablesAndSupplements)" DestinationFiles="@(ExecutablesAndSupplements->Replace('dll/BizHawk.Client.', ''))" />
<Delete Files="$(FinalPublishDir)dll/doc_comments.xml" />
<MakeDir Directories="$(FinalPublishDir)ExternalTools;$(FinalPublishDir)Firmware;$(FinalPublishDir)Tools" />
</Target>
</Project>

View File

@ -40,7 +40,6 @@
<EmbeddedResource Remove="images/sms-icon.png" />
<EmbeddedResource Remove="images/tastudio/ts_h_piano_*.png" />
<EmbeddedResource Remove="images/tastudio/ts_v_piano_*.png" />
<None Include="$(ProjectDir)../../Assets/**/*.*" CopyToOutputDirectory="PreserveNewest" />
<None Remove="packages.config" />
<None Remove="Properties/Resources.resources" />
</ItemGroup>

View File

@ -5,6 +5,7 @@
<DefineConstants>$(DefineConstants);AVI_SUPPORT</DefineConstants>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <!-- it would be nice to rename these to *.api_reference.xml or something, but it seems https://github.com/dotnet/standard/issues/614 was never fixed -->
<NoWarn>$(NoWarn);CS1573;CS1591;NU1702</NoWarn>
<PublishDocumentationFiles>false</PublishDocumentationFiles>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' And '$(SolutionDir)' != '' ">

View File

@ -1,26 +1,9 @@
<Project>
<Import Project="MainSlnCommon.props" />
<PropertyGroup>
<OutputPath>$(MSBuildProjectDirectory)/../../output/</OutputPath>
<!-- Setting TargetFileName does not change the AssemblyName (as setting TargetName would), but also does not change the output file name
for the executable on build (as one would expect). So we still need to rename the executable file below. Using this method has the advantage
of IDEs respecting the TargetFileName and expecting it. -->
<TargetFileName>$(MSBuildProjectName.Substring($([MSBuild]::Add($(MSBuildProjectName.LastIndexOf('.')), 1)))).exe</TargetFileName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputType>WinExe</OutputType>
</PropertyGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<ItemGroup>
<ExecFilesFromExecProj Include="$(OutputPath)$(MSBuildProjectName).*" /> <!-- doesn't include the .exe.config because those are automatically renamed??? -->
<NotExecFilesFromExecProj Include="$(OutputPath)*.dll;$(OutputPath)*.pdb;$(OutputPath)*.xml" Exclude="@(ExecFilesFromExecProj)" />
<NotExecFilesFromExecProj Remove="$(OutputPath)DiscoHawk.*;$(OutputPath)EmuHawk.*" /> <!-- otherwise one will move the other's to /output/dll -->
</ItemGroup>
<Move SourceFiles="@(NotExecFilesFromExecProj)" DestinationFolder="$(OutputPath)dll/" />
<Move SourceFiles="@(ExecFilesFromExecProj)" DestinationFiles="@(ExecFilesFromExecProj->Replace('BizHawk.Client.', ''))" />
<MakeDir Directories="$(OutputPath)ExternalTools;$(OutputPath)Firmware;$(OutputPath)Tools" />
</Target>
</Project>