Skip to content
This repository was archived by the owner on Apr 8, 2019. It is now read-only.

Commit 90443bf

Browse files
committed
Update to the new project system
1 parent 0246c15 commit 90443bf

21 files changed

+281
-688
lines changed

.nuget/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="NuGet.CommandLine" version="2.8.3" />
3+
<package id="Codecov" version="1.0.1" />
44
<package id="OpenCover" version="4.6.247-rc" />
55
<package id="ReportGenerator" version="2.3.5.0" targetFramework="net452" />
66
<package id="xunit.runner.console" version="2.1.0" targetFramework="net452" />

PublicApiAnalyzer.sln

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 14
4-
VisualStudioVersion = 14.0.24720.0
5-
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PublicApiAnalyzer", "PublicApiAnalyzer\PublicApiAnalyzer\PublicApiAnalyzer.csproj", "{627985B3-0CF1-4BD4-AE60-E54214B8563C}"
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26906.1
5+
MinimumVisualStudioVersion = 15.0
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PublicApiAnalyzer", "PublicApiAnalyzer\PublicApiAnalyzer\PublicApiAnalyzer.csproj", "{627985B3-0CF1-4BD4-AE60-E54214B8563C}"
77
EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{A3ABF729-C055-4ED6-B72C-75ADB618D14A}"
99
ProjectSection(SolutionItems) = preProject
1010
.nuget\packages.config = .nuget\packages.config
1111
EndProjectSection
1212
EndProject
13-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PublicApiAnalyzer.Test", "PublicApiAnalyzer\PublicApiAnalyzer.Test\PublicApiAnalyzer.Test.csproj", "{C489533B-81AA-4240-9B55-B0CF0054B9E9}"
13+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PublicApiAnalyzer.Test", "PublicApiAnalyzer\PublicApiAnalyzer.Test\PublicApiAnalyzer.Test.csproj", "{C489533B-81AA-4240-9B55-B0CF0054B9E9}"
1414
EndProject
15-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PublicApiAnalyzer.Vsix", "PublicApiAnalyzer\PublicApiAnalyzer.Vsix\PublicApiAnalyzer.Vsix.csproj", "{B6281E4F-86D6-4526-9BA9-357CCF7B77B9}"
15+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PublicApiAnalyzer.Vsix", "PublicApiAnalyzer\PublicApiAnalyzer.Vsix\PublicApiAnalyzer.Vsix.csproj", "{B6281E4F-86D6-4526-9BA9-357CCF7B77B9}"
1616
EndProject
1717
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{518166A7-F023-490D-B092-FEF1447EBC3B}"
1818
ProjectSection(SolutionItems) = preProject
@@ -26,6 +26,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7B1E5C00
2626
ProjectSection(SolutionItems) = preProject
2727
build\build.ps1 = build\build.ps1
2828
build\check-key.ps1 = build\check-key.ps1
29+
PublicApiAnalyzer\Directory.Build.props = PublicApiAnalyzer\Directory.Build.props
30+
PublicApiAnalyzer\Directory.Build.targets = PublicApiAnalyzer\Directory.Build.targets
2931
build\keys.ps1 = build\keys.ps1
3032
build\opencover-report.ps1 = build\opencover-report.ps1
3133
build\push.ps1 = build\push.ps1
@@ -34,7 +36,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7B1E5C00
3436
EndProject
3537
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "documentation", "documentation", "{443032E9-3E95-4023-8E4B-51825BB94EE7}"
3638
EndProject
37-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PublicApiAnalyzer.CodeFixes", "PublicApiAnalyzer\PublicApiAnalyzer.CodeFixes\PublicApiAnalyzer.CodeFixes.csproj", "{8974DAEA-DD04-44B4-86A2-B430D066E9A1}"
39+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PublicApiAnalyzer.CodeFixes", "PublicApiAnalyzer\PublicApiAnalyzer.CodeFixes\PublicApiAnalyzer.CodeFixes.csproj", "{8974DAEA-DD04-44B4-86A2-B430D066E9A1}"
3840
EndProject
3941
Global
4042
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -62,4 +64,7 @@ Global
6264
GlobalSection(SolutionProperties) = preSolution
6365
HideSolutionNode = FALSE
6466
EndGlobalSection
67+
GlobalSection(ExtensibilityGlobals) = postSolution
68+
SolutionGuid = {F897640F-51AE-4982-B0D2-FB5F255A8549}
69+
EndGlobalSection
6570
EndGlobal
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project>
3+
4+
<PropertyGroup>
5+
<Description>An analyzer for packages with public APIs.</Description>
6+
<Product>Public API Analyzer</Product>
7+
<Company>Tunnel Vision Laboratories, LLC</Company>
8+
<Copyright>Copyright © Tunnel Vision Laboratories, LLC 2015</Copyright>
9+
<NeutralLanguage>en-US</NeutralLanguage>
10+
11+
<Version>1.0.0.1</Version>
12+
<FileVersion>1.0.0.1</FileVersion>
13+
<InformationalVersion>1.0.0-dev</InformationalVersion>
14+
</PropertyGroup>
15+
16+
<PropertyGroup>
17+
<EnableDefaultNoneItems>False</EnableDefaultNoneItems>
18+
</PropertyGroup>
19+
20+
<PropertyGroup>
21+
<LangVersion>6</LangVersion>
22+
<Features>strict</Features>
23+
</PropertyGroup>
24+
25+
<PropertyGroup Condition="'$(BuildingInsideVisualStudio)' != 'true'">
26+
<!-- Ideally this is always enabled, but that tends to hurt developer productivity -->
27+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
28+
</PropertyGroup>
29+
30+
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
31+
<DebugType>full</DebugType>
32+
<DebugSymbols>true</DebugSymbols>
33+
</PropertyGroup>
34+
35+
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
36+
<DebugType>pdbonly</DebugType>
37+
<DebugSymbols>true</DebugSymbols>
38+
</PropertyGroup>
39+
40+
<PropertyGroup>
41+
<!--
42+
Make sure any documentation comments which are included in code get checked for syntax during the build, but do
43+
not report warnings for missing comments.
44+
45+
CS1573: Parameter 'parameter' has no matching param tag in the XML comment for 'parameter' (but other parameters do)
46+
CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member'
47+
-->
48+
<GenerateDocumentationFile>True</GenerateDocumentationFile>
49+
<NoWarn>$(NoWarn),1573,1591</NoWarn>
50+
51+
<!-- The referenced Roslyn API includes analyzers that completely fail. -->
52+
<NoWarn>$(NoWarn),AD0001</NoWarn>
53+
</PropertyGroup>
54+
55+
<ItemGroup>
56+
<PackageReference Include="AsyncUsageAnalyzers" Version="1.0.0-alpha003" PrivateAssets="all" />
57+
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2" PrivateAssets="all" />
58+
</ItemGroup>
59+
60+
<ItemGroup>
61+
<None Include="$(MSBuildThisFileDirectory)*.ruleset" Link="%(Filename)%(Extension)" />
62+
63+
<!-- Show launchSettings.json in the project if it exists. -->
64+
<None Include="$(AppDesignerFolder)\launchSettings.json" Condition="Exists('$(AppDesignerFolder)\launchSettings.json')" />
65+
</ItemGroup>
66+
67+
<ItemGroup>
68+
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json">
69+
<Link>stylecop.json</Link>
70+
</AdditionalFiles>
71+
</ItemGroup>
72+
73+
</Project>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project>
3+
4+
<ItemGroup>
5+
<!-- Enable code generation for resource files -->
6+
<CodeGenerationEmbeddedResource Include="@(EmbeddedResource)" Exclude="**\*.??-??.resx" />
7+
<EmbeddedResource Update="@(CodeGenerationEmbeddedResource)" Generator="ResXFileCodeGenerator" />
8+
</ItemGroup>
9+
10+
<!-- Special handling for embedded resources and generated files to show as nested in Solution Explorer -->
11+
<ItemGroup>
12+
<!-- Update designer files for *.resx files -->
13+
<Compile Update="@(CodeGenerationEmbeddedResource->'%(RecursiveDir)%(Filename).Designer.cs')" DependentUpon="$([System.IO.Path]::ChangeExtension($([System.IO.Path]::GetFileNameWithoutExtension(%(Identity))), '.resx'))" />
14+
15+
<!-- Localized embedded resources are just dependent on the parent RESX -->
16+
<EmbeddedResource Update="**\*.??-??.resx" DependentUpon="$([System.IO.Path]::ChangeExtension($([System.IO.Path]::GetFileNameWithoutExtension(%(Identity))), '.resx'))" />
17+
</ItemGroup>
18+
19+
<ItemGroup>
20+
<None Include="$(MSBuildProjectFileDirectory)$(AssemblyOriginatorKeyFile)" Link="%(Filename)%(Extension)" />
21+
</ItemGroup>
22+
23+
</Project>

PublicApiAnalyzer/PublicApiAnalyzer.CodeFixes/Helpers/CustomBatchFixAllProvider.cs

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,20 @@ public virtual async Task<CodeAction> GetFixAsync(
5151

5252
var documents = documentsAndDiagnosticsToFixMap.Keys.ToImmutableArray();
5353
var fixesBag = new List<CodeAction>[documents.Length];
54-
var options = new ParallelOptions() { CancellationToken = fixAllContext.CancellationToken };
55-
Parallel.ForEach(documents, options, (document, state, index) =>
54+
var fixOperations = new List<Task>(documents.Length);
55+
for (int index = 0; index < documents.Length; index++)
5656
{
57-
fixAllContext.CancellationToken.ThrowIfCancellationRequested();
57+
if (fixAllContext.CancellationToken.IsCancellationRequested)
58+
{
59+
break;
60+
}
61+
62+
var document = documents[index];
5863
fixesBag[index] = new List<CodeAction>();
59-
this.AddDocumentFixesAsync(document, documentsAndDiagnosticsToFixMap[document], fixesBag[index].Add, fixAllContext).Wait(fixAllContext.CancellationToken);
60-
});
64+
fixOperations.Add(this.AddDocumentFixesAsync(document, documentsAndDiagnosticsToFixMap[document], fixesBag[index].Add, fixAllContext));
65+
}
66+
67+
await Task.WhenAll(fixOperations).ConfigureAwait(false);
6168

6269
if (fixesBag.Any(fixes => fixes.Count > 0))
6370
{
@@ -129,15 +136,23 @@ public virtual async Task<CodeAction> GetFixAsync(
129136
{
130137
if (projectsAndDiagnosticsToFixMap != null && projectsAndDiagnosticsToFixMap.Any())
131138
{
132-
var options = new ParallelOptions() { CancellationToken = fixAllContext.CancellationToken };
133139
var fixesBag = new List<CodeAction>[projectsAndDiagnosticsToFixMap.Count];
134-
Parallel.ForEach(projectsAndDiagnosticsToFixMap.Keys, options, (project, state, index) =>
140+
var fixOperations = new List<Task>(projectsAndDiagnosticsToFixMap.Count);
141+
int index = -1;
142+
foreach (var project in projectsAndDiagnosticsToFixMap.Keys)
135143
{
136-
fixAllContext.CancellationToken.ThrowIfCancellationRequested();
144+
if (fixAllContext.CancellationToken.IsCancellationRequested)
145+
{
146+
break;
147+
}
148+
149+
index++;
137150
var diagnostics = projectsAndDiagnosticsToFixMap[project];
138151
fixesBag[index] = new List<CodeAction>();
139-
this.AddProjectFixesAsync(project, diagnostics, fixesBag[index].Add, fixAllContext).Wait(fixAllContext.CancellationToken);
140-
});
152+
fixOperations.Add(this.AddProjectFixesAsync(project, diagnostics, fixesBag[index].Add, fixAllContext));
153+
}
154+
155+
await Task.WhenAll(fixOperations).ConfigureAwait(false);
141156

142157
if (fixesBag.Any(fixes => fixes.Count > 0))
143158
{

PublicApiAnalyzer/PublicApiAnalyzer.CodeFixes/Helpers/FixAllContextHelper.cs

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,19 +110,33 @@ public static async Task<ImmutableDictionary<Project, ImmutableArray<Diagnostic>
110110

111111
case FixAllScope.Solution:
112112
var projectsAndDiagnostics = new ConcurrentDictionary<Project, ImmutableArray<Diagnostic>>();
113-
var options = new ParallelOptions() { CancellationToken = fixAllContext.CancellationToken };
114-
Parallel.ForEach(project.Solution.Projects, options, proj =>
113+
var tasks = new List<Task>(project.Solution.ProjectIds.Count);
114+
Func<Project, Task> projectAction =
115+
async proj =>
116+
{
117+
if (fixAllContext.CancellationToken.IsCancellationRequested)
118+
{
119+
return;
120+
}
121+
122+
var projectDiagnostics = await fixAllContext.GetProjectDiagnosticsAsync(proj).ConfigureAwait(false);
123+
if (projectDiagnostics.Any())
124+
{
125+
projectsAndDiagnostics.TryAdd(proj, projectDiagnostics);
126+
}
127+
};
128+
129+
foreach (var proj in project.Solution.Projects)
115130
{
116-
fixAllContext.CancellationToken.ThrowIfCancellationRequested();
117-
var projectDiagnosticsTask = fixAllContext.GetProjectDiagnosticsAsync(proj);
118-
projectDiagnosticsTask.Wait(fixAllContext.CancellationToken);
119-
var projectDiagnostics = projectDiagnosticsTask.Result;
120-
if (projectDiagnostics.Any())
131+
if (fixAllContext.CancellationToken.IsCancellationRequested)
121132
{
122-
projectsAndDiagnostics.TryAdd(proj, projectDiagnostics);
133+
break;
123134
}
124-
});
125135

136+
tasks.Add(projectAction(proj));
137+
}
138+
139+
await Task.WhenAll(tasks).ConfigureAwait(false);
126140
return projectsAndDiagnostics.ToImmutableDictionary();
127141
}
128142
}

PublicApiAnalyzer/PublicApiAnalyzer.CodeFixes/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,19 @@
33

44
using System;
55
using System.Reflection;
6-
using System.Resources;
76
using System.Runtime.CompilerServices;
87
using System.Runtime.InteropServices;
98

109
// General Information about an assembly is controlled through the following
1110
// set of attributes. Change these attribute values to modify the information
1211
// associated with an assembly.
13-
[assembly: AssemblyTitle("PublicApiAnalyzer.CodeFixes")]
14-
[assembly: AssemblyDescription("")]
15-
[assembly: AssemblyConfiguration("")]
16-
[assembly: AssemblyCompany("Tunnel Vision Laboratories, LLC")]
17-
[assembly: AssemblyProduct("Public API Analyzer")]
18-
[assembly: AssemblyCopyright("Copyright © Sam Harwell 2016")]
1912
[assembly: AssemblyTrademark("")]
2013
[assembly: AssemblyCulture("")]
2114
[assembly: CLSCompliant(false)]
22-
[assembly: NeutralResourcesLanguage("en-US")]
2315

2416
// Setting ComVisible to false makes the types in this assembly not visible
2517
// to COM components. If you need to access a type in this assembly from
2618
// COM, set the ComVisible attribute to true on that type.
2719
[assembly: ComVisible(false)]
2820

29-
// Version information for an assembly consists of the following four values:
30-
//
31-
// Major Version
32-
// Minor Version
33-
// Build Number
34-
// Revision
35-
//
36-
// You can specify all the values or you can default the Build and Revision Numbers
37-
// by using the '*' as shown below:
38-
[assembly: AssemblyVersion("1.0.0.1")]
39-
[assembly: AssemblyFileVersion("1.0.0.1")]
40-
[assembly: AssemblyInformationalVersion("1.0.0-dev")]
41-
4221
[assembly: InternalsVisibleTo("PublicApiAnalyzer.Test, PublicKey=00240000048000009400000006020000002400005253413100040000010001008d7949d002a66db66875775e2b20a3bbf6589ea56624495d375c3d1f15d2517d2baa654575f5384b91edf0e3951c0c85a7a0228391d6a92134b14d8720e3926338e4f5b349f8066f2f98a8a83263bb54ba74a41a91ca51e02f4a3feb666a578bb38bd275397051ef4532b03256a159a9fa54102ce3d5718e5afbd794ee15df92")]

0 commit comments

Comments
 (0)