Skip to content

Commit

Permalink
Fix build errors from an updated SDK/compiler and floating package ve…
Browse files Browse the repository at this point in the history
…rsions. (#944)

Centralize package versions in Versions.props so we have one point for updating a given package across the whole repo.
  • Loading branch information
jkoritzinsky authored Apr 9, 2021
1 parent 0c64a2a commit 9aac138
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 26 deletions.
2 changes: 1 addition & 1 deletion DllImportGenerator/Benchmarks/Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
<PackageReference Include="BenchmarkDotNet" Version="$(BenchmarkDotNetVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PackageReference Include="coverlet.collector" Version="$(CoverletVersion)">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="$(CompilerPlatformVersion)" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.0.1-beta1.20478.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="1.0.1-beta1.20478.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="$(MicrosoftCodeAnalysisAnalyzersVersion)" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="$(CompilerPlatformTestingVersion)" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing.XUnit" Version="$(CompilerPlatformTestingVersion)" PrivateAssets="all" />
<PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="$(CompilerPlatformVersion)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PackageReference Include="coverlet.collector" Version="$(CoverletVersion)">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="$(CompilerPlatformVersion)" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="$(MicrosoftCodeAnalysisAnalyzersVersion)" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion DllImportGenerator/TestAssets/NativeExports/Arrays.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public static byte AndAllMembers([DNNE.C99Type("struct bool_struct*")] BoolStruc
BoolStruct managed = pArray[i].ToManaged();
result &= managed.b1 && managed.b2 && managed.b3;
}
return result ? 1 : 0;
return (byte)(result ? 1 : 0);
}

private static int* CreateRangeImpl(int start, int end, int* numValues)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ public static void NegateBools(
{
*pBoolStructOut = new BoolStructNative
{
b1 = boolStruct.b1 != 0 ? 0 : 1,
b2 = boolStruct.b2 != 0 ? 0 : 1,
b3 = boolStruct.b3 != 0 ? 0 : 1,
b1 = (byte)(boolStruct.b1 != 0 ? 0 : 1),
b2 = (byte)(boolStruct.b2 != 0 ? 0 : 1),
b3 = (byte)(boolStruct.b3 != 0 ? 0 : 1),
};
}

[UnmanagedCallersOnly(EntryPoint = "and_bools_ref")]
public static byte AndBoolsRef(
[DNNE.C99Type("struct bool_struct*")] BoolStructNative* boolStruct)
{
return boolStruct->b1 != 0 && boolStruct->b2 != 0 && boolStruct->b3 != 0 ? 1 : 0;
return (byte)(boolStruct->b1 != 0 && boolStruct->b2 != 0 && boolStruct->b3 != 0 ? 1 : 0);
}

[UnmanagedCallersOnly(EntryPoint = "double_int_ref")]
Expand Down
4 changes: 2 additions & 2 deletions DllImportGenerator/TestAssets/NativeExports/Handles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ public static void AllocateHandleOut(nint* handle)
[UnmanagedCallersOnly(EntryPoint = "release_handle")]
public static byte ReleaseHandle(nint handle)
{
return ActiveHandles.Remove(handle) ? 1 : 0;
return (byte)(ActiveHandles.Remove(handle) ? 1 : 0);
}

[UnmanagedCallersOnly(EntryPoint = "is_handle_alive")]
public static byte IsHandleAlive(nint handle)
{
return ActiveHandles.Contains(handle) ? 1 : 0;
return (byte)(ActiveHandles.Contains(handle) ? 1 : 0);
}

[UnmanagedCallersOnly(EntryPoint = "modify_handle")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DNNE" Version="1.0.16" />
<PackageReference Include="DNNE" Version="$(DNNEVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions DllImportGenerator/TestAssets/SharedTypes/NonBlittable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ public struct BoolStructNative
public byte b3;
public BoolStructNative(BoolStruct bs)
{
b1 = bs.b1 ? 1 : 0;
b2 = bs.b2 ? 1 : 0;
b3 = bs.b3 ? 1 : 0;
b1 = (byte)(bs.b1 ? 1 : 0);
b2 = (byte)(bs.b2 ? 1 : 0);
b3 = (byte)(bs.b3 ? 1 : 0);
}

public BoolStruct ToManaged()
Expand Down
2 changes: 1 addition & 1 deletion DllImportGenerator/Tools/Benchmarking/Benchmarking.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Iced" Version="1.8.0" />
<PackageReference Include="Iced" Version="$(IcedVersion)" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion DllImportGenerator/Tools/PInvokeDump/PInvokeDump.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.CommandLine" Version="[2.0.*-*, )" />
<PackageReference Include="System.CommandLine" Version="$(SystemCommandLineVersion)" />
</ItemGroup>

</Project>
13 changes: 7 additions & 6 deletions DllImportGenerator/Tools/PInvokeDump/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ private void Print()

public static Task<int> Main(string[] args)
{
var excludeOption = new Option<string>(
"--exclude",
"Name of file to exclude",
ArgumentArity.ZeroOrMore);
excludeOption.AddAlias("-x");

var rootCommand = new RootCommand
{
new Option<FileInfo>(
Expand All @@ -113,12 +119,7 @@ public static Task<int> Main(string[] args)
new string[] { "--output-format", "-fmt" },
getDefaultValue: () => OutputFormat.Text,
"Output format"),
new Option<string>(
new string[] { "--exclude", "-x"},
"Name of file to exclude")
{
Argument = new Argument<string>() { Arity = ArgumentArity.ZeroOrMore }
},
excludeOption,
new Option<bool>(
new string[] { "--quiet", "-q" },
getDefaultValue: () => false,
Expand Down
8 changes: 8 additions & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,13 @@
<XUnitRunnerVisualStudioVersion>2.4.3</XUnitRunnerVisualStudioVersion>
<!-- Roslyn dependencies -->
<CompilerPlatformVersion>3.8.0-3.final</CompilerPlatformVersion>
<CompilerPlatformTestingVersion>1.0.1-beta1.20478.1</CompilerPlatformTestingVersion>
<MicrosoftCodeAnalysisAnalyzersVersion>3.3.0</MicrosoftCodeAnalysisAnalyzersVersion>
<!-- Package dependencies -->
<SystemCommandLineVersion>2.0.0-beta1.21118.1</SystemCommandLineVersion>
<IcedVersion>1.8.0</IcedVersion>
<BenchmarkDotNetVersion>0.12.1</BenchmarkDotNetVersion>
<CoverletVersion>1.3.0</CoverletVersion>
<DNNEVersion>1.0.16</DNNEVersion>
</PropertyGroup>
</Project>

0 comments on commit 9aac138

Please sign in to comment.