dependabot-nuget 0.295.0 → 0.296.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ac3a95f5211adff79f8e7954308a4d3656b63c8be20b70a7b6f129f04402881
4
- data.tar.gz: a79771c0cc6c0a08bfaa2a7cef8253902c7e8b92b868568c231064098ba77a1c
3
+ metadata.gz: 22109eb4de3c3d7317682ad493e6162a7af4328e07751a27c8dbb48978597ef3
4
+ data.tar.gz: 9a8afdc613b3313c7e08ac3967c4abd311a6eb66a662022677bed40229e52d3b
5
5
  SHA512:
6
- metadata.gz: 800097bc4856927e983da508d16b4e6d0fd75cf40b5ca5ed25901fbb467f0f99e8f8dc724341c0da6cc6126303c6437a5bd8c7521132c3363ed752181402ee1b
7
- data.tar.gz: c0a1675e7cdf06ec0314d58092de09d633fa46892ae8f01c20ec74553d756265fda431434babb6eb140184b3380b78576f6309c1ec010f41e0e09e6ad6b28adb
6
+ metadata.gz: fe8805919ec14b5bf6385d4bb4ff3a1dc00137fc08c1e002d8c3db0600c4e5c2e8e86319d3e40fe4c608d29229834c3c741fa8a262b3e8d9f9c8e21755cf9029
7
+ data.tar.gz: d0b247df044695e253e08ed9cabbdea0341ff9234ca601c61fc48d2f13ac138ffce51683ebf45ed37478190750a791bacbc3308ab0a69e3cff70e61cffb8576a
@@ -62,9 +62,13 @@ public record ExperimentsManager
62
62
  return false;
63
63
  }
64
64
 
65
- if (experiments.TryGetValue(experimentName, out var value))
65
+ // prefer experiments named with underscores, but hyphens are also allowed as an alternate
66
+ object? experimentValue;
67
+ var experimentNameAlternate = experimentName.Replace("_", "-");
68
+ if (experiments.TryGetValue(experimentName, out experimentValue) ||
69
+ experiments.TryGetValue(experimentNameAlternate, out experimentValue))
66
70
  {
67
- if ((value?.ToString() ?? "").Equals("true", StringComparison.OrdinalIgnoreCase))
71
+ if ((experimentValue?.ToString() ?? "").Equals("true", StringComparison.OrdinalIgnoreCase))
68
72
  {
69
73
  return true;
70
74
  }
@@ -924,7 +924,7 @@ internal static partial class MSBuildHelper
924
924
  ThrowOnUnauthenticatedFeed(output);
925
925
  ThrowOnMissingFile(output);
926
926
  ThrowOnMissingPackages(output);
927
- ThrowOnUnresolvableDependencies(output);
927
+ ThrowOnUpdateNotPossible(output);
928
928
  }
929
929
 
930
930
  private static void ThrowOnUnauthenticatedFeed(string stdout)
@@ -962,13 +962,20 @@ internal static partial class MSBuildHelper
962
962
  }
963
963
  }
964
964
 
965
- private static void ThrowOnUnresolvableDependencies(string output)
965
+ private static void ThrowOnUpdateNotPossible(string output)
966
966
  {
967
- var unresolvablePackagePattern = new Regex(@"Unable to resolve dependencies\. '(?<PackageName>[^ ]+) (?<PackageVersion>[^']+)'");
968
- var match = unresolvablePackagePattern.Match(output);
969
- if (match.Success)
967
+ var patterns = new[]
970
968
  {
971
- throw new UpdateNotPossibleException([$"{match.Groups["PackageName"].Value}.{match.Groups["PackageVersion"].Value}"]);
969
+ new Regex(@"Unable to resolve dependencies\. '(?<PackageName>[^ ]+) (?<PackageVersion>[^']+)'"),
970
+ new Regex(@"Could not install package '(?<PackageName>[^ ]+) (?<PackageVersion>[^']+)'. You are trying to install this package"),
971
+ new Regex(@"Unable to find a version of '[^']+' that is compatible with '[^ ]+ [^ ]+ constraint: (?<PackageName>[^ ]+) \([^ ]+ (?<PackageVersion>[^)]+)\)'"),
972
+ new Regex(@"the following error\(s\) may be blocking the current package operation: '(?<PackageName>[^ ]+) (?<PackageVersion>[^ ]+) constraint:"),
973
+ };
974
+ var matches = patterns.Select(p => p.Match(output)).Where(m => m.Success);
975
+ if (matches.Any())
976
+ {
977
+ var packages = matches.Select(m => $"{m.Groups["PackageName"].Value}.{m.Groups["PackageVersion"].Value}").Distinct().ToArray();
978
+ throw new UpdateNotPossibleException(packages);
972
979
  }
973
980
  }
974
981
 
@@ -227,6 +227,36 @@ public class SerializationTests
227
227
  Assert.False(experimentsManager.UseDirectDiscovery);
228
228
  }
229
229
 
230
+ [Fact]
231
+ public void DeserializeExperimentsManager_AlternateNames()
232
+ {
233
+ // experiment names can be either snake case or kebab case
234
+ var jobWrapper = RunWorker.Deserialize("""
235
+ {
236
+ "job": {
237
+ "package-manager": "nuget",
238
+ "allowed-updates": [
239
+ {
240
+ "update-type": "all"
241
+ }
242
+ ],
243
+ "source": {
244
+ "provider": "github",
245
+ "repo": "some-org/some-repo",
246
+ "directory": "some-dir"
247
+ },
248
+ "experiments": {
249
+ "nuget-legacy-dependency-solver": true,
250
+ "nuget-use-direct-discovery": true
251
+ }
252
+ }
253
+ }
254
+ """);
255
+ var experimentsManager = ExperimentsManager.GetExperimentsManager(jobWrapper.Job.Experiments);
256
+ Assert.True(experimentsManager.UseLegacyDependencySolver);
257
+ Assert.True(experimentsManager.UseDirectDiscovery);
258
+ }
259
+
230
260
  [Theory]
231
261
  [MemberData(nameof(DeserializeErrorTypesData))]
232
262
  public void SerializeError(JobErrorBase error, string expectedSerialization)
@@ -1450,6 +1450,30 @@ public class MSBuildHelperTests : TestBase
1450
1450
  // expectedError
1451
1451
  new UpdateNotPossible(["Some.Package.1.2.3"]),
1452
1452
  ];
1453
+
1454
+ yield return
1455
+ [
1456
+ // output
1457
+ "Could not install package 'Some.Package 1.2.3'. You are trying to install this package into a project that targets 'SomeFramework'",
1458
+ // expectedError
1459
+ new UpdateNotPossible(["Some.Package.1.2.3"]),
1460
+ ];
1461
+
1462
+ yield return
1463
+ [
1464
+ // output
1465
+ "Unable to find a version of 'Some.Package' that is compatible with 'Some.Other.Package 4.5.6 constraint: Some.Package (>= 1.2.3)'",
1466
+ // expectedError
1467
+ new UpdateNotPossible(["Some.Package.1.2.3"]),
1468
+ ];
1469
+
1470
+ yield return
1471
+ [
1472
+ // output
1473
+ "the following error(s) may be blocking the current package operation: 'Some.Package 1.2.3 constraint: Some.Other.Package (>= 4.5.6)'",
1474
+ // expectedError
1475
+ new UpdateNotPossible(["Some.Package.1.2.3"]),
1476
+ ];
1453
1477
  }
1454
1478
 
1455
1479
  public static IEnumerable<object[]> GetTopLevelPackageDependencyInfosTestData()
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.295.0
4
+ version: 0.296.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-01-30 00:00:00.000000000 Z
11
+ date: 2025-02-06 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.295.0
19
+ version: 0.296.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.295.0
26
+ version: 0.296.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rubyzip
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -529,7 +529,7 @@ licenses:
529
529
  - MIT
530
530
  metadata:
531
531
  bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
532
- changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.295.0
532
+ changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.296.0
533
533
  post_install_message:
534
534
  rdoc_options: []
535
535
  require_paths: