dependabot-nuget 0.287.0 → 0.288.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/helpers/lib/NuGetUpdater/.gitignore +1 -0
- data/helpers/lib/NuGetUpdater/Directory.Build.targets +17 -0
- data/helpers/lib/NuGetUpdater/Directory.Packages.props +10 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs +7 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/RunCommand.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +72 -51
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalyzeWorker.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencyDiscovery.props +7 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencyDiscovery.targets +10 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +36 -19
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/PackagesConfigDiscovery.cs +6 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/PackagesConfigDiscoveryResult.cs +2 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/ProjectDiscoveryResult.cs +5 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs +386 -12
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/WorkspaceDiscoveryResult.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/ExperimentsManager.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/NuGetUpdater.Core.csproj +7 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Job.cs +23 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs +0 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/TargetFrameworkReporter.targets +13 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/LockFileUpdater.cs +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackageReferenceUpdater.cs +2 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/CollectionExtensions.cs +17 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +57 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathComparer.cs +31 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +30 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTests.cs +50 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +74 -38
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.PackagesConfig.cs +50 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Proj.cs +5 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs +728 -253
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +322 -78
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/ExpectedDiscoveryResults.cs +2 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/SdkProjectDiscoveryTests.cs +472 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/MockNuGetPackage.cs +46 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/NuGetUpdater.Core.Test.csproj +0 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/SerializationTests.cs +33 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TemporaryDirectory.cs +3 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +4 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/PathHelperTests.cs +3 -2
- data/lib/dependabot/nuget/file_parser.rb +7 -1
- data/lib/dependabot/nuget/native_discovery/native_discovery_json_reader.rb +0 -3
- data/lib/dependabot/nuget/native_discovery/native_workspace_discovery.rb +7 -10
- data/lib/dependabot/nuget/native_helpers.rb +13 -4
- metadata +12 -8
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DirectoryPackagesPropsDiscovery.cs +0 -69
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DirectoryPackagesPropsDiscoveryResult.cs +0 -11
- data/lib/dependabot/nuget/native_discovery/native_directory_packages_props_discovery.rb +0 -44
@@ -23,7 +23,7 @@ public class PathHelperTests
|
|
23
23
|
[Fact]
|
24
24
|
public void VerifyResolveCaseInsensitivePath()
|
25
25
|
{
|
26
|
-
var temp = new TemporaryDirectory();
|
26
|
+
using var temp = new TemporaryDirectory();
|
27
27
|
Directory.CreateDirectory(Path.Combine(temp.DirectoryPath, "src", "a"));
|
28
28
|
File.WriteAllText(Path.Combine(temp.DirectoryPath, "src", "a", "packages.config"), "");
|
29
29
|
|
@@ -31,6 +31,7 @@ public class PathHelperTests
|
|
31
31
|
|
32
32
|
var resolvedPath = PathHelper.ResolveCaseInsensitivePathInsideRepoRoot(Path.Combine(repoRootPath, "A", "PACKAGES.CONFIG"), repoRootPath);
|
33
33
|
|
34
|
-
|
34
|
+
var expected = Path.Combine(temp.DirectoryPath, "src", "a", "packages.config").NormalizePathToUnix();
|
35
|
+
Assert.Equal(expected, resolvedPath);
|
35
36
|
}
|
36
37
|
}
|
@@ -34,7 +34,8 @@ module Dependabot
|
|
34
34
|
discovery_json_path = NativeDiscoveryJsonReader.create_discovery_file_path_from_dependency_files(
|
35
35
|
dependency_files
|
36
36
|
)
|
37
|
-
NativeHelpers.run_nuget_discover_tool(
|
37
|
+
NativeHelpers.run_nuget_discover_tool(job_path: job_file_path,
|
38
|
+
repo_root: T.must(repo_contents_path),
|
38
39
|
workspace_path: workspace_path,
|
39
40
|
output_path: discovery_json_path,
|
40
41
|
credentials: credentials)
|
@@ -58,6 +59,11 @@ module Dependabot
|
|
58
59
|
|
59
60
|
private
|
60
61
|
|
62
|
+
sig { returns(String) }
|
63
|
+
def job_file_path
|
64
|
+
ENV.fetch("DEPENDABOT_JOB_PATH")
|
65
|
+
end
|
66
|
+
|
61
67
|
sig { returns(T::Array[Dependabot::DependencyFile]) }
|
62
68
|
def proj_files
|
63
69
|
projfile = /\.proj$/
|
@@ -159,9 +159,6 @@ module Dependabot
|
|
159
159
|
workspace_result.projects.each do |project|
|
160
160
|
dependency_set += project.dependency_set
|
161
161
|
end
|
162
|
-
if workspace_result.directory_packages_props
|
163
|
-
dependency_set += T.must(workspace_result.directory_packages_props).dependency_set
|
164
|
-
end
|
165
162
|
if workspace_result.dotnet_tools_json
|
166
163
|
dependency_set += T.must(workspace_result.dotnet_tools_json).dependency_set
|
167
164
|
end
|
@@ -2,7 +2,6 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require "dependabot/nuget/native_discovery/native_dependency_file_discovery"
|
5
|
-
require "dependabot/nuget/native_discovery/native_directory_packages_props_discovery"
|
6
5
|
require "dependabot/nuget/native_discovery/native_project_discovery"
|
7
6
|
require "dependabot/nuget/native_helpers"
|
8
7
|
require "sorbet-runtime"
|
@@ -21,9 +20,7 @@ module Dependabot
|
|
21
20
|
projects = T.let(json.fetch("Projects"), T::Array[T::Hash[String, T.untyped]]).filter_map do |project|
|
22
21
|
NativeProjectDiscovery.from_json(project, path)
|
23
22
|
end
|
24
|
-
|
25
|
-
.from_json(T.let(json.fetch("DirectoryPackagesProps"),
|
26
|
-
T.nilable(T::Hash[String, T.untyped])), path)
|
23
|
+
imported_files = T.let(json.fetch("ImportedFiles"), T::Array[String])
|
27
24
|
global_json = NativeDependencyFileDiscovery
|
28
25
|
.from_json(T.let(json.fetch("GlobalJson"), T.nilable(T::Hash[String, T.untyped])), path)
|
29
26
|
dotnet_tools_json = NativeDependencyFileDiscovery
|
@@ -32,7 +29,7 @@ module Dependabot
|
|
32
29
|
|
33
30
|
NativeWorkspaceDiscovery.new(path: path,
|
34
31
|
projects: projects,
|
35
|
-
|
32
|
+
imported_files: imported_files,
|
36
33
|
global_json: global_json,
|
37
34
|
dotnet_tools_json: dotnet_tools_json)
|
38
35
|
end
|
@@ -40,14 +37,14 @@ module Dependabot
|
|
40
37
|
sig do
|
41
38
|
params(path: String,
|
42
39
|
projects: T::Array[NativeProjectDiscovery],
|
43
|
-
|
40
|
+
imported_files: T::Array[String],
|
44
41
|
global_json: T.nilable(NativeDependencyFileDiscovery),
|
45
42
|
dotnet_tools_json: T.nilable(NativeDependencyFileDiscovery)).void
|
46
43
|
end
|
47
|
-
def initialize(path:, projects:,
|
44
|
+
def initialize(path:, projects:, imported_files:, global_json:, dotnet_tools_json:)
|
48
45
|
@path = path
|
49
46
|
@projects = projects
|
50
|
-
@
|
47
|
+
@imported_files = imported_files
|
51
48
|
@global_json = global_json
|
52
49
|
@dotnet_tools_json = dotnet_tools_json
|
53
50
|
end
|
@@ -58,8 +55,8 @@ module Dependabot
|
|
58
55
|
sig { returns(T::Array[NativeProjectDiscovery]) }
|
59
56
|
attr_reader :projects
|
60
57
|
|
61
|
-
sig { returns(T
|
62
|
-
attr_reader :
|
58
|
+
sig { returns(T::Array[String]) }
|
59
|
+
attr_reader :imported_files
|
63
60
|
|
64
61
|
sig { returns(T.nilable(NativeDependencyFileDiscovery)) }
|
65
62
|
attr_reader :global_json
|
@@ -54,13 +54,20 @@ module Dependabot
|
|
54
54
|
end
|
55
55
|
|
56
56
|
sig do
|
57
|
-
params(
|
57
|
+
params(
|
58
|
+
job_path: String,
|
59
|
+
repo_root: String,
|
60
|
+
workspace_path: String,
|
61
|
+
output_path: String
|
62
|
+
).returns([String, String])
|
58
63
|
end
|
59
|
-
def self.get_nuget_discover_tool_command(repo_root:, workspace_path:, output_path:)
|
64
|
+
def self.get_nuget_discover_tool_command(job_path:, repo_root:, workspace_path:, output_path:)
|
60
65
|
exe_path = File.join(native_helpers_root, "NuGetUpdater", "NuGetUpdater.Cli")
|
61
66
|
command_parts = [
|
62
67
|
exe_path,
|
63
68
|
"discover",
|
69
|
+
"--job-path",
|
70
|
+
job_path,
|
64
71
|
"--repo-root",
|
65
72
|
repo_root,
|
66
73
|
"--workspace",
|
@@ -87,14 +94,16 @@ module Dependabot
|
|
87
94
|
|
88
95
|
sig do
|
89
96
|
params(
|
97
|
+
job_path: String,
|
90
98
|
repo_root: String,
|
91
99
|
workspace_path: String,
|
92
100
|
output_path: String,
|
93
101
|
credentials: T::Array[Dependabot::Credential]
|
94
102
|
).void
|
95
103
|
end
|
96
|
-
def self.run_nuget_discover_tool(repo_root:, workspace_path:, output_path:, credentials:)
|
97
|
-
(command, fingerprint) = get_nuget_discover_tool_command(
|
104
|
+
def self.run_nuget_discover_tool(job_path:, repo_root:, workspace_path:, output_path:, credentials:)
|
105
|
+
(command, fingerprint) = get_nuget_discover_tool_command(job_path: job_path,
|
106
|
+
repo_root: repo_root,
|
98
107
|
workspace_path: workspace_path,
|
99
108
|
output_path: output_path)
|
100
109
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dependabot-nuget
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.288.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dependabot-common
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.288.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.288.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubyzip
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -266,6 +266,7 @@ files:
|
|
266
266
|
- helpers/lib/NuGetUpdater/.editorconfig
|
267
267
|
- helpers/lib/NuGetUpdater/.gitignore
|
268
268
|
- helpers/lib/NuGetUpdater/Directory.Build.props
|
269
|
+
- helpers/lib/NuGetUpdater/Directory.Build.targets
|
269
270
|
- helpers/lib/NuGetUpdater/Directory.Common.props
|
270
271
|
- helpers/lib/NuGetUpdater/Directory.Packages.props
|
271
272
|
- helpers/lib/NuGetUpdater/NuGetProjects/Directory.Build.props
|
@@ -321,6 +322,7 @@ files:
|
|
321
322
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs
|
322
323
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs
|
323
324
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/ExpectedDiscoveryResults.cs
|
325
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/SdkProjectDiscoveryTests.cs
|
324
326
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/DotNetToolsJsonBuildFileTests.cs
|
325
327
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/GlobalJsonBuildFileTests.cs
|
326
328
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/PackagesConfigBuildFileTests.cs
|
@@ -376,9 +378,9 @@ files:
|
|
376
378
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Clone/IGitCommandHandler.cs
|
377
379
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Clone/ShellGitCommandHandler.cs
|
378
380
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Dependency.cs
|
381
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencyDiscovery.props
|
382
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencyDiscovery.targets
|
379
383
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencyType.cs
|
380
|
-
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DirectoryPackagesPropsDiscovery.cs
|
381
|
-
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DirectoryPackagesPropsDiscoveryResult.cs
|
382
384
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs
|
383
385
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DotNetToolsJsonDiscovery.cs
|
384
386
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DotNetToolsJsonDiscoveryResult.cs
|
@@ -433,6 +435,7 @@ files:
|
|
433
435
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/IApiHandler.cs
|
434
436
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunResult.cs
|
435
437
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs
|
438
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/TargetFrameworkReporter.targets
|
436
439
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/UpdateNotPossibleException.cs
|
437
440
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs
|
438
441
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectResolver.cs
|
@@ -447,6 +450,7 @@ files:
|
|
447
450
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs
|
448
451
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/WebApplicationTargetsConditionPatcher.cs
|
449
452
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/XmlFilePreAndPostProcessor.cs
|
453
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/CollectionExtensions.cs
|
450
454
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ConsoleLogger.cs
|
451
455
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/DependencyConflictResolver.cs
|
452
456
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/HashSetExtensions.cs
|
@@ -455,6 +459,7 @@ files:
|
|
455
459
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/JsonHelper.cs
|
456
460
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs
|
457
461
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/NuGetHelper.cs
|
462
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathComparer.cs
|
458
463
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs
|
459
464
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ProcessExtensions.cs
|
460
465
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/XmlExtensions.cs
|
@@ -482,7 +487,6 @@ files:
|
|
482
487
|
- lib/dependabot/nuget/metadata_finder.rb
|
483
488
|
- lib/dependabot/nuget/native_discovery/native_dependency_details.rb
|
484
489
|
- lib/dependabot/nuget/native_discovery/native_dependency_file_discovery.rb
|
485
|
-
- lib/dependabot/nuget/native_discovery/native_directory_packages_props_discovery.rb
|
486
490
|
- lib/dependabot/nuget/native_discovery/native_discovery_json_reader.rb
|
487
491
|
- lib/dependabot/nuget/native_discovery/native_evaluation_details.rb
|
488
492
|
- lib/dependabot/nuget/native_discovery/native_project_discovery.rb
|
@@ -511,7 +515,7 @@ licenses:
|
|
511
515
|
- MIT
|
512
516
|
metadata:
|
513
517
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
514
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
518
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.288.0
|
515
519
|
post_install_message:
|
516
520
|
rdoc_options: []
|
517
521
|
require_paths:
|
@@ -1,69 +0,0 @@
|
|
1
|
-
using System.Collections.Immutable;
|
2
|
-
|
3
|
-
namespace NuGetUpdater.Core.Discover;
|
4
|
-
|
5
|
-
internal static class DirectoryPackagesPropsDiscovery
|
6
|
-
{
|
7
|
-
public static DirectoryPackagesPropsDiscoveryResult? Discover(string repoRootPath, string workspacePath, ImmutableArray<ProjectDiscoveryResult> projectResults, ILogger logger)
|
8
|
-
{
|
9
|
-
var projectResult = projectResults.FirstOrDefault(
|
10
|
-
p => p.Properties.FirstOrDefault(prop => prop.Name.Equals("ManagePackageVersionsCentrally", StringComparison.OrdinalIgnoreCase)) is Property property
|
11
|
-
&& string.Equals(property.Value, "true", StringComparison.OrdinalIgnoreCase));
|
12
|
-
if (projectResult is null)
|
13
|
-
{
|
14
|
-
logger.Log(" Central Package Management is not enabled.");
|
15
|
-
return null;
|
16
|
-
}
|
17
|
-
|
18
|
-
var projectFilePath = Path.GetFullPath(projectResult.FilePath, workspacePath);
|
19
|
-
if (!MSBuildHelper.TryGetDirectoryPackagesPropsPath(repoRootPath, projectFilePath, out var directoryPackagesPropsPath))
|
20
|
-
{
|
21
|
-
logger.Log(" No Directory.Packages.props file found.");
|
22
|
-
return null;
|
23
|
-
}
|
24
|
-
|
25
|
-
var relativeDirectoryPackagesPropsPath = Path.GetRelativePath(workspacePath, directoryPackagesPropsPath);
|
26
|
-
var directoryPackagesPropsFile = projectResults.FirstOrDefault(p => p.FilePath.Equals(relativeDirectoryPackagesPropsPath, StringComparison.OrdinalIgnoreCase));
|
27
|
-
if (directoryPackagesPropsFile is null)
|
28
|
-
{
|
29
|
-
logger.Log($" No project file found for [{relativeDirectoryPackagesPropsPath}].");
|
30
|
-
return null;
|
31
|
-
}
|
32
|
-
|
33
|
-
logger.Log($" Discovered [{directoryPackagesPropsFile.FilePath}] file.");
|
34
|
-
|
35
|
-
var isTransitivePinningEnabled = projectResult.Properties.FirstOrDefault(prop => prop.Name.Equals("EnableTransitivePinning", StringComparison.OrdinalIgnoreCase)) is Property property
|
36
|
-
&& string.Equals(property.Value, "true", StringComparison.OrdinalIgnoreCase);
|
37
|
-
var properties = projectResult.Properties.ToImmutableDictionary(p => p.Name, StringComparer.OrdinalIgnoreCase);
|
38
|
-
var dependencies = GetDependencies(workspacePath, directoryPackagesPropsPath, properties)
|
39
|
-
.OrderBy(d => d.Name)
|
40
|
-
.ToImmutableArray();
|
41
|
-
|
42
|
-
return new()
|
43
|
-
{
|
44
|
-
FilePath = directoryPackagesPropsFile.FilePath,
|
45
|
-
IsTransitivePinningEnabled = isTransitivePinningEnabled,
|
46
|
-
Dependencies = dependencies,
|
47
|
-
};
|
48
|
-
}
|
49
|
-
|
50
|
-
private static IEnumerable<Dependency> GetDependencies(string workspacePath, string directoryPackagesPropsPath, ImmutableDictionary<string, Property> properties)
|
51
|
-
{
|
52
|
-
var dependencies = ProjectBuildFile.Open(workspacePath, directoryPackagesPropsPath).GetDependencies();
|
53
|
-
return dependencies.Select(d =>
|
54
|
-
{
|
55
|
-
if (d.Version == null)
|
56
|
-
{
|
57
|
-
return d;
|
58
|
-
}
|
59
|
-
|
60
|
-
var evaluation = MSBuildHelper.GetEvaluatedValue(d.Version, properties);
|
61
|
-
return d with
|
62
|
-
{
|
63
|
-
Version = evaluation.EvaluatedValue,
|
64
|
-
EvaluationResult = evaluation,
|
65
|
-
IsDirect = true,
|
66
|
-
};
|
67
|
-
});
|
68
|
-
}
|
69
|
-
}
|
data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DirectoryPackagesPropsDiscoveryResult.cs
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
using System.Collections.Immutable;
|
2
|
-
|
3
|
-
namespace NuGetUpdater.Core.Discover;
|
4
|
-
|
5
|
-
public sealed record DirectoryPackagesPropsDiscoveryResult : IDiscoveryResultWithDependencies
|
6
|
-
{
|
7
|
-
public required string FilePath { get; init; }
|
8
|
-
public bool IsSuccess { get; init; } = true;
|
9
|
-
public bool IsTransitivePinningEnabled { get; init; }
|
10
|
-
public ImmutableArray<Dependency> Dependencies { get; init; }
|
11
|
-
}
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# typed: strong
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "dependabot/nuget/native_discovery/native_dependency_details"
|
5
|
-
require "sorbet-runtime"
|
6
|
-
|
7
|
-
module Dependabot
|
8
|
-
module Nuget
|
9
|
-
class NativeDirectoryPackagesPropsDiscovery < NativeDependencyFileDiscovery
|
10
|
-
extend T::Sig
|
11
|
-
|
12
|
-
sig do
|
13
|
-
override.params(json: T.nilable(T::Hash[String, T.untyped]),
|
14
|
-
directory: String).returns(T.nilable(NativeDirectoryPackagesPropsDiscovery))
|
15
|
-
end
|
16
|
-
def self.from_json(json, directory)
|
17
|
-
return nil if json.nil?
|
18
|
-
|
19
|
-
file_path = File.join(directory, T.let(json.fetch("FilePath"), String))
|
20
|
-
is_transitive_pinning_enabled = T.let(json.fetch("IsTransitivePinningEnabled"), T::Boolean)
|
21
|
-
dependencies = T.let(json.fetch("Dependencies"), T::Array[T::Hash[String, T.untyped]]).map do |dep|
|
22
|
-
NativeDependencyDetails.from_json(dep)
|
23
|
-
end
|
24
|
-
|
25
|
-
NativeDirectoryPackagesPropsDiscovery.new(file_path: file_path,
|
26
|
-
is_transitive_pinning_enabled: is_transitive_pinning_enabled,
|
27
|
-
dependencies: dependencies)
|
28
|
-
end
|
29
|
-
|
30
|
-
sig do
|
31
|
-
params(file_path: String,
|
32
|
-
is_transitive_pinning_enabled: T::Boolean,
|
33
|
-
dependencies: T::Array[NativeDependencyDetails]).void
|
34
|
-
end
|
35
|
-
def initialize(file_path:, is_transitive_pinning_enabled:, dependencies:)
|
36
|
-
super(file_path: file_path, dependencies: dependencies)
|
37
|
-
@is_transitive_pinning_enabled = is_transitive_pinning_enabled
|
38
|
-
end
|
39
|
-
|
40
|
-
sig { returns(T::Boolean) }
|
41
|
-
attr_reader :is_transitive_pinning_enabled
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|