Skip to content

Commit

Permalink
SDK targets rework
Browse files Browse the repository at this point in the history
* Merge SharpPatch into SharpGenTools.Sdk
* Merge SharpGen tasks into a single one (SharpGenTask)
* Rework MSBuild file invalidation to be well specified
* Rework test infra to support large test matrices

* Extensibility and documentation parts are expected in Episode 6
  • Loading branch information
andrew-boyarshin committed Jan 4, 2021
1 parent 79b669e commit 1a42c38
Show file tree
Hide file tree
Showing 40 changed files with 1,142 additions and 1,439 deletions.
2 changes: 2 additions & 0 deletions SdkTests/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
RestoredPackages/
LocalPackages/
Native/x86
Native/x64
1 change: 1 addition & 0 deletions SdkTests/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<BuildingSdkTests>true</BuildingSdkTests>
<MicrosoftCommonPropsHasBeenImported>true</MicrosoftCommonPropsHasBeenImported>
</PropertyGroup>

<Import Project="Sdk.props" Sdk="Microsoft.Build.CentralPackageVersions" Condition="'$(MSBuildProjectExtension)' == '.csproj'" />
Expand Down
2 changes: 1 addition & 1 deletion SdkTests/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<Target Name="LayoutNative" AfterTargets="Build" Condition="'$(SdkTestNative)' != ''">
<ItemGroup>
<SdkTestNativeFiles Include="$(MSBuildThisFileDirectory)Native\$(SdkTestNative)\Debug\$(SdkTestNative)Native.*" />
<SdkTestNativeFiles Include="$(MSBuildThisFileDirectory)Native\$(TargetPlatform)\$(SdkTestNative)\Debug\$(SdkTestNative)Native.*" />
</ItemGroup>
<Copy
DestinationFolder="$(OutputPath)"
Expand Down
28 changes: 27 additions & 1 deletion SdkTests/Managed.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<Platforms>x86;x64</Platforms>
<IsPackable>false</IsPackable>
<RestorePackagesPath>$(MSBuildThisFileDirectory)RestoredPackages/</RestorePackagesPath>
<RestoreNoCache>true</RestoreNoCache>
Expand All @@ -11,6 +11,11 @@
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>

<PropertyGroup Condition="'$(BuildingInsideVisualStudio)' == 'true' and '$(VisualStudioVersion)' != ''">
<TargetFramework>net5.0</TargetFramework>
<TargetPlatform>x86</TargetPlatform>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SharpGen.Runtime" Version="$(LocalPackageVersion)" IsImplicitlyDefined="true"/>
<PackageReference Include="SharpGenTools.Sdk" Version="$(LocalPackageVersion)" IsImplicitlyDefined="true" PrivateAssets="All"/>
Expand All @@ -23,6 +28,27 @@
<SharpGenMapping Include="Mapping.xml"/>
</ItemGroup>

<!--
<Target Name="SharpGenSdkTestsSetDebuggerAttach" BeforeTargets="SharpGenExecute">
<PropertyGroup>
<SharpGenWaitForDebuggerAttach>true</SharpGenWaitForDebuggerAttach>
</PropertyGroup>
</Target>
<Target Name="SharpGenSdkTestsClearDebuggerAttach" AfterTargets="SharpGenExecute">
<PropertyGroup>
<SharpGenWaitForDebuggerAttach>false</SharpGenWaitForDebuggerAttach>
</PropertyGroup>
</Target>
-->

<Target Name="SharpGenSdkTestsVerifyTFM" BeforeTargets="BeforeCompile;CoreCompile">
<Error Text="TFM not set properly"
Condition="'$(TargetFramework)' != 'net472' and '$(TargetFramework)' != 'netcoreapp2.1' and '$(TargetFramework)' != 'net5.0'"/>
<Error Text="TP not set properly"
Condition="'$(TargetPlatform)' != 'x86' and '$(TargetPlatform)' != 'x64'"/>
</Target>

<Target Name="_ResolveCopyLocalNuGetPackagePdbsAndXml" AfterTargets="ResolveReferences">
<ItemGroup>
<ReferenceCopyLocalPaths
Expand Down
4 changes: 2 additions & 2 deletions SdkTests/Native/Interface/InterfaceNative.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ struct InterfaceWithProperties
virtual int __stdcall GetValuePersistent() = 0;
virtual RESULT __stdcall GetValue2Persistent(int* value) = 0;

virtual InterfaceWithProperties* GetSelfPersistent() = 0;
virtual RESULT GetSelfOutPersistent(InterfaceWithProperties** child) = 0;
virtual InterfaceWithProperties* __stdcall GetSelfPersistent() = 0;
virtual RESULT __stdcall GetSelfOutPersistent(InterfaceWithProperties** child) = 0;
};

extern "C" __declspec(dllexport) IInterface2* __stdcall CreateInstance(void);
Expand Down
62 changes: 24 additions & 38 deletions SdkTests/SdkTests.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,36 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Functions", "Functions\Func
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{497A3F6F-50DD-4BF3-B671-F1CE7D9AB1FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{497A3F6F-50DD-4BF3-B671-F1CE7D9AB1FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{497A3F6F-50DD-4BF3-B671-F1CE7D9AB1FB}.Debug|x64.ActiveCfg = Debug|Any CPU
{497A3F6F-50DD-4BF3-B671-F1CE7D9AB1FB}.Debug|x64.Build.0 = Debug|Any CPU
{497A3F6F-50DD-4BF3-B671-F1CE7D9AB1FB}.Debug|x86.ActiveCfg = Debug|Any CPU
{497A3F6F-50DD-4BF3-B671-F1CE7D9AB1FB}.Debug|x86.Build.0 = Debug|Any CPU
{497A3F6F-50DD-4BF3-B671-F1CE7D9AB1FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{497A3F6F-50DD-4BF3-B671-F1CE7D9AB1FB}.Release|Any CPU.Build.0 = Release|Any CPU
{497A3F6F-50DD-4BF3-B671-F1CE7D9AB1FB}.Release|x64.ActiveCfg = Release|Any CPU
{497A3F6F-50DD-4BF3-B671-F1CE7D9AB1FB}.Release|x64.Build.0 = Release|Any CPU
{497A3F6F-50DD-4BF3-B671-F1CE7D9AB1FB}.Release|x86.ActiveCfg = Release|Any CPU
{497A3F6F-50DD-4BF3-B671-F1CE7D9AB1FB}.Release|x86.Build.0 = Release|Any CPU
{177CA2F6-8ECA-4FBA-A01C-4D064C307E65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{177CA2F6-8ECA-4FBA-A01C-4D064C307E65}.Debug|Any CPU.Build.0 = Debug|Any CPU
{177CA2F6-8ECA-4FBA-A01C-4D064C307E65}.Debug|x64.ActiveCfg = Debug|Any CPU
{177CA2F6-8ECA-4FBA-A01C-4D064C307E65}.Debug|x64.Build.0 = Debug|Any CPU
{177CA2F6-8ECA-4FBA-A01C-4D064C307E65}.Debug|x86.ActiveCfg = Debug|Any CPU
{177CA2F6-8ECA-4FBA-A01C-4D064C307E65}.Debug|x86.Build.0 = Debug|Any CPU
{177CA2F6-8ECA-4FBA-A01C-4D064C307E65}.Release|Any CPU.ActiveCfg = Release|Any CPU
{177CA2F6-8ECA-4FBA-A01C-4D064C307E65}.Release|Any CPU.Build.0 = Release|Any CPU
{177CA2F6-8ECA-4FBA-A01C-4D064C307E65}.Release|x64.ActiveCfg = Release|Any CPU
{177CA2F6-8ECA-4FBA-A01C-4D064C307E65}.Release|x64.Build.0 = Release|Any CPU
{177CA2F6-8ECA-4FBA-A01C-4D064C307E65}.Release|x86.ActiveCfg = Release|Any CPU
{177CA2F6-8ECA-4FBA-A01C-4D064C307E65}.Release|x86.Build.0 = Release|Any CPU
{15D8B589-1E22-4B38-B8DF-A851C0E564AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{15D8B589-1E22-4B38-B8DF-A851C0E564AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{15D8B589-1E22-4B38-B8DF-A851C0E564AB}.Debug|x64.ActiveCfg = Debug|Any CPU
{15D8B589-1E22-4B38-B8DF-A851C0E564AB}.Debug|x64.Build.0 = Debug|Any CPU
{15D8B589-1E22-4B38-B8DF-A851C0E564AB}.Debug|x86.ActiveCfg = Debug|Any CPU
{15D8B589-1E22-4B38-B8DF-A851C0E564AB}.Debug|x86.Build.0 = Debug|Any CPU
{15D8B589-1E22-4B38-B8DF-A851C0E564AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{15D8B589-1E22-4B38-B8DF-A851C0E564AB}.Release|Any CPU.Build.0 = Release|Any CPU
{15D8B589-1E22-4B38-B8DF-A851C0E564AB}.Release|x64.ActiveCfg = Release|Any CPU
{15D8B589-1E22-4B38-B8DF-A851C0E564AB}.Release|x64.Build.0 = Release|Any CPU
{15D8B589-1E22-4B38-B8DF-A851C0E564AB}.Release|x86.ActiveCfg = Release|Any CPU
{15D8B589-1E22-4B38-B8DF-A851C0E564AB}.Release|x86.Build.0 = Release|Any CPU
{497A3F6F-50DD-4BF3-B671-F1CE7D9AB1FB}.Debug|x64.ActiveCfg = Debug|x64
{497A3F6F-50DD-4BF3-B671-F1CE7D9AB1FB}.Debug|x64.Build.0 = Debug|x64
{497A3F6F-50DD-4BF3-B671-F1CE7D9AB1FB}.Debug|x86.ActiveCfg = Debug|x86
{497A3F6F-50DD-4BF3-B671-F1CE7D9AB1FB}.Debug|x86.Build.0 = Debug|x86
{497A3F6F-50DD-4BF3-B671-F1CE7D9AB1FB}.Release|x64.ActiveCfg = Release|x64
{497A3F6F-50DD-4BF3-B671-F1CE7D9AB1FB}.Release|x64.Build.0 = Release|x64
{497A3F6F-50DD-4BF3-B671-F1CE7D9AB1FB}.Release|x86.ActiveCfg = Release|x86
{497A3F6F-50DD-4BF3-B671-F1CE7D9AB1FB}.Release|x86.Build.0 = Release|x86
{177CA2F6-8ECA-4FBA-A01C-4D064C307E65}.Debug|x64.ActiveCfg = Debug|x64
{177CA2F6-8ECA-4FBA-A01C-4D064C307E65}.Debug|x64.Build.0 = Debug|x64
{177CA2F6-8ECA-4FBA-A01C-4D064C307E65}.Debug|x86.ActiveCfg = Debug|x86
{177CA2F6-8ECA-4FBA-A01C-4D064C307E65}.Debug|x86.Build.0 = Debug|x86
{177CA2F6-8ECA-4FBA-A01C-4D064C307E65}.Release|x64.ActiveCfg = Release|x64
{177CA2F6-8ECA-4FBA-A01C-4D064C307E65}.Release|x64.Build.0 = Release|x64
{177CA2F6-8ECA-4FBA-A01C-4D064C307E65}.Release|x86.ActiveCfg = Release|x86
{177CA2F6-8ECA-4FBA-A01C-4D064C307E65}.Release|x86.Build.0 = Release|x86
{15D8B589-1E22-4B38-B8DF-A851C0E564AB}.Debug|x64.ActiveCfg = Debug|x64
{15D8B589-1E22-4B38-B8DF-A851C0E564AB}.Debug|x64.Build.0 = Debug|x64
{15D8B589-1E22-4B38-B8DF-A851C0E564AB}.Debug|x86.ActiveCfg = Debug|x86
{15D8B589-1E22-4B38-B8DF-A851C0E564AB}.Debug|x86.Build.0 = Debug|x86
{15D8B589-1E22-4B38-B8DF-A851C0E564AB}.Release|x64.ActiveCfg = Release|x64
{15D8B589-1E22-4B38-B8DF-A851C0E564AB}.Release|x64.Build.0 = Release|x64
{15D8B589-1E22-4B38-B8DF-A851C0E564AB}.Release|x86.ActiveCfg = Release|x86
{15D8B589-1E22-4B38-B8DF-A851C0E564AB}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
10 changes: 10 additions & 0 deletions SharpGen/Logging/LoggingCodes.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;

namespace SharpGen.Logging
Expand Down Expand Up @@ -50,10 +51,19 @@ public static class LoggingCodes

public const string InvalidPlatformDetectionType = "SG0023";

public const string InvalidGlobalNamespaceOverride = "SG0024";

public const string CastXmlError = "CX0001";

public const string CastXmlWarning = "CX0002";

public const string CastXmlFailed = "CX0003";

// Used by SharpGen MSBuild SDK targets file
[SuppressMessage("ReSharper", "UnusedMember.Global")]
public const string ExplicitRuntimePackageReference = "SD0001";

[SuppressMessage("ReSharper", "UnusedMember.Global")]
public const string MissingExplicitRuntimePackageReferenceForPackageReferenceSdk = "SD0002";
}
}
25 changes: 0 additions & 25 deletions SharpGenTools.Sdk/MSBuildSharpPatchLogger.cs

This file was deleted.

Loading

0 comments on commit 1a42c38

Please sign in to comment.