From 44123a48e8465bc123f9d79be2342f866ebdd371 Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Fri, 7 Feb 2020 11:41:34 -0800 Subject: [PATCH] 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. --- src/Analyzers/build.sh | 0 ....Analyzers.FeatureDetection.Sources.csproj | 74 ----------------- .../ProjectCompilationFeatureDetector.cs | 80 ------------------- .../FeatureDetection/lib/netstandard1.0/_._ | 0 4 files changed, 154 deletions(-) mode change 100644 => 100755 src/Analyzers/build.sh delete mode 100644 src/Analyzers/shared/FeatureDetection/Microsoft.AspNetCore.Analyzers.FeatureDetection.Sources.csproj delete mode 100644 src/Analyzers/shared/FeatureDetection/ProjectCompilationFeatureDetector.cs delete mode 100644 src/Analyzers/shared/FeatureDetection/lib/netstandard1.0/_._ diff --git a/src/Analyzers/build.sh b/src/Analyzers/build.sh old mode 100644 new mode 100755 diff --git a/src/Analyzers/shared/FeatureDetection/Microsoft.AspNetCore.Analyzers.FeatureDetection.Sources.csproj b/src/Analyzers/shared/FeatureDetection/Microsoft.AspNetCore.Analyzers.FeatureDetection.Sources.csproj deleted file mode 100644 index 1ec3645965..0000000000 --- a/src/Analyzers/shared/FeatureDetection/Microsoft.AspNetCore.Analyzers.FeatureDetection.Sources.csproj +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - netstandard1.0 - true - false - true - true - true - false - false - false - false - contentFiles - true - $(DefaultExcludeItems);$(BaseOutputPath);$(BaseIntermediateOutputPath); - $(NoWarn);CS8021 - false - - - - - True - lib - - - - true - $(ContentTargetFolders)\cs\netstandard1.0\shared\ - - - - - - %(FileName)%(Extension) - true - $(ContentTargetFolders)\cs\netstandard1.0\shared\ - - - %(FileName)%(Extension) - true - $(ContentTargetFolders)\cs\netstandard1.0\shared\ - - - %(FileName)%(Extension) - true - $(ContentTargetFolders)\cs\netstandard1.0\shared\ - - - %(FileName)%(Extension) - true - $(ContentTargetFolders)\cs\netstandard1.0\shared\ - - - %(FileName)%(Extension) - true - $(ContentTargetFolders)\cs\netstandard1.0\shared\ - - - %(FileName)%(Extension) - true - $(ContentTargetFolders)\cs\netstandard1.0\shared\ - - - - - - - - - diff --git a/src/Analyzers/shared/FeatureDetection/ProjectCompilationFeatureDetector.cs b/src/Analyzers/shared/FeatureDetection/ProjectCompilationFeatureDetector.cs deleted file mode 100644 index 9a92559a61..0000000000 --- a/src/Analyzers/shared/FeatureDetection/ProjectCompilationFeatureDetector.cs +++ /dev/null @@ -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 _workspace; - - [ImportingConstructor] - public ProjectCompilationFeatureDetector(Lazy workspace) - { - _workspace = workspace; - } - - public async Task> 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.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; - } - } -} diff --git a/src/Analyzers/shared/FeatureDetection/lib/netstandard1.0/_._ b/src/Analyzers/shared/FeatureDetection/lib/netstandard1.0/_._ deleted file mode 100644 index e69de29bb2..0000000000