Upgrade to .NET 8.0 and remove/migrate obsolete stuff

This commit is contained in:
michaeldgg2
2024-09-13 23:01:58 +02:00
committed by Paul Chote
parent 2a3ef8f910
commit 81aa068b15
15 changed files with 27 additions and 47 deletions

View File

@@ -10,17 +10,17 @@ permissions:
jobs:
linux:
name: Linux (.NET 6.0)
name: Linux (.NET 8.0)
runs-on: ubuntu-22.04
steps:
- name: Clone Repository
uses: actions/checkout@v4
- name: Install .NET 6.0
- name: Install .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
dotnet-version: '8.0.x'
- name: Check Code
run: |
@@ -34,17 +34,17 @@ jobs:
make TREAT_WARNINGS_AS_ERRORS=true test
windows:
name: Windows (.NET 6.0)
name: Windows (.NET 8.0)
runs-on: windows-2019
steps:
- name: Clone Repository
uses: actions/checkout@v4
- name: Install .NET 6.0
- name: Install .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
dotnet-version: '8.0.x'
- name: Check Code
shell: powershell

View File

@@ -56,10 +56,10 @@ jobs:
with:
ref: ${{ needs.prepare.outputs.git_tag }}
- name: Install .NET 6
- name: Install .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
dotnet-version: '8.0.x'
- name: Prepare Environment
run: |
@@ -111,10 +111,10 @@ jobs:
with:
ref: ${{ needs.prepare.outputs.git_tag }}
- name: Install .NET 6
- name: Install .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
dotnet-version: '8.0.x'
- name: Prepare Environment
run: |

View File

@@ -42,10 +42,10 @@ jobs:
- name: Clone Repository
uses: actions/checkout@v4
- name: Install .NET 6.0
- name: Install .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
dotnet-version: '8.0.x'
- name: Prepare Environment
run: echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> ${GITHUB_ENV}
@@ -72,10 +72,10 @@ jobs:
- name: Clone Repository
uses: actions/checkout@v4
- name: Install .NET 6.0
- name: Install .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
dotnet-version: '8.0.x'
- name: Prepare Environment
run: echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> ${GITHUB_ENV}
@@ -107,10 +107,10 @@ jobs:
- name: Clone Repository
uses: actions/checkout@v4
- name: Install .NET 6.0
- name: Install .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
dotnet-version: '8.0.x'
- name: Prepare Environment
run: |

View File

@@ -18,7 +18,7 @@
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>

View File

@@ -8,7 +8,7 @@ Windows
Compiling OpenRA requires the following dependencies:
* [Windows PowerShell >= 4.0](https://microsoft.com/powershell) (included by default in recent Windows 10 versions)
* [.NET 6 SDK](https://dotnet.microsoft.com/download/dotnet/6.0) (or via Visual Studio)
* [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0) (or via Visual Studio)
To compile OpenRA, open the `OpenRA.sln` solution in the main folder, build it from the command-line with `dotnet` or use the Makefile analogue command `make all` scripted in PowerShell syntax.
@@ -17,7 +17,7 @@ Run the game with `launch-game.cmd`. It can be handed arguments that specify the
Linux
=====
.NET 6 is required to compile OpenRA. The [.NET 6 download page](https://dotnet.microsoft.com/download/dotnet/6.0) provides repositories for various package managers and binary releases for several architectures.
.NET 8 is required to compile OpenRA. The [.NET 8 download page](https://dotnet.microsoft.com/download/dotnet/8.0) provides repositories for various package managers and binary releases for several architectures.
To compile OpenRA, run `make` from the command line. After this one can run the game with `./launch-game.sh`. It is also possible to specify the mod you wish to run from the command line, e.g. with `./launch-game.sh Game.Mod=ts` if you wish to try the experimental Tiberian Sun mod.
@@ -76,6 +76,6 @@ Type `sudo make install` for system-wide installation. Run `sudo make install-li
macOS
=====
[.NET 6](https://dotnet.microsoft.com/download/dotnet/6.0) is required to compile OpenRA.
[.NET 8](https://dotnet.microsoft.com/download/dotnet/8.0) is required to compile OpenRA.
To compile OpenRA, run `make` from the command line. Run with `./launch-game.sh`.

View File

@@ -16,7 +16,6 @@ using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using OpenRA.Primitives;
using OpenRA.Support;
@@ -26,7 +25,6 @@ namespace OpenRA
{
const char SplitComma = ',';
[Serializable]
public class MissingFieldsException : YamlException
{
public readonly string[] Missing;
@@ -46,13 +44,6 @@ namespace OpenRA
Header = missing.Length > 1 ? header : headerSingle ?? header;
Missing = missing;
}
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
info.AddValue("Missing", Missing);
info.AddValue("Header", Header);
}
}
public static Func<string, Type, string, object> InvalidValueAction = (s, t, f) =>

View File

@@ -16,7 +16,6 @@ using OpenRA.Primitives;
namespace OpenRA.Graphics
{
[Serializable]
public class SheetOverflowException : Exception
{
public SheetOverflowException(string message)

View File

@@ -14,7 +14,7 @@ using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Runtime.CompilerServices;
using OpenRA.Primitives;
using OpenRA.Traits;
@@ -70,7 +70,7 @@ namespace OpenRA
if (type == null)
throw new InvalidDataException($"Unknown initializer type '{initInstance[0]}Init'");
var init = (ActorInit)FormatterServices.GetUninitializedObject(type);
var init = (ActorInit)RuntimeHelpers.GetUninitializedObject(type);
if (initInstance.Length > 1)
type.GetField(nameof(ActorInit.InstanceName)).SetValue(init, initInstance[1]);

View File

@@ -724,7 +724,6 @@ namespace OpenRA
}
}
[Serializable]
public class YamlException : Exception
{
public YamlException(string s)

View File

@@ -254,7 +254,6 @@ namespace OpenRA.Mods.Common.Commands
world.IssueOrder(new Order(command, world.LocalPlayer.PlayerActor, false));
}
[Serializable]
public class DevException : Exception { }
}
}

View File

@@ -13,7 +13,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Runtime.CompilerServices;
using Eluant;
using OpenRA.Mods.Common.Traits;
using OpenRA.Primitives;
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Scripting
throw new LuaException($"Unknown initializer type '{initInstance[0]}'");
// Construct the ActorInit.
var init = (ActorInit)FormatterServices.GetUninitializedObject(initType);
var init = (ActorInit)RuntimeHelpers.GetUninitializedObject(initType);
if (initInstance.Length > 1)
initType.GetField(nameof(ActorInit.InstanceName)).SetValue(init, initInstance[1]);

View File

@@ -13,13 +13,11 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
namespace OpenRA
{
using UtilityActions = Dictionary<string, KeyValuePair<Action<Utility, string[]>, Func<string[], bool>>>;
[Serializable]
public class NoSuchCommandException : Exception
{
public readonly string Command;
@@ -28,12 +26,6 @@ namespace OpenRA
{
Command = command;
}
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
info.AddValue("Command", Command);
}
}
sealed class Program

View File

@@ -119,7 +119,7 @@ install_windows_launcher() (
# -p:DisplayName doesn't seem to have a visible effect?
dotnet publish "${SRC_PATH}/OpenRA.WindowsLauncher/OpenRA.WindowsLauncher.csproj" -c Release -r "${TARGETPLATFORM}" -p:LauncherName="${LAUNCHER_NAME}",TargetPlatform="${TARGETPLATFORM}",ModID="${MOD_ID}",PublishDir="${DEST_PATH}",FaqUrl="${FAQ_URL}",InformationalVersion="${VERSION}" --self-contained true
# NET 6 is unable to customize the application host for windows when compiling from Linux,
# NET 8 is unable to customize the application host for windows when compiling from Linux,
# so we must patch the properties we need in the PE header.
# Setting the application icon requires an external tool, so is left to the calling code
python3 "${SRC_PATH}/packaging/windows/fixlauncher.py" "${DEST_PATH}/${LAUNCHER_NAME}.exe"

View File

@@ -11,7 +11,7 @@
// because macOS will only properly associate dock icons and tooltips to windows that are
// created by a process in the Contents/MacOS directory (not subdirectories).
//
// .NET 6 does not support universal binaries, and the apphost that is created when
// .NET 8 does not support universal binaries, and the apphost that is created when
// publishing requires the runtime files to exist in the same directory as the launcher.
//

View File

@@ -54,7 +54,7 @@ function makelauncher()
convert "${ARTWORK_DIR}/${MOD_ID}_16x16.png" "${ARTWORK_DIR}/${MOD_ID}_24x24.png" "${ARTWORK_DIR}/${MOD_ID}_32x32.png" "${ARTWORK_DIR}/${MOD_ID}_48x48.png" "${ARTWORK_DIR}/${MOD_ID}_256x256.png" "${BUILTDIR}/${MOD_ID}.ico"
install_windows_launcher "${SRCDIR}" "${BUILTDIR}" "win-${PLATFORM}" "${MOD_ID}" "${LAUNCHER_NAME}" "${DISPLAY_NAME}" "${FAQ_URL}" "${TAG}"
# Use rcedit to patch the generated EXE with missing assembly/PortableExecutable information because .NET 6 ignores that when building on Linux.
# Use rcedit to patch the generated EXE with missing assembly/PortableExecutable information because .NET 8 ignores that when building on Linux.
# Using a backwards version tag because rcedit is unable to set versions starting with a letter.
wine64 rcedit-x64.exe "${BUILTDIR}/${LAUNCHER_NAME}.exe" --set-product-version "${BACKWARDS_TAG}"
wine64 rcedit-x64.exe "${BUILTDIR}/${LAUNCHER_NAME}.exe" --set-version-string "ProductName" "OpenRA"