Skip to content

Commit 9911565

Browse files
committed
Merge remote-tracking branch 'sharwell-status/update-codegen' into merge-status-site
2 parents c20e75d + ef8359f commit 9911565

7 files changed

Lines changed: 64 additions & 193 deletions

File tree

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
3-
<startup>
4-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
5-
</startup>
3+
<runtime>
4+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
5+
<dependentAssembly>
6+
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral" />
7+
<bindingRedirect oldVersion="0.0.0.0-2.9.0.0" newVersion="2.9.0.0" />
8+
</dependentAssembly>
9+
</assemblyBinding>
10+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
11+
<dependentAssembly>
12+
<assemblyIdentity name="Microsoft.CodeAnalysis.Workspaces" publicKeyToken="31bf3856ad364e35" culture="neutral" />
13+
<bindingRedirect oldVersion="0.0.0.0-2.9.0.0" newVersion="2.9.0.0" />
14+
</dependentAssembly>
15+
</assemblyBinding>
16+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
17+
<dependentAssembly>
18+
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral" />
19+
<bindingRedirect oldVersion="0.0.0.0-2.9.0.0" newVersion="2.9.0.0" />
20+
</dependentAssembly>
21+
</assemblyBinding>
22+
</runtime>
623
</configuration>

StyleCop.Analyzers/StyleCop.Analyzers.Status.Generator/Program.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace StyleCop.Analyzers.Status.Generator
77
using System.IO;
88
using System.Linq;
99
using LibGit2Sharp;
10+
using Microsoft.Build.Locator;
1011
using Newtonsoft.Json;
1112

1213
/// <summary>
@@ -18,14 +19,22 @@ internal class Program
1819
/// The starting point of this application.
1920
/// </summary>
2021
/// <param name="args">The command line parameters.</param>
21-
internal static void Main(string[] args)
22+
/// <returns>Zero if the tool completes successfully; otherwise, a non-zero error code.</returns>
23+
internal static int Main(string[] args)
2224
{
2325
if (args.Length < 1)
2426
{
2527
Console.WriteLine("Path to sln file required.");
26-
return;
28+
return 1;
2729
}
2830

31+
if (!File.Exists(args[0]))
32+
{
33+
Console.WriteLine($"Could not find solution file: {Path.GetFullPath(args[0])}");
34+
return 1;
35+
}
36+
37+
MSBuildLocator.RegisterDefaults();
2938
SolutionReader reader = SolutionReader.CreateAsync(args[0]).Result;
3039

3140
var diagnostics = reader.GetDiagnosticsAsync().Result;
@@ -53,8 +62,10 @@ internal static void Main(string[] args)
5362
}
5463
};
5564

56-
Console.WriteLine(JsonConvert.SerializeObject(output));
65+
Console.WriteLine(JsonConvert.SerializeObject(output, Formatting.Indented));
5766
}
67+
68+
return 0;
5869
}
5970
}
6071
}

StyleCop.Analyzers/StyleCop.Analyzers.Status.Generator/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"profiles": {
3+
"StyleCop.Analyzers.Status.Generator": {
4+
"commandName": "Project",
5+
"commandLineArgs": "..\\..\\..\\..\\..\\StyleCopAnalyzers\\StyleCopAnalyzers.sln"
6+
}
7+
}
8+
}

StyleCop.Analyzers/StyleCop.Analyzers.Status.Generator/SolutionReader.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,11 @@ private async Task InitializeAsync()
177177
{
178178
this.solution = await this.workspace.OpenSolutionAsync(this.SlnPath);
179179

180-
this.analyzerProject = this.solution.Projects.Single(x => x.Name == this.AnalyzerProjectName);
180+
this.analyzerProject = this.solution.Projects.First(x => x.Name == this.AnalyzerProjectName || x.AssemblyName == this.AnalyzerProjectName);
181181
this.analyzerCompilation = await this.analyzerProject.GetCompilationAsync();
182182
this.analyzerCompilation = this.analyzerCompilation.WithOptions(this.analyzerCompilation.Options.WithOutputKind(OutputKind.DynamicallyLinkedLibrary));
183183

184-
this.codeFixProject = this.solution.Projects.Single(x => x.Name == this.CodeFixProjectName);
184+
this.codeFixProject = this.solution.Projects.First(x => x.Name == this.CodeFixProjectName || x.AssemblyName == this.CodeFixProjectName);
185185
this.codeFixCompilation = await this.codeFixProject.GetCompilationAsync();
186186
this.codeFixCompilation = this.codeFixCompilation.WithOptions(this.codeFixCompilation.Options.WithOutputKind(OutputKind.DynamicallyLinkedLibrary));
187187

@@ -210,7 +210,7 @@ private void InitializeCodeFixTypes()
210210

211211
private void Compile()
212212
{
213-
string path = Path.Combine(Path.GetDirectoryName(this.SlnPath), this.AnalyzerProjectName);
213+
string path = Path.GetDirectoryName(this.analyzerProject.FilePath);
214214
this.analyzerAssembly = this.GetAssembly(this.analyzerCompilation, ResourceReader.GetResourcesRecursive(path));
215215

216216
this.codeFixAssembly = this.GetAssembly(this.codeFixCompilation);
Lines changed: 19 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -1,147 +1,35 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\packages\LibGit2Sharp.0.21.0.176\build\net40\LibGit2Sharp.props" Condition="Exists('..\packages\LibGit2Sharp.0.21.0.176\build\net40\LibGit2Sharp.props')" />
4-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
2+
<Project Sdk="Microsoft.NET.Sdk">
3+
54
<PropertyGroup>
6-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8-
<ProjectGuid>{9BF22A9E-9708-4AE4-A5C7-7A00AE4C8885}</ProjectGuid>
5+
<TargetFramework>net46</TargetFramework>
96
<OutputType>Exe</OutputType>
10-
<AppDesignerFolder>Properties</AppDesignerFolder>
11-
<RootNamespace>StyleCop.Analyzers.Status.Generator</RootNamespace>
12-
<AssemblyName>StyleCop.Analyzers.Status.Generator</AssemblyName>
13-
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
14-
<FileAlignment>512</FileAlignment>
15-
<NuGetPackageImportStamp>
16-
</NuGetPackageImportStamp>
17-
<TargetFrameworkProfile />
7+
8+
<!-- Automatically generate the necessary assembly binding redirects -->
9+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
1810
</PropertyGroup>
19-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
20-
<PlatformTarget>AnyCPU</PlatformTarget>
21-
<DebugSymbols>true</DebugSymbols>
22-
<DebugType>full</DebugType>
23-
<Optimize>false</Optimize>
24-
<OutputPath>bin\Debug\</OutputPath>
25-
<DefineConstants>DEBUG;TRACE</DefineConstants>
26-
<ErrorReport>prompt</ErrorReport>
27-
<WarningLevel>4</WarningLevel>
11+
12+
<PropertyGroup>
2813
<CodeAnalysisRuleSet>Rules.ruleset</CodeAnalysisRuleSet>
29-
<DocumentationFile>bin\Debug\StyleCop.Analyzers.Status.Generator.XML</DocumentationFile>
30-
</PropertyGroup>
31-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
32-
<PlatformTarget>AnyCPU</PlatformTarget>
33-
<DebugType>pdbonly</DebugType>
34-
<Optimize>true</Optimize>
35-
<OutputPath>bin\Release\</OutputPath>
36-
<DefineConstants>TRACE</DefineConstants>
37-
<ErrorReport>prompt</ErrorReport>
38-
<WarningLevel>4</WarningLevel>
14+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
3915
</PropertyGroup>
16+
4017
<ItemGroup>
41-
<Reference Include="LibGit2Sharp, Version=0.21.0.176, Culture=neutral, processorArchitecture=MSIL">
42-
<HintPath>..\packages\LibGit2Sharp.0.21.0.176\lib\net40\LibGit2Sharp.dll</HintPath>
43-
<Private>True</Private>
44-
</Reference>
45-
<Reference Include="Microsoft.CodeAnalysis, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
46-
<HintPath>..\packages\Microsoft.CodeAnalysis.Common.1.0.0\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
47-
<Private>True</Private>
48-
</Reference>
49-
<Reference Include="Microsoft.CodeAnalysis.CSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
50-
<HintPath>..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0\lib\net45\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
51-
<Private>True</Private>
52-
</Reference>
53-
<Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
54-
<HintPath>..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath>
55-
<Private>True</Private>
56-
</Reference>
57-
<Reference Include="Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
58-
<HintPath>..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
59-
<Private>True</Private>
60-
</Reference>
61-
<Reference Include="Microsoft.CodeAnalysis.Workspaces.Desktop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
62-
<HintPath>..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
63-
<Private>True</Private>
64-
</Reference>
65-
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
66-
<HintPath>..\packages\Newtonsoft.Json.7.0.1-beta3\lib\net45\Newtonsoft.Json.dll</HintPath>
67-
<Private>True</Private>
68-
</Reference>
6918
<Reference Include="System" />
70-
<Reference Include="System.Collections.Immutable, Version=1.1.36.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
71-
<HintPath>..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
72-
<Private>True</Private>
73-
</Reference>
74-
<Reference Include="System.Composition.AttributedModel, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
75-
<HintPath>..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll</HintPath>
76-
<Private>True</Private>
77-
</Reference>
78-
<Reference Include="System.Composition.Convention, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
79-
<HintPath>..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll</HintPath>
80-
<Private>True</Private>
81-
</Reference>
82-
<Reference Include="System.Composition.Hosting, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
83-
<HintPath>..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll</HintPath>
84-
<Private>True</Private>
85-
</Reference>
86-
<Reference Include="System.Composition.Runtime, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
87-
<HintPath>..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll</HintPath>
88-
<Private>True</Private>
89-
</Reference>
90-
<Reference Include="System.Composition.TypedParts, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
91-
<HintPath>..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath>
92-
<Private>True</Private>
93-
</Reference>
94-
<Reference Include="System.Core" />
95-
<Reference Include="System.Reflection.Metadata, Version=1.0.21.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
96-
<HintPath>..\packages\System.Reflection.Metadata.1.0.21\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
97-
<Private>True</Private>
98-
</Reference>
9919
<Reference Include="System.Windows.Forms" />
100-
<Reference Include="System.Xml.Linq" />
101-
<Reference Include="System.Data.DataSetExtensions" />
102-
<Reference Include="Microsoft.CSharp" />
103-
<Reference Include="System.Data" />
104-
<Reference Include="System.Net.Http" />
105-
<Reference Include="System.Xml" />
10620
</ItemGroup>
21+
10722
<ItemGroup>
108-
<Compile Include="CodeFixStatus.cs" />
109-
<Compile Include="CompilationFailedException.cs" />
110-
<Compile Include="Program.cs" />
111-
<Compile Include="Properties\AssemblyInfo.cs" />
112-
<Compile Include="ResourceReader.cs" />
113-
<Compile Include="SolutionReader.cs" />
114-
<Compile Include="StyleCopDiagnostic.cs" />
23+
<PackageReference Include="LibGit2Sharp" Version="0.21.0.176" />
24+
<PackageReference Include="Microsoft.Build.Locator" Version="1.0.13" />
25+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.9.0-beta4-62830-01" />
26+
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="2.9.0-beta4-62830-01" />
27+
<PackageReference Include="Newtonsoft.Json" Version="7.0.1-beta3" />
28+
<PackageReference Include="StyleCop.Analyzers" Version="1.0.0-beta015" PrivateAssets="all" />
11529
</ItemGroup>
30+
11631
<ItemGroup>
117-
<None Include="App.config" />
118-
<None Include="packages.config">
119-
<SubType>Designer</SubType>
120-
</None>
121-
<None Include="Rules.ruleset" />
12232
<None Include="..\stylecop.json" />
12333
</ItemGroup>
124-
<ItemGroup>
125-
<Analyzer Include="..\packages\Microsoft.CodeAnalysis.Analyzers.1.0.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.Analyzers.dll" />
126-
<Analyzer Include="..\packages\Microsoft.CodeAnalysis.Analyzers.1.0.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.Analyzers.dll" />
127-
<Analyzer Include="..\packages\StyleCop.Analyzers.1.0.0-beta015\analyzers\dotnet\cs\Newtonsoft.Json.dll" />
128-
<Analyzer Include="..\packages\StyleCop.Analyzers.1.0.0-beta015\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
129-
<Analyzer Include="..\packages\StyleCop.Analyzers.1.0.0-beta015\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
130-
</ItemGroup>
131-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
132-
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
133-
<PropertyGroup>
134-
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
135-
</PropertyGroup>
136-
<Error Condition="!Exists('..\packages\LibGit2Sharp.0.21.0.176\build\net40\LibGit2Sharp.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.0.21.0.176\build\net40\LibGit2Sharp.props'))" />
137-
<Error Condition="!Exists('..\packages\StyleCop.Analyzers.1.0.0-beta015\build\StyleCop.Analyzers.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\StyleCop.Analyzers.1.0.0-beta015\build\StyleCop.Analyzers.targets'))" />
138-
</Target>
139-
<Import Project="..\packages\StyleCop.Analyzers.1.0.0-beta015\build\StyleCop.Analyzers.targets" Condition="Exists('..\packages\StyleCop.Analyzers.1.0.0-beta015\build\StyleCop.Analyzers.targets')" />
140-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
141-
Other similar extension points exist, see Microsoft.Common.targets.
142-
<Target Name="BeforeBuild">
143-
</Target>
144-
<Target Name="AfterBuild">
145-
</Target>
146-
-->
34+
14735
</Project>

StyleCop.Analyzers/StyleCop.Analyzers.Status.Generator/packages.config

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)