Skip to content

Commit

Permalink
!WIP! Employ new .NET Core projects (with "net45" Target FW)
Browse files Browse the repository at this point in the history
TODO:
* project.assets.json on obj dir => dotnet/sdk#980
* R# sdk: error with installation detection => https://youtrack.jetbrains.com/issue/RSRP-463584
  • Loading branch information
ulrichb committed Mar 12, 2017
1 parent 78cc747 commit d240503
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 2 deletions.
14 changes: 14 additions & 0 deletions ImplicitNullability.sln
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImplicitNullability.Plugin.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImplicitNullability.Plugin.VsFormatDefinitions", "Src\ImplicitNullability.Plugin.VsFormatDefinitions\ImplicitNullability.Plugin.VsFormatDefinitions.csproj", "{06B8BCDD-6F91-42C7-A474-C50CD24C397E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImplicitNullability.Plugin.R20171", "Src\ImplicitNullability.Plugin\ImplicitNullability.Plugin.R20171.csproj", "{F11EC71A-6C97-446D-B2CC-FF9D94BECF41}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImplicitNullability.Plugin.Tests.R20171", "Src\ImplicitNullability.Plugin.Tests\ImplicitNullability.Plugin.Tests.R20171.csproj", "{8709C388-4692-4C91-A383-A738A966657A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -87,6 +91,14 @@ Global
{06B8BCDD-6F91-42C7-A474-C50CD24C397E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{06B8BCDD-6F91-42C7-A474-C50CD24C397E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{06B8BCDD-6F91-42C7-A474-C50CD24C397E}.Release|Any CPU.Build.0 = Release|Any CPU
{F11EC71A-6C97-446D-B2CC-FF9D94BECF41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F11EC71A-6C97-446D-B2CC-FF9D94BECF41}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F11EC71A-6C97-446D-B2CC-FF9D94BECF41}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F11EC71A-6C97-446D-B2CC-FF9D94BECF41}.Release|Any CPU.Build.0 = Release|Any CPU
{8709C388-4692-4C91-A383-A738A966657A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8709C388-4692-4C91-A383-A738A966657A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8709C388-4692-4C91-A383-A738A966657A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8709C388-4692-4C91-A383-A738A966657A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -102,5 +114,7 @@ Global
{DB452FAF-D3A5-4CE9-AA1B-A738CB79F50D} = {67859B65-179D-40D0-80DB-003011824913}
{1B815C86-2DD2-4B1F-A50A-3BFB7132D99E} = {67859B65-179D-40D0-80DB-003011824913}
{06B8BCDD-6F91-42C7-A474-C50CD24C397E} = {67859B65-179D-40D0-80DB-003011824913}
{F11EC71A-6C97-446D-B2CC-FF9D94BECF41} = {67859B65-179D-40D0-80DB-003011824913}
{8709C388-4692-4C91-A383-A738A966657A} = {67859B65-179D-40D0-80DB-003011824913}
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion Shared
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net45</TargetFramework>
<RootNamespace>ImplicitNullability.Plugin.Tests</RootNamespace>
<!-- <BaseIntermediateOutputPath>obj\R20171\</BaseIntermediateOutputPath> doesn't work :/ -->
<IntermediateOutputPath>obj\R20171\</IntermediateOutputPath> <!-- TODO: what about the project.assets.json ?? -->
<EnableDefaultItems>false</EnableDefaultItems>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;DEBUG;NET45;RESHARPER20171</DefineConstants>
<OutputPath>bin\R20171\Debug\</OutputPath>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>TRACE;RELEASE;NET45;RESHARPER20171</DefineConstants>
<OutputPath>bin\R20171\Release\</OutputPath>
</PropertyGroup>

<ItemGroup>
<Compile Include="**\*.cs" Exclude="obj\**;Packages\**;test\data\**" />
</ItemGroup>
<ItemGroup>
<None Include="test\data\nuget.config" />
<None Include="test\data\**\*.cs" />
<None Include="test\data\**\*.gold" />
<None Include="ExternalAnnotations\.NETFramework\System.Web\4.0.0.0.Nullness.Gen.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="JetBrains.ReSharper.SDK.Tests" Version="2017.1.20170309.135707-eap04" />
<PackageReference Include="FakeItEasy" Version="2.3.2" />
<PackageReference Include="ncalc" Version="1.3.8" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ImplicitNullability.Plugin\ImplicitNullability.Plugin.R20171.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#if RESHARPER20161 || RESHARPER20162 || RESHARPER20163
using System;
using JetBrains.Annotations;
using JetBrains.ReSharper.Psi.Tree;

namespace ImplicitNullability.Plugin.Tests.Infrastructure
{
public static class Compatibility
{
[CanBeNull]
public static ITreeNode FindPreviousNode([NotNull] this ITreeNode node, [NotNull] Func<ITreeNode, TreeNodeActionType> predicate)
{
return node.FindPrevNode(predicate);
}
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private string ExtractExpectedWarningId(string commentText, string[] definedExpe
[CanBeNull]
private ITreeNode FindPreviousNonWhiteSpaceNode(ITreeNode currentNode)
{
return currentNode.FindPrevNode(x => x is IWhitespaceNode ? TreeNodeActionType.CONTINUE : TreeNodeActionType.ACCEPT);
return currentNode.FindPreviousNode(x => x is IWhitespaceNode ? TreeNodeActionType.CONTINUE : TreeNodeActionType.ACCEPT);
}

private static IReadOnlyCollection<IIssue> RunInspections(ISolution solution, ICollection<IPsiSourceFile> sourceFiles)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net45</TargetFramework>
<RootNamespace>ImplicitNullability.Plugin</RootNamespace>
<!-- <BaseIntermediateOutputPath>obj\R20171\</BaseIntermediateOutputPath> doesn't work :/ -->
<IntermediateOutputPath>obj\R20171\</IntermediateOutputPath> <!-- TODO: what about the project.assets.json ?? -->
<EnableDefaultItems>false</EnableDefaultItems>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;DEBUG;NET45;RESHARPER20171</DefineConstants>
<OutputPath>bin\R20171\Debug\</OutputPath>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DefineConstants>TRACE;RELEASE;NET45;RESHARPER20171</DefineConstants>
<OutputPath>bin\R20171\Release\</OutputPath>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\..\Shared\Src\ReSharperExtensionsShared\Debugging\DebugUtility.cs">
<Link>ReSharperExtensionsShared\DebugUtility.cs</Link>
</Compile>
<Compile Include="..\..\Shared\Src\ReSharperExtensionsShared\Highlighting\SimpleTreeNodeHighlightingBase.cs">
<Link>ReSharperExtensionsShared\SimpleTreeNodeHighlightingBase.cs</Link>
</Compile>
<Compile Include="**\*.cs" Exclude="obj\**" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="JetBrains.ReSharper.SDK" Version="2017.1.20170309.135707-eap04" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ImplicitNullability.Plugin.VsFormatDefinitions\ImplicitNullability.Plugin.VsFormatDefinitions.csproj" />
</ItemGroup>

</Project>
10 changes: 10 additions & 0 deletions Src/ImplicitNullability.Plugin/ImplicitNullabilityProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
using JetBrains.ReSharper.Psi.Util;
using JetBrains.Util;
using static JetBrains.ReSharper.Psi.DeclaredElementConstants;
#if !(RESHARPER20161 || RESHARPER20162 || RESHARPER20163)
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.CSharp.Util;

#endif

namespace ImplicitNullability.Plugin
{
Expand Down Expand Up @@ -145,7 +150,12 @@ CodeAnnotationAttributesChecker codeAnnotationAttributesChecker
{
if (!ContainsContractAnnotationAttribute(method))
{
#if RESHARPER20161 || RESHARPER20162 || RESHARPER20163
var taskUnderlyingType = method.ReturnType.GetTaskUnderlyingType();
#else
// TODO: How do we get the CSharpLanguageLevel / a "context" node?
var taskUnderlyingType = method.ReturnType.GetTasklikeUnderlyingType(CSharpLanguageLevel.Latest);
#endif

if (taskUnderlyingType != null)
result = GetNullabilityForType(taskUnderlyingType);
Expand Down

0 comments on commit d240503

Please sign in to comment.