dependabot-nuget 0.297.2 → 0.299.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,6 +17,7 @@ public class UpdatedDependencyListTests
17
17
  Directory.CreateDirectory(Path.Combine(temp.DirectoryPath, "src", "a"));
18
18
  Directory.CreateDirectory(Path.Combine(temp.DirectoryPath, "src", "b"));
19
19
  Directory.CreateDirectory(Path.Combine(temp.DirectoryPath, "src", "c"));
20
+ Directory.CreateDirectory(Path.Combine(temp.DirectoryPath, ".config"));
20
21
 
21
22
  File.WriteAllText(Path.Combine(temp.DirectoryPath, "src", "a", "packages.config"), "");
22
23
  File.WriteAllText(Path.Combine(temp.DirectoryPath, "src", "b", "packages.config"), "");
@@ -25,6 +26,9 @@ public class UpdatedDependencyListTests
25
26
  File.WriteAllText(Path.Combine(temp.DirectoryPath, "src", "b", "project.csproj"), "");
26
27
  File.WriteAllText(Path.Combine(temp.DirectoryPath, "src", "c", "project.csproj"), "");
27
28
 
29
+ File.WriteAllText(Path.Combine(temp.DirectoryPath, "global.json"), "");
30
+ File.WriteAllText(Path.Combine(temp.DirectoryPath, ".config/dotnet-tools.json"), "");
31
+
28
32
  var discovery = new WorkspaceDiscoveryResult()
29
33
  {
30
34
  Path = "src",
@@ -69,13 +73,55 @@ public class UpdatedDependencyListTests
69
73
  ImportedFiles = [],
70
74
  AdditionalFiles = ["packages.config"],
71
75
  }
72
- ]
76
+ ],
77
+ GlobalJson = new()
78
+ {
79
+ FilePath = "../global.json",
80
+ Dependencies = [
81
+ new("Some.MSBuild.Sdk", "1.0.0", DependencyType.MSBuildSdk)
82
+ ]
83
+ },
84
+ DotNetToolsJson = new()
85
+ {
86
+ FilePath = "../.config/dotnet-tools.json",
87
+ Dependencies = [
88
+ new("some-tool", "2.0.0", DependencyType.DotNetTool)
89
+ ]
90
+ }
73
91
  };
74
92
  var updatedDependencyList = RunWorker.GetUpdatedDependencyListFromDiscovery(discovery, pathToContents: temp.DirectoryPath);
75
93
  var expectedDependencyList = new UpdatedDependencyList()
76
94
  {
77
95
  Dependencies =
78
96
  [
97
+ new ReportedDependency()
98
+ {
99
+ Name = "some-tool",
100
+ Version = "2.0.0",
101
+ Requirements =
102
+ [
103
+ new ReportedRequirement()
104
+ {
105
+ Requirement = "2.0.0",
106
+ File = "/.config/dotnet-tools.json",
107
+ Groups = ["dependencies"],
108
+ }
109
+ ]
110
+ },
111
+ new ReportedDependency()
112
+ {
113
+ Name = "Some.MSBuild.Sdk",
114
+ Version = "1.0.0",
115
+ Requirements =
116
+ [
117
+ new ReportedRequirement()
118
+ {
119
+ Requirement = "1.0.0",
120
+ File = "/global.json",
121
+ Groups = ["dependencies"],
122
+ }
123
+ ]
124
+ },
79
125
  new ReportedDependency()
80
126
  {
81
127
  Name = "Microsoft.Extensions.DependencyModel",
@@ -119,7 +165,7 @@ public class UpdatedDependencyListTests
119
165
  ],
120
166
  },
121
167
  ],
122
- DependencyFiles = ["/src/a/packages.config", "/src/a/project.csproj", "/src/b/packages.config", "/src/b/project.csproj", "/src/c/packages.config", "/src/c/project.csproj"],
168
+ DependencyFiles = ["/.config/dotnet-tools.json", "/global.json", "/src/a/packages.config", "/src/a/project.csproj", "/src/b/packages.config", "/src/b/project.csproj", "/src/c/packages.config", "/src/c/project.csproj"],
123
169
  };
124
170
 
125
171
  // doing JSON comparison makes this easier; we don't have to define custom record equality and we get an easy diff
@@ -0,0 +1,23 @@
1
+ using System.Text.RegularExpressions;
2
+
3
+ using Xunit;
4
+
5
+ using static NuGetUpdater.Core.Utilities.EOLHandling;
6
+
7
+ namespace NuGetUpdater.Core.Test.Utilities
8
+ {
9
+ public class EOLHandlingTests
10
+ {
11
+ [Theory]
12
+ [InlineData(EOLType.LF, "\n")]
13
+ [InlineData(EOLType.CR, "\r")]
14
+ [InlineData(EOLType.CRLF, "\r\n")]
15
+ public void ValidateEOLNormalizesFromLF(EOLType eolType, string literal)
16
+ {
17
+ var teststring = "this\ris\na\r\nstring\rwith\nmixed\r\nline\rendings\n.";
18
+ var changed = teststring.SetEOL(eolType);
19
+ var lineEndings = Regex.Split(changed, "\\S+");
20
+ Assert.All(lineEndings, lineEnding => lineEnding.Equals(literal));
21
+ }
22
+ }
23
+ }
@@ -1542,6 +1542,14 @@ public class MSBuildHelperTests : TestBase
1542
1542
  new DependencyNotFound("Some.Package"),
1543
1543
  ];
1544
1544
 
1545
+ yield return
1546
+ [
1547
+ // output
1548
+ """error : Could not resolve SDK "missing-sdk".""",
1549
+ // expectedError
1550
+ new DependencyNotFound("missing-sdk"),
1551
+ ];
1552
+
1545
1553
  yield return
1546
1554
  [
1547
1555
  // output
@@ -26,6 +26,7 @@ module Dependabot
26
26
 
27
27
  sig { override.returns(T::Array[DependencyFile]) }
28
28
  def fetch_files
29
+ NativeHelpers.normalize_file_names
29
30
  NativeHelpers.install_dotnet_sdks
30
31
  discovery_json_reader = DiscoveryJsonReader.run_discovery_in_directory(
31
32
  repo_contents_path: T.must(repo_contents_path),
@@ -286,6 +286,22 @@ module Dependabot
286
286
  end
287
287
  end
288
288
 
289
+ sig { void }
290
+ def self.normalize_file_names
291
+ # environment variables are required and the following will generate an actionable error message if they're not
292
+ _dependabot_repo_contents_path = ENV.fetch("DEPENDABOT_REPO_CONTENTS_PATH")
293
+
294
+ # this environment variable is directly used
295
+ dependabot_home = ENV.fetch("DEPENDABOT_HOME")
296
+
297
+ command = [
298
+ "pwsh",
299
+ "#{dependabot_home}/dependabot-updater/bin/normalize-file-names.ps1"
300
+ ].join(" ")
301
+ output = SharedHelpers.run_shell_command(command)
302
+ puts output
303
+ end
304
+
289
305
  sig { void }
290
306
  def self.install_dotnet_sdks
291
307
  return unless Dependabot::Experiments.enabled?(:nuget_install_dotnet_sdks)
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.297.2
4
+ version: 0.299.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-19 00:00:00.000000000 Z
11
+ date: 2025-02-27 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.297.2
19
+ version: 0.299.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.297.2
26
+ version: 0.299.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rubyzip
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -375,6 +375,7 @@ files:
375
375
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs
376
376
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/AssertEx.cs
377
377
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/DiffUtil.cs
378
+ - helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/EOLHandlingTests.cs
378
379
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/JsonHelperTests.cs
379
380
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/LinuxOnlyAttribute.cs
380
381
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs
@@ -493,6 +494,7 @@ files:
493
494
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ConsoleLogger.cs
494
495
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/DependencyConflictResolver.cs
495
496
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/DotNetPackageCorrelationManager.cs
497
+ - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/EOLHandling.cs
496
498
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/HashSetExtensions.cs
497
499
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ILogger.cs
498
500
  - helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ImmutableArrayExtensions.cs
@@ -535,7 +537,7 @@ licenses:
535
537
  - MIT
536
538
  metadata:
537
539
  bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
538
- changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.297.2
540
+ changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.299.0
539
541
  post_install_message:
540
542
  rdoc_options: []
541
543
  require_paths: