Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 0 additions & 17 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
<Project>
<Import Project="$(MSBuildThisFileDirectory)SdkPackage.targets" Condition="'$(SharpGenSdkPackage)' == 'true'" />

<Target Name="IncludeTargetingPackReferencePatch" BeforeTargets="_CheckForInvalidConfigurationAndPlatform;CollectPackageReferences;CheckForImplicitPackageReferenceOverrides"
Condition="'$(TargetFrameworkMoniker)' != '' and '$(TargetFrameworkIdentifier)' == '.NETFramework'">
<GetReferenceAssemblyPaths
TargetFrameworkMoniker="$(TargetFrameworkMoniker)"
RootPath="$(TargetFrameworkRootPath)"
TargetFrameworkFallbackSearchPaths="$(TargetFrameworkFallbackSearchPaths)"
BypassFrameworkInstallChecks="$(BypassFrameworkInstallChecks)"
SuppressNotFoundError="true">
<Output TaskParameter="FullFrameworkReferenceAssemblyPaths" PropertyName="_FullFrameworkReferenceAssemblyPaths"/>
</GetReferenceAssemblyPaths>

<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="$(MicrosoftNETFrameworkReferenceAssembliesLatestPackageVersion)" PrivateAssets="All"
Condition="'$(_FullFrameworkReferenceAssemblyPaths)' == ''"/>
</ItemGroup>
</Target>
</Project>
7 changes: 3 additions & 4 deletions Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
</PackageReference>
<PackageReference Update="FakeItEasy" Version="6.0.1" />
<PackageReference Update="FakeItEasy.Analyzer.CSharp" Version="6.0.0" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Update="xunit" Version="2.4.1" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Update="Xunit.SkippableFact" Version="1.3.12" />
<PackageReference Update="Xunit.SkippableFact" Version="1.4.8" />
<PackageReference Update="Microsoft.CodeAnalysis.CSharp" Version="3.6.0-3.final" />
<PackageReference Update="Microsoft.Win32.Registry" Version="4.7.0" />
<PackageReference Update="Superpower" Version="2.3.0" />
<PackageReference Update="System.Diagnostics.Process" Version="4.3.0" />
<PackageReference Update="System.Runtime.Extensions" Version="4.3.1" />
<PackageReference Update="System.ValueTuple" Version="4.5.0" />
Expand All @@ -32,7 +31,7 @@
<PackageReference Update="System.Runtime.CompilerServices.Unsafe" Version="4.7.1" />
<PackageReference Update="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
<PackageReference Update="Microsoft.Build.Utilities.Core" Version="15.3.409" />
<PackageReference Update="Microsoft.Net.Compilers.Toolset" Version="3.7.0-1.20223.1">
<PackageReference Update="Microsoft.Net.Compilers.Toolset" Version="3.7.0-1.20230.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion SharpGen.Runtime/SharpGen.Runtime.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<Description>Support classes for code generated by SharpGen.</Description>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>preview</LangVersion>
<AutomaticallyUseReferenceAssemblyPackages>false</AutomaticallyUseReferenceAssemblyPackages>
</PropertyGroup>

<ItemGroup>
Expand Down
9 changes: 6 additions & 3 deletions SharpGen.UnitTests/IncludeDirectoryResolverTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ public void RegistryPathsFailToResolveOffWindows()
var resolver = new IncludeDirectoryResolver(Logger);
resolver.AddDirectories(new[] { new IncludeDirRule(@"=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots\KitsRoot10;SubFolder") });

var resolvedPaths = resolver.IncludePaths;

AssertLoggingCodeLogged(LoggingCodes.RegistryKeyNotFound);
using (LoggerMessageCountEnvironment(1, LogLevel.Error))
using (LoggerMessageCountEnvironment(0, ~LogLevel.Error))
using (LoggerCodeRequiredEnvironment(LoggingCodes.RegistryKeyNotFound))
{
resolver.IncludePaths.ToArray();
}
}
}
}
4 changes: 4 additions & 0 deletions SharpGen.UnitTests/LoggerAssertHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namespace SharpGen.UnitTests
{
internal delegate void LoggerAssertHandler(XUnitLogEvent[] events);
}
8 changes: 5 additions & 3 deletions SharpGen.UnitTests/Mapping/Struct.cs
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,11 @@ public void NonPortableStructAlignmentRaisesError()
var module = new CppModule();
module.Add(include);

var (solution, _) = MapModel(module, config);

AssertLoggingCodeLogged(LoggingCodes.NonPortableAlignment);
using (LoggerMessageCountEnvironment(1, LogLevel.Error))
using (LoggerCodeRequiredEnvironment(LoggingCodes.NonPortableAlignment))
{
MapModel(module, config);
}
}

[Fact]
Expand Down
10 changes: 7 additions & 3 deletions SharpGen.UnitTests/MarshalledElementFactoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -376,14 +376,18 @@ public void ParameterWithStructSizeRelationLogsError()
TypeName = "int"
};

cppParameter.GetMappingRule().Relation = "struct_size()";
cppParameter.GetMappingRule().Relation = "struct-size()";

var typeRegistry = new TypeRegistry(Logger, A.Fake<IDocumentationLinker>());
typeRegistry.BindType("int", typeRegistry.ImportType(typeof(int)));
var marshalledElementFactory = new MarshalledElementFactory(Logger, new GlobalNamespaceProvider("SharpGen.Runtime"), typeRegistry);
var csParameter = marshalledElementFactory.Create(cppParameter);

AssertLoggingCodeLogged(LoggingCodes.InvalidRelation);
using (LoggerMessageCountEnvironment(1, LogLevel.Error))
using (LoggerMessageCountEnvironment(0, ~LogLevel.Error))
using (LoggerCodeRequiredEnvironment(LoggingCodes.InvalidRelation))
{
marshalledElementFactory.Create(cppParameter);
}
}

[Fact]
Expand Down
8 changes: 5 additions & 3 deletions SharpGen.UnitTests/Parsing/GeneralParsing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ public void InvalidCppErrorsLogger()
}
};

var model = ParseCpp(config);

AssertLoggingCodeLogged(LoggingCodes.CastXmlError);
using (LoggerMessageCountEnvironment(3, LogLevel.Error))
using (LoggerCodeRequiredEnvironment(LoggingCodes.CastXmlError))
{
ParseCpp(config);
}
}

[Fact]
Expand Down
Loading