Remove FeatureDetection sources package

Fixes: #18835

This removes a package that we were publishing for WTE to consume in VS.
They are no longer using this and have built their own version of the
functionality. We still build this in 3.1 so it will be available if
they need older bits for their servicing.

Also makes this node's build script executable.
This commit is contained in:
Ryan Nowak 2020-02-07 11:41:34 -08:00
parent 04f68e0015
commit 44123a48e8
4 changed files with 0 additions and 154 deletions

0
src/Analyzers/build.sh Normal file → Executable file
View File

View File

@ -1,74 +0,0 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<!-- This does not represent the TFM for the code. It's only here because /t:Pack requires it. -->
<TargetFramework>netstandard1.0</TargetFramework>
<IsPackable>true</IsPackable>
<IsShipping>false</IsShipping>
<IsSourcePackage>true</IsSourcePackage>
<NoBuild>true</NoBuild>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<EnableDefaultItems>false</EnableDefaultItems>
<IncludeBuildOutput>false</IncludeBuildOutput>
<IncludeSymbols>false</IncludeSymbols>
<ContentTargetFolders>contentFiles</ContentTargetFolders>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<DefaultExcludeItems>$(DefaultExcludeItems);$(BaseOutputPath);$(BaseIntermediateOutputPath);</DefaultExcludeItems>
<NoWarn>$(NoWarn);CS8021</NoWarn>
<IsProjectReferenceProvider>false</IsProjectReferenceProvider>
</PropertyGroup>
<ItemGroup>
<None Include="lib\**\*">
<Pack>True</Pack>
<PackagePath>lib</PackagePath>
</None>
<Compile Include="$(MSBuildProjectDirectory)\**\*.cs" Exclude="$(DefaultExcludeItems)">
<Pack>true</Pack>
<PackagePath>$(ContentTargetFolders)\cs\netstandard1.0\shared\</PackagePath>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="../../Analyzers/src/CompilationFeatureDetector.cs">
<Link>%(FileName)%(Extension)</Link>
<Pack>true</Pack>
<PackagePath>$(ContentTargetFolders)\cs\netstandard1.0\shared\</PackagePath>
</Compile>
<Compile Include="../../Analyzers/src/ConfigureMethodVisitor.cs">
<Link>%(FileName)%(Extension)</Link>
<Pack>true</Pack>
<PackagePath>$(ContentTargetFolders)\cs\netstandard1.0\shared\</PackagePath>
</Compile>
<Compile Include="../../Analyzers/src/StartupFacts.cs">
<Link>%(FileName)%(Extension)</Link>
<Pack>true</Pack>
<PackagePath>$(ContentTargetFolders)\cs\netstandard1.0\shared\</PackagePath>
</Compile>
<Compile Include="../../Analyzers/src/StartupSymbols.cs">
<Link>%(FileName)%(Extension)</Link>
<Pack>true</Pack>
<PackagePath>$(ContentTargetFolders)\cs\netstandard1.0\shared\</PackagePath>
</Compile>
<Compile Include="../../Analyzers/src/SymbolNames.cs">
<Link>%(FileName)%(Extension)</Link>
<Pack>true</Pack>
<PackagePath>$(ContentTargetFolders)\cs\netstandard1.0\shared\</PackagePath>
</Compile>
<Compile Include="../../Analyzers/src/WellKnownFeatures.cs">
<Link>%(FileName)%(Extension)</Link>
<Pack>true</Pack>
<PackagePath>$(ContentTargetFolders)\cs\netstandard1.0\shared\</PackagePath>
</Compile>
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<!-- This project does not produce a binary. Disable the compiler. -->
<Target Name="Compile" />
<Target Name="CopyFilesToOutputDirectory" />
</Project>

View File

@ -1,80 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Immutable;
using System.ComponentModel.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.VisualStudio.LanguageServices;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Threading;
using Task = System.Threading.Tasks.Task;
namespace Microsoft.AspNetCore.Analyzers.FeatureDetection
{
// Be very careful making changes to this file. No project in this repo builds it.
//
// If you need to verify a change, make a local project (net472) and copy in everything included by this project.
//
// You'll also need some nuget packages like:
// - Microsoft.VisualStudio.LanguageServices
// - Microsoft.VisualStudio.Shell.15.0
// - Microsoft.VisualStudio.Threading
[Export(typeof(ProjectCompilationFeatureDetector))]
internal class ProjectCompilationFeatureDetector
{
private readonly Lazy<VisualStudioWorkspace> _workspace;
[ImportingConstructor]
public ProjectCompilationFeatureDetector(Lazy<VisualStudioWorkspace> workspace)
{
_workspace = workspace;
}
public async Task<IImmutableSet<string>> DetectFeaturesAsync(string projectFullPath, CancellationToken cancellationToken = default)
{
if (projectFullPath == null)
{
throw new ArgumentNullException(nameof(projectFullPath));
}
// If the workspace is uninitialized, we need to do the first access on the UI thread.
//
// This is very unlikely to occur, but doing it here for completeness.
if (!_workspace.IsValueCreated)
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
GC.KeepAlive(_workspace.Value);
await TaskScheduler.Default;
}
var workspace = _workspace.Value;
var solution = workspace.CurrentSolution;
var project = GetProject(solution, projectFullPath);
if (project == null)
{
// Cannot find matching project.
return ImmutableHashSet<string>.Empty;
}
var compilation = await project.GetCompilationAsync(cancellationToken).ConfigureAwait(false);
return await CompilationFeatureDetector.DetectFeaturesAsync(compilation, cancellationToken);
}
private static Project GetProject(Solution solution, string projectFilePath)
{
foreach (var project in solution.Projects)
{
if (string.Equals(projectFilePath, project.FilePath, StringComparison.OrdinalIgnoreCase))
{
return project;
}
}
return null;
}
}
}