Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor RemoteNET projects #13

Merged
merged 20 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c84d719
[third_party/RemoteNET] Simplify resource bundling
Qonfused Mar 29, 2024
adf749a
[MTGOSDK] Merge RemoteNET and ScubaDiver.API projects
Qonfused Mar 30, 2024
e72f273
Remove old projects, simplify MSBuild pipeline
Qonfused Mar 30, 2024
be4b5f6
[MTGOSDK.MSBuild] Indicate whether Ref assembly generation was skipped
Qonfused Mar 30, 2024
ee5d56c
CI: (Testing) Show detailed NuGet restore
Qonfused Mar 30, 2024
10adb9b
[MTGOSDK] Evaluate resource projects dynamically
Qonfused Mar 30, 2024
fb53e5c
Revert CI logging verbosity, add resource embedding logging
Qonfused Mar 30, 2024
b4c42a8
[MTGOSDK.Core.Remoting.Interop] Migrate ScubaDiver.API to Remoting na…
Qonfused Mar 30, 2024
c120cf7
[MTGOSDK/Core/Remoting] Remove Logger stub
Qonfused Mar 30, 2024
4a77262
[MTGOSDK/Core/Remoting/Interop] Use smaller struct object footprint
Qonfused Mar 31, 2024
d92354f
[MTGOSDK] Remove nullability warnings from exclusion list
Qonfused Mar 31, 2024
f2c05d4
[MTGOSDK/Core/Remoting] Move RemoteClient to namespace, rename RemoteApp
Qonfused Mar 31, 2024
57b9947
[MTGOSDK/Core/Remoting/Interop] Use classes for JSON-serialized types
Qonfused Mar 31, 2024
15bf88c
Fix missing refactors from f2c05d4
Qonfused Mar 31, 2024
1b01a88
[MTGOSDK] Exclude API from ScubaDiver compile
Qonfused Mar 31, 2024
cd114b6
[MTGOSDK] Exclude reference assemblies from ScubaDiver builds
Qonfused Mar 31, 2024
59cfb00
[MTGOSDK] Use netstandard2.0 TFM for core build
Qonfused Mar 31, 2024
dff8e99
[third_party/ScubaDiver] Move project directory
Qonfused Mar 31, 2024
bd21b84
[third_party/ScubaDiver] Fix project relative paths
Qonfused Mar 31, 2024
1097401
[third_party/ScubaDiver] Add SPDX license headers
Qonfused Mar 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
<Project>

<PropertyGroup>
<!-- Project Directories -->
<SolutionDir>$(MSBuildThisFileDirectory)</SolutionDir>
<DistDir>$(SolutionDir)\dist</DistDir>
<!-- User Directories -->
<LocalDir>$([MSBuild]::NormalizeDirectory($(AppData)\..\Local))</LocalDir>
</PropertyGroup>

<PropertyGroup>
<LocalDir>$([MSBuild]::NormalizeDirectory($(AppData)\..\Local))</LocalDir>
<RestoreUseStaticGraphEvaluation>true</RestoreUseStaticGraphEvaluation>
</PropertyGroup>

</Project>
</Project>
2 changes: 1 addition & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
<RemoveDir Directories="@(FoldersToClean)" />
</Target> -->

</Project>
</Project>
13 changes: 8 additions & 5 deletions MTGOSDK.MSBuild/build/MTGOSDK.MSBuild.targets
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@
<Output TaskParameter="Version" PropertyName="MTGOVersion" />
</ExtractMTGOInstallation>

<Message Text="MTGOSDK.MSBuild: Extracted MTGO version $(MTGOVersion)"
Importance="high" />

<!--
We build reference assemblies from the latest MTGO installation directory
to ensure that we're only targeting the latest APIs of the MTGO client.
Expand All @@ -53,6 +50,10 @@
MTGOAppDir="$(MTGOAppDir)"
Version="$(MTGOVersion)"
OutputPath="$(_MTGOSDK_Refs)">
<!--
Indicates whether the task has skipped generating reference assemblies.
-->
<Output TaskParameter="HasSkipped" PropertyName="HasSkipped" />
<!--
Updates the internal reference path to reflect the new subpath.

Expand All @@ -64,9 +65,11 @@

<!-- TODO: Verify the output reference assemblies w/ ILVerify -->
<Message Text="MTGOSDK.MSBuild: Updated reference assemblies for MTGO version $(MTGOVersion)"
Importance="high" />
Importance="high"
Condition="'$(HasSkipped)' != 'true'" />
<Message Text="MTGOSDK.MSBuild: Reference assemblies are located at $(_MTGOSDK_Refs)"
Importance="high" />
Importance="high"
Condition="'$(HasSkipped)' != 'true'" />
</Target>

</Project>
4 changes: 2 additions & 2 deletions MTGOSDK.MSBuild/src/Tasks/ExtractMTGOInstallation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ namespace MTGOSDK.MSBuild.Tasks;
public class ExtractMTGOInstallation : Task
{
/// <summary>
/// The path to the MTGO application directory.
/// The path to the MTGO application directory.
/// </summary>
[Required]
[Output]
public string MTGOAppDir { get; set; } = string.Empty;

/// <summary>
/// The path to the MTGO user data directory.
/// The path to the MTGO user data directory.
/// </summary>
[Output]
public string MTGODataDir { get; set; } = string.Empty;
Expand Down
11 changes: 9 additions & 2 deletions MTGOSDK.MSBuild/src/Tasks/GenerateReferenceAssemblies.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace MTGOSDK.MSBuild.Tasks;
public class GenerateReferenceAssemblies : Task
{
/// <summary>
/// The path to the MTGO application directory.
/// The path to the MTGO application directory.
/// </summary>
[Required]
public string MTGOAppDir { get; set; } = string.Empty;
Expand All @@ -28,10 +28,15 @@ public class GenerateReferenceAssemblies : Task
[Required]
public string Version { get; set; } = string.Empty;

/// <summary>
/// Whether the task has been skipped.
/// </summary>
[Output]
public bool HasSkipped { get; set; } = false;

/// <summary>
/// The path to store the generated reference assemblies.
/// </summary>
///
[Required]
[Output]
public string OutputPath { get; set; } = string.Empty;
Expand All @@ -45,7 +50,9 @@ public override bool Execute()
Log.LogMessage(MessageImportance.High,
$"MTGOSDK.MSBuild: Reference assemblies for version {Version} already exist.");

HasSkipped = true;
OutputPath = versionPath;

return true;
}
// Clear out previous versions' reference assemblies
Expand Down
13 changes: 13 additions & 0 deletions MTGOSDK.Win32/src/Extensions/ProcessExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,19 @@ public static IEnumerable<MODULEENTRY32> GetModules(this Process process)
}
}

/// <summary>
/// Converts a <see cref="ProcessModuleCollection"/> to an enumerable collection of <see cref="ProcessModule"/>.
/// </summary>
/// <param name="collection">The <see cref="ProcessModuleCollection"/> to convert.</param>
/// <returns>An enumerable collection of <see cref="ProcessModule"/>.</returns>
public static IEnumerable<ProcessModule> AsEnumerable(this ProcessModuleCollection collection)
{
foreach (ProcessModule module in collection)
{
yield return module;
}
}

/// <summary>
/// Determines whether the specified process is a 64-bit process.
/// </summary>
Expand Down
97 changes: 52 additions & 45 deletions MTGOSDK/MTGOSDK.csproj
Original file line number Diff line number Diff line change
@@ -1,65 +1,72 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFrameworks>netstandard2.0;net8.0-windows</TargetFrameworks>
<LangVersion>Latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<!-- Disables unenforcable nullable warnings - breaks static analysis -->
<NoWarn>$(NoWarn);CS8597;CS8600;CS8602;CS8603;CS8604;CS8625;IDE0065;</NoWarn>
<!-- Used for referencing WPF assemblies at runtime (w/ reflection) -->
<UseWPF>true</UseWPF>
<NoWarn>$(NoWarn);
<!-- Disables unenforcable nullable warnings - breaks static analysis -->
CS8597;CS8600;CS8602;CS8603;CS8604;CS8625;CS8767;CS9113;IDE0065;
<!-- FIXME: From RemoteNET library -->
CS8601;CS8608;CS8610;CS8618;CS8619;CS8620;CS8765;
</NoWarn>
</PropertyGroup>

<!-- Package Properties -->
<PropertyGroup>
<PackageId>MTGOSDK</PackageId>
<Version>1.0.0</Version>
<Authors>Cory Bennett</Authors>
<Company>Videre Project</Company>
</PropertyGroup>

<!-- Publishing Configuration -->
<PropertyGroup>
<PublishDir>..\publish\</PublishDir>
<DebugType>embedded</DebugType>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
</PropertyGroup>
<!-- Import MTGOSDK package properties -->
<Import Project="MTGOSDK.pkg.props" />

<ItemGroup>
<PackageReference Include="Microsoft.CSharp"
Version="4.7.0" />
<PackageReference Include="Microsoft.Diagnostics.Runtime"
Version="3.1.512801" />
<PackageReference Include="Meziantou.Polyfill"
Version="1.0.37"
Condition="'$(TargetFramework)' == 'netstandard2.0'" />
<PackageReference Include="ImpromptuInterface"
Version="8.0.4" />
<PackageReference Include="Newtonsoft.Json"
Version="13.0.3" />
<ProjectReference Include="..\MTGOSDK.Win32\MTGOSDK.Win32.csproj" />
<ProjectReference Include="..\third_party\RemoteNET\src\RemoteNET\RemoteNET.csproj" />
<ProjectReference Include="..\third_party\RemoteNET\src\ScubaDiver.API\ScubaDiver.API.csproj" />
</ItemGroup>

<!--
Bootstrap the MTGOSDK.Ref project to generate reference assemblies for
the current MTGO version. Due to the way that MSBuild works, this must
import the MTGOSDK.MSBuild.props file before referencing the project.
-->
<Import Project="..\MTGOSDK.MSBuild\build\MTGOSDK.MSBuild.props" />
<PropertyGroup>
<MTGOSDK_Refs>$(_MTGOSDK_Refs)\3.4.*.*</MTGOSDK_Refs>
<!-- For builds used by the ScubaDiver assembly, exclude compiling the API -->
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<DefaultItemExcludes>$(DefaultItemExcludes);src\API\**</DefaultItemExcludes>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\MTGOSDK.Ref\MTGOSDK.Ref.csproj"
ReferenceOutputAssembly="false" />
<!--
Include reference assemblies to compile against the current MTGO version.
Note that the '_MTGOSDK_Refs' path does not reference the updated version
subpath as it is only evaluated after building the MTGOSDK.Ref project.
-->
<Reference Include="$(MTGOSDK_Refs)\Core.dll" />
<Reference Include="$(MTGOSDK_Refs)\FlsClient.dll" />
<Reference Include="$(MTGOSDK_Refs)\MTGOEnumStruct.dll" />
<Reference Include="$(MTGOSDK_Refs)\WotC.MtGO.Client.Common.dll" />
<Reference Include="$(MTGOSDK_Refs)\WotC.MtGO.Client.Model.Chat.dll" />
<Reference Include="$(MTGOSDK_Refs)\WotC.MtGO.Client.Model.Core.dll" />
<Reference Include="$(MTGOSDK_Refs)\WotC.MtGO.Client.Model.Reference.dll" />
</ItemGroup>

<!-- Import MTGOSDK reference assemblies -->
<Import Project="MTGOSDK.ref.props"
Condition="'$(TargetFramework)' != 'netstandard2.0'" />

<!-- Configures build-time resource dependencies for the main library -->
<Target Name="CollectResourceProjects"
BeforeTargets="ResolveProjectReferences"
Condition="'$(TargetFramework)' != 'netstandard2.0'">
<ItemGroup>
<ResourceProjects Include="..\third_party\ScubaDiver\ScubaDiver.csproj" />
<ResourceProjects Include="..\third_party\SharpNeedle\src\Bootstrapper\*.vcxproj" />
<ResourceProjects Include="..\third_party\SharpNeedle\src\Launcher\*.vcxproj" />
<ProjectReference Include="@(ResourceProjects)"
ReferenceOutputAssembly="false"
Private="false" />
</ItemGroup>
</Target>

<!-- Bundle resource projects' build artifacts into the main library -->
<Target Name="EmbedResources"
BeforeTargets="CoreCompile"
AfterTargets="ResolveProjectReferences"
DependsOnTargets="CollectResourceProjects"
Condition="'@(ResourceProjects)' != ''">
<ItemGroup>
<ResourceFiles Include="$(SolutionDir)\dist\$(Configuration)\Win32\*.*" />
<ResourceFiles Include="$(SolutionDir)\dist\$(Configuration)\x64\*.*" />
<ResourceFiles Include="$(SolutionDir)\dist\$(Configuration)\*.*" />
<EmbeddedResource Include="@(ResourceFiles)"
LogicalName="Resources\%(Filename)%(Extension)" />
</ItemGroup>
</Target>

</Project>
19 changes: 19 additions & 0 deletions MTGOSDK/MTGOSDK.pkg.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!-- Package Properties -->
<PropertyGroup>
<PackageId>MTGOSDK</PackageId>
<Version>1.0.0</Version>
<Authors>Cory Bennett</Authors>
<Company>Videre Project</Company>
</PropertyGroup>

<!-- Publishing Configuration -->
<PropertyGroup>
<PublishDir>..\publish\</PublishDir>
<DebugType>embedded</DebugType>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
</PropertyGroup>

</Project>
37 changes: 37 additions & 0 deletions MTGOSDK/MTGOSDK.ref.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<!-- Disables warnings for referencing incompatible project TFMs -->
<NoWarn>$(NoWarn);NU1702;MSB3277;</NoWarn>
<!-- Used for referencing WPF assemblies at runtime (w/ reflection) -->
<UseWPF>true</UseWPF>
</PropertyGroup>

<!--
Bootstrap the MTGOSDK.Ref project to generate reference assemblies for
the current MTGO version. Due to the way that MSBuild works, this must
import the MTGOSDK.MSBuild.props file before referencing the project.
-->
<Import Project="..\MTGOSDK.MSBuild\build\MTGOSDK.MSBuild.props" />
<PropertyGroup>
<MTGOSDK_Refs>$(_MTGOSDK_Refs)\3.4.*.*</MTGOSDK_Refs>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\MTGOSDK.Ref\MTGOSDK.Ref.csproj"
ReferenceOutputAssembly="false" />
<!--
Include reference assemblies to compile against the current MTGO version.
Note that the '_MTGOSDK_Refs' path does not reference the updated version
subpath as it is only evaluated after building the MTGOSDK.Ref project.
-->
<Reference Include="$(MTGOSDK_Refs)\Core.dll" />
<Reference Include="$(MTGOSDK_Refs)\FlsClient.dll" />
<Reference Include="$(MTGOSDK_Refs)\MTGOEnumStruct.dll" />
<Reference Include="$(MTGOSDK_Refs)\WotC.MtGO.Client.Common.dll" />
<Reference Include="$(MTGOSDK_Refs)\WotC.MtGO.Client.Model.Chat.dll" />
<Reference Include="$(MTGOSDK_Refs)\WotC.MtGO.Client.Model.Core.dll" />
<Reference Include="$(MTGOSDK_Refs)\WotC.MtGO.Client.Model.Reference.dll" />
</ItemGroup>

</Project>
Loading
Loading