Skip to content

Commit

Permalink
Fix type forwarding for init/record workaround (#895)
Browse files Browse the repository at this point in the history
* Update `nuke.globaltool` to fix macOS CI

* Revert "disable macos builds for now"

This reverts commit 82934b6 and
commit 9b583ba.

* Fix type forwarding for `init` and `record` workaround

* Only target `net6.0` for tests

So they don't need `IsExternalInit` defined too.
  • Loading branch information
andyleejordan committed Dec 2, 2022
1 parent 7fd2219 commit aac9b59
Show file tree
Hide file tree
Showing 16 changed files with 23 additions and 124 deletions.
6 changes: 3 additions & 3 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ jobs:
Linux:
BuildName: 'Linux'
ImageName: 'ubuntu-latest'
# macOS:
# BuildName: 'macOS'
# ImageName: 'macOS-latest'
macOS:
BuildName: 'macOS'
ImageName: 'macOS-latest'
pool:
vmImage: $(ImageName)
steps:
Expand Down
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
]
},
"nuke.globaltool": {
"version": "6.0.3",
"version": "6.2.1",
"commands": [
"nuke"
]
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os:
# - macOS-latest
- windows-latest
- ubuntu-latest
os: [macOS-latest, windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion sample/SampleServer/SampleServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<IsPackable>false</IsPackable>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
<LangVersion>latest</LangVersion>
</PropertyGroup>
Expand Down
13 changes: 5 additions & 8 deletions src/JsonRpc.Generators/Records.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#pragma warning disable MA0048 // File name must match type name
#define INTERNAL_RECORD_ATTRIBUTES
#if NETSTANDARD2_0 || NETSTANDARD2_1 || NETCOREAPP2_0 || NETCOREAPP2_1 || NETCOREAPP2_2 || NET45 || NET451 || NET452 || NET6 || NET461 || NET462 || NET47 || NET471 || NET472 || NET48
#if NET5_0_OR_GREATER
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.IsExternalInit))]
#else

using System.ComponentModel;

// ReSharper disable once CheckNamespace
Expand All @@ -11,12 +13,7 @@ namespace System.Runtime.CompilerServices
/// This class should not be used by developers in source code.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
#if INTERNAL_RECORD_ATTRIBUTES
internal
#else
public
#endif
static class IsExternalInit
internal static class IsExternalInit
{
}
}
Expand Down
13 changes: 5 additions & 8 deletions src/JsonRpc/Nullable/Records.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#pragma warning disable MA0048 // File name must match type name
#define INTERNAL_RECORD_ATTRIBUTES
#if NETSTANDARD || NETCOREAPP
#if NET5_0_OR_GREATER
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.IsExternalInit))]
#else

using System.ComponentModel;

// ReSharper disable once CheckNamespace
Expand All @@ -11,12 +13,7 @@ namespace System.Runtime.CompilerServices
/// This class should not be used by developers in source code.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
#if INTERNAL_RECORD_ATTRIBUTES
internal
#else
public
#endif
static class IsExternalInit
internal static class IsExternalInit
{
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/Client.Tests/Client.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<AssemblyName>OmniSharp.Extensions.LanguageClient.Tests</AssemblyName>
<RootNamespace>OmniSharp.Extensions.LanguageServer.Client.Tests</RootNamespace>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions test/Dap.Tests/Dap.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<WarningsAsErrors>true</WarningsAsErrors>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
Expand All @@ -16,6 +16,6 @@
<ProjectReference Include="..\..\src\JsonRpc.Generators\JsonRpc.Generators.csproj" IncludeAssets="analyzers" ExcludeAssets="compile;runtime;native" PrivateAssets="contentfiles;build;buildMultitargeting;buildTransitive" OutputItemType="Analyzer" />
</ItemGroup>
<ItemGroup>
<Folder Include="obj\Release\netcoreapp3.1\" />
<Folder Include="obj\Release\net6.0\" />
</ItemGroup>
</Project>
23 changes: 0 additions & 23 deletions test/Dap.Tests/Records.cs

This file was deleted.

2 changes: 1 addition & 1 deletion test/Generation.Tests/Generation.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<WarningsAsErrors>true</WarningsAsErrors>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
Expand Down
23 changes: 0 additions & 23 deletions test/Generation.Tests/Records.cs

This file was deleted.

2 changes: 1 addition & 1 deletion test/JsonRpc.Tests/JsonRpc.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<WarningsAsErrors>true</WarningsAsErrors>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion test/Lsp.Integration.Tests/Lsp.Integration.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<WarningsAsErrors>true</WarningsAsErrors>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
Expand Down
23 changes: 0 additions & 23 deletions test/Lsp.Integration.Tests/Records.cs

This file was deleted.

2 changes: 1 addition & 1 deletion test/Lsp.Tests/Lsp.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<WarningsAsErrors>true</WarningsAsErrors>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
Expand Down
23 changes: 0 additions & 23 deletions test/Lsp.Tests/Records.cs

This file was deleted.

0 comments on commit aac9b59

Please sign in to comment.