Skip to content

Commit

Permalink
Merge pull request #1293 from microsoft/libtemplateUpdate
Browse files Browse the repository at this point in the history
Merge latest Library.Template
  • Loading branch information
AArnott authored Oct 1, 2024
2 parents c923b4f + 2402e7c commit 58e9499
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
]
},
"dotnet-coverage": {
"version": "17.12.3",
"version": "17.12.5",
"commands": [
"dotnet-coverage"
]
Expand Down
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<PackageVersion Include="System.Text.Json" Version="4.7.2" />
<PackageVersion Include="Xunit.Combinatorial" Version="1.6.24" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="xunit" Version="2.9.0" />
<PackageVersion Include="xunit" Version="2.9.2" />
</ItemGroup>
<ItemGroup Condition="'$(IsTestProject)'!='true'">
<!-- These versions carefully chosen to support VS 2019 Update 11. -->
Expand Down
4 changes: 3 additions & 1 deletion init.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ try {
if ($SBOM) {
Write-Host "Installing MicroBuild SBOM plugin" -ForegroundColor $HeaderColor
& $InstallNuGetPkgScriptPath MicroBuild.Plugins.Sbom -source $MicroBuildPackageSource -Verbosity $nugetVerbosity
$PkgMicrosoft_ManifestTool_CrossPlatform = & $InstallNuGetPkgScriptPath Microsoft.ManifestTool.CrossPlatform -source 'https://1essharedassets.pkgs.visualstudio.com/1esPkgs/_packaging/SBOMTool/nuget/v3/index.json' -Verbosity $nugetVerbosity
# The feed with the latest versions of the tool is at 'https://1essharedassets.pkgs.visualstudio.com/1esPkgs/_packaging/SBOMTool/nuget/v3/index.json',
# but we'll use the feed that the SBOM task itself uses to install the tool for consistency.
$PkgMicrosoft_ManifestTool_CrossPlatform = & $InstallNuGetPkgScriptPath Microsoft.ManifestTool.CrossPlatform -source $MicroBuildPackageSource -Verbosity $nugetVerbosity
$EnvVars['GenerateSBOM'] = "true"
$EnvVars['PkgMicrosoft_ManifestTool_CrossPlatform'] = $PkgMicrosoft_ManifestTool_CrossPlatform
}
Expand Down
8 changes: 4 additions & 4 deletions test/Microsoft.Windows.CsWin32.Tests/COMTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ public void COMPropertiesAreGeneratedAsStructProperties_NonConsecutiveAccessors(
// And in some cases, the types are *not* the same, so don't generate any property.
Assert.Null(FindAccessor(structSyntax, "ClassName", SyntaxKind.GetAccessorDeclaration));
Assert.Null(FindAccessor(structSyntax, "ClassName", SyntaxKind.SetAccessorDeclaration));
Assert.NotEmpty(structSyntax.Members.OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "get_ClassName"));
Assert.NotEmpty(structSyntax.Members.OfType<MethodDeclarationSyntax>().Where(m => m.Identifier.ValueText == "put_ClassName"));
Assert.Contains(structSyntax.Members.OfType<MethodDeclarationSyntax>(), m => m.Identifier.ValueText == "get_ClassName");
Assert.Contains(structSyntax.Members.OfType<MethodDeclarationSyntax>(), m => m.Identifier.ValueText == "put_ClassName");
}

/// <summary>
Expand Down Expand Up @@ -203,8 +203,8 @@ public void WinRTInterfaceWithWinRTOutObjectUsesMarshaler()
AttributeSyntax marshalAsAttr = Assert.Single(FindAttribute(lastParam.AttributeLists, "MarshalAs"));

Assert.True(marshalAsAttr.ArgumentList?.Arguments[0].ToString() == "UnmanagedType.CustomMarshaler");
Assert.Single(marshalAsAttr.ArgumentList.Arguments.Where(arg => arg.ToString() == $"MarshalCookie = \"{WinRTClassName}\""));
Assert.Single(marshalAsAttr.ArgumentList.Arguments.Where(arg => arg.ToString() == $"MarshalType = \"{WinRTCustomMarshalerFullName}\""));
Assert.Single(marshalAsAttr.ArgumentList.Arguments, arg => arg.ToString() == $"MarshalCookie = \"{WinRTClassName}\"");
Assert.Single(marshalAsAttr.ArgumentList.Arguments, arg => arg.ToString() == $"MarshalType = \"{WinRTCustomMarshalerFullName}\"");

// Make sure the WinRT marshaler was brought in
Assert.Single(this.FindGeneratedType(WinRTCustomMarshalerClass));
Expand Down
2 changes: 1 addition & 1 deletion test/Microsoft.Windows.CsWin32.Tests/GeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ public void NativeArray_SizeParamIndex_ProducesSimplerFriendlyOverload(bool allo
this.CollectGeneratedCode(this.generator);
this.AssertNoDiagnostics();
IEnumerable<MethodDeclarationSyntax> overloads = this.FindGeneratedMethod("EvtNext");
Assert.NotEmpty(overloads.Where(o => o.ParameterList.Parameters.Count == 5 && (o.ParameterList.Parameters[1].Type?.ToString().StartsWith("Span<", StringComparison.Ordinal) ?? false)));
Assert.Contains(overloads, o => o.ParameterList.Parameters.Count == 5 && (o.ParameterList.Parameters[1].Type?.ToString().StartsWith("Span<", StringComparison.Ordinal) ?? false));
}

[Theory, PairwiseData]
Expand Down
4 changes: 2 additions & 2 deletions test/Microsoft.Windows.CsWin32.Tests/StructTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ public void StructConstantsAreGeneratedAsConstants()
{
this.GenerateApi("Color");
var type = (StructDeclarationSyntax)Assert.Single(this.FindGeneratedType("Color"));
FieldDeclarationSyntax argb = Assert.Single(type.Members.OfType<FieldDeclarationSyntax>().Where(f => !(f.Modifiers.Any(SyntaxKind.StaticKeyword) || f.Modifiers.Any(SyntaxKind.ConstKeyword))));
FieldDeclarationSyntax argb = Assert.Single(type.Members.OfType<FieldDeclarationSyntax>(), f => !(f.Modifiers.Any(SyntaxKind.StaticKeyword) || f.Modifiers.Any(SyntaxKind.ConstKeyword)));
Assert.Equal("Argb", argb.Declaration.Variables.Single().Identifier.ValueText);
Assert.NotEmpty(type.Members.OfType<FieldDeclarationSyntax>().Where(f => f.Modifiers.Any(SyntaxKind.ConstKeyword)));
Assert.Contains(type.Members.OfType<FieldDeclarationSyntax>(), f => f.Modifiers.Any(SyntaxKind.ConstKeyword));
}

[Theory]
Expand Down

0 comments on commit 58e9499

Please sign in to comment.