-
Notifications
You must be signed in to change notification settings - Fork 94
/
Copy pathServiceCollectionExtensions.cs
147 lines (123 loc) · 7.04 KB
/
ServiceCollectionExtensions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
namespace Microsoft.ComponentDetection.Orchestrator.Extensions;
using Microsoft.ComponentDetection.Common;
using Microsoft.ComponentDetection.Common.Telemetry;
using Microsoft.ComponentDetection.Contracts;
using Microsoft.ComponentDetection.Detectors.CocoaPods;
using Microsoft.ComponentDetection.Detectors.Conan;
using Microsoft.ComponentDetection.Detectors.Dockerfile;
using Microsoft.ComponentDetection.Detectors.Go;
using Microsoft.ComponentDetection.Detectors.Gradle;
using Microsoft.ComponentDetection.Detectors.Ivy;
using Microsoft.ComponentDetection.Detectors.Linux;
using Microsoft.ComponentDetection.Detectors.Maven;
using Microsoft.ComponentDetection.Detectors.Npm;
using Microsoft.ComponentDetection.Detectors.NuGet;
using Microsoft.ComponentDetection.Detectors.Pip;
using Microsoft.ComponentDetection.Detectors.Pnpm;
using Microsoft.ComponentDetection.Detectors.Poetry;
using Microsoft.ComponentDetection.Detectors.Ruby;
using Microsoft.ComponentDetection.Detectors.Rust;
using Microsoft.ComponentDetection.Detectors.Spdx;
using Microsoft.ComponentDetection.Detectors.Vcpkg;
using Microsoft.ComponentDetection.Detectors.Yarn;
using Microsoft.ComponentDetection.Detectors.Yarn.Parsers;
using Microsoft.ComponentDetection.Orchestrator.Experiments;
using Microsoft.ComponentDetection.Orchestrator.Experiments.Configs;
using Microsoft.ComponentDetection.Orchestrator.Services;
using Microsoft.ComponentDetection.Orchestrator.Services.GraphTranslation;
using Microsoft.Extensions.DependencyInjection;
public static class ServiceCollectionExtensions
{
/// <summary>
/// Register Component Detection services.
/// </summary>
/// <param name="services">The <see cref="IServiceCollection" /> to register the services with.</param>
/// <returns>The <see cref="IServiceCollection" /> so that additional calls can be chained.</returns>
public static IServiceCollection AddComponentDetection(this IServiceCollection services)
{
// Shared services
services.AddSingleton<ITelemetryService, CommandLineTelemetryService>();
services.AddSingleton<ICommandLineInvocationService, CommandLineInvocationService>();
services.AddSingleton<IComponentStreamEnumerableFactory, ComponentStreamEnumerableFactory>();
services.AddSingleton<IConsoleWritingService, ConsoleWritingService>();
services.AddSingleton<IDockerService, DockerService>();
services.AddSingleton<IEnvironmentVariableService, EnvironmentVariableService>();
services.AddSingleton<IObservableDirectoryWalkerFactory, FastDirectoryWalkerFactory>();
services.AddSingleton<IFileUtilityService, FileUtilityService>();
services.AddSingleton<IFileWritingService, FileWritingService>();
services.AddSingleton<IGraphTranslationService, DefaultGraphTranslationService>();
services.AddSingleton<IPathUtilityService, PathUtilityService>();
services.AddSingleton<ISafeFileEnumerableFactory, SafeFileEnumerableFactory>();
// Command line services
services.AddSingleton<IScanExecutionService, ScanExecutionService>();
services.AddSingleton<IDetectorProcessingService, DetectorProcessingService>();
services.AddSingleton<IDetectorRestrictionService, DetectorRestrictionService>();
services.AddSingleton<IArgumentHelper, ArgumentHelper>();
// Experiments
services.AddSingleton<IExperimentService, ExperimentService>();
services.AddSingleton<IExperimentProcessor, DefaultExperimentProcessor>();
services.AddSingleton<IExperimentConfiguration, SimplePipExperiment>();
services.AddSingleton<IExperimentConfiguration, RustCliDetectorExperiment>();
services.AddSingleton<IExperimentConfiguration, GoDetectorReplaceExperiment>();
// Detectors
// CocoaPods
services.AddSingleton<IComponentDetector, PodComponentDetector>();
// Conan
services.AddSingleton<IComponentDetector, ConanLockComponentDetector>();
// Conda
services.AddSingleton<IComponentDetector, CondaLockComponentDetector>();
// Dockerfile
services.AddSingleton<IComponentDetector, DockerfileComponentDetector>();
// Go
services.AddSingleton<IComponentDetector, GoComponentDetector>();
services.AddSingleton<IComponentDetector, GoComponentWithReplaceDetector>();
// Gradle
services.AddSingleton<IComponentDetector, GradleComponentDetector>();
// Ivy
services.AddSingleton<IComponentDetector, IvyDetector>();
// Linux
services.AddSingleton<ILinuxScanner, LinuxScanner>();
services.AddSingleton<IComponentDetector, LinuxContainerDetector>();
// Maven
services.AddSingleton<IMavenCommandService, MavenCommandService>();
services.AddSingleton<IMavenStyleDependencyGraphParserService, MavenStyleDependencyGraphParserService>();
services.AddSingleton<IComponentDetector, MvnCliComponentDetector>();
// npm
services.AddSingleton<IComponentDetector, NpmComponentDetector>();
services.AddSingleton<IComponentDetector, NpmComponentDetectorWithRoots>();
services.AddSingleton<IComponentDetector, NpmLockfile3Detector>();
// NuGet
services.AddSingleton<IComponentDetector, NuGetComponentDetector>();
services.AddSingleton<IComponentDetector, NuGetPackagesConfigDetector>();
services.AddSingleton<IComponentDetector, NuGetProjectModelProjectCentricComponentDetector>();
services.AddSingleton<IComponentDetector, NuGetMSBuildBinaryLogComponentDetector>();
// PIP
services.AddSingleton<IPyPiClient, PyPiClient>();
services.AddSingleton<ISimplePyPiClient, SimplePyPiClient>();
services.AddSingleton<IPythonCommandService, PythonCommandService>();
services.AddSingleton<IPythonResolver, PythonResolver>();
services.AddSingleton<ISimplePythonResolver, SimplePythonResolver>();
services.AddSingleton<IComponentDetector, PipComponentDetector>();
services.AddSingleton<IComponentDetector, SimplePipComponentDetector>();
services.AddSingleton<IPipCommandService, PipCommandService>();
services.AddSingleton<IComponentDetector, PipReportComponentDetector>();
// pnpm
services.AddSingleton<IComponentDetector, PnpmComponentDetectorFactory>();
// Poetry
services.AddSingleton<IComponentDetector, PoetryComponentDetector>();
// Ruby
services.AddSingleton<IComponentDetector, RubyComponentDetector>();
// Rust
services.AddSingleton<IComponentDetector, RustCrateDetector>();
services.AddSingleton<IComponentDetector, RustCliDetector>();
// SPDX
services.AddSingleton<IComponentDetector, Spdx22ComponentDetector>();
// VCPKG
services.AddSingleton<IComponentDetector, VcpkgComponentDetector>();
// Yarn
services.AddSingleton<IYarnLockParser, YarnLockParser>();
services.AddSingleton<IYarnLockFileFactory, YarnLockFileFactory>();
services.AddSingleton<IComponentDetector, YarnLockComponentDetector>();
return services;
}
}