Skip to content

Commit 75e23a0

Browse files
authored
Fix some .NET 5.0 compile issues (IronLanguages#940)
* Fix .NET 5.0 compile issues * Install .NET SDKs * Enable testing on .NET 5.0 * Add .NET 5.0 to VSTS * Disable packaging for testing * Temporarily disable some tests on .NET 5.0 * Add some SupportedOSPlatform annotations * Bump to RC2 * Change TargetFramework of Wpf project * Update to release * Update NuGet packages * Try some C# 9 features * Disable warnings in analyzer * Update versions in documentation
1 parent a2dbbe4 commit 75e23a0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+237
-86
lines changed

.github/workflows/main.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ jobs:
2727
uses: actions/setup-dotnet@v1
2828
with:
2929
dotnet-version: '3.1.x'
30+
- name: Setup .NET 5.0
31+
uses: actions/setup-dotnet@v1
32+
with:
33+
dotnet-version: '5.0.x'
3034
- name: Set Mono Version
3135
if: matrix.os == 'macos-latest'
3236
run: echo ::add-path::/Library/Frameworks/Mono.framework/Versions/6.4.0/bin
@@ -37,12 +41,12 @@ jobs:
3741
shell: pwsh
3842
- name: Build
3943
run: pwsh make.ps1
40-
- name: Package
41-
run: pwsh make.ps1 package
42-
- uses: actions/upload-artifact@v2
43-
with:
44-
name: packages
45-
path: Package/Release/Packages
44+
# - name: Package
45+
# run: pwsh make.ps1 package
46+
# - uses: actions/upload-artifact@v2
47+
# with:
48+
# name: packages
49+
# path: Package/Release/Packages
4650
- name: Test (net46)
4751
run: ./make.ps1 -frameworks net46 test-all
4852
shell: pwsh
@@ -52,3 +56,6 @@ jobs:
5256
- name: Test (netcoreapp3.1)
5357
run: ./make.ps1 -frameworks netcoreapp3.1 test-all
5458
shell: pwsh
59+
- name: Test (net5.0)
60+
run: ./make.ps1 -frameworks net5.0 test-all
61+
shell: pwsh

Build/net5.0-windows.props

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project>
2+
<PropertyGroup>
3+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
4+
<OutputPath Condition=" '$(TargetFramework)' == 'net5.0-windows' ">$(BaseOutputPath)\net5.0</OutputPath>
5+
</PropertyGroup>
6+
7+
<Import Project="net5.0.props" />
8+
</Project>

Build/net5.0.props

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<IsFullFramework>false</IsFullFramework>
5+
</PropertyGroup>
6+
7+
<PropertyGroup>
8+
<Features>$(Features);FEATURE_APARTMENTSTATE</Features>
9+
<Features>$(Features);FEATURE_ASSEMBLY_GETFORWARDEDTYPES</Features>
10+
<Features>$(Features);FEATURE_ASSEMBLY_RESOLVE</Features>
11+
<Features>$(Features);FEATURE_ASSEMBLYBUILDER_DEFINEDYNAMICASSEMBLY</Features>
12+
<Features>$(Features);FEATURE_BASIC_CONSOLE</Features>
13+
<Features>$(Features);FEATURE_CODEDOM</Features>
14+
<Features>$(Features);FEATURE_COM</Features>
15+
<Features>$(Features);FEATURE_CONFIGURATION</Features>
16+
<Features>$(Features);FEATURE_CTYPES</Features>
17+
<Features>$(Features);FEATURE_CUSTOM_TYPE_DESCRIPTOR</Features>
18+
<Features>$(Features);FEATURE_DYNAMIC_EXPRESSION_VISITOR</Features>
19+
<Features>$(Features);FEATURE_EXCEPTION_STATE</Features>
20+
<Features>$(Features);FEATURE_FILESYSTEM</Features>
21+
<Features>$(Features);FEATURE_FULL_CONSOLE</Features>
22+
<Features>$(Features);FEATURE_FULL_CRYPTO</Features>
23+
<Features>$(Features);FEATURE_FULL_NET</Features>
24+
<Features>$(Features);FEATURE_LCG</Features>
25+
<Features>$(Features);FEATURE_LOADWITHPARTIALNAME</Features>
26+
<Features>$(Features);FEATURE_METADATA_READER</Features>
27+
<Features>$(Features);FEATURE_MMAP</Features>
28+
<Features>$(Features);FEATURE_NATIVE</Features>
29+
<Features>$(Features);FEATURE_OSPLATFORMATTRIBUTE</Features>
30+
<Features>$(Features);FEATURE_PIPES</Features>
31+
<Features>$(Features);FEATURE_PROCESS</Features>
32+
<Features>$(Features);FEATURE_REFEMIT</Features>
33+
<Features>$(Features);FEATURE_REGISTRY</Features>
34+
<Features>$(Features);FEATURE_RUNTIMEINFORMATION</Features>
35+
<Features>$(Features);FEATURE_SECURITY_RULES</Features>
36+
<Features>$(Features);FEATURE_SERIALIZATION</Features>
37+
<Features>$(Features);FEATURE_STACK_TRACE</Features>
38+
<Features>$(Features);FEATURE_SYNC_SOCKETS</Features>
39+
<Features>$(Features);FEATURE_THREAD</Features>
40+
<Features>$(Features);FEATURE_XMLDOC</Features>
41+
</PropertyGroup>
42+
</Project>

Build/steps.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,17 @@ steps:
3131
version: '2.1.x'
3232

3333
- task: UseDotNet@2
34-
displayName: Install .NET Core 3.1 SDK for build
34+
displayName: Install .NET Core 3.1 runtime for running tests
3535
inputs:
36-
packageType: 'sdk'
36+
packageType: 'runtime'
3737
version: '3.1.x'
3838

39+
- task: UseDotNet@2
40+
displayName: Install .NET Core 5.0 SDK for build
41+
inputs:
42+
packageType: 'sdk'
43+
version: '5.0.x'
44+
3945
# Set Mono version on macOS
4046
- ${{ if eq(parameters.os, 'macOS') }}:
4147
- task: ms-devlabs.utilitytasks.task-Shellpp.Shell++@0
@@ -93,9 +99,9 @@ steps:
9399
testRunTitle: ${{ parameters.os }}
94100
condition: succeededOrFailed()
95101

96-
- powershell: ./make.ps1 package
97-
displayName: Package
98-
condition: succeededOrFailed()
102+
# - powershell: ./make.ps1 package
103+
# displayName: Package
104+
# condition: succeededOrFailed()
99105

100106
- task: CopyFiles@2
101107
displayName: Copy NuGet and Zip Packages

Directory.Build.props

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,15 @@
9494
<Configuration Condition="'$(Configuration)' == 'Release'">Release</Configuration>
9595
</PropertyGroup>
9696

97-
<!-- References -->
98-
<Import Project="$(BuildSysDir)\$(TargetFramework).props" Condition="'$(TargetFramework)' != ''" />
99-
10097
<PropertyGroup>
10198
<BaseOutputPath>$(RootDir)bin\$(Configuration)</BaseOutputPath>
10299
<OutputPath>$(BaseOutputPath)</OutputPath>
100+
</PropertyGroup>
101+
102+
<!-- References -->
103+
<Import Project="$(BuildSysDir)\$(TargetFramework).props" Condition="'$(TargetFramework)' != ''" />
104+
105+
<PropertyGroup>
103106
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
104107
<NoWarn>1573;1591</NoWarn>
105108
<ErrorReport>prompt</ErrorReport>

Documentation/building.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Building IronPython3
22

3-
To build IronPython3 you will need the .NET SDK (minimum 4.5), a [.NET Core SDK (minimum 3.1)](https://dotnet.microsoft.com/download/visual-studio-sdks) and if building on Linux/macOS you will need [Mono](https://mono-project.com).
3+
To build IronPython3 you will need the [.NET SDK (minimum v5.0.100)](https://dotnet.microsoft.com/download/visual-studio-sdks).
44

55
See [Getting the Sources](getting-the-sources.md) for information on getting the source for IronPython3.
66

77
## Building from Visual Studio
88

9-
Visual Studio 16.4(2019) or above is required to build IronPython3.
9+
Visual Studio 2019 v16.8 or above is required to build IronPython3.
1010

1111
* Open `c:\path\to\ironpython3\IronPython.sln` solution file
1212
* Select the configuration options (Release,Debug, etc)
@@ -38,8 +38,7 @@ There are also other targets available for use with packaging and testing, most
3838
package Creates packages supported by the current platform
3939
stage Stages files ready for packaging
4040
test-* Runs tests from `all` categories, `ironpython` specific tests,
41-
`cpython` tests from the CPython stdlib test suite, `smoke` a small
42-
set of tests
41+
`cpython` tests from the CPython stdlib test suite
4342
```
4443

45-
If the build is successful the binaries are stored in ironpython3/bin/{ConfigurationName}/{Framework}
44+
If the build is successful the binaries are stored in ironpython3/bin/{Configuration}/{TargetFramework}

IronPython.sln

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{17737ACB
3535
ProjectSection(SolutionItems) = preProject
3636
Build\After.targets = Build\After.targets
3737
Build\net46.props = Build\net46.props
38+
Build\net5.0-windows.props = Build\net5.0-windows.props
39+
Build\net5.0.props = Build\net5.0.props
3840
Build\netcoreapp2.1.props = Build\netcoreapp2.1.props
3941
Build\netcoreapp3.1.props = Build\netcoreapp3.1.props
4042
Build\netstandard2.0.props = Build\netstandard2.0.props

IronPythonAnalyzer/IronPythonAnalyzer/IronPythonAnalyzer.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="2.9.8" PrivateAssets="all" />
9-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.4.0" PrivateAssets="all" />
8+
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.1" PrivateAssets="all" />
9+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.7.0" PrivateAssets="all" />
1010
</ItemGroup>
1111

1212
</Project>

IronPythonAnalyzer/IronPythonAnalyzer/IronPythonAnalyzerAnalyzer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ namespace IronPythonAnalyzer {
1717
public class IronPythonAnalyzerAnalyzer : DiagnosticAnalyzer {
1818
public const string DiagnosticId = "IronPythonAnalyzer";
1919

20+
#pragma warning disable RS2008 // Enable analyzer release tracking
2021
private static readonly DiagnosticDescriptor Rule1 = new DiagnosticDescriptor("IPY01", title: "Parameter which is marked not nullable does not have the NotNullAttribute", messageFormat: "Parameter '{0}' does not have the NotNullAttribute", category: "Usage", DiagnosticSeverity.Warning, isEnabledByDefault: true, description: "Non-nullable reference type parameters should have the NotNullAttribute.");
2122
private static readonly DiagnosticDescriptor Rule2 = new DiagnosticDescriptor("IPY02", title: "Parameter which is marked nullable has the NotNullAttribute", messageFormat: "Parameter '{0}' should not have the NotNullAttribute", category: "Usage", DiagnosticSeverity.Warning, isEnabledByDefault: true, description: "Nullable reference type parameters should not have the NotNullAttribute.");
2223
private static readonly DiagnosticDescriptor Rule3 = new DiagnosticDescriptor("IPY03", title: "BytesLikeAttribute used on a not supported type", messageFormat: "Parameter '{0}' declared bytes-like on unsupported type '{1}'", category: "Usage", DiagnosticSeverity.Warning, isEnabledByDefault: true, description: "BytesLikeAttribute is only allowed on parameters of type IReadOnlyList<byte>, or IList<byte>.");
24+
#pragma warning restore RS2008 // Enable analyzer release tracking
2325

2426
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get { return ImmutableArray.Create(Rule1, Rule2, Rule3); } }
2527

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ Since the main development is on Windows, Mono bugs may inadvertantly be introdu
5050
- please report them!
5151

5252
## Supported Platforms
53-
IronPython 3 targets .NET 4.6 and .NET Core 2.1/3.1.
53+
IronPython 3 targets .NET Framework 4.6, .NET Core 2.1/3.1 and .NET 5.0. The support for .NET Core and .NET 5 will follow the lifecycle defined on [.NET Core and .NET 5 Support Policy](https://dotnet.microsoft.com/platform/support/policy/dotnet-core).

0 commit comments

Comments
 (0)