From 98766fe41190182bb252d86093a6782e8aae0376 Mon Sep 17 00:00:00 2001 From: kumarasantosh Date: Tue, 10 Mar 2026 01:57:55 +0530 Subject: [PATCH 1/2] packagedcode: add DotNetDepsJsonHandler to parse .deps.json files Add support for parsing NuGet .deps.json lockfiles which are present alongside .dll and .pdb files in .NET projects and NuGet packages. Extracts package names, versions, types and dependencies from the libraries section of .deps.json files. Fixes #4496 Signed-off-by: kumarasantosh --- src/packagedcode/__init__.py | 1 + src/packagedcode/nuget.py | 118 +++ .../data/nuget/deps_json/Snoop.Core.deps.json | 942 ++++++++++++++++++ .../data/nuget/deps_json/simple.deps.json | 23 + tests/packagedcode/test_deps_json.py | 151 +++ 5 files changed, 1235 insertions(+) create mode 100644 tests/packagedcode/data/nuget/deps_json/Snoop.Core.deps.json create mode 100644 tests/packagedcode/data/nuget/deps_json/simple.deps.json create mode 100644 tests/packagedcode/test_deps_json.py diff --git a/src/packagedcode/__init__.py b/src/packagedcode/__init__.py index d3c48b6e259..fba40b2acf2 100644 --- a/src/packagedcode/__init__.py +++ b/src/packagedcode/__init__.py @@ -156,6 +156,7 @@ nuget.NugetNupkgHandler, nuget.NugetNuspecHandler, nuget.NugetPackagesLockHandler, + nuget.DotNetDepsJsonHandler, opam.OpamFileHandler, diff --git a/src/packagedcode/nuget.py b/src/packagedcode/nuget.py index d0d7e110f2f..092ed42ff37 100644 --- a/src/packagedcode/nuget.py +++ b/src/packagedcode/nuget.py @@ -265,3 +265,121 @@ def parse(cls, location, package_only=False): ) yield models.PackageData.from_data(package_data, package_only) + +class DotNetDepsJsonHandler(models.DatafileHandler): + datasource_id = 'nuget_deps_json' + path_patterns = ('*.deps.json',) + default_package_type = 'nuget' + description = 'NuGet .deps.json lockfile' + documentation_url = 'https://github.com/dotnet/sdk/blob/main/documentation/specs/runtime-configuration-file.md' + + @classmethod + def parse(cls, location, package_only=False): + with open(location) as loc: + try: + parsed = json.load(loc) + except Exception: + return + + if not parsed or not isinstance(parsed, dict): + return + + libraries = parsed.get('libraries') + if not libraries or not isinstance(libraries, dict): + return + + target_framework = None + runtime_target = parsed.get('runtimeTarget') + if runtime_target and isinstance(runtime_target, dict): + target_framework = runtime_target.get('name') + + # Collect target sections to look up dependencies. We prefer the runtime + # target when available, but fall back to other targets to avoid missing + # dependencies in valid .deps.json files without runtimeTarget. + targets_dict = parsed.get('targets') or {} + if not isinstance(targets_dict, dict): + targets_dict = {} + + available_targets = [ + (target_name, target_obj) + for target_name, target_obj in targets_dict.items() + if isinstance(target_obj, dict) + ] + + runtime_target_matched = False + if target_framework: + selected_targets = [ + (target_name, target_obj) + for target_name, target_obj in available_targets + if target_name == target_framework + ] + runtime_target_matched = bool(selected_targets) + else: + selected_targets = [] + + if not selected_targets: + selected_targets = available_targets + + for lib_key, lib_info in libraries.items(): + if not lib_key or '/' not in lib_key: + continue + if not isinstance(lib_info, dict): + continue + + name, version = lib_key.split('/', 1) + + package_type = lib_info.get('type') + + # Extract dependencies from targets + dependencies = [] + seen_dependencies = set() + for scope, target_obj in selected_targets: + target_lib = target_obj.get(lib_key) or {} + if not isinstance(target_lib, dict): + continue + + deps = target_lib.get('dependencies') + if not deps or not isinstance(deps, dict): + continue + + for dep_name, dep_version in deps.items(): + if not dep_name: + continue + + dep_key = (dep_name, dep_version, scope) + if dep_key in seen_dependencies: + continue + seen_dependencies.add(dep_key) + + dependencies.append( + models.DependentPackage( + purl=str(PackageURL(type='nuget', name=dep_name, version=dep_version)), + extracted_requirement=dep_version, + scope=scope, + is_runtime=True, + is_optional=False, + is_pinned=True, + is_direct=True, + ).to_dict() + ) + + extra_data = {} + if runtime_target_matched: + extra_data['target_framework'] = target_framework + elif len(selected_targets) == 1: + extra_data['target_framework'] = selected_targets[0][0] + elif selected_targets: + extra_data['target_frameworks'] = [scope for scope, _target_obj in selected_targets] + + if package_type: + extra_data['type'] = package_type + + package_data = dict( + datasource_id=cls.datasource_id, + type=cls.default_package_type, + name=name, + version=version, + dependencies=dependencies, + extra_data=extra_data, + ) + yield models.PackageData.from_data(package_data, package_only) diff --git a/tests/packagedcode/data/nuget/deps_json/Snoop.Core.deps.json b/tests/packagedcode/data/nuget/deps_json/Snoop.Core.deps.json new file mode 100644 index 00000000000..59b80807a0b --- /dev/null +++ b/tests/packagedcode/data/nuget/deps_json/Snoop.Core.deps.json @@ -0,0 +1,942 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v3.1", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v3.1": { + "Snoop.Core/1.0.0": { + "dependencies": { + "JetBrains.Annotations": "2023.2.0", + "Microsoft.CodeAnalysis.CSharp": "4.7.0", + "Microsoft.NETFramework.ReferenceAssemblies.net452": "1.0.3", + "Microsoft.SourceLink.GitHub": "1.1.1", + "StyleCop.Analyzers": "1.2.0-beta.507", + "System.Management.Automation": "7.0.0", + "WpfAnalyzers": "4.1.1" + }, + "runtime": { + "Snoop.Core.dll": {} + } + }, + "JetBrains.Annotations/2023.2.0": {}, + "Microsoft.ApplicationInsights/2.13.1": { + "dependencies": { + "System.Diagnostics.DiagnosticSource": "4.6.0" + }, + "runtime": { + "lib/netstandard2.0/Microsoft.ApplicationInsights.dll": { + "assemblyVersion": "2.13.1.12554", + "fileVersion": "2.13.1.12554" + } + } + }, + "Microsoft.Build.Tasks.Git/1.1.1": {}, + "Microsoft.CodeAnalysis.Analyzers/3.3.4": {}, + "Microsoft.CodeAnalysis.Common/4.7.0": { + "dependencies": { + "Microsoft.CodeAnalysis.Analyzers": "3.3.4", + "System.Collections.Immutable": "7.0.0", + "System.Memory": "4.5.5", + "System.Reflection.Metadata": "7.0.0", + "System.Runtime.CompilerServices.Unsafe": "6.0.0", + "System.Text.Encoding.CodePages": "7.0.0", + "System.Threading.Tasks.Extensions": "4.5.4" + } + }, + "Microsoft.CodeAnalysis.CSharp/4.7.0": { + "dependencies": { + "Microsoft.CodeAnalysis.Common": "4.7.0" + } + }, + "Microsoft.Management.Infrastructure/2.0.0": { + "dependencies": { + "Microsoft.Management.Infrastructure.Runtime.Unix": "2.0.0", + "Microsoft.Management.Infrastructure.Runtime.Win": "2.0.0" + } + }, + "Microsoft.Management.Infrastructure.Runtime.Unix/2.0.0": { + "runtimeTargets": { + "runtimes/unix/lib/netstandard1.6/Microsoft.Management.Infrastructure.dll": { + "rid": "unix", + "assetType": "runtime", + "assemblyVersion": "2.0.0.0", + "fileVersion": "2.0.0.0" + } + } + }, + "Microsoft.Management.Infrastructure.Runtime.Win/2.0.0": { + "runtimeTargets": { + "runtimes/win-arm/lib/netstandard1.6/Microsoft.Management.Infrastructure.Native.dll": { + "rid": "win-arm", + "assetType": "runtime", + "assemblyVersion": "1.0.0.0", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win-arm/lib/netstandard1.6/Microsoft.Management.Infrastructure.dll": { + "rid": "win-arm", + "assetType": "runtime", + "assemblyVersion": "1.0.0.0", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win-arm64/lib/netstandard1.6/Microsoft.Management.Infrastructure.Native.dll": { + "rid": "win-arm64", + "assetType": "runtime", + "assemblyVersion": "1.0.0.0", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win-arm64/lib/netstandard1.6/Microsoft.Management.Infrastructure.dll": { + "rid": "win-arm64", + "assetType": "runtime", + "assemblyVersion": "1.0.0.0", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win10-x64/lib/netstandard1.6/Microsoft.Management.Infrastructure.Native.dll": { + "rid": "win10-x64", + "assetType": "runtime", + "assemblyVersion": "1.0.0.0", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win10-x64/lib/netstandard1.6/Microsoft.Management.Infrastructure.dll": { + "rid": "win10-x64", + "assetType": "runtime", + "assemblyVersion": "1.0.0.0", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win10-x86/lib/netstandard1.6/Microsoft.Management.Infrastructure.Native.dll": { + "rid": "win10-x86", + "assetType": "runtime", + "assemblyVersion": "1.0.0.0", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win10-x86/lib/netstandard1.6/Microsoft.Management.Infrastructure.dll": { + "rid": "win10-x86", + "assetType": "runtime", + "assemblyVersion": "1.0.0.0", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win7-x64/lib/netstandard1.6/Microsoft.Management.Infrastructure.Native.dll": { + "rid": "win7-x64", + "assetType": "runtime", + "assemblyVersion": "1.0.0.0", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win7-x64/lib/netstandard1.6/Microsoft.Management.Infrastructure.dll": { + "rid": "win7-x64", + "assetType": "runtime", + "assemblyVersion": "1.0.0.0", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win7-x86/lib/netstandard1.6/Microsoft.Management.Infrastructure.Native.dll": { + "rid": "win7-x86", + "assetType": "runtime", + "assemblyVersion": "1.0.0.0", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win7-x86/lib/netstandard1.6/Microsoft.Management.Infrastructure.dll": { + "rid": "win7-x86", + "assetType": "runtime", + "assemblyVersion": "1.0.0.0", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win8-x64/lib/netstandard1.6/Microsoft.Management.Infrastructure.Native.dll": { + "rid": "win8-x64", + "assetType": "runtime", + "assemblyVersion": "1.0.0.0", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win8-x64/lib/netstandard1.6/Microsoft.Management.Infrastructure.dll": { + "rid": "win8-x64", + "assetType": "runtime", + "assemblyVersion": "1.0.0.0", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win8-x86/lib/netstandard1.6/Microsoft.Management.Infrastructure.Native.dll": { + "rid": "win8-x86", + "assetType": "runtime", + "assemblyVersion": "1.0.0.0", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win8-x86/lib/netstandard1.6/Microsoft.Management.Infrastructure.dll": { + "rid": "win8-x86", + "assetType": "runtime", + "assemblyVersion": "1.0.0.0", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win81-x64/lib/netstandard1.6/Microsoft.Management.Infrastructure.Native.dll": { + "rid": "win81-x64", + "assetType": "runtime", + "assemblyVersion": "1.0.0.0", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win81-x64/lib/netstandard1.6/Microsoft.Management.Infrastructure.dll": { + "rid": "win81-x64", + "assetType": "runtime", + "assemblyVersion": "1.0.0.0", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win81-x86/lib/netstandard1.6/Microsoft.Management.Infrastructure.Native.dll": { + "rid": "win81-x86", + "assetType": "runtime", + "assemblyVersion": "1.0.0.0", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win81-x86/lib/netstandard1.6/Microsoft.Management.Infrastructure.dll": { + "rid": "win81-x86", + "assetType": "runtime", + "assemblyVersion": "1.0.0.0", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win-arm/native/Microsoft.Management.Infrastructure.Native.Unmanaged.dll": { + "rid": "win-arm", + "assetType": "native", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win-arm/native/mi.dll": { + "rid": "win-arm", + "assetType": "native", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win-arm/native/miutils.dll": { + "rid": "win-arm", + "assetType": "native", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win-arm64/native/Microsoft.Management.Infrastructure.Native.Unmanaged.dll": { + "rid": "win-arm64", + "assetType": "native", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win-arm64/native/mi.dll": { + "rid": "win-arm64", + "assetType": "native", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win-arm64/native/miutils.dll": { + "rid": "win-arm64", + "assetType": "native", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win10-x64/native/Microsoft.Management.Infrastructure.Native.Unmanaged.dll": { + "rid": "win10-x64", + "assetType": "native", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win10-x64/native/mi.dll": { + "rid": "win10-x64", + "assetType": "native", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win10-x64/native/miutils.dll": { + "rid": "win10-x64", + "assetType": "native", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win10-x86/native/Microsoft.Management.Infrastructure.Native.Unmanaged.dll": { + "rid": "win10-x86", + "assetType": "native", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win10-x86/native/mi.dll": { + "rid": "win10-x86", + "assetType": "native", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win10-x86/native/miutils.dll": { + "rid": "win10-x86", + "assetType": "native", + "fileVersion": "10.0.18362.1" + }, + "runtimes/win7-x64/native/Microsoft.Management.Infrastructure.Native.Unmanaged.dll": { + "rid": "win7-x64", + "assetType": "native", + "fileVersion": "10.0.14394.1000" + }, + "runtimes/win7-x64/native/mi.dll": { + "rid": "win7-x64", + "assetType": "native", + "fileVersion": "10.0.14394.1000" + }, + "runtimes/win7-x64/native/miutils.dll": { + "rid": "win7-x64", + "assetType": "native", + "fileVersion": "10.0.14394.1000" + }, + "runtimes/win7-x86/native/Microsoft.Management.Infrastructure.Native.Unmanaged.dll": { + "rid": "win7-x86", + "assetType": "native", + "fileVersion": "10.0.14394.1000" + }, + "runtimes/win7-x86/native/mi.dll": { + "rid": "win7-x86", + "assetType": "native", + "fileVersion": "10.0.14394.1000" + }, + "runtimes/win7-x86/native/miutils.dll": { + "rid": "win7-x86", + "assetType": "native", + "fileVersion": "10.0.14394.1000" + }, + "runtimes/win8-x64/native/mi.dll": { + "rid": "win8-x64", + "assetType": "native", + "fileVersion": "6.2.9200.22812" + }, + "runtimes/win8-x64/native/miutils.dll": { + "rid": "win8-x64", + "assetType": "native", + "fileVersion": "6.2.9200.22812" + }, + "runtimes/win8-x86/native/mi.dll": { + "rid": "win8-x86", + "assetType": "native", + "fileVersion": "6.2.9200.22812" + }, + "runtimes/win8-x86/native/miutils.dll": { + "rid": "win8-x86", + "assetType": "native", + "fileVersion": "6.2.9200.22812" + }, + "runtimes/win81-x64/native/Microsoft.Management.Infrastructure.Native.Unmanaged.dll": { + "rid": "win81-x64", + "assetType": "native", + "fileVersion": "6.3.9600.16384" + }, + "runtimes/win81-x64/native/mi.dll": { + "rid": "win81-x64", + "assetType": "native", + "fileVersion": "6.3.9600.16384" + }, + "runtimes/win81-x64/native/miutils.dll": { + "rid": "win81-x64", + "assetType": "native", + "fileVersion": "6.3.9600.16384" + }, + "runtimes/win81-x86/native/Microsoft.Management.Infrastructure.Native.Unmanaged.dll": { + "rid": "win81-x86", + "assetType": "native", + "fileVersion": "6.3.9600.16384" + }, + "runtimes/win81-x86/native/mi.dll": { + "rid": "win81-x86", + "assetType": "native", + "fileVersion": "6.3.9600.16384" + }, + "runtimes/win81-x86/native/miutils.dll": { + "rid": "win81-x86", + "assetType": "native", + "fileVersion": "6.3.9600.16384" + } + } + }, + "Microsoft.NETCore.Platforms/3.1.0": {}, + "Microsoft.NETFramework.ReferenceAssemblies.net452/1.0.3": {}, + "Microsoft.PowerShell.CoreCLR.Eventing/7.0.0": { + "dependencies": { + "System.Diagnostics.EventLog": "4.7.0" + }, + "runtimeTargets": { + "runtimes/win/lib/netcoreapp3.1/Microsoft.PowerShell.CoreCLR.Eventing.dll": { + "rid": "win", + "assetType": "runtime", + "assemblyVersion": "7.0.0.0", + "fileVersion": "7.0.0.0" + } + } + }, + "Microsoft.PowerShell.Native/7.0.0": { + "runtimeTargets": { + "runtimes/linux-arm/native/libpsl-native.so": { + "rid": "linux-arm", + "assetType": "native", + "fileVersion": "0.0.0.0" + }, + "runtimes/linux-arm64/native/libpsl-native.so": { + "rid": "linux-arm64", + "assetType": "native", + "fileVersion": "0.0.0.0" + }, + "runtimes/linux-musl-x64/native/libpsl-native.so": { + "rid": "linux-musl-x64", + "assetType": "native", + "fileVersion": "0.0.0.0" + }, + "runtimes/linux-x64/native/libmi.so": { + "rid": "linux-x64", + "assetType": "native", + "fileVersion": "0.0.0.0" + }, + "runtimes/linux-x64/native/libpsl-native.so": { + "rid": "linux-x64", + "assetType": "native", + "fileVersion": "0.0.0.0" + }, + "runtimes/linux-x64/native/libpsrpclient.so": { + "rid": "linux-x64", + "assetType": "native", + "fileVersion": "0.0.0.0" + }, + "runtimes/osx/native/libmi.dylib": { + "rid": "osx", + "assetType": "native", + "fileVersion": "0.0.0.0" + }, + "runtimes/osx/native/libpsl-native.dylib": { + "rid": "osx", + "assetType": "native", + "fileVersion": "0.0.0.0" + }, + "runtimes/osx/native/libpsrpclient.dylib": { + "rid": "osx", + "assetType": "native", + "fileVersion": "0.0.0.0" + }, + "runtimes/win-arm/native/PowerShell.Core.Instrumentation.dll": { + "rid": "win-arm", + "assetType": "native", + "fileVersion": "10.0.10011.16384" + }, + "runtimes/win-arm/native/pwrshplugin.dll": { + "rid": "win-arm", + "assetType": "native", + "fileVersion": "10.0.10011.16384" + }, + "runtimes/win-arm64/native/PowerShell.Core.Instrumentation.dll": { + "rid": "win-arm64", + "assetType": "native", + "fileVersion": "10.0.10011.16384" + }, + "runtimes/win-arm64/native/pwrshplugin.dll": { + "rid": "win-arm64", + "assetType": "native", + "fileVersion": "10.0.10011.16384" + }, + "runtimes/win-x64/native/PowerShell.Core.Instrumentation.dll": { + "rid": "win-x64", + "assetType": "native", + "fileVersion": "10.0.10011.16384" + }, + "runtimes/win-x64/native/pwrshplugin.dll": { + "rid": "win-x64", + "assetType": "native", + "fileVersion": "10.0.10011.16384" + }, + "runtimes/win-x86/native/PowerShell.Core.Instrumentation.dll": { + "rid": "win-x86", + "assetType": "native", + "fileVersion": "10.0.10011.16384" + }, + "runtimes/win-x86/native/pwrshplugin.dll": { + "rid": "win-x86", + "assetType": "native", + "fileVersion": "10.0.10011.16384" + } + } + }, + "Microsoft.SourceLink.Common/1.1.1": {}, + "Microsoft.SourceLink.GitHub/1.1.1": { + "dependencies": { + "Microsoft.Build.Tasks.Git": "1.1.1", + "Microsoft.SourceLink.Common": "1.1.1" + } + }, + "Microsoft.Win32.Registry/4.7.0": { + "dependencies": { + "System.Security.AccessControl": "4.7.0", + "System.Security.Principal.Windows": "4.7.0" + } + }, + "Microsoft.Win32.Registry.AccessControl/4.7.0": { + "dependencies": { + "Microsoft.Win32.Registry": "4.7.0", + "System.Security.AccessControl": "4.7.0" + } + }, + "Microsoft.Win32.SystemEvents/4.7.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "3.1.0" + } + }, + "Newtonsoft.Json/12.0.3": { + "runtime": { + "lib/netstandard2.0/Newtonsoft.Json.dll": { + "assemblyVersion": "12.0.0.0", + "fileVersion": "12.0.3.23909" + } + } + }, + "StyleCop.Analyzers/1.2.0-beta.507": { + "dependencies": { + "StyleCop.Analyzers.Unstable": "1.2.0.507" + } + }, + "StyleCop.Analyzers.Unstable/1.2.0.507": {}, + "System.CodeDom/4.7.0": {}, + "System.Collections.Immutable/7.0.0": { + "dependencies": { + "System.Memory": "4.5.5", + "System.Runtime.CompilerServices.Unsafe": "6.0.0" + } + }, + "System.Configuration.ConfigurationManager/4.7.0": { + "dependencies": { + "System.Security.Cryptography.ProtectedData": "4.7.0", + "System.Security.Permissions": "4.7.0" + } + }, + "System.Diagnostics.DiagnosticSource/4.6.0": {}, + "System.Diagnostics.EventLog/4.7.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "3.1.0", + "Microsoft.Win32.Registry": "4.7.0", + "System.Security.Principal.Windows": "4.7.0" + } + }, + "System.DirectoryServices/4.7.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "3.1.0", + "System.IO.FileSystem.AccessControl": "4.7.0", + "System.Security.AccessControl": "4.7.0", + "System.Security.Permissions": "4.7.0", + "System.Security.Principal.Windows": "4.7.0" + } + }, + "System.Drawing.Common/4.7.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "3.1.0", + "Microsoft.Win32.SystemEvents": "4.7.0" + } + }, + "System.IO.FileSystem.AccessControl/4.7.0": { + "dependencies": { + "System.Security.AccessControl": "4.7.0", + "System.Security.Principal.Windows": "4.7.0" + } + }, + "System.Management/4.7.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "3.1.0", + "Microsoft.Win32.Registry": "4.7.0", + "System.CodeDom": "4.7.0" + }, + "runtime": { + "lib/netstandard2.0/System.Management.dll": { + "assemblyVersion": "4.0.1.0", + "fileVersion": "4.700.19.56404" + } + }, + "runtimeTargets": { + "runtimes/win/lib/netcoreapp2.0/System.Management.dll": { + "rid": "win", + "assetType": "runtime", + "assemblyVersion": "4.0.1.0", + "fileVersion": "4.700.19.56404" + } + } + }, + "System.Management.Automation/7.0.0": { + "dependencies": { + "Microsoft.ApplicationInsights": "2.13.1", + "Microsoft.Management.Infrastructure": "2.0.0", + "Microsoft.PowerShell.CoreCLR.Eventing": "7.0.0", + "Microsoft.PowerShell.Native": "7.0.0", + "Microsoft.Win32.Registry.AccessControl": "4.7.0", + "Newtonsoft.Json": "12.0.3", + "System.Configuration.ConfigurationManager": "4.7.0", + "System.DirectoryServices": "4.7.0", + "System.IO.FileSystem.AccessControl": "4.7.0", + "System.Management": "4.7.0", + "System.Runtime.CompilerServices.Unsafe": "6.0.0", + "System.Security.AccessControl": "4.7.0", + "System.Security.Cryptography.Pkcs": "4.7.0", + "System.Security.Permissions": "4.7.0", + "System.Text.Encoding.CodePages": "7.0.0" + }, + "runtimeTargets": { + "runtimes/unix/lib/netcoreapp3.1/System.Management.Automation.dll": { + "rid": "unix", + "assetType": "runtime", + "assemblyVersion": "7.0.0.0", + "fileVersion": "7.0.0.0" + }, + "runtimes/win/lib/netcoreapp3.1/System.Management.Automation.dll": { + "rid": "win", + "assetType": "runtime", + "assemblyVersion": "7.0.0.0", + "fileVersion": "7.0.0.0" + } + } + }, + "System.Memory/4.5.5": {}, + "System.Reflection.Metadata/7.0.0": { + "dependencies": { + "System.Collections.Immutable": "7.0.0", + "System.Memory": "4.5.5" + } + }, + "System.Runtime.CompilerServices.Unsafe/6.0.0": { + "runtime": { + "lib/netcoreapp3.1/System.Runtime.CompilerServices.Unsafe.dll": { + "assemblyVersion": "6.0.0.0", + "fileVersion": "6.0.21.52210" + } + } + }, + "System.Security.AccessControl/4.7.0": { + "dependencies": { + "Microsoft.NETCore.Platforms": "3.1.0", + "System.Security.Principal.Windows": "4.7.0" + } + }, + "System.Security.Cryptography.Cng/4.7.0": {}, + "System.Security.Cryptography.Pkcs/4.7.0": { + "dependencies": { + "System.Security.Cryptography.Cng": "4.7.0" + } + }, + "System.Security.Cryptography.ProtectedData/4.7.0": {}, + "System.Security.Permissions/4.7.0": { + "dependencies": { + "System.Security.AccessControl": "4.7.0", + "System.Windows.Extensions": "4.7.0" + } + }, + "System.Security.Principal.Windows/4.7.0": {}, + "System.Text.Encoding.CodePages/7.0.0": { + "dependencies": { + "System.Memory": "4.5.5", + "System.Runtime.CompilerServices.Unsafe": "6.0.0" + }, + "runtime": { + "lib/netstandard2.0/System.Text.Encoding.CodePages.dll": { + "assemblyVersion": "7.0.0.0", + "fileVersion": "7.0.22.51805" + } + } + }, + "System.Threading.Tasks.Extensions/4.5.4": {}, + "System.Windows.Extensions/4.7.0": { + "dependencies": { + "System.Drawing.Common": "4.7.0" + } + }, + "WpfAnalyzers/4.1.1": {} + } + }, + "libraries": { + "Snoop.Core/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "JetBrains.Annotations/2023.2.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-dvO//8aLmLRsCVVgoc/7qBqi2/y4BTyRcg20LCBWtK4n6E9Um06Zp7jF1n0hOE+yqBHwcrDzAjWvCaM3qH8flg==", + "path": "jetbrains.annotations/2023.2.0", + "hashPath": "jetbrains.annotations.2023.2.0.nupkg.sha512" + }, + "Microsoft.ApplicationInsights/2.13.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-BQhLmYR06Z8TVCdxnr8WOhhovJHtqYRNeB5gePBdQ4uDOE8D4IK9HW9i6a3llELz1QHv4HtFpku6dpXMGnO22g==", + "path": "microsoft.applicationinsights/2.13.1", + "hashPath": "microsoft.applicationinsights.2.13.1.nupkg.sha512" + }, + "Microsoft.Build.Tasks.Git/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-AT3HlgTjsqHnWpBHSNeR0KxbLZD7bztlZVj7I8vgeYG9SYqbeFGh0TM/KVtC6fg53nrWHl3VfZFvb5BiQFcY6Q==", + "path": "microsoft.build.tasks.git/1.1.1", + "hashPath": "microsoft.build.tasks.git.1.1.1.nupkg.sha512" + }, + "Microsoft.CodeAnalysis.Analyzers/3.3.4": { + "type": "package", + "serviceable": true, + "sha512": "sha512-AxkxcPR+rheX0SmvpLVIGLhOUXAKG56a64kV9VQZ4y9gR9ZmPXnqZvHJnmwLSwzrEP6junUF11vuc+aqo5r68g==", + "path": "microsoft.codeanalysis.analyzers/3.3.4", + "hashPath": "microsoft.codeanalysis.analyzers.3.3.4.nupkg.sha512" + }, + "Microsoft.CodeAnalysis.Common/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-pD5S14xMUebSGYe75kt0q/aaS/ftvktSo/pEv7aX7hNPHfdZS+SZeXvkvcffGxWkunYOyRF9m1oN7zzSdYj9dQ==", + "path": "microsoft.codeanalysis.common/4.7.0", + "hashPath": "microsoft.codeanalysis.common.4.7.0.nupkg.sha512" + }, + "Microsoft.CodeAnalysis.CSharp/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-JHCP2L6lB0oJ3tQoHkC67SFZxW+KbJVOnAo+6L01K5r/NlBlSUhTk5nUAldWhTVwGdzqNeHqGtnEqpsCmGSwQA==", + "path": "microsoft.codeanalysis.csharp/4.7.0", + "hashPath": "microsoft.codeanalysis.csharp.4.7.0.nupkg.sha512" + }, + "Microsoft.Management.Infrastructure/2.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-IaKZRNBBv3sdrmBWd+aqwHq8cVHk/3WgWFAN/dt40MRY9rbtHiDfTTmaEN0tGTmQqGCGDo/ncntA8MvFMvcsRw==", + "path": "microsoft.management.infrastructure/2.0.0", + "hashPath": "microsoft.management.infrastructure.2.0.0.nupkg.sha512" + }, + "Microsoft.Management.Infrastructure.Runtime.Unix/2.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-p0lslMX5bdWLxO2P7ao+rjAMOB0LEwPYpzvdCQ2OEYgX2NxFpQ8ILvqPGnYlTAb53rT8gu5DyIol1HboHFYfxQ==", + "path": "microsoft.management.infrastructure.runtime.unix/2.0.0", + "hashPath": "microsoft.management.infrastructure.runtime.unix.2.0.0.nupkg.sha512" + }, + "Microsoft.Management.Infrastructure.Runtime.Win/2.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-vjBWQeDOjgernkrOdbEgn7M70SF7hof7ORdKPSlL06Uc15+oYdth5dZju9KsgUoti/cwnkZTiwtDx/lRtay0sA==", + "path": "microsoft.management.infrastructure.runtime.win/2.0.0", + "hashPath": "microsoft.management.infrastructure.runtime.win.2.0.0.nupkg.sha512" + }, + "Microsoft.NETCore.Platforms/3.1.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-z7aeg8oHln2CuNulfhiLYxCVMPEwBl3rzicjvIX+4sUuCwvXw5oXQEtbiU2c0z4qYL5L3Kmx0mMA/+t/SbY67w==", + "path": "microsoft.netcore.platforms/3.1.0", + "hashPath": "microsoft.netcore.platforms.3.1.0.nupkg.sha512" + }, + "Microsoft.NETFramework.ReferenceAssemblies.net452/1.0.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kuFOgilYbs29xENHlqQ6aJYa+t56u+OqHx85P7GYLVlo7HL3nsug9IQY2DoPgkOpZ2xb9btYV2EFK7Enll8S3A==", + "path": "microsoft.netframework.referenceassemblies.net452/1.0.3", + "hashPath": "microsoft.netframework.referenceassemblies.net452.1.0.3.nupkg.sha512" + }, + "Microsoft.PowerShell.CoreCLR.Eventing/7.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-bX1HxVGw4e5LRW4CkukufgUfVT3RceLLWT1WAAmRgpWetwLspIbqpXzPmBuD0qyJA2Ud2+9X2AVag4qcBkekRw==", + "path": "microsoft.powershell.coreclr.eventing/7.0.0", + "hashPath": "microsoft.powershell.coreclr.eventing.7.0.0.nupkg.sha512" + }, + "Microsoft.PowerShell.Native/7.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-btrvvHj0QEdPU2lIKD5divnLbMok/dNUUo4pjTZJAyU+y+We6cuPL5UurHJTzWPEwU/NzS8+2tqV4jSXvlPB2Q==", + "path": "microsoft.powershell.native/7.0.0", + "hashPath": "microsoft.powershell.native.7.0.0.nupkg.sha512" + }, + "Microsoft.SourceLink.Common/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-WMcGpWKrmJmzrNeuaEb23bEMnbtR/vLmvZtkAP5qWu7vQsY59GqfRJd65sFpBszbd2k/bQ8cs8eWawQKAabkVg==", + "path": "microsoft.sourcelink.common/1.1.1", + "hashPath": "microsoft.sourcelink.common.1.1.1.nupkg.sha512" + }, + "Microsoft.SourceLink.GitHub/1.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-IaJGnOv/M7UQjRJks7B6p7pbPnOwisYGOIzqCz5ilGFTApZ3ktOR+6zJ12ZRPInulBmdAf1SrGdDG2MU8g6XTw==", + "path": "microsoft.sourcelink.github/1.1.1", + "hashPath": "microsoft.sourcelink.github.1.1.1.nupkg.sha512" + }, + "Microsoft.Win32.Registry/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-KSrRMb5vNi0CWSGG1++id2ZOs/1QhRqROt+qgbEAdQuGjGrFcl4AOl4/exGPUYz2wUnU42nvJqon1T3U0kPXLA==", + "path": "microsoft.win32.registry/4.7.0", + "hashPath": "microsoft.win32.registry.4.7.0.nupkg.sha512" + }, + "Microsoft.Win32.Registry.AccessControl/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-6ZBpiCrPHoRxm0GWrlUfSKx5i4987cRs2hi8KVHD+iI72pm0jScyr5QvqdLeyTgf22R4WgdmBo2k64wtVotPRA==", + "path": "microsoft.win32.registry.accesscontrol/4.7.0", + "hashPath": "microsoft.win32.registry.accesscontrol.4.7.0.nupkg.sha512" + }, + "Microsoft.Win32.SystemEvents/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-mtVirZr++rq+XCDITMUdnETD59XoeMxSpLRIII7JRI6Yj0LEDiO1pPn0ktlnIj12Ix8bfvQqQDMMIF9wC98oCA==", + "path": "microsoft.win32.systemevents/4.7.0", + "hashPath": "microsoft.win32.systemevents.4.7.0.nupkg.sha512" + }, + "Newtonsoft.Json/12.0.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-6mgjfnRB4jKMlzHSl+VD+oUc1IebOZabkbyWj2RiTgWwYPPuaK1H97G1sHqGwPlS5npiF5Q0OrxN1wni2n5QWg==", + "path": "newtonsoft.json/12.0.3", + "hashPath": "newtonsoft.json.12.0.3.nupkg.sha512" + }, + "StyleCop.Analyzers/1.2.0-beta.507": { + "type": "package", + "serviceable": true, + "sha512": "sha512-/FtugDT66cKJJ+GGH7rNpG6UDrT4iIWz45M6lrXXHobDUFDHw+q5VgkbiR+6ffTO564ge7w6fQh/eoQhVdJO8Q==", + "path": "stylecop.analyzers/1.2.0-beta.507", + "hashPath": "stylecop.analyzers.1.2.0-beta.507.nupkg.sha512" + }, + "StyleCop.Analyzers.Unstable/1.2.0.507": { + "type": "package", + "serviceable": true, + "sha512": "sha512-gTY3IQdRqDJ4hbhSA3e/R48oE8b/OiKfvwkt1QdNVfrJK2gMHBV8ldaHJ885jxWZfllK66soa/sdcjh9bX49Tw==", + "path": "stylecop.analyzers.unstable/1.2.0.507", + "hashPath": "stylecop.analyzers.unstable.1.2.0.507.nupkg.sha512" + }, + "System.CodeDom/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Hs9pw/kmvH3lXaZ1LFKj3pLQsiGfj2xo3sxSzwiLlRL6UcMZUTeCfoJ9Udalvn3yq5dLlPEZzYegrTQ1/LhPOQ==", + "path": "system.codedom/4.7.0", + "hashPath": "system.codedom.4.7.0.nupkg.sha512" + }, + "System.Collections.Immutable/7.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-dQPcs0U1IKnBdRDBkrCTi1FoajSTBzLcVTpjO4MBCMC7f4pDOIPzgBoX8JjG7X6uZRJ8EBxsi8+DR1JuwjnzOQ==", + "path": "system.collections.immutable/7.0.0", + "hashPath": "system.collections.immutable.7.0.0.nupkg.sha512" + }, + "System.Configuration.ConfigurationManager/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-/anOTeSZCNNI2zDilogWrZ8pNqCmYbzGNexUnNhjW8k0sHqEZ2nHJBp147jBV3hGYswu5lINpNg1vxR7bnqvVA==", + "path": "system.configuration.configurationmanager/4.7.0", + "hashPath": "system.configuration.configurationmanager.4.7.0.nupkg.sha512" + }, + "System.Diagnostics.DiagnosticSource/4.6.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-mbBgoR0rRfl2uimsZ2avZY8g7Xnh1Mza0rJZLPcxqiMWlkGukjmRkuMJ/er+AhQuiRIh80CR/Hpeztr80seV5g==", + "path": "system.diagnostics.diagnosticsource/4.6.0", + "hashPath": "system.diagnostics.diagnosticsource.4.6.0.nupkg.sha512" + }, + "System.Diagnostics.EventLog/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-iDoKGQcRwX0qwY+eAEkaJGae0d/lHlxtslO+t8pJWAUxlvY3tqLtVOPnW2UU4cFjP0Y/L1QBqhkZfSyGqVMR2w==", + "path": "system.diagnostics.eventlog/4.7.0", + "hashPath": "system.diagnostics.eventlog.4.7.0.nupkg.sha512" + }, + "System.DirectoryServices/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-NRENC4ulDamI4DQtrYybxtQU3qnhGSTUdEKJkLyctHXY4RqNyS/egZpB9z8/CnFCiaQZmwLlqxfBmw80VlKBTA==", + "path": "system.directoryservices/4.7.0", + "hashPath": "system.directoryservices.4.7.0.nupkg.sha512" + }, + "System.Drawing.Common/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-v+XbyYHaZjDfn0ENmJEV1VYLgGgCTx1gnfOBcppowbpOAriglYgGCvFCPr2EEZyBvXlpxbEsTwkOlInl107ahA==", + "path": "system.drawing.common/4.7.0", + "hashPath": "system.drawing.common.4.7.0.nupkg.sha512" + }, + "System.IO.FileSystem.AccessControl/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-vMToiarpU81LR1/KZtnT7VDPvqAZfw9oOS5nY6pPP78nGYz3COLsQH3OfzbR+SjTgltd31R6KmKklz/zDpTmzw==", + "path": "system.io.filesystem.accesscontrol/4.7.0", + "hashPath": "system.io.filesystem.accesscontrol.4.7.0.nupkg.sha512" + }, + "System.Management/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-IY+uuGhgzWiCg21i8IvQeY/Z7m1tX8VuPF+ludfn7iTCaccTtJo5HkjZbBEL8kbBubKhAKKtNXr7uMtmAc28Pw==", + "path": "system.management/4.7.0", + "hashPath": "system.management.4.7.0.nupkg.sha512" + }, + "System.Management.Automation/7.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-VRCxKA4+RVXt6Fp6wv7RAx1IQr0TUtawT9/O2X3SYuyLxpsW3KW4yuBLKHj/grZBpi3Gtt9+Q0cR6HrKW2f8vw==", + "path": "system.management.automation/7.0.0", + "hashPath": "system.management.automation.7.0.0.nupkg.sha512" + }, + "System.Memory/4.5.5": { + "type": "package", + "serviceable": true, + "sha512": "sha512-XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==", + "path": "system.memory/4.5.5", + "hashPath": "system.memory.4.5.5.nupkg.sha512" + }, + "System.Reflection.Metadata/7.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-MclTG61lsD9sYdpNz9xsKBzjsmsfCtcMZYXz/IUr2zlhaTaABonlr1ESeompTgM+Xk+IwtGYU7/voh3YWB/fWw==", + "path": "system.reflection.metadata/7.0.0", + "hashPath": "system.reflection.metadata.7.0.0.nupkg.sha512" + }, + "System.Runtime.CompilerServices.Unsafe/6.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==", + "path": "system.runtime.compilerservices.unsafe/6.0.0", + "hashPath": "system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512" + }, + "System.Security.AccessControl/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-JECvTt5aFF3WT3gHpfofL2MNNP6v84sxtXxpqhLBCcDRzqsPBmHhQ6shv4DwwN2tRlzsUxtb3G9M3763rbXKDg==", + "path": "system.security.accesscontrol/4.7.0", + "hashPath": "system.security.accesscontrol.4.7.0.nupkg.sha512" + }, + "System.Security.Cryptography.Cng/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-4WQjFuypWtxb/bl/YwEE7LYGn4fgpsikFfBU6xwEm4YBYiRAhXAEJ62lILBu2JJSFbClIAntFTGfDZafn8yZTg==", + "path": "system.security.cryptography.cng/4.7.0", + "hashPath": "system.security.cryptography.cng.4.7.0.nupkg.sha512" + }, + "System.Security.Cryptography.Pkcs/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-0Srzh6YlhjuMxaqMyeCCdZs22cucaUAG6SKDd3gNHBJmre0VZ71ekzWu9rvLD4YXPetyNdPvV6Qst+8C++9v3Q==", + "path": "system.security.cryptography.pkcs/4.7.0", + "hashPath": "system.security.cryptography.pkcs.4.7.0.nupkg.sha512" + }, + "System.Security.Cryptography.ProtectedData/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ehYW0m9ptxpGWvE4zgqongBVWpSDU/JCFD4K7krxkQwSz/sFQjEXCUqpvencjy6DYDbn7Ig09R8GFffu8TtneQ==", + "path": "system.security.cryptography.protecteddata/4.7.0", + "hashPath": "system.security.cryptography.protecteddata.4.7.0.nupkg.sha512" + }, + "System.Security.Permissions/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-dkOV6YYVBnYRa15/yv004eCGRBVADXw8qRbbNiCn/XpdJSUXkkUeIvdvFHkvnko4CdKMqG8yRHC4ox83LSlMsQ==", + "path": "system.security.permissions/4.7.0", + "hashPath": "system.security.permissions.4.7.0.nupkg.sha512" + }, + "System.Security.Principal.Windows/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-ojD0PX0XhneCsUbAZVKdb7h/70vyYMDYs85lwEI+LngEONe/17A0cFaRFqZU+sOEidcVswYWikYOQ9PPfjlbtQ==", + "path": "system.security.principal.windows/4.7.0", + "hashPath": "system.security.principal.windows.4.7.0.nupkg.sha512" + }, + "System.Text.Encoding.CodePages/7.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-LSyCblMpvOe0N3E+8e0skHcrIhgV2huaNcjUUEa8hRtgEAm36aGkRoC8Jxlb6Ra6GSfF29ftduPNywin8XolzQ==", + "path": "system.text.encoding.codepages/7.0.0", + "hashPath": "system.text.encoding.codepages.7.0.0.nupkg.sha512" + }, + "System.Threading.Tasks.Extensions/4.5.4": { + "type": "package", + "serviceable": true, + "sha512": "sha512-zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==", + "path": "system.threading.tasks.extensions/4.5.4", + "hashPath": "system.threading.tasks.extensions.4.5.4.nupkg.sha512" + }, + "System.Windows.Extensions/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-CeWTdRNfRaSh0pm2gDTJFwVaXfTq6Xwv/sA887iwPTneW7oMtMlpvDIO+U60+3GWTB7Aom6oQwv5VZVUhQRdPQ==", + "path": "system.windows.extensions/4.7.0", + "hashPath": "system.windows.extensions.4.7.0.nupkg.sha512" + }, + "WpfAnalyzers/4.1.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-4+oLAk4gB4Wqn0ozKstB6fY9BafSU6c6GEgWjgOThyzHFBVqxihkS/1OmvEaYJnhjNUA/GOcZ6m2B7Xr2EePNw==", + "path": "wpfanalyzers/4.1.1", + "hashPath": "wpfanalyzers.4.1.1.nupkg.sha512" + } + } +} \ No newline at end of file diff --git a/tests/packagedcode/data/nuget/deps_json/simple.deps.json b/tests/packagedcode/data/nuget/deps_json/simple.deps.json new file mode 100644 index 00000000000..83f1b0030a5 --- /dev/null +++ b/tests/packagedcode/data/nuget/deps_json/simple.deps.json @@ -0,0 +1,23 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v6.0" + }, + "targets": { + ".NETCoreApp,Version=v6.0": { + "MyApp/1.0.0": { + "dependencies": { + "Newtonsoft.Json": "13.0.1" + } + }, + "Newtonsoft.Json/13.0.1": {} + } + }, + "libraries": { + "MyApp/1.0.0": { + "type": "project" + }, + "Newtonsoft.Json/13.0.1": { + "type": "package" + } + } +} \ No newline at end of file diff --git a/tests/packagedcode/test_deps_json.py b/tests/packagedcode/test_deps_json.py new file mode 100644 index 00000000000..3eafbce05d4 --- /dev/null +++ b/tests/packagedcode/test_deps_json.py @@ -0,0 +1,151 @@ +import json +import os +import tempfile + +from packagedcode import nuget +from packages_test_utils import PackageTester + + +class TestDotNetDepsJson(PackageTester): + test_data_dir = os.path.join(os.path.dirname(__file__), 'data') + + def test_deps_json_is_datafile(self): + test_file = self.get_test_loc('nuget/deps_json/simple.deps.json') + assert nuget.DotNetDepsJsonHandler.is_datafile(test_file) + + def test_parse_simple_deps_json(self): + test_file = self.get_test_loc('nuget/deps_json/simple.deps.json') + packages = list(nuget.DotNetDepsJsonHandler.parse(test_file)) + + assert len(packages) == 2 + + # MyApp/1.0.0 + my_app_packages = [p for p in packages if p.name == 'MyApp'] + assert len(my_app_packages) == 1 + my_app = my_app_packages[0] + assert my_app.name == 'MyApp' + assert my_app.version == '1.0.0' + assert my_app.extra_data.get('type') == 'project' + assert my_app.extra_data.get('target_framework') == '.NETCoreApp,Version=v6.0' + + assert len(my_app.dependencies) == 1 + dep = my_app.dependencies[0] + assert dep.get('purl') == 'pkg:nuget/Newtonsoft.Json@13.0.1' + assert dep.get('extracted_requirement') == '13.0.1' + assert dep.get('is_pinned') is True + assert dep.get('is_direct') is True + + # Newtonsoft.Json/13.0.1 + json_packages = [p for p in packages if p.name == 'Newtonsoft.Json'] + assert len(json_packages) == 1 + json_pkg = json_packages[0] + assert json_pkg.name == 'Newtonsoft.Json' + assert json_pkg.version == '13.0.1' + assert json_pkg.extra_data.get('type') == 'package' + assert len(json_pkg.dependencies) == 0 + + + def test_parse_snoop_deps_json(self): + test_file = self.get_test_loc('nuget/deps_json/Snoop.Core.deps.json') + packages = list(nuget.DotNetDepsJsonHandler.parse(test_file)) + + # The Snoop file has 45 items in the "libraries" section + assert len(packages) == 45 + + # Check for the main project + snoop_pkgs = [p for p in packages if p.name == 'Snoop.Core'] + assert len(snoop_pkgs) == 1 + snoop = snoop_pkgs[0] + assert snoop.name == 'Snoop.Core' + assert snoop.version == '1.0.0' + # Snoop.Core has 7 dependencies listed + assert len(snoop.dependencies) == 7 + + # Check one known dependency from the list + jb_packages = [p for p in packages if p.name == 'JetBrains.Annotations'] + assert len(jb_packages) == 1 + jb = jb_packages[0] + assert jb.name == 'JetBrains.Annotations' + assert jb.version == '2023.2.0' + + + def test_parse_empty_libraries_deps_json(self): + fd, temp_path = tempfile.mkstemp(suffix='.deps.json') + with os.fdopen(fd, 'w') as f: + json.dump({ + "runtimeTarget": {"name": ".NETCoreApp,Version=v6.0"}, + "libraries": {} + }, f) + + try: + packages = list(nuget.DotNetDepsJsonHandler.parse(temp_path)) + assert len(packages) == 0 + finally: + os.remove(temp_path) + + def test_parse_without_runtime_target_uses_targets(self): + fd, temp_path = tempfile.mkstemp(suffix='.deps.json') + with os.fdopen(fd, 'w') as f: + json.dump({ + "targets": { + ".NETCoreApp,Version=v8.0": { + "App/1.0.0": { + "dependencies": { + "Newtonsoft.Json": "13.0.3" + } + }, + "Newtonsoft.Json/13.0.3": {} + } + }, + "libraries": { + "App/1.0.0": {"type": "project"}, + "Newtonsoft.Json/13.0.3": {"type": "package"} + } + }, f) + + try: + packages = list(nuget.DotNetDepsJsonHandler.parse(temp_path)) + assert len(packages) == 2 + + app = [p for p in packages if p.name == 'App'][0] + assert app.extra_data.get('target_framework') == '.NETCoreApp,Version=v8.0' + assert len(app.dependencies) == 1 + dependency = app.dependencies[0] + assert dependency.get('purl') == 'pkg:nuget/Newtonsoft.Json@13.0.3' + assert dependency.get('scope') == '.NETCoreApp,Version=v8.0' + finally: + os.remove(temp_path) + + def test_parse_runtime_target_mismatch_falls_back_to_targets(self): + fd, temp_path = tempfile.mkstemp(suffix='.deps.json') + with os.fdopen(fd, 'w') as f: + json.dump({ + "runtimeTarget": {"name": ".NETCoreApp,Version=v8.0/win-x64"}, + "targets": { + ".NETCoreApp,Version=v8.0": { + "App/1.0.0": { + "dependencies": { + "Serilog": "3.1.0" + } + }, + "Serilog/3.1.0": {} + } + }, + "libraries": { + "App/1.0.0": {"type": "project"}, + "Serilog/3.1.0": {"type": "package"} + } + }, f) + + try: + packages = list(nuget.DotNetDepsJsonHandler.parse(temp_path)) + assert len(packages) == 2 + + app = [p for p in packages if p.name == 'App'][0] + assert app.extra_data.get('target_framework') == '.NETCoreApp,Version=v8.0' + assert len(app.dependencies) == 1 + dependency = app.dependencies[0] + assert dependency.get('purl') == 'pkg:nuget/Serilog@3.1.0' + assert dependency.get('scope') == '.NETCoreApp,Version=v8.0' + finally: + os.remove(temp_path) From 0708369572d85c7b7e7460322e117d46aef8ea73 Mon Sep 17 00:00:00 2001 From: kumarasantosh Date: Wed, 15 Apr 2026 20:28:39 +0530 Subject: [PATCH 2/2] packagedcode: address deps.json PR review feedback Signed-off-by: kumarasantosh --- src/packagedcode/nuget.py | 172 ++- .../data/nuget/deps_json/Snoop.Core.deps.json | 1018 ++--------------- .../deps_json/Snoop.Core.deps.json.ABOUT | 3 + .../deps_json/Snoop.Core.deps.json.expected | 557 +++++++++ .../nuget/deps_json/simple.deps.json.ABOUT | 2 + .../nuget/deps_json/simple.deps.json.expected | 151 +++ .../data/nuget/deps_json/small_app.deps.json | 54 + .../nuget/deps_json/small_app.deps.json.ABOUT | 3 + .../deps_json/small_app.deps.json.expected | 253 ++++ tests/packagedcode/test_deps_json.py | 151 --- tests/packagedcode/test_nuget.py | 162 +++ 11 files changed, 1370 insertions(+), 1156 deletions(-) create mode 100644 tests/packagedcode/data/nuget/deps_json/Snoop.Core.deps.json.ABOUT create mode 100644 tests/packagedcode/data/nuget/deps_json/Snoop.Core.deps.json.expected create mode 100644 tests/packagedcode/data/nuget/deps_json/simple.deps.json.ABOUT create mode 100644 tests/packagedcode/data/nuget/deps_json/simple.deps.json.expected create mode 100644 tests/packagedcode/data/nuget/deps_json/small_app.deps.json create mode 100644 tests/packagedcode/data/nuget/deps_json/small_app.deps.json.ABOUT create mode 100644 tests/packagedcode/data/nuget/deps_json/small_app.deps.json.expected delete mode 100644 tests/packagedcode/test_deps_json.py diff --git a/src/packagedcode/nuget.py b/src/packagedcode/nuget.py index 092ed42ff37..f9f5143fdfd 100644 --- a/src/packagedcode/nuget.py +++ b/src/packagedcode/nuget.py @@ -276,10 +276,7 @@ class DotNetDepsJsonHandler(models.DatafileHandler): @classmethod def parse(cls, location, package_only=False): with open(location) as loc: - try: - parsed = json.load(loc) - except Exception: - return + parsed = json.load(loc) if not parsed or not isinstance(parsed, dict): return @@ -320,66 +317,115 @@ def parse(cls, location, package_only=False): if not selected_targets: selected_targets = available_targets - for lib_key, lib_info in libraries.items(): - if not lib_key or '/' not in lib_key: + packages = parse_deps_json_libraries( + libraries=libraries, + selected_targets=selected_targets, + runtime_target_matched=runtime_target_matched, + target_framework=target_framework, + datasource_id=cls.datasource_id, + default_package_type=cls.default_package_type, + ) + + for package_data in packages: + yield models.PackageData.from_data(package_data, package_only) + + +def parse_deps_json_libraries( + libraries, + selected_targets, + runtime_target_matched, + target_framework, + datasource_id, + default_package_type, +): + """ + Parse the libraries and targets sections of a .deps.json file. + Returns a list of package dictionaries. + """ + packages = [] + if not selected_targets: + selected_targets = [] + + for lib_key, lib_info in libraries.items(): + if not lib_key or '/' not in lib_key: + continue + if not isinstance(lib_info, dict): + continue + + name, version = lib_key.split('/', 1) + package_type = lib_info.get('type') + dependencies = get_deps_json_dependencies( + lib_key=lib_key, + selected_targets=selected_targets, + default_package_type=default_package_type, + ) + + extra_data = {} + if runtime_target_matched: + extra_data['target_framework'] = target_framework + elif len(selected_targets) == 1: + extra_data['target_framework'] = selected_targets[0][0] + elif selected_targets: + extra_data['target_frameworks'] = [scope for scope, _target_obj in selected_targets] + + if package_type: + extra_data['type'] = package_type + + package_data = dict( + datasource_id=datasource_id, + type=default_package_type, + name=name, + version=version, + dependencies=dependencies, + extra_data=extra_data, + ) + packages.append(package_data) + + return packages + + +def get_deps_json_dependencies(lib_key, selected_targets, default_package_type): + """ + Return dependency mappings for ``lib_key`` gathered from all ``selected_targets``. + """ + dependencies = [] + seen_dependencies = set() + + for scope, target_obj in selected_targets: + target_lib = target_obj.get(lib_key) or {} + if not isinstance(target_lib, dict): + continue + + deps = target_lib.get('dependencies') + if not deps or not isinstance(deps, dict): + continue + + for dep_name, dep_version in deps.items(): + if not dep_name: continue - if not isinstance(lib_info, dict): + + dep_key = (dep_name, dep_version, scope) + if dep_key in seen_dependencies: continue + seen_dependencies.add(dep_key) - name, version = lib_key.split('/', 1) - - package_type = lib_info.get('type') - - # Extract dependencies from targets - dependencies = [] - seen_dependencies = set() - for scope, target_obj in selected_targets: - target_lib = target_obj.get(lib_key) or {} - if not isinstance(target_lib, dict): - continue - - deps = target_lib.get('dependencies') - if not deps or not isinstance(deps, dict): - continue - - for dep_name, dep_version in deps.items(): - if not dep_name: - continue - - dep_key = (dep_name, dep_version, scope) - if dep_key in seen_dependencies: - continue - seen_dependencies.add(dep_key) - - dependencies.append( - models.DependentPackage( - purl=str(PackageURL(type='nuget', name=dep_name, version=dep_version)), - extracted_requirement=dep_version, - scope=scope, - is_runtime=True, - is_optional=False, - is_pinned=True, - is_direct=True, - ).to_dict() - ) - - extra_data = {} - if runtime_target_matched: - extra_data['target_framework'] = target_framework - elif len(selected_targets) == 1: - extra_data['target_framework'] = selected_targets[0][0] - elif selected_targets: - extra_data['target_frameworks'] = [scope for scope, _target_obj in selected_targets] - - if package_type: - extra_data['type'] = package_type - - package_data = dict( - datasource_id=cls.datasource_id, - type=cls.default_package_type, - name=name, - version=version, - dependencies=dependencies, - extra_data=extra_data, + purl = PackageURL(type=default_package_type, name=dep_name, version=dep_version) + resolved_package = models.PackageData( + type=purl.type, + name=dep_name, + version=dep_version, + ).to_dict() + + dependency = models.DependentPackage( + purl=str(purl), + extracted_requirement=dep_version, + scope=scope, + is_runtime=True, + is_optional=False, + is_pinned=True, + is_direct=True, + resolved_package=resolved_package, ) - yield models.PackageData.from_data(package_data, package_only) + dependencies.append(dependency.to_dict()) + + return dependencies diff --git a/tests/packagedcode/data/nuget/deps_json/Snoop.Core.deps.json b/tests/packagedcode/data/nuget/deps_json/Snoop.Core.deps.json index 59b80807a0b..7ceaa916c17 100644 --- a/tests/packagedcode/data/nuget/deps_json/Snoop.Core.deps.json +++ b/tests/packagedcode/data/nuget/deps_json/Snoop.Core.deps.json @@ -1,942 +1,76 @@ -{ - "runtimeTarget": { - "name": ".NETCoreApp,Version=v3.1", - "signature": "" - }, - "compilationOptions": {}, - "targets": { - ".NETCoreApp,Version=v3.1": { - "Snoop.Core/1.0.0": { - "dependencies": { - "JetBrains.Annotations": "2023.2.0", - "Microsoft.CodeAnalysis.CSharp": "4.7.0", - "Microsoft.NETFramework.ReferenceAssemblies.net452": "1.0.3", - "Microsoft.SourceLink.GitHub": "1.1.1", - "StyleCop.Analyzers": "1.2.0-beta.507", - "System.Management.Automation": "7.0.0", - "WpfAnalyzers": "4.1.1" - }, - "runtime": { - "Snoop.Core.dll": {} - } - }, - "JetBrains.Annotations/2023.2.0": {}, - "Microsoft.ApplicationInsights/2.13.1": { - "dependencies": { - "System.Diagnostics.DiagnosticSource": "4.6.0" - }, - "runtime": { - "lib/netstandard2.0/Microsoft.ApplicationInsights.dll": { - "assemblyVersion": "2.13.1.12554", - "fileVersion": "2.13.1.12554" - } - } - }, - "Microsoft.Build.Tasks.Git/1.1.1": {}, - "Microsoft.CodeAnalysis.Analyzers/3.3.4": {}, - "Microsoft.CodeAnalysis.Common/4.7.0": { - "dependencies": { - "Microsoft.CodeAnalysis.Analyzers": "3.3.4", - "System.Collections.Immutable": "7.0.0", - "System.Memory": "4.5.5", - "System.Reflection.Metadata": "7.0.0", - "System.Runtime.CompilerServices.Unsafe": "6.0.0", - "System.Text.Encoding.CodePages": "7.0.0", - "System.Threading.Tasks.Extensions": "4.5.4" - } - }, - "Microsoft.CodeAnalysis.CSharp/4.7.0": { - "dependencies": { - "Microsoft.CodeAnalysis.Common": "4.7.0" - } - }, - "Microsoft.Management.Infrastructure/2.0.0": { - "dependencies": { - "Microsoft.Management.Infrastructure.Runtime.Unix": "2.0.0", - "Microsoft.Management.Infrastructure.Runtime.Win": "2.0.0" - } - }, - "Microsoft.Management.Infrastructure.Runtime.Unix/2.0.0": { - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/Microsoft.Management.Infrastructure.dll": { - "rid": "unix", - "assetType": "runtime", - "assemblyVersion": "2.0.0.0", - "fileVersion": "2.0.0.0" - } - } - }, - "Microsoft.Management.Infrastructure.Runtime.Win/2.0.0": { - "runtimeTargets": { - "runtimes/win-arm/lib/netstandard1.6/Microsoft.Management.Infrastructure.Native.dll": { - "rid": "win-arm", - "assetType": "runtime", - "assemblyVersion": "1.0.0.0", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win-arm/lib/netstandard1.6/Microsoft.Management.Infrastructure.dll": { - "rid": "win-arm", - "assetType": "runtime", - "assemblyVersion": "1.0.0.0", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win-arm64/lib/netstandard1.6/Microsoft.Management.Infrastructure.Native.dll": { - "rid": "win-arm64", - "assetType": "runtime", - "assemblyVersion": "1.0.0.0", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win-arm64/lib/netstandard1.6/Microsoft.Management.Infrastructure.dll": { - "rid": "win-arm64", - "assetType": "runtime", - "assemblyVersion": "1.0.0.0", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win10-x64/lib/netstandard1.6/Microsoft.Management.Infrastructure.Native.dll": { - "rid": "win10-x64", - "assetType": "runtime", - "assemblyVersion": "1.0.0.0", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win10-x64/lib/netstandard1.6/Microsoft.Management.Infrastructure.dll": { - "rid": "win10-x64", - "assetType": "runtime", - "assemblyVersion": "1.0.0.0", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win10-x86/lib/netstandard1.6/Microsoft.Management.Infrastructure.Native.dll": { - "rid": "win10-x86", - "assetType": "runtime", - "assemblyVersion": "1.0.0.0", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win10-x86/lib/netstandard1.6/Microsoft.Management.Infrastructure.dll": { - "rid": "win10-x86", - "assetType": "runtime", - "assemblyVersion": "1.0.0.0", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win7-x64/lib/netstandard1.6/Microsoft.Management.Infrastructure.Native.dll": { - "rid": "win7-x64", - "assetType": "runtime", - "assemblyVersion": "1.0.0.0", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win7-x64/lib/netstandard1.6/Microsoft.Management.Infrastructure.dll": { - "rid": "win7-x64", - "assetType": "runtime", - "assemblyVersion": "1.0.0.0", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win7-x86/lib/netstandard1.6/Microsoft.Management.Infrastructure.Native.dll": { - "rid": "win7-x86", - "assetType": "runtime", - "assemblyVersion": "1.0.0.0", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win7-x86/lib/netstandard1.6/Microsoft.Management.Infrastructure.dll": { - "rid": "win7-x86", - "assetType": "runtime", - "assemblyVersion": "1.0.0.0", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win8-x64/lib/netstandard1.6/Microsoft.Management.Infrastructure.Native.dll": { - "rid": "win8-x64", - "assetType": "runtime", - "assemblyVersion": "1.0.0.0", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win8-x64/lib/netstandard1.6/Microsoft.Management.Infrastructure.dll": { - "rid": "win8-x64", - "assetType": "runtime", - "assemblyVersion": "1.0.0.0", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win8-x86/lib/netstandard1.6/Microsoft.Management.Infrastructure.Native.dll": { - "rid": "win8-x86", - "assetType": "runtime", - "assemblyVersion": "1.0.0.0", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win8-x86/lib/netstandard1.6/Microsoft.Management.Infrastructure.dll": { - "rid": "win8-x86", - "assetType": "runtime", - "assemblyVersion": "1.0.0.0", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win81-x64/lib/netstandard1.6/Microsoft.Management.Infrastructure.Native.dll": { - "rid": "win81-x64", - "assetType": "runtime", - "assemblyVersion": "1.0.0.0", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win81-x64/lib/netstandard1.6/Microsoft.Management.Infrastructure.dll": { - "rid": "win81-x64", - "assetType": "runtime", - "assemblyVersion": "1.0.0.0", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win81-x86/lib/netstandard1.6/Microsoft.Management.Infrastructure.Native.dll": { - "rid": "win81-x86", - "assetType": "runtime", - "assemblyVersion": "1.0.0.0", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win81-x86/lib/netstandard1.6/Microsoft.Management.Infrastructure.dll": { - "rid": "win81-x86", - "assetType": "runtime", - "assemblyVersion": "1.0.0.0", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win-arm/native/Microsoft.Management.Infrastructure.Native.Unmanaged.dll": { - "rid": "win-arm", - "assetType": "native", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win-arm/native/mi.dll": { - "rid": "win-arm", - "assetType": "native", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win-arm/native/miutils.dll": { - "rid": "win-arm", - "assetType": "native", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win-arm64/native/Microsoft.Management.Infrastructure.Native.Unmanaged.dll": { - "rid": "win-arm64", - "assetType": "native", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win-arm64/native/mi.dll": { - "rid": "win-arm64", - "assetType": "native", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win-arm64/native/miutils.dll": { - "rid": "win-arm64", - "assetType": "native", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win10-x64/native/Microsoft.Management.Infrastructure.Native.Unmanaged.dll": { - "rid": "win10-x64", - "assetType": "native", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win10-x64/native/mi.dll": { - "rid": "win10-x64", - "assetType": "native", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win10-x64/native/miutils.dll": { - "rid": "win10-x64", - "assetType": "native", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win10-x86/native/Microsoft.Management.Infrastructure.Native.Unmanaged.dll": { - "rid": "win10-x86", - "assetType": "native", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win10-x86/native/mi.dll": { - "rid": "win10-x86", - "assetType": "native", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win10-x86/native/miutils.dll": { - "rid": "win10-x86", - "assetType": "native", - "fileVersion": "10.0.18362.1" - }, - "runtimes/win7-x64/native/Microsoft.Management.Infrastructure.Native.Unmanaged.dll": { - "rid": "win7-x64", - "assetType": "native", - "fileVersion": "10.0.14394.1000" - }, - "runtimes/win7-x64/native/mi.dll": { - "rid": "win7-x64", - "assetType": "native", - "fileVersion": "10.0.14394.1000" - }, - "runtimes/win7-x64/native/miutils.dll": { - "rid": "win7-x64", - "assetType": "native", - "fileVersion": "10.0.14394.1000" - }, - "runtimes/win7-x86/native/Microsoft.Management.Infrastructure.Native.Unmanaged.dll": { - "rid": "win7-x86", - "assetType": "native", - "fileVersion": "10.0.14394.1000" - }, - "runtimes/win7-x86/native/mi.dll": { - "rid": "win7-x86", - "assetType": "native", - "fileVersion": "10.0.14394.1000" - }, - "runtimes/win7-x86/native/miutils.dll": { - "rid": "win7-x86", - "assetType": "native", - "fileVersion": "10.0.14394.1000" - }, - "runtimes/win8-x64/native/mi.dll": { - "rid": "win8-x64", - "assetType": "native", - "fileVersion": "6.2.9200.22812" - }, - "runtimes/win8-x64/native/miutils.dll": { - "rid": "win8-x64", - "assetType": "native", - "fileVersion": "6.2.9200.22812" - }, - "runtimes/win8-x86/native/mi.dll": { - "rid": "win8-x86", - "assetType": "native", - "fileVersion": "6.2.9200.22812" - }, - "runtimes/win8-x86/native/miutils.dll": { - "rid": "win8-x86", - "assetType": "native", - "fileVersion": "6.2.9200.22812" - }, - "runtimes/win81-x64/native/Microsoft.Management.Infrastructure.Native.Unmanaged.dll": { - "rid": "win81-x64", - "assetType": "native", - "fileVersion": "6.3.9600.16384" - }, - "runtimes/win81-x64/native/mi.dll": { - "rid": "win81-x64", - "assetType": "native", - "fileVersion": "6.3.9600.16384" - }, - "runtimes/win81-x64/native/miutils.dll": { - "rid": "win81-x64", - "assetType": "native", - "fileVersion": "6.3.9600.16384" - }, - "runtimes/win81-x86/native/Microsoft.Management.Infrastructure.Native.Unmanaged.dll": { - "rid": "win81-x86", - "assetType": "native", - "fileVersion": "6.3.9600.16384" - }, - "runtimes/win81-x86/native/mi.dll": { - "rid": "win81-x86", - "assetType": "native", - "fileVersion": "6.3.9600.16384" - }, - "runtimes/win81-x86/native/miutils.dll": { - "rid": "win81-x86", - "assetType": "native", - "fileVersion": "6.3.9600.16384" - } - } - }, - "Microsoft.NETCore.Platforms/3.1.0": {}, - "Microsoft.NETFramework.ReferenceAssemblies.net452/1.0.3": {}, - "Microsoft.PowerShell.CoreCLR.Eventing/7.0.0": { - "dependencies": { - "System.Diagnostics.EventLog": "4.7.0" - }, - "runtimeTargets": { - "runtimes/win/lib/netcoreapp3.1/Microsoft.PowerShell.CoreCLR.Eventing.dll": { - "rid": "win", - "assetType": "runtime", - "assemblyVersion": "7.0.0.0", - "fileVersion": "7.0.0.0" - } - } - }, - "Microsoft.PowerShell.Native/7.0.0": { - "runtimeTargets": { - "runtimes/linux-arm/native/libpsl-native.so": { - "rid": "linux-arm", - "assetType": "native", - "fileVersion": "0.0.0.0" - }, - "runtimes/linux-arm64/native/libpsl-native.so": { - "rid": "linux-arm64", - "assetType": "native", - "fileVersion": "0.0.0.0" - }, - "runtimes/linux-musl-x64/native/libpsl-native.so": { - "rid": "linux-musl-x64", - "assetType": "native", - "fileVersion": "0.0.0.0" - }, - "runtimes/linux-x64/native/libmi.so": { - "rid": "linux-x64", - "assetType": "native", - "fileVersion": "0.0.0.0" - }, - "runtimes/linux-x64/native/libpsl-native.so": { - "rid": "linux-x64", - "assetType": "native", - "fileVersion": "0.0.0.0" - }, - "runtimes/linux-x64/native/libpsrpclient.so": { - "rid": "linux-x64", - "assetType": "native", - "fileVersion": "0.0.0.0" - }, - "runtimes/osx/native/libmi.dylib": { - "rid": "osx", - "assetType": "native", - "fileVersion": "0.0.0.0" - }, - "runtimes/osx/native/libpsl-native.dylib": { - "rid": "osx", - "assetType": "native", - "fileVersion": "0.0.0.0" - }, - "runtimes/osx/native/libpsrpclient.dylib": { - "rid": "osx", - "assetType": "native", - "fileVersion": "0.0.0.0" - }, - "runtimes/win-arm/native/PowerShell.Core.Instrumentation.dll": { - "rid": "win-arm", - "assetType": "native", - "fileVersion": "10.0.10011.16384" - }, - "runtimes/win-arm/native/pwrshplugin.dll": { - "rid": "win-arm", - "assetType": "native", - "fileVersion": "10.0.10011.16384" - }, - "runtimes/win-arm64/native/PowerShell.Core.Instrumentation.dll": { - "rid": "win-arm64", - "assetType": "native", - "fileVersion": "10.0.10011.16384" - }, - "runtimes/win-arm64/native/pwrshplugin.dll": { - "rid": "win-arm64", - "assetType": "native", - "fileVersion": "10.0.10011.16384" - }, - "runtimes/win-x64/native/PowerShell.Core.Instrumentation.dll": { - "rid": "win-x64", - "assetType": "native", - "fileVersion": "10.0.10011.16384" - }, - "runtimes/win-x64/native/pwrshplugin.dll": { - "rid": "win-x64", - "assetType": "native", - "fileVersion": "10.0.10011.16384" - }, - "runtimes/win-x86/native/PowerShell.Core.Instrumentation.dll": { - "rid": "win-x86", - "assetType": "native", - "fileVersion": "10.0.10011.16384" - }, - "runtimes/win-x86/native/pwrshplugin.dll": { - "rid": "win-x86", - "assetType": "native", - "fileVersion": "10.0.10011.16384" - } - } - }, - "Microsoft.SourceLink.Common/1.1.1": {}, - "Microsoft.SourceLink.GitHub/1.1.1": { - "dependencies": { - "Microsoft.Build.Tasks.Git": "1.1.1", - "Microsoft.SourceLink.Common": "1.1.1" - } - }, - "Microsoft.Win32.Registry/4.7.0": { - "dependencies": { - "System.Security.AccessControl": "4.7.0", - "System.Security.Principal.Windows": "4.7.0" - } - }, - "Microsoft.Win32.Registry.AccessControl/4.7.0": { - "dependencies": { - "Microsoft.Win32.Registry": "4.7.0", - "System.Security.AccessControl": "4.7.0" - } - }, - "Microsoft.Win32.SystemEvents/4.7.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "3.1.0" - } - }, - "Newtonsoft.Json/12.0.3": { - "runtime": { - "lib/netstandard2.0/Newtonsoft.Json.dll": { - "assemblyVersion": "12.0.0.0", - "fileVersion": "12.0.3.23909" - } - } - }, - "StyleCop.Analyzers/1.2.0-beta.507": { - "dependencies": { - "StyleCop.Analyzers.Unstable": "1.2.0.507" - } - }, - "StyleCop.Analyzers.Unstable/1.2.0.507": {}, - "System.CodeDom/4.7.0": {}, - "System.Collections.Immutable/7.0.0": { - "dependencies": { - "System.Memory": "4.5.5", - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - } - }, - "System.Configuration.ConfigurationManager/4.7.0": { - "dependencies": { - "System.Security.Cryptography.ProtectedData": "4.7.0", - "System.Security.Permissions": "4.7.0" - } - }, - "System.Diagnostics.DiagnosticSource/4.6.0": {}, - "System.Diagnostics.EventLog/4.7.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "3.1.0", - "Microsoft.Win32.Registry": "4.7.0", - "System.Security.Principal.Windows": "4.7.0" - } - }, - "System.DirectoryServices/4.7.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "3.1.0", - "System.IO.FileSystem.AccessControl": "4.7.0", - "System.Security.AccessControl": "4.7.0", - "System.Security.Permissions": "4.7.0", - "System.Security.Principal.Windows": "4.7.0" - } - }, - "System.Drawing.Common/4.7.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "3.1.0", - "Microsoft.Win32.SystemEvents": "4.7.0" - } - }, - "System.IO.FileSystem.AccessControl/4.7.0": { - "dependencies": { - "System.Security.AccessControl": "4.7.0", - "System.Security.Principal.Windows": "4.7.0" - } - }, - "System.Management/4.7.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "3.1.0", - "Microsoft.Win32.Registry": "4.7.0", - "System.CodeDom": "4.7.0" - }, - "runtime": { - "lib/netstandard2.0/System.Management.dll": { - "assemblyVersion": "4.0.1.0", - "fileVersion": "4.700.19.56404" - } - }, - "runtimeTargets": { - "runtimes/win/lib/netcoreapp2.0/System.Management.dll": { - "rid": "win", - "assetType": "runtime", - "assemblyVersion": "4.0.1.0", - "fileVersion": "4.700.19.56404" - } - } - }, - "System.Management.Automation/7.0.0": { - "dependencies": { - "Microsoft.ApplicationInsights": "2.13.1", - "Microsoft.Management.Infrastructure": "2.0.0", - "Microsoft.PowerShell.CoreCLR.Eventing": "7.0.0", - "Microsoft.PowerShell.Native": "7.0.0", - "Microsoft.Win32.Registry.AccessControl": "4.7.0", - "Newtonsoft.Json": "12.0.3", - "System.Configuration.ConfigurationManager": "4.7.0", - "System.DirectoryServices": "4.7.0", - "System.IO.FileSystem.AccessControl": "4.7.0", - "System.Management": "4.7.0", - "System.Runtime.CompilerServices.Unsafe": "6.0.0", - "System.Security.AccessControl": "4.7.0", - "System.Security.Cryptography.Pkcs": "4.7.0", - "System.Security.Permissions": "4.7.0", - "System.Text.Encoding.CodePages": "7.0.0" - }, - "runtimeTargets": { - "runtimes/unix/lib/netcoreapp3.1/System.Management.Automation.dll": { - "rid": "unix", - "assetType": "runtime", - "assemblyVersion": "7.0.0.0", - "fileVersion": "7.0.0.0" - }, - "runtimes/win/lib/netcoreapp3.1/System.Management.Automation.dll": { - "rid": "win", - "assetType": "runtime", - "assemblyVersion": "7.0.0.0", - "fileVersion": "7.0.0.0" - } - } - }, - "System.Memory/4.5.5": {}, - "System.Reflection.Metadata/7.0.0": { - "dependencies": { - "System.Collections.Immutable": "7.0.0", - "System.Memory": "4.5.5" - } - }, - "System.Runtime.CompilerServices.Unsafe/6.0.0": { - "runtime": { - "lib/netcoreapp3.1/System.Runtime.CompilerServices.Unsafe.dll": { - "assemblyVersion": "6.0.0.0", - "fileVersion": "6.0.21.52210" - } - } - }, - "System.Security.AccessControl/4.7.0": { - "dependencies": { - "Microsoft.NETCore.Platforms": "3.1.0", - "System.Security.Principal.Windows": "4.7.0" - } - }, - "System.Security.Cryptography.Cng/4.7.0": {}, - "System.Security.Cryptography.Pkcs/4.7.0": { - "dependencies": { - "System.Security.Cryptography.Cng": "4.7.0" - } - }, - "System.Security.Cryptography.ProtectedData/4.7.0": {}, - "System.Security.Permissions/4.7.0": { - "dependencies": { - "System.Security.AccessControl": "4.7.0", - "System.Windows.Extensions": "4.7.0" - } - }, - "System.Security.Principal.Windows/4.7.0": {}, - "System.Text.Encoding.CodePages/7.0.0": { - "dependencies": { - "System.Memory": "4.5.5", - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - }, - "runtime": { - "lib/netstandard2.0/System.Text.Encoding.CodePages.dll": { - "assemblyVersion": "7.0.0.0", - "fileVersion": "7.0.22.51805" - } - } - }, - "System.Threading.Tasks.Extensions/4.5.4": {}, - "System.Windows.Extensions/4.7.0": { - "dependencies": { - "System.Drawing.Common": "4.7.0" - } - }, - "WpfAnalyzers/4.1.1": {} - } - }, - "libraries": { - "Snoop.Core/1.0.0": { - "type": "project", - "serviceable": false, - "sha512": "" - }, - "JetBrains.Annotations/2023.2.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-dvO//8aLmLRsCVVgoc/7qBqi2/y4BTyRcg20LCBWtK4n6E9Um06Zp7jF1n0hOE+yqBHwcrDzAjWvCaM3qH8flg==", - "path": "jetbrains.annotations/2023.2.0", - "hashPath": "jetbrains.annotations.2023.2.0.nupkg.sha512" - }, - "Microsoft.ApplicationInsights/2.13.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-BQhLmYR06Z8TVCdxnr8WOhhovJHtqYRNeB5gePBdQ4uDOE8D4IK9HW9i6a3llELz1QHv4HtFpku6dpXMGnO22g==", - "path": "microsoft.applicationinsights/2.13.1", - "hashPath": "microsoft.applicationinsights.2.13.1.nupkg.sha512" - }, - "Microsoft.Build.Tasks.Git/1.1.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-AT3HlgTjsqHnWpBHSNeR0KxbLZD7bztlZVj7I8vgeYG9SYqbeFGh0TM/KVtC6fg53nrWHl3VfZFvb5BiQFcY6Q==", - "path": "microsoft.build.tasks.git/1.1.1", - "hashPath": "microsoft.build.tasks.git.1.1.1.nupkg.sha512" - }, - "Microsoft.CodeAnalysis.Analyzers/3.3.4": { - "type": "package", - "serviceable": true, - "sha512": "sha512-AxkxcPR+rheX0SmvpLVIGLhOUXAKG56a64kV9VQZ4y9gR9ZmPXnqZvHJnmwLSwzrEP6junUF11vuc+aqo5r68g==", - "path": "microsoft.codeanalysis.analyzers/3.3.4", - "hashPath": "microsoft.codeanalysis.analyzers.3.3.4.nupkg.sha512" - }, - "Microsoft.CodeAnalysis.Common/4.7.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-pD5S14xMUebSGYe75kt0q/aaS/ftvktSo/pEv7aX7hNPHfdZS+SZeXvkvcffGxWkunYOyRF9m1oN7zzSdYj9dQ==", - "path": "microsoft.codeanalysis.common/4.7.0", - "hashPath": "microsoft.codeanalysis.common.4.7.0.nupkg.sha512" - }, - "Microsoft.CodeAnalysis.CSharp/4.7.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-JHCP2L6lB0oJ3tQoHkC67SFZxW+KbJVOnAo+6L01K5r/NlBlSUhTk5nUAldWhTVwGdzqNeHqGtnEqpsCmGSwQA==", - "path": "microsoft.codeanalysis.csharp/4.7.0", - "hashPath": "microsoft.codeanalysis.csharp.4.7.0.nupkg.sha512" - }, - "Microsoft.Management.Infrastructure/2.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-IaKZRNBBv3sdrmBWd+aqwHq8cVHk/3WgWFAN/dt40MRY9rbtHiDfTTmaEN0tGTmQqGCGDo/ncntA8MvFMvcsRw==", - "path": "microsoft.management.infrastructure/2.0.0", - "hashPath": "microsoft.management.infrastructure.2.0.0.nupkg.sha512" - }, - "Microsoft.Management.Infrastructure.Runtime.Unix/2.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-p0lslMX5bdWLxO2P7ao+rjAMOB0LEwPYpzvdCQ2OEYgX2NxFpQ8ILvqPGnYlTAb53rT8gu5DyIol1HboHFYfxQ==", - "path": "microsoft.management.infrastructure.runtime.unix/2.0.0", - "hashPath": "microsoft.management.infrastructure.runtime.unix.2.0.0.nupkg.sha512" - }, - "Microsoft.Management.Infrastructure.Runtime.Win/2.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-vjBWQeDOjgernkrOdbEgn7M70SF7hof7ORdKPSlL06Uc15+oYdth5dZju9KsgUoti/cwnkZTiwtDx/lRtay0sA==", - "path": "microsoft.management.infrastructure.runtime.win/2.0.0", - "hashPath": "microsoft.management.infrastructure.runtime.win.2.0.0.nupkg.sha512" - }, - "Microsoft.NETCore.Platforms/3.1.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-z7aeg8oHln2CuNulfhiLYxCVMPEwBl3rzicjvIX+4sUuCwvXw5oXQEtbiU2c0z4qYL5L3Kmx0mMA/+t/SbY67w==", - "path": "microsoft.netcore.platforms/3.1.0", - "hashPath": "microsoft.netcore.platforms.3.1.0.nupkg.sha512" - }, - "Microsoft.NETFramework.ReferenceAssemblies.net452/1.0.3": { - "type": "package", - "serviceable": true, - "sha512": "sha512-kuFOgilYbs29xENHlqQ6aJYa+t56u+OqHx85P7GYLVlo7HL3nsug9IQY2DoPgkOpZ2xb9btYV2EFK7Enll8S3A==", - "path": "microsoft.netframework.referenceassemblies.net452/1.0.3", - "hashPath": "microsoft.netframework.referenceassemblies.net452.1.0.3.nupkg.sha512" - }, - "Microsoft.PowerShell.CoreCLR.Eventing/7.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-bX1HxVGw4e5LRW4CkukufgUfVT3RceLLWT1WAAmRgpWetwLspIbqpXzPmBuD0qyJA2Ud2+9X2AVag4qcBkekRw==", - "path": "microsoft.powershell.coreclr.eventing/7.0.0", - "hashPath": "microsoft.powershell.coreclr.eventing.7.0.0.nupkg.sha512" - }, - "Microsoft.PowerShell.Native/7.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-btrvvHj0QEdPU2lIKD5divnLbMok/dNUUo4pjTZJAyU+y+We6cuPL5UurHJTzWPEwU/NzS8+2tqV4jSXvlPB2Q==", - "path": "microsoft.powershell.native/7.0.0", - "hashPath": "microsoft.powershell.native.7.0.0.nupkg.sha512" - }, - "Microsoft.SourceLink.Common/1.1.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-WMcGpWKrmJmzrNeuaEb23bEMnbtR/vLmvZtkAP5qWu7vQsY59GqfRJd65sFpBszbd2k/bQ8cs8eWawQKAabkVg==", - "path": "microsoft.sourcelink.common/1.1.1", - "hashPath": "microsoft.sourcelink.common.1.1.1.nupkg.sha512" - }, - "Microsoft.SourceLink.GitHub/1.1.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-IaJGnOv/M7UQjRJks7B6p7pbPnOwisYGOIzqCz5ilGFTApZ3ktOR+6zJ12ZRPInulBmdAf1SrGdDG2MU8g6XTw==", - "path": "microsoft.sourcelink.github/1.1.1", - "hashPath": "microsoft.sourcelink.github.1.1.1.nupkg.sha512" - }, - "Microsoft.Win32.Registry/4.7.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-KSrRMb5vNi0CWSGG1++id2ZOs/1QhRqROt+qgbEAdQuGjGrFcl4AOl4/exGPUYz2wUnU42nvJqon1T3U0kPXLA==", - "path": "microsoft.win32.registry/4.7.0", - "hashPath": "microsoft.win32.registry.4.7.0.nupkg.sha512" - }, - "Microsoft.Win32.Registry.AccessControl/4.7.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-6ZBpiCrPHoRxm0GWrlUfSKx5i4987cRs2hi8KVHD+iI72pm0jScyr5QvqdLeyTgf22R4WgdmBo2k64wtVotPRA==", - "path": "microsoft.win32.registry.accesscontrol/4.7.0", - "hashPath": "microsoft.win32.registry.accesscontrol.4.7.0.nupkg.sha512" - }, - "Microsoft.Win32.SystemEvents/4.7.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-mtVirZr++rq+XCDITMUdnETD59XoeMxSpLRIII7JRI6Yj0LEDiO1pPn0ktlnIj12Ix8bfvQqQDMMIF9wC98oCA==", - "path": "microsoft.win32.systemevents/4.7.0", - "hashPath": "microsoft.win32.systemevents.4.7.0.nupkg.sha512" - }, - "Newtonsoft.Json/12.0.3": { - "type": "package", - "serviceable": true, - "sha512": "sha512-6mgjfnRB4jKMlzHSl+VD+oUc1IebOZabkbyWj2RiTgWwYPPuaK1H97G1sHqGwPlS5npiF5Q0OrxN1wni2n5QWg==", - "path": "newtonsoft.json/12.0.3", - "hashPath": "newtonsoft.json.12.0.3.nupkg.sha512" - }, - "StyleCop.Analyzers/1.2.0-beta.507": { - "type": "package", - "serviceable": true, - "sha512": "sha512-/FtugDT66cKJJ+GGH7rNpG6UDrT4iIWz45M6lrXXHobDUFDHw+q5VgkbiR+6ffTO564ge7w6fQh/eoQhVdJO8Q==", - "path": "stylecop.analyzers/1.2.0-beta.507", - "hashPath": "stylecop.analyzers.1.2.0-beta.507.nupkg.sha512" - }, - "StyleCop.Analyzers.Unstable/1.2.0.507": { - "type": "package", - "serviceable": true, - "sha512": "sha512-gTY3IQdRqDJ4hbhSA3e/R48oE8b/OiKfvwkt1QdNVfrJK2gMHBV8ldaHJ885jxWZfllK66soa/sdcjh9bX49Tw==", - "path": "stylecop.analyzers.unstable/1.2.0.507", - "hashPath": "stylecop.analyzers.unstable.1.2.0.507.nupkg.sha512" - }, - "System.CodeDom/4.7.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-Hs9pw/kmvH3lXaZ1LFKj3pLQsiGfj2xo3sxSzwiLlRL6UcMZUTeCfoJ9Udalvn3yq5dLlPEZzYegrTQ1/LhPOQ==", - "path": "system.codedom/4.7.0", - "hashPath": "system.codedom.4.7.0.nupkg.sha512" - }, - "System.Collections.Immutable/7.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-dQPcs0U1IKnBdRDBkrCTi1FoajSTBzLcVTpjO4MBCMC7f4pDOIPzgBoX8JjG7X6uZRJ8EBxsi8+DR1JuwjnzOQ==", - "path": "system.collections.immutable/7.0.0", - "hashPath": "system.collections.immutable.7.0.0.nupkg.sha512" - }, - "System.Configuration.ConfigurationManager/4.7.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-/anOTeSZCNNI2zDilogWrZ8pNqCmYbzGNexUnNhjW8k0sHqEZ2nHJBp147jBV3hGYswu5lINpNg1vxR7bnqvVA==", - "path": "system.configuration.configurationmanager/4.7.0", - "hashPath": "system.configuration.configurationmanager.4.7.0.nupkg.sha512" - }, - "System.Diagnostics.DiagnosticSource/4.6.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-mbBgoR0rRfl2uimsZ2avZY8g7Xnh1Mza0rJZLPcxqiMWlkGukjmRkuMJ/er+AhQuiRIh80CR/Hpeztr80seV5g==", - "path": "system.diagnostics.diagnosticsource/4.6.0", - "hashPath": "system.diagnostics.diagnosticsource.4.6.0.nupkg.sha512" - }, - "System.Diagnostics.EventLog/4.7.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-iDoKGQcRwX0qwY+eAEkaJGae0d/lHlxtslO+t8pJWAUxlvY3tqLtVOPnW2UU4cFjP0Y/L1QBqhkZfSyGqVMR2w==", - "path": "system.diagnostics.eventlog/4.7.0", - "hashPath": "system.diagnostics.eventlog.4.7.0.nupkg.sha512" - }, - "System.DirectoryServices/4.7.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-NRENC4ulDamI4DQtrYybxtQU3qnhGSTUdEKJkLyctHXY4RqNyS/egZpB9z8/CnFCiaQZmwLlqxfBmw80VlKBTA==", - "path": "system.directoryservices/4.7.0", - "hashPath": "system.directoryservices.4.7.0.nupkg.sha512" - }, - "System.Drawing.Common/4.7.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-v+XbyYHaZjDfn0ENmJEV1VYLgGgCTx1gnfOBcppowbpOAriglYgGCvFCPr2EEZyBvXlpxbEsTwkOlInl107ahA==", - "path": "system.drawing.common/4.7.0", - "hashPath": "system.drawing.common.4.7.0.nupkg.sha512" - }, - "System.IO.FileSystem.AccessControl/4.7.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-vMToiarpU81LR1/KZtnT7VDPvqAZfw9oOS5nY6pPP78nGYz3COLsQH3OfzbR+SjTgltd31R6KmKklz/zDpTmzw==", - "path": "system.io.filesystem.accesscontrol/4.7.0", - "hashPath": "system.io.filesystem.accesscontrol.4.7.0.nupkg.sha512" - }, - "System.Management/4.7.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-IY+uuGhgzWiCg21i8IvQeY/Z7m1tX8VuPF+ludfn7iTCaccTtJo5HkjZbBEL8kbBubKhAKKtNXr7uMtmAc28Pw==", - "path": "system.management/4.7.0", - "hashPath": "system.management.4.7.0.nupkg.sha512" - }, - "System.Management.Automation/7.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-VRCxKA4+RVXt6Fp6wv7RAx1IQr0TUtawT9/O2X3SYuyLxpsW3KW4yuBLKHj/grZBpi3Gtt9+Q0cR6HrKW2f8vw==", - "path": "system.management.automation/7.0.0", - "hashPath": "system.management.automation.7.0.0.nupkg.sha512" - }, - "System.Memory/4.5.5": { - "type": "package", - "serviceable": true, - "sha512": "sha512-XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==", - "path": "system.memory/4.5.5", - "hashPath": "system.memory.4.5.5.nupkg.sha512" - }, - "System.Reflection.Metadata/7.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-MclTG61lsD9sYdpNz9xsKBzjsmsfCtcMZYXz/IUr2zlhaTaABonlr1ESeompTgM+Xk+IwtGYU7/voh3YWB/fWw==", - "path": "system.reflection.metadata/7.0.0", - "hashPath": "system.reflection.metadata.7.0.0.nupkg.sha512" - }, - "System.Runtime.CompilerServices.Unsafe/6.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==", - "path": "system.runtime.compilerservices.unsafe/6.0.0", - "hashPath": "system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512" - }, - "System.Security.AccessControl/4.7.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-JECvTt5aFF3WT3gHpfofL2MNNP6v84sxtXxpqhLBCcDRzqsPBmHhQ6shv4DwwN2tRlzsUxtb3G9M3763rbXKDg==", - "path": "system.security.accesscontrol/4.7.0", - "hashPath": "system.security.accesscontrol.4.7.0.nupkg.sha512" - }, - "System.Security.Cryptography.Cng/4.7.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-4WQjFuypWtxb/bl/YwEE7LYGn4fgpsikFfBU6xwEm4YBYiRAhXAEJ62lILBu2JJSFbClIAntFTGfDZafn8yZTg==", - "path": "system.security.cryptography.cng/4.7.0", - "hashPath": "system.security.cryptography.cng.4.7.0.nupkg.sha512" - }, - "System.Security.Cryptography.Pkcs/4.7.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-0Srzh6YlhjuMxaqMyeCCdZs22cucaUAG6SKDd3gNHBJmre0VZ71ekzWu9rvLD4YXPetyNdPvV6Qst+8C++9v3Q==", - "path": "system.security.cryptography.pkcs/4.7.0", - "hashPath": "system.security.cryptography.pkcs.4.7.0.nupkg.sha512" - }, - "System.Security.Cryptography.ProtectedData/4.7.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-ehYW0m9ptxpGWvE4zgqongBVWpSDU/JCFD4K7krxkQwSz/sFQjEXCUqpvencjy6DYDbn7Ig09R8GFffu8TtneQ==", - "path": "system.security.cryptography.protecteddata/4.7.0", - "hashPath": "system.security.cryptography.protecteddata.4.7.0.nupkg.sha512" - }, - "System.Security.Permissions/4.7.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-dkOV6YYVBnYRa15/yv004eCGRBVADXw8qRbbNiCn/XpdJSUXkkUeIvdvFHkvnko4CdKMqG8yRHC4ox83LSlMsQ==", - "path": "system.security.permissions/4.7.0", - "hashPath": "system.security.permissions.4.7.0.nupkg.sha512" - }, - "System.Security.Principal.Windows/4.7.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-ojD0PX0XhneCsUbAZVKdb7h/70vyYMDYs85lwEI+LngEONe/17A0cFaRFqZU+sOEidcVswYWikYOQ9PPfjlbtQ==", - "path": "system.security.principal.windows/4.7.0", - "hashPath": "system.security.principal.windows.4.7.0.nupkg.sha512" - }, - "System.Text.Encoding.CodePages/7.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-LSyCblMpvOe0N3E+8e0skHcrIhgV2huaNcjUUEa8hRtgEAm36aGkRoC8Jxlb6Ra6GSfF29ftduPNywin8XolzQ==", - "path": "system.text.encoding.codepages/7.0.0", - "hashPath": "system.text.encoding.codepages.7.0.0.nupkg.sha512" - }, - "System.Threading.Tasks.Extensions/4.5.4": { - "type": "package", - "serviceable": true, - "sha512": "sha512-zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==", - "path": "system.threading.tasks.extensions/4.5.4", - "hashPath": "system.threading.tasks.extensions.4.5.4.nupkg.sha512" - }, - "System.Windows.Extensions/4.7.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-CeWTdRNfRaSh0pm2gDTJFwVaXfTq6Xwv/sA887iwPTneW7oMtMlpvDIO+U60+3GWTB7Aom6oQwv5VZVUhQRdPQ==", - "path": "system.windows.extensions/4.7.0", - "hashPath": "system.windows.extensions.4.7.0.nupkg.sha512" - }, - "WpfAnalyzers/4.1.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-4+oLAk4gB4Wqn0ozKstB6fY9BafSU6c6GEgWjgOThyzHFBVqxihkS/1OmvEaYJnhjNUA/GOcZ6m2B7Xr2EePNw==", - "path": "wpfanalyzers/4.1.1", - "hashPath": "wpfanalyzers.4.1.1.nupkg.sha512" - } - } -} \ No newline at end of file +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v3.1", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v3.1": { + "Snoop.Core/1.0.0": { + "dependencies": { + "JetBrains.Annotations": "2023.2.0", + "Microsoft.CodeAnalysis.CSharp": "4.7.0", + "Microsoft.NETFramework.ReferenceAssemblies.net452": "1.0.3" + }, + "runtime": { + "Snoop.Core.dll": {} + } + }, + "JetBrains.Annotations/2023.2.0": {}, + "Microsoft.CodeAnalysis.Common/4.7.0": { + "dependencies": { + "System.Collections.Immutable": "7.0.0" + } + }, + "Microsoft.CodeAnalysis.CSharp/4.7.0": { + "dependencies": { + "Microsoft.CodeAnalysis.Common": "4.7.0" + } + }, + "Microsoft.NETFramework.ReferenceAssemblies.net452/1.0.3": {}, + "System.Collections.Immutable/7.0.0": {} + } + }, + "libraries": { + "Snoop.Core/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "JetBrains.Annotations/2023.2.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-dvO//8aLmLRsCVVgoc/7qBqi2/y4BTyRcg20LCBWtK4n6E9Um06Zp7jF1n0hOE+yqBHwcrDzAjWvCaM3qH8flg==", + "path": "jetbrains.annotations/2023.2.0", + "hashPath": "jetbrains.annotations.2023.2.0.nupkg.sha512" + }, + "Microsoft.CodeAnalysis.Common/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-pD5S14xMUebSGYe75kt0q/aaS/ftvktSo/pEv7aX7hNPHfdZS+SZeXvkvcffGxWkunYOyRF9m1oN7zzSdYj9dQ==", + "path": "microsoft.codeanalysis.common/4.7.0", + "hashPath": "microsoft.codeanalysis.common.4.7.0.nupkg.sha512" + }, + "Microsoft.CodeAnalysis.CSharp/4.7.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-JHCP2L6lB0oJ3tQoHkC67SFZxW+KbJVOnAo+6L01K5r/NlBlSUhTk5nUAldWhTVwGdzqNeHqGtnEqpsCmGSwQA==", + "path": "microsoft.codeanalysis.csharp/4.7.0", + "hashPath": "microsoft.codeanalysis.csharp.4.7.0.nupkg.sha512" + }, + "Microsoft.NETFramework.ReferenceAssemblies.net452/1.0.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-kuFOgilYbs29xENHlqQ6aJYa+t56u+OqHx85P7GYLVlo7HL3nsug9IQY2DoPgkOpZ2xb9btYV2EFK7Enll8S3A==", + "path": "microsoft.netframework.referenceassemblies.net452/1.0.3", + "hashPath": "microsoft.netframework.referenceassemblies.net452.1.0.3.nupkg.sha512" + }, + "System.Collections.Immutable/7.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-dQPcs0U1IKnBdRDBkrCTi1FoajSTBzLcVTpjO4MBCMC7f4pDOIPzgBoX8JjG7X6uZRJ8EBxsi8+DR1JuwjnzOQ==", + "path": "system.collections.immutable/7.0.0", + "hashPath": "system.collections.immutable.7.0.0.nupkg.sha512" + } + } +} diff --git a/tests/packagedcode/data/nuget/deps_json/Snoop.Core.deps.json.ABOUT b/tests/packagedcode/data/nuget/deps_json/Snoop.Core.deps.json.ABOUT new file mode 100644 index 00000000000..707414e0f90 --- /dev/null +++ b/tests/packagedcode/data/nuget/deps_json/Snoop.Core.deps.json.ABOUT @@ -0,0 +1,3 @@ +about_resource: Snoop.Core.deps.json +download_url: https://github.com/snoopwpf/snoopwpf/releases/tag/v5.1.0 +notes: Trimmed from the upstream release asset to keep the fixture small while preserving libraries and targets consistency for tests. diff --git a/tests/packagedcode/data/nuget/deps_json/Snoop.Core.deps.json.expected b/tests/packagedcode/data/nuget/deps_json/Snoop.Core.deps.json.expected new file mode 100644 index 00000000000..3bc14db69bb --- /dev/null +++ b/tests/packagedcode/data/nuget/deps_json/Snoop.Core.deps.json.expected @@ -0,0 +1,557 @@ +[ + { + "type": "nuget", + "namespace": null, + "name": "Snoop.Core", + "version": "1.0.0", + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "target_framework": ".NETCoreApp,Version=v3.1", + "type": "project" + }, + "dependencies": [ + { + "purl": "pkg:nuget/JetBrains.Annotations@2023.2.0", + "extracted_requirement": "2023.2.0", + "scope": ".NETCoreApp,Version=v3.1", + "is_runtime": true, + "is_optional": false, + "is_pinned": true, + "is_direct": true, + "resolved_package": { + "type": "nuget", + "namespace": null, + "name": "JetBrains.Annotations", + "version": "2023.2.0", + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": null, + "purl": "pkg:nuget/JetBrains.Annotations@2023.2.0" + }, + "extra_data": {} + }, + { + "purl": "pkg:nuget/Microsoft.CodeAnalysis.CSharp@4.7.0", + "extracted_requirement": "4.7.0", + "scope": ".NETCoreApp,Version=v3.1", + "is_runtime": true, + "is_optional": false, + "is_pinned": true, + "is_direct": true, + "resolved_package": { + "type": "nuget", + "namespace": null, + "name": "Microsoft.CodeAnalysis.CSharp", + "version": "4.7.0", + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": null, + "purl": "pkg:nuget/Microsoft.CodeAnalysis.CSharp@4.7.0" + }, + "extra_data": {} + }, + { + "purl": "pkg:nuget/Microsoft.NETFramework.ReferenceAssemblies.net452@1.0.3", + "extracted_requirement": "1.0.3", + "scope": ".NETCoreApp,Version=v3.1", + "is_runtime": true, + "is_optional": false, + "is_pinned": true, + "is_direct": true, + "resolved_package": { + "type": "nuget", + "namespace": null, + "name": "Microsoft.NETFramework.ReferenceAssemblies.net452", + "version": "1.0.3", + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": null, + "purl": "pkg:nuget/Microsoft.NETFramework.ReferenceAssemblies.net452@1.0.3" + }, + "extra_data": {} + } + ], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "nuget_deps_json", + "purl": "pkg:nuget/Snoop.Core@1.0.0" + }, + { + "type": "nuget", + "namespace": null, + "name": "JetBrains.Annotations", + "version": "2023.2.0", + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "target_framework": ".NETCoreApp,Version=v3.1", + "type": "package" + }, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "nuget_deps_json", + "purl": "pkg:nuget/JetBrains.Annotations@2023.2.0" + }, + { + "type": "nuget", + "namespace": null, + "name": "Microsoft.CodeAnalysis.Common", + "version": "4.7.0", + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "target_framework": ".NETCoreApp,Version=v3.1", + "type": "package" + }, + "dependencies": [ + { + "purl": "pkg:nuget/System.Collections.Immutable@7.0.0", + "extracted_requirement": "7.0.0", + "scope": ".NETCoreApp,Version=v3.1", + "is_runtime": true, + "is_optional": false, + "is_pinned": true, + "is_direct": true, + "resolved_package": { + "type": "nuget", + "namespace": null, + "name": "System.Collections.Immutable", + "version": "7.0.0", + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": null, + "purl": "pkg:nuget/System.Collections.Immutable@7.0.0" + }, + "extra_data": {} + } + ], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "nuget_deps_json", + "purl": "pkg:nuget/Microsoft.CodeAnalysis.Common@4.7.0" + }, + { + "type": "nuget", + "namespace": null, + "name": "Microsoft.CodeAnalysis.CSharp", + "version": "4.7.0", + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "target_framework": ".NETCoreApp,Version=v3.1", + "type": "package" + }, + "dependencies": [ + { + "purl": "pkg:nuget/Microsoft.CodeAnalysis.Common@4.7.0", + "extracted_requirement": "4.7.0", + "scope": ".NETCoreApp,Version=v3.1", + "is_runtime": true, + "is_optional": false, + "is_pinned": true, + "is_direct": true, + "resolved_package": { + "type": "nuget", + "namespace": null, + "name": "Microsoft.CodeAnalysis.Common", + "version": "4.7.0", + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": null, + "purl": "pkg:nuget/Microsoft.CodeAnalysis.Common@4.7.0" + }, + "extra_data": {} + } + ], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "nuget_deps_json", + "purl": "pkg:nuget/Microsoft.CodeAnalysis.CSharp@4.7.0" + }, + { + "type": "nuget", + "namespace": null, + "name": "Microsoft.NETFramework.ReferenceAssemblies.net452", + "version": "1.0.3", + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "target_framework": ".NETCoreApp,Version=v3.1", + "type": "package" + }, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "nuget_deps_json", + "purl": "pkg:nuget/Microsoft.NETFramework.ReferenceAssemblies.net452@1.0.3" + }, + { + "type": "nuget", + "namespace": null, + "name": "System.Collections.Immutable", + "version": "7.0.0", + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "target_framework": ".NETCoreApp,Version=v3.1", + "type": "package" + }, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "nuget_deps_json", + "purl": "pkg:nuget/System.Collections.Immutable@7.0.0" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/nuget/deps_json/simple.deps.json.ABOUT b/tests/packagedcode/data/nuget/deps_json/simple.deps.json.ABOUT new file mode 100644 index 00000000000..d7243c60ae9 --- /dev/null +++ b/tests/packagedcode/data/nuget/deps_json/simple.deps.json.ABOUT @@ -0,0 +1,2 @@ +about_resource: simple.deps.json +notes: Minimal hand-crafted .deps.json fixture used to cover parser edge cases that are awkward to isolate from larger real-world files. diff --git a/tests/packagedcode/data/nuget/deps_json/simple.deps.json.expected b/tests/packagedcode/data/nuget/deps_json/simple.deps.json.expected new file mode 100644 index 00000000000..7973669c73d --- /dev/null +++ b/tests/packagedcode/data/nuget/deps_json/simple.deps.json.expected @@ -0,0 +1,151 @@ +[ + { + "type": "nuget", + "namespace": null, + "name": "MyApp", + "version": "1.0.0", + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "target_framework": ".NETCoreApp,Version=v6.0", + "type": "project" + }, + "dependencies": [ + { + "purl": "pkg:nuget/Newtonsoft.Json@13.0.1", + "extracted_requirement": "13.0.1", + "scope": ".NETCoreApp,Version=v6.0", + "is_runtime": true, + "is_optional": false, + "is_pinned": true, + "is_direct": true, + "resolved_package": { + "type": "nuget", + "namespace": null, + "name": "Newtonsoft.Json", + "version": "13.0.1", + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": null, + "purl": "pkg:nuget/Newtonsoft.Json@13.0.1" + }, + "extra_data": {} + } + ], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "nuget_deps_json", + "purl": "pkg:nuget/MyApp@1.0.0" + }, + { + "type": "nuget", + "namespace": null, + "name": "Newtonsoft.Json", + "version": "13.0.1", + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "target_framework": ".NETCoreApp,Version=v6.0", + "type": "package" + }, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "nuget_deps_json", + "purl": "pkg:nuget/Newtonsoft.Json@13.0.1" + } +] \ No newline at end of file diff --git a/tests/packagedcode/data/nuget/deps_json/small_app.deps.json b/tests/packagedcode/data/nuget/deps_json/small_app.deps.json new file mode 100644 index 00000000000..5b76766a280 --- /dev/null +++ b/tests/packagedcode/data/nuget/deps_json/small_app.deps.json @@ -0,0 +1,54 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v8.0/linux-x64", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v8.0": { + "jellyfin/10.8.10": { + "dependencies": { + "MediaBrowser.Common": "10.8.10" + }, + "runtime": { + "jellyfin.dll": {} + } + }, + "MediaBrowser.Common/10.8.10": { + "dependencies": { + "Newtonsoft.Json": "13.0.3" + }, + "runtime": { + "MediaBrowser.Common.dll": {} + } + }, + "Newtonsoft.Json/13.0.3": { + "runtime": { + "lib/net6.0/Newtonsoft.Json.dll": { + "assemblyVersion": "13.0.0.0", + "fileVersion": "13.0.3.27908" + } + } + } + } + }, + "libraries": { + "jellyfin/10.8.10": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "MediaBrowser.Common/10.8.10": { + "type": "project", + "serviceable": false, + "sha512": "" + }, + "Newtonsoft.Json/13.0.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==", + "path": "newtonsoft.json/13.0.3", + "hashPath": "newtonsoft.json.13.0.3.nupkg.sha512" + } + } +} diff --git a/tests/packagedcode/data/nuget/deps_json/small_app.deps.json.ABOUT b/tests/packagedcode/data/nuget/deps_json/small_app.deps.json.ABOUT new file mode 100644 index 00000000000..3000f634377 --- /dev/null +++ b/tests/packagedcode/data/nuget/deps_json/small_app.deps.json.ABOUT @@ -0,0 +1,3 @@ +about_resource: small_app.deps.json +download_url: https://github.com/jellyfin/jellyfin/releases/download/v10.8.10/jellyfin_10.8.10_amd64.tar.gz +notes: Trimmed from the Jellyfin release to provide a smaller real-world .deps.json fixture. diff --git a/tests/packagedcode/data/nuget/deps_json/small_app.deps.json.expected b/tests/packagedcode/data/nuget/deps_json/small_app.deps.json.expected new file mode 100644 index 00000000000..29b87add83d --- /dev/null +++ b/tests/packagedcode/data/nuget/deps_json/small_app.deps.json.expected @@ -0,0 +1,253 @@ +[ + { + "type": "nuget", + "namespace": null, + "name": "jellyfin", + "version": "10.8.10", + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "target_framework": ".NETCoreApp,Version=v8.0", + "type": "project" + }, + "dependencies": [ + { + "purl": "pkg:nuget/MediaBrowser.Common@10.8.10", + "extracted_requirement": "10.8.10", + "scope": ".NETCoreApp,Version=v8.0", + "is_runtime": true, + "is_optional": false, + "is_pinned": true, + "is_direct": true, + "resolved_package": { + "type": "nuget", + "namespace": null, + "name": "MediaBrowser.Common", + "version": "10.8.10", + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": null, + "purl": "pkg:nuget/MediaBrowser.Common@10.8.10" + }, + "extra_data": {} + } + ], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "nuget_deps_json", + "purl": "pkg:nuget/jellyfin@10.8.10" + }, + { + "type": "nuget", + "namespace": null, + "name": "MediaBrowser.Common", + "version": "10.8.10", + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "target_framework": ".NETCoreApp,Version=v8.0", + "type": "project" + }, + "dependencies": [ + { + "purl": "pkg:nuget/Newtonsoft.Json@13.0.3", + "extracted_requirement": "13.0.3", + "scope": ".NETCoreApp,Version=v8.0", + "is_runtime": true, + "is_optional": false, + "is_pinned": true, + "is_direct": true, + "resolved_package": { + "type": "nuget", + "namespace": null, + "name": "Newtonsoft.Json", + "version": "13.0.3", + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": {}, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": null, + "purl": "pkg:nuget/Newtonsoft.Json@13.0.3" + }, + "extra_data": {} + } + ], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "nuget_deps_json", + "purl": "pkg:nuget/MediaBrowser.Common@10.8.10" + }, + { + "type": "nuget", + "namespace": null, + "name": "Newtonsoft.Json", + "version": "13.0.3", + "qualifiers": {}, + "subpath": null, + "primary_language": null, + "description": null, + "release_date": null, + "parties": [], + "keywords": [], + "homepage_url": null, + "download_url": null, + "size": null, + "sha1": null, + "md5": null, + "sha256": null, + "sha512": null, + "bug_tracking_url": null, + "code_view_url": null, + "vcs_url": null, + "copyright": null, + "holder": null, + "declared_license_expression": null, + "declared_license_expression_spdx": null, + "license_detections": [], + "other_license_expression": null, + "other_license_expression_spdx": null, + "other_license_detections": [], + "extracted_license_statement": null, + "notice_text": null, + "source_packages": [], + "file_references": [], + "is_private": false, + "is_virtual": false, + "extra_data": { + "target_framework": ".NETCoreApp,Version=v8.0", + "type": "package" + }, + "dependencies": [], + "repository_homepage_url": null, + "repository_download_url": null, + "api_data_url": null, + "datasource_id": "nuget_deps_json", + "purl": "pkg:nuget/Newtonsoft.Json@13.0.3" + } +] \ No newline at end of file diff --git a/tests/packagedcode/test_deps_json.py b/tests/packagedcode/test_deps_json.py deleted file mode 100644 index 3eafbce05d4..00000000000 --- a/tests/packagedcode/test_deps_json.py +++ /dev/null @@ -1,151 +0,0 @@ -import json -import os -import tempfile - -from packagedcode import nuget -from packages_test_utils import PackageTester - - -class TestDotNetDepsJson(PackageTester): - test_data_dir = os.path.join(os.path.dirname(__file__), 'data') - - def test_deps_json_is_datafile(self): - test_file = self.get_test_loc('nuget/deps_json/simple.deps.json') - assert nuget.DotNetDepsJsonHandler.is_datafile(test_file) - - def test_parse_simple_deps_json(self): - test_file = self.get_test_loc('nuget/deps_json/simple.deps.json') - packages = list(nuget.DotNetDepsJsonHandler.parse(test_file)) - - assert len(packages) == 2 - - # MyApp/1.0.0 - my_app_packages = [p for p in packages if p.name == 'MyApp'] - assert len(my_app_packages) == 1 - my_app = my_app_packages[0] - assert my_app.name == 'MyApp' - assert my_app.version == '1.0.0' - assert my_app.extra_data.get('type') == 'project' - assert my_app.extra_data.get('target_framework') == '.NETCoreApp,Version=v6.0' - - assert len(my_app.dependencies) == 1 - dep = my_app.dependencies[0] - assert dep.get('purl') == 'pkg:nuget/Newtonsoft.Json@13.0.1' - assert dep.get('extracted_requirement') == '13.0.1' - assert dep.get('is_pinned') is True - assert dep.get('is_direct') is True - - # Newtonsoft.Json/13.0.1 - json_packages = [p for p in packages if p.name == 'Newtonsoft.Json'] - assert len(json_packages) == 1 - json_pkg = json_packages[0] - assert json_pkg.name == 'Newtonsoft.Json' - assert json_pkg.version == '13.0.1' - assert json_pkg.extra_data.get('type') == 'package' - assert len(json_pkg.dependencies) == 0 - - - def test_parse_snoop_deps_json(self): - test_file = self.get_test_loc('nuget/deps_json/Snoop.Core.deps.json') - packages = list(nuget.DotNetDepsJsonHandler.parse(test_file)) - - # The Snoop file has 45 items in the "libraries" section - assert len(packages) == 45 - - # Check for the main project - snoop_pkgs = [p for p in packages if p.name == 'Snoop.Core'] - assert len(snoop_pkgs) == 1 - snoop = snoop_pkgs[0] - assert snoop.name == 'Snoop.Core' - assert snoop.version == '1.0.0' - # Snoop.Core has 7 dependencies listed - assert len(snoop.dependencies) == 7 - - # Check one known dependency from the list - jb_packages = [p for p in packages if p.name == 'JetBrains.Annotations'] - assert len(jb_packages) == 1 - jb = jb_packages[0] - assert jb.name == 'JetBrains.Annotations' - assert jb.version == '2023.2.0' - - - def test_parse_empty_libraries_deps_json(self): - fd, temp_path = tempfile.mkstemp(suffix='.deps.json') - with os.fdopen(fd, 'w') as f: - json.dump({ - "runtimeTarget": {"name": ".NETCoreApp,Version=v6.0"}, - "libraries": {} - }, f) - - try: - packages = list(nuget.DotNetDepsJsonHandler.parse(temp_path)) - assert len(packages) == 0 - finally: - os.remove(temp_path) - - def test_parse_without_runtime_target_uses_targets(self): - fd, temp_path = tempfile.mkstemp(suffix='.deps.json') - with os.fdopen(fd, 'w') as f: - json.dump({ - "targets": { - ".NETCoreApp,Version=v8.0": { - "App/1.0.0": { - "dependencies": { - "Newtonsoft.Json": "13.0.3" - } - }, - "Newtonsoft.Json/13.0.3": {} - } - }, - "libraries": { - "App/1.0.0": {"type": "project"}, - "Newtonsoft.Json/13.0.3": {"type": "package"} - } - }, f) - - try: - packages = list(nuget.DotNetDepsJsonHandler.parse(temp_path)) - assert len(packages) == 2 - - app = [p for p in packages if p.name == 'App'][0] - assert app.extra_data.get('target_framework') == '.NETCoreApp,Version=v8.0' - assert len(app.dependencies) == 1 - dependency = app.dependencies[0] - assert dependency.get('purl') == 'pkg:nuget/Newtonsoft.Json@13.0.3' - assert dependency.get('scope') == '.NETCoreApp,Version=v8.0' - finally: - os.remove(temp_path) - - def test_parse_runtime_target_mismatch_falls_back_to_targets(self): - fd, temp_path = tempfile.mkstemp(suffix='.deps.json') - with os.fdopen(fd, 'w') as f: - json.dump({ - "runtimeTarget": {"name": ".NETCoreApp,Version=v8.0/win-x64"}, - "targets": { - ".NETCoreApp,Version=v8.0": { - "App/1.0.0": { - "dependencies": { - "Serilog": "3.1.0" - } - }, - "Serilog/3.1.0": {} - } - }, - "libraries": { - "App/1.0.0": {"type": "project"}, - "Serilog/3.1.0": {"type": "package"} - } - }, f) - - try: - packages = list(nuget.DotNetDepsJsonHandler.parse(temp_path)) - assert len(packages) == 2 - - app = [p for p in packages if p.name == 'App'][0] - assert app.extra_data.get('target_framework') == '.NETCoreApp,Version=v8.0' - assert len(app.dependencies) == 1 - dependency = app.dependencies[0] - assert dependency.get('purl') == 'pkg:nuget/Serilog@3.1.0' - assert dependency.get('scope') == '.NETCoreApp,Version=v8.0' - finally: - os.remove(temp_path) diff --git a/tests/packagedcode/test_nuget.py b/tests/packagedcode/test_nuget.py index d3af13ab51b..c7182742a0b 100644 --- a/tests/packagedcode/test_nuget.py +++ b/tests/packagedcode/test_nuget.py @@ -7,7 +7,9 @@ # See https://aboutcode.org for more information about nexB OSS projects. # +import json import os +import tempfile from packagedcode import nuget from packages_test_utils import PackageTester @@ -72,3 +74,163 @@ def test_parse_nuget_package_lock_json(self): def test_package_lock_json_is_package_data_file(self): test_file = self.get_test_loc('nuget/packages.lock.json') assert nuget.NugetPackagesLockHandler.is_datafile(test_file) + + def test_deps_json_is_datafile(self): + test_file = self.get_test_loc('nuget/deps_json/simple.deps.json') + assert nuget.DotNetDepsJsonHandler.is_datafile(test_file) + + def test_parse_simple_deps_json(self): + test_file = self.get_test_loc('nuget/deps_json/simple.deps.json') + packages = nuget.DotNetDepsJsonHandler.parse(test_file) + expected_loc = self.get_test_loc('nuget/deps_json/simple.deps.json.expected') + self.check_packages_data(packages, expected_loc, regen=REGEN_TEST_FIXTURES) + + def test_parse_snoop_deps_json(self): + test_file = self.get_test_loc('nuget/deps_json/Snoop.Core.deps.json') + packages = nuget.DotNetDepsJsonHandler.parse(test_file) + expected_loc = self.get_test_loc('nuget/deps_json/Snoop.Core.deps.json.expected') + self.check_packages_data(packages, expected_loc, regen=REGEN_TEST_FIXTURES) + + def test_parse_small_app_deps_json(self): + test_file = self.get_test_loc('nuget/deps_json/small_app.deps.json') + packages = nuget.DotNetDepsJsonHandler.parse(test_file) + expected_loc = self.get_test_loc('nuget/deps_json/small_app.deps.json.expected') + self.check_packages_data(packages, expected_loc, regen=REGEN_TEST_FIXTURES) + + def test_parse_empty_libraries_deps_json(self): + fd, temp_path = tempfile.mkstemp(suffix='.deps.json') + with os.fdopen(fd, 'w') as f: + json.dump({ + "runtimeTarget": {"name": ".NETCoreApp,Version=v6.0"}, + "libraries": {} + }, f) + + try: + packages = list(nuget.DotNetDepsJsonHandler.parse(temp_path)) + assert len(packages) == 0 + finally: + os.remove(temp_path) + + def test_parse_without_runtime_target_uses_targets(self): + fd, temp_path = tempfile.mkstemp(suffix='.deps.json') + with os.fdopen(fd, 'w') as f: + json.dump({ + "targets": { + ".NETCoreApp,Version=v8.0": { + "App/1.0.0": { + "dependencies": { + "Newtonsoft.Json": "13.0.3" + } + }, + "Newtonsoft.Json/13.0.3": {} + } + }, + "libraries": { + "App/1.0.0": {"type": "project"}, + "Newtonsoft.Json/13.0.3": {"type": "package"} + } + }, f) + + try: + packages = list(nuget.DotNetDepsJsonHandler.parse(temp_path)) + assert len(packages) == 2 + + app = [p for p in packages if p.name == 'App'][0] + assert app.extra_data.get('target_framework') == '.NETCoreApp,Version=v8.0' + assert len(app.dependencies) == 1 + dependency = app.dependencies[0] + assert dependency.get('purl') == 'pkg:nuget/Newtonsoft.Json@13.0.3' + assert dependency.get('scope') == '.NETCoreApp,Version=v8.0' + assert dependency.get('resolved_package', {}).get('purl') == 'pkg:nuget/Newtonsoft.Json@13.0.3' + finally: + os.remove(temp_path) + + def test_parse_runtime_target_mismatch_falls_back_to_targets(self): + fd, temp_path = tempfile.mkstemp(suffix='.deps.json') + with os.fdopen(fd, 'w') as f: + json.dump({ + "runtimeTarget": {"name": ".NETCoreApp,Version=v8.0/win-x64"}, + "targets": { + ".NETCoreApp,Version=v8.0": { + "App/1.0.0": { + "dependencies": { + "Serilog": "3.1.0" + } + }, + "Serilog/3.1.0": {} + } + }, + "libraries": { + "App/1.0.0": {"type": "project"}, + "Serilog/3.1.0": {"type": "package"} + } + }, f) + + try: + packages = list(nuget.DotNetDepsJsonHandler.parse(temp_path)) + assert len(packages) == 2 + + app = [p for p in packages if p.name == 'App'][0] + assert app.extra_data.get('target_framework') == '.NETCoreApp,Version=v8.0' + assert len(app.dependencies) == 1 + dependency = app.dependencies[0] + assert dependency.get('purl') == 'pkg:nuget/Serilog@3.1.0' + assert dependency.get('scope') == '.NETCoreApp,Version=v8.0' + assert dependency.get('resolved_package', {}).get('purl') == 'pkg:nuget/Serilog@3.1.0' + finally: + os.remove(temp_path) + + def test_parse_without_runtime_target_merges_multiple_targets(self): + fd, temp_path = tempfile.mkstemp(suffix='.deps.json') + with os.fdopen(fd, 'w') as f: + json.dump({ + "targets": { + ".NETCoreApp,Version=v8.0": { + "App/1.0.0": { + "dependencies": { + "Newtonsoft.Json": "13.0.3" + } + }, + "Newtonsoft.Json/13.0.3": {} + }, + ".NETFramework,Version=v4.7.2": { + "App/1.0.0": { + "dependencies": { + "Serilog": "3.1.0" + } + }, + "Serilog/3.1.0": {} + } + }, + "libraries": { + "App/1.0.0": {"type": "project"}, + "Newtonsoft.Json/13.0.3": {"type": "package"}, + "Serilog/3.1.0": {"type": "package"} + } + }, f) + + try: + packages = list(nuget.DotNetDepsJsonHandler.parse(temp_path)) + assert len(packages) == 3 + + app = [p for p in packages if p.name == 'App'][0] + assert app.extra_data.get('target_frameworks') == [ + '.NETCoreApp,Version=v8.0', + '.NETFramework,Version=v4.7.2', + ] + + dependencies = sorted(app.dependencies, key=lambda dep: dep.get('purl')) + assert [dep.get('purl') for dep in dependencies] == [ + 'pkg:nuget/Newtonsoft.Json@13.0.3', + 'pkg:nuget/Serilog@3.1.0', + ] + assert [dep.get('scope') for dep in dependencies] == [ + '.NETCoreApp,Version=v8.0', + '.NETFramework,Version=v4.7.2', + ] + assert [dep.get('resolved_package', {}).get('purl') for dep in dependencies] == [ + 'pkg:nuget/Newtonsoft.Json@13.0.3', + 'pkg:nuget/Serilog@3.1.0', + ] + finally: + os.remove(temp_path)