Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add supplier/license info for cargo and pip #479

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
Revert unnecessary changes
  • Loading branch information
sebasgomez238 committed Jan 12, 2024
commit 458ed7096abf44cc243c471503fd9d56993b51bb
Original file line number Diff line number Diff line change
@@ -2,8 +2,31 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Collections.Concurrent;
using Microsoft.ComponentDetection.Common;
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;
using Microsoft.ComponentDetection.Orchestrator.Extensions;
using Microsoft.ComponentDetection.Orchestrator.Experiments;
using Microsoft.ComponentDetection.Orchestrator.Services;
using Microsoft.ComponentDetection.Orchestrator.Services.GraphTranslation;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Http;
using Microsoft.Extensions.Logging;
@@ -189,7 +212,10 @@ public static IServiceCollection AddSbomTool(this IServiceCollection services, L

return manifestData;
})
.AddComponentDetection()
.ConfigureLoggingProviders()
.ConfigureComponentDetectors()
.ConfigureComponentDetectionSharedServices()
.ConfigureComponentDetectionCommandLineServices()
.AddHttpClient<LicenseInformationService>();

return services;
@@ -214,4 +240,74 @@ public static IServiceCollection ConfigureLoggingProviders(this IServiceCollecti

return services;
}

public static IServiceCollection ConfigureComponentDetectionCommandLineServices(this IServiceCollection services)
{
services.AddSingleton<IScanExecutionService, ScanExecutionService>();
services.AddSingleton<IDetectorProcessingService, DetectorProcessingService>();
services.AddSingleton<IDetectorRestrictionService, DetectorRestrictionService>();
services.AddSingleton<IArgumentHelper, ArgumentHelper>();

return services;
}

public static IServiceCollection ConfigureComponentDetectionSharedServices(this IServiceCollection services)
{
services.AddSingleton<IFileWritingService, FileWritingService>();
services.AddSingleton<IArgumentHelper, ArgumentHelper>();
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>();
services.AddSingleton<IExperimentService, ExperimentService>();

return services;
}

public static IServiceCollection ConfigureComponentDetectors(this IServiceCollection services)
{
services.AddSingleton<IComponentDetector, PodComponentDetector>();
services.AddSingleton<IComponentDetector, ConanLockComponentDetector>();
services.AddSingleton<IComponentDetector, CondaLockComponentDetector>();
services.AddSingleton<IComponentDetector, DockerfileComponentDetector>();
services.AddSingleton<IComponentDetector, GoComponentDetector>();
services.AddSingleton<IComponentDetector, GradleComponentDetector>();
services.AddSingleton<IComponentDetector, IvyDetector>();
services.AddSingleton<ILinuxScanner, LinuxScanner>();
services.AddSingleton<IComponentDetector, LinuxContainerDetector>();
services.AddSingleton<IMavenCommandService, MavenCommandService>();
services.AddSingleton<IMavenStyleDependencyGraphParserService, MavenStyleDependencyGraphParserService>();
services.AddSingleton<IComponentDetector, MvnCliComponentDetector>();
services.AddSingleton<IComponentDetector, NpmComponentDetector>();
services.AddSingleton<IComponentDetector, NpmComponentDetectorWithRoots>();
services.AddSingleton<IComponentDetector, NpmLockfile3Detector>();
services.AddSingleton<IComponentDetector, NuGetComponentDetector>();
services.AddSingleton<IComponentDetector, NuGetPackagesConfigDetector>();
services.AddSingleton<IComponentDetector, NuGetProjectModelProjectCentricComponentDetector>();
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<IComponentDetector, PnpmComponentDetector>();
services.AddSingleton<IComponentDetector, PoetryComponentDetector>();
services.AddSingleton<IComponentDetector, RubyComponentDetector>();
services.AddSingleton<IComponentDetector, RustCrateDetector>();
services.AddSingleton<IComponentDetector, Spdx22ComponentDetector>();
services.AddSingleton<IComponentDetector, VcpkgComponentDetector>();
services.AddSingleton<IYarnLockParser, YarnLockParser>();
services.AddSingleton<IYarnLockFileFactory, YarnLockFileFactory>();
services.AddSingleton<IComponentDetector, YarnLockComponentDetector>();

return services;
}
}
1 change: 0 additions & 1 deletion src/Microsoft.Sbom.Tool/Program.cs
Original file line number Diff line number Diff line change
@@ -69,7 +69,6 @@ await Host.CreateDefaultBuilder(args)
inputConfiguration.ToConfiguration();
return inputConfiguration;
})
.ConfigureLoggingProviders()
.AddSbomTool();
})
.RunConsoleAsync(x => x.SuppressStatusMessages = true);
Loading
Oops, something went wrong.