dependabot-nuget 0.280.0 → 0.282.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/Directory.Common.props +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/AnalyzeCommand.cs +4 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs +4 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/FrameworkCheckCommand.cs +4 -7
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/RunCommand.cs +4 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/UpdateCommand.cs +3 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Analyze.cs +0 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.FrameworkCheck.cs +0 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Run.cs +1 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +3 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalyzeWorker.cs +9 -9
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/CompatabilityChecker.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/DependencyFinder.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/NuGetContext.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/VersionFinder.cs +5 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DirectoryPackagesPropsDiscovery.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +3 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DotNetToolsJsonDiscovery.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/GlobalJsonDiscovery.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/PackagesConfigDiscovery.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/ErrorType.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/DotNetToolsJsonBuildFile.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/GlobalJsonBuildFile.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/JsonBuildFile.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/CompatabilityChecker.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs +16 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/DotNetToolsJsonUpdater.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/GlobalJsonUpdater.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/LockFileUpdater.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/{SdkPackageUpdater.cs → PackageReferenceUpdater.cs} +97 -37
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackagesConfigUpdater.cs +26 -10
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +12 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ConsoleLogger.cs +9 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/DependencyConflictResolver.cs +14 -16
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ILogger.cs +6 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +25 -23
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/NuGetHelper.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTestBase.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTests.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/CompatibilityCheckerTests.cs +7 -7
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/DependencySolverEnvironment.cs +12 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/DotNetToolsJsonBuildFileTests.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/GlobalJsonBuildFileTests.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/CompatibilityCheckerFacts.cs +4 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestLogger.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/ExpectedUpdateOperationResult.cs +8 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/PackagesConfigUpdaterTests.cs +3 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +14 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DirsProj.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Mixed.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/{UpdateWorkerTests.Sdk.cs → UpdateWorkerTests.PackageReference.cs} +200 -23
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +221 -8
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +56 -18
- data/lib/dependabot/nuget/file_fetcher.rb +58 -21
- data/lib/dependabot/nuget/file_updater.rb +1 -0
- data/lib/dependabot/nuget/native_helpers.rb +10 -16
- metadata +19 -15
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/Logger.cs +0 -21
@@ -442,9 +442,9 @@ public class MSBuildHelperTests : TestBase
|
|
442
442
|
}
|
443
443
|
|
444
444
|
[Fact]
|
445
|
-
public async Task
|
445
|
+
public async Task DependencyConflictsCanBeResolvedWithBruteForce()
|
446
446
|
{
|
447
|
-
var repoRoot = Directory.CreateTempSubdirectory($"test_{nameof(
|
447
|
+
var repoRoot = Directory.CreateTempSubdirectory($"test_{nameof(DependencyConflictsCanBeResolvedWithBruteForce)}_");
|
448
448
|
MockNuGetPackage[] testPackages =
|
449
449
|
[
|
450
450
|
// some base packages
|
@@ -483,7 +483,7 @@ public class MSBuildHelperTests : TestBase
|
|
483
483
|
{
|
484
484
|
new Dependency("Some.Other.Package", "1.2.0", DependencyType.PackageReference),
|
485
485
|
};
|
486
|
-
var resolvedDependencies = await MSBuildHelper.
|
486
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflictsWithBruteForce(repoRoot.FullName, projectPath, "net8.0", dependencies, new TestLogger());
|
487
487
|
Assert.NotNull(resolvedDependencies);
|
488
488
|
Assert.Equal(2, resolvedDependencies.Length);
|
489
489
|
Assert.Equal("Some.Package", resolvedDependencies[0].Name);
|
@@ -497,6 +497,44 @@ public class MSBuildHelperTests : TestBase
|
|
497
497
|
}
|
498
498
|
}
|
499
499
|
|
500
|
+
[Fact]
|
501
|
+
public void UpdateWithWorkloadsTargetFrameworks()
|
502
|
+
{
|
503
|
+
// Arrange
|
504
|
+
var projectContents = """
|
505
|
+
<Project>
|
506
|
+
<PropertyGroup>
|
507
|
+
<TargetFrameworks>net8.0-ios;net8.0-android;net8.0-macos;net8.0-maccatalyst;</TargetFrameworks>
|
508
|
+
</PropertyGroup>
|
509
|
+
<ItemGroup>
|
510
|
+
<PackageReference Include="Some.Package" Version="$(PackageVersion1)" />
|
511
|
+
</ItemGroup>
|
512
|
+
</Project>
|
513
|
+
""";
|
514
|
+
var propertyInfo = new Dictionary<string, Property>
|
515
|
+
{
|
516
|
+
{ "PackageVersion1", new("PackageVersion1", "1.1.1", "Packages.props") },
|
517
|
+
};
|
518
|
+
|
519
|
+
// Act
|
520
|
+
var (resultType, _, evaluatedValue, _, _) = MSBuildHelper.GetEvaluatedValue(projectContents, propertyInfo);
|
521
|
+
|
522
|
+
Assert.Equal(EvaluationResultType.Success, resultType);
|
523
|
+
|
524
|
+
// Assert
|
525
|
+
Assert.Equal("""
|
526
|
+
<Project>
|
527
|
+
<PropertyGroup>
|
528
|
+
<TargetFrameworks>net8.0-ios;net8.0-android;net8.0-macos;net8.0-maccatalyst;</TargetFrameworks>
|
529
|
+
</PropertyGroup>
|
530
|
+
<ItemGroup>
|
531
|
+
<PackageReference Include="Some.Package" Version="1.1.1" />
|
532
|
+
</ItemGroup>
|
533
|
+
</Project>
|
534
|
+
""", evaluatedValue);
|
535
|
+
}
|
536
|
+
|
537
|
+
|
500
538
|
#region
|
501
539
|
// Updating root package
|
502
540
|
// CS-Script Code to 2.0.0 requires its dependency Microsoft.CodeAnalysis.CSharp.Scripting to be 3.6.0 and its transitive dependency Microsoft.CodeAnalysis.Common to be 3.6.0
|
@@ -533,7 +571,7 @@ public class MSBuildHelperTests : TestBase
|
|
533
571
|
new Dependency("CS-Script.Core", "2.0.0", DependencyType.PackageReference),
|
534
572
|
};
|
535
573
|
|
536
|
-
var resolvedDependencies = await MSBuildHelper.
|
574
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
537
575
|
Assert.NotNull(resolvedDependencies);
|
538
576
|
Assert.Equal(3, resolvedDependencies.Length);
|
539
577
|
Assert.Equal("CS-Script.Core", resolvedDependencies[0].Name);
|
@@ -578,7 +616,7 @@ public class MSBuildHelperTests : TestBase
|
|
578
616
|
new Dependency("Microsoft.Bcl.AsyncInterfaces", "1.1.1", DependencyType.Unknown)
|
579
617
|
};
|
580
618
|
|
581
|
-
var resolvedDependencies = await MSBuildHelper.
|
619
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
582
620
|
Assert.NotNull(resolvedDependencies);
|
583
621
|
Assert.Single(resolvedDependencies);
|
584
622
|
Assert.Equal("Azure.Core", resolvedDependencies[0].Name);
|
@@ -621,7 +659,7 @@ public class MSBuildHelperTests : TestBase
|
|
621
659
|
new Dependency("Newtonsoft.Json", "13.0.1", DependencyType.Unknown)
|
622
660
|
};
|
623
661
|
|
624
|
-
var resolvedDependencies = await MSBuildHelper.
|
662
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
625
663
|
Assert.NotNull(resolvedDependencies);
|
626
664
|
Assert.Equal(2, resolvedDependencies.Length);
|
627
665
|
Assert.Equal("Newtonsoft.Json.Bson", resolvedDependencies[0].Name);
|
@@ -671,7 +709,7 @@ public class MSBuildHelperTests : TestBase
|
|
671
709
|
new Dependency("Microsoft.CodeAnalysis.Common", "4.10.0", DependencyType.PackageReference)
|
672
710
|
};
|
673
711
|
|
674
|
-
var resolvedDependencies = await MSBuildHelper.
|
712
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
675
713
|
Assert.NotNull(resolvedDependencies);
|
676
714
|
Assert.Equal(3, resolvedDependencies.Length);
|
677
715
|
Assert.Equal("Microsoft.CodeAnalysis.Compilers", resolvedDependencies[0].Name);
|
@@ -723,7 +761,7 @@ public class MSBuildHelperTests : TestBase
|
|
723
761
|
new Dependency("Microsoft.CodeAnalysis.Common", "4.10.0", DependencyType.PackageReference)
|
724
762
|
};
|
725
763
|
|
726
|
-
var resolvedDependencies = await MSBuildHelper.
|
764
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
727
765
|
Assert.NotNull(resolvedDependencies);
|
728
766
|
Assert.Equal(4, resolvedDependencies.Length);
|
729
767
|
Assert.Equal("Microsoft.CodeAnalysis.Compilers", resolvedDependencies[0].Name);
|
@@ -779,7 +817,7 @@ public class MSBuildHelperTests : TestBase
|
|
779
817
|
new Dependency("Newtonsoft.Json", "13.0.1", DependencyType.Unknown)
|
780
818
|
};
|
781
819
|
|
782
|
-
var resolvedDependencies = await MSBuildHelper.
|
820
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
783
821
|
Assert.NotNull(resolvedDependencies);
|
784
822
|
Assert.Equal(5, resolvedDependencies.Length);
|
785
823
|
Assert.Equal("Microsoft.CodeAnalysis.Compilers", resolvedDependencies[0].Name);
|
@@ -838,7 +876,7 @@ public class MSBuildHelperTests : TestBase
|
|
838
876
|
new Dependency("Buildalyzer", "7.0.1", DependencyType.PackageReference),
|
839
877
|
};
|
840
878
|
|
841
|
-
var resolvedDependencies = await MSBuildHelper.
|
879
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
842
880
|
Assert.NotNull(resolvedDependencies);
|
843
881
|
Assert.Equal(4, resolvedDependencies.Length);
|
844
882
|
Assert.Equal("Buildalyzer", resolvedDependencies[0].Name);
|
@@ -895,7 +933,7 @@ public class MSBuildHelperTests : TestBase
|
|
895
933
|
new Dependency("Azure.Core", "1.22.0", DependencyType.PackageReference)
|
896
934
|
};
|
897
935
|
|
898
|
-
var resolvedDependencies = await MSBuildHelper.
|
936
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
899
937
|
Assert.NotNull(resolvedDependencies);
|
900
938
|
Assert.Equal(4, resolvedDependencies.Length);
|
901
939
|
Assert.Equal("System.Collections.Immutable", resolvedDependencies[0].Name);
|
@@ -952,7 +990,7 @@ public class MSBuildHelperTests : TestBase
|
|
952
990
|
new Dependency("Azure.Core", "1.22.0", DependencyType.PackageReference)
|
953
991
|
};
|
954
992
|
|
955
|
-
var resolvedDependencies = await MSBuildHelper.
|
993
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
956
994
|
Assert.NotNull(resolvedDependencies);
|
957
995
|
Assert.Equal(5, resolvedDependencies.Length);
|
958
996
|
Assert.Equal("System.Collections.Immutable", resolvedDependencies[0].Name);
|
@@ -1007,7 +1045,7 @@ public class MSBuildHelperTests : TestBase
|
|
1007
1045
|
new Dependency("AutoMapper.Collection", "10.0.0", DependencyType.PackageReference)
|
1008
1046
|
};
|
1009
1047
|
|
1010
|
-
var resolvedDependencies = await MSBuildHelper.
|
1048
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
1011
1049
|
Assert.NotNull(resolvedDependencies);
|
1012
1050
|
Assert.Equal(3, resolvedDependencies.Length);
|
1013
1051
|
Assert.Equal("AutoMapper.Extensions.Microsoft.DependencyInjection", resolvedDependencies[0].Name);
|
@@ -1054,7 +1092,7 @@ public class MSBuildHelperTests : TestBase
|
|
1054
1092
|
new Dependency("Microsoft.Extensions.Caching.Memory", "8.0.0", DependencyType.PackageReference)
|
1055
1093
|
};
|
1056
1094
|
|
1057
|
-
var resolvedDependencies = await MSBuildHelper.
|
1095
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
1058
1096
|
Assert.NotNull(resolvedDependencies);
|
1059
1097
|
Assert.Equal(2, resolvedDependencies.Length);
|
1060
1098
|
Assert.Equal("Microsoft.EntityFrameworkCore", resolvedDependencies[0].Name);
|
@@ -1104,7 +1142,7 @@ public class MSBuildHelperTests : TestBase
|
|
1104
1142
|
new Dependency("Microsoft.EntityFrameworkCore.Analyzers", "8.0.0", DependencyType.PackageReference)
|
1105
1143
|
};
|
1106
1144
|
|
1107
|
-
var resolvedDependencies = await MSBuildHelper.
|
1145
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
1108
1146
|
Assert.NotNull(resolvedDependencies);
|
1109
1147
|
Assert.Equal(4, resolvedDependencies.Length);
|
1110
1148
|
Assert.Equal("Microsoft.EntityFrameworkCore.Design", resolvedDependencies[0].Name);
|
@@ -1156,7 +1194,7 @@ public class MSBuildHelperTests : TestBase
|
|
1156
1194
|
new Dependency("Microsoft.EntityFrameworkCore.Analyzers", "8.0.0", DependencyType.PackageReference)
|
1157
1195
|
};
|
1158
1196
|
|
1159
|
-
var resolvedDependencies = await MSBuildHelper.
|
1197
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
1160
1198
|
Assert.NotNull(resolvedDependencies);
|
1161
1199
|
Assert.Equal(3, resolvedDependencies.Length);
|
1162
1200
|
Assert.Equal("Microsoft.EntityFrameworkCore.Design", resolvedDependencies[0].Name);
|
@@ -1208,7 +1246,7 @@ public class MSBuildHelperTests : TestBase
|
|
1208
1246
|
new Dependency("System.Collections.Immutable", "8.0.0", DependencyType.PackageReference),
|
1209
1247
|
};
|
1210
1248
|
|
1211
|
-
var resolvedDependencies = await MSBuildHelper.
|
1249
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
1212
1250
|
Assert.NotNull(resolvedDependencies);
|
1213
1251
|
Assert.Equal(4, resolvedDependencies.Length);
|
1214
1252
|
Assert.Equal("System.Collections.Immutable", resolvedDependencies[0].Name);
|
@@ -1260,7 +1298,7 @@ public class MSBuildHelperTests : TestBase
|
|
1260
1298
|
new Dependency("System.Collections.Immutable", "8.0.0", DependencyType.PackageReference),
|
1261
1299
|
};
|
1262
1300
|
|
1263
|
-
var resolvedDependencies = await MSBuildHelper.
|
1301
|
+
var resolvedDependencies = await MSBuildHelper.ResolveDependencyConflicts(repoRoot.FullName, projectPath, "net8.0", dependencies, update, new TestLogger());
|
1264
1302
|
Assert.NotNull(resolvedDependencies);
|
1265
1303
|
Assert.Equal(3, resolvedDependencies.Length);
|
1266
1304
|
Assert.Equal("Microsoft.CodeAnalysis.CSharp.Workspaces", resolvedDependencies[0].Name);
|
@@ -121,15 +121,11 @@ module Dependabot
|
|
121
121
|
def packages_config_files
|
122
122
|
return @packages_config_files if @packages_config_files
|
123
123
|
|
124
|
-
|
125
|
-
[*project_files.map { |f| File.dirname(f.name) }, "."].uniq
|
124
|
+
imported_project_files = imported_property_files.filter { |f| f.name.match?(/\.(cs|vb|fs)proj$/) }
|
126
125
|
|
127
|
-
@packages_config_files =
|
128
|
-
|
129
|
-
|
130
|
-
.find { |f| f.name.casecmp("packages.config").zero? }
|
131
|
-
fetch_file_from_host(File.join(dir, file.name)) if file
|
132
|
-
end
|
126
|
+
@packages_config_files = [*project_files, *imported_project_files].filter_map do |f|
|
127
|
+
named_file_next_to_project_file(f, "packages.config")
|
128
|
+
end
|
133
129
|
end
|
134
130
|
|
135
131
|
sig { returns(T::Array[Dependabot::DependencyFile]) }
|
@@ -312,6 +308,32 @@ module Dependabot
|
|
312
308
|
found_expected_file
|
313
309
|
end
|
314
310
|
|
311
|
+
sig do
|
312
|
+
params(
|
313
|
+
project_file: Dependabot::DependencyFile,
|
314
|
+
expected_file_name: String
|
315
|
+
)
|
316
|
+
.returns(T.nilable(Dependabot::DependencyFile))
|
317
|
+
end
|
318
|
+
def named_file_next_to_project_file(project_file, expected_file_name)
|
319
|
+
found_expected_file = T.let(nil, T.nilable(Dependabot::DependencyFile))
|
320
|
+
directory_path = Pathname.new(directory)
|
321
|
+
full_project_dir = Pathname.new(project_file.directory).join(project_file.name).dirname
|
322
|
+
|
323
|
+
candidate_file_path = Pathname.new(full_project_dir).join(expected_file_name).cleanpath.to_path
|
324
|
+
candidate_directory = Pathname.new(File.dirname(candidate_file_path))
|
325
|
+
relative_candidate_directory = candidate_directory.relative_path_from(directory_path)
|
326
|
+
candidate_file = repo_contents(dir: relative_candidate_directory).find do |f|
|
327
|
+
f.name.casecmp?(expected_file_name)
|
328
|
+
end
|
329
|
+
if candidate_file
|
330
|
+
found_expected_file = fetch_file_from_host(File.join(relative_candidate_directory,
|
331
|
+
candidate_file.name))
|
332
|
+
end
|
333
|
+
|
334
|
+
found_expected_file
|
335
|
+
end
|
336
|
+
|
315
337
|
sig { returns(T.nilable(Dependabot::DependencyFile)) }
|
316
338
|
def global_json
|
317
339
|
@global_json ||= T.let(fetch_file_if_present("global.json"), T.nilable(Dependabot::DependencyFile))
|
@@ -355,6 +377,7 @@ module Dependabot
|
|
355
377
|
end
|
356
378
|
def fetch_imported_property_files(file:, previously_fetched_files:)
|
357
379
|
file_id = file.directory + "/" + file.name
|
380
|
+
|
358
381
|
if @fetched_files[file_id]
|
359
382
|
T.must(@fetched_files[file_id])
|
360
383
|
else
|
@@ -363,23 +386,37 @@ module Dependabot
|
|
363
386
|
ImportPathsFinder.new(project_file: file).project_reference_paths +
|
364
387
|
ImportPathsFinder.new(project_file: file).project_file_paths
|
365
388
|
|
366
|
-
|
389
|
+
# Initialize a set to hold fetched files temporarily to avoid duplicates
|
390
|
+
fetched_files_set = Set.new([file])
|
391
|
+
|
392
|
+
paths.each do |path|
|
367
393
|
next if previously_fetched_files.map(&:name).include?(path)
|
368
394
|
next if file.name == path
|
369
395
|
next if path.include?("$(")
|
370
396
|
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
397
|
+
begin
|
398
|
+
fetched_file = fetch_file_from_host(path)
|
399
|
+
grandchild_property_files = fetch_imported_property_files(
|
400
|
+
file: fetched_file,
|
401
|
+
previously_fetched_files: previously_fetched_files + [file]
|
402
|
+
)
|
403
|
+
|
404
|
+
# Add fetched file and grandchild property files to the set
|
405
|
+
fetched_files_set << fetched_file
|
406
|
+
fetched_files_set.merge(grandchild_property_files)
|
407
|
+
rescue Dependabot::DependencyFileNotFound
|
408
|
+
# Don't worry about missing files, just skip them for now
|
409
|
+
Dependabot.logger.info("unable to find expected file #{file.name}")
|
410
|
+
nil
|
411
|
+
end
|
412
|
+
end
|
413
|
+
|
414
|
+
# Convert the set to an array and cache the fetched files
|
415
|
+
fetched_files = fetched_files_set.to_a
|
416
|
+
@fetched_files[file_id] = fetched_files
|
417
|
+
|
418
|
+
# Return the fetched files
|
419
|
+
fetched_files
|
383
420
|
end
|
384
421
|
end
|
385
422
|
end
|
@@ -20,6 +20,7 @@ module Dependabot
|
|
20
20
|
def self.updated_files_regex
|
21
21
|
[
|
22
22
|
/.*\.([a-z]{2})?proj$/, # Matches files with any extension like .csproj, .vbproj, etc., in any directory
|
23
|
+
/packages\.lock\.json/, # Matches packages.lock.json in any directory
|
23
24
|
/packages\.config$/i, # Matches packages.config in any directory
|
24
25
|
/app\.config$/i, # Matches app.config in any directory
|
25
26
|
/web\.config$/i, # Matches web.config in any directory
|
@@ -28,8 +28,7 @@ module Dependabot
|
|
28
28
|
"--project-tfms",
|
29
29
|
*project_tfms,
|
30
30
|
"--package-tfms",
|
31
|
-
*package_tfms
|
32
|
-
"--verbose"
|
31
|
+
*package_tfms
|
33
32
|
]
|
34
33
|
command = Shellwords.join(command_parts)
|
35
34
|
|
@@ -39,8 +38,7 @@ module Dependabot
|
|
39
38
|
"--project-tfms",
|
40
39
|
"<project-tfms>",
|
41
40
|
"--package-tfms",
|
42
|
-
"<package-tfms>"
|
43
|
-
"--verbose"
|
41
|
+
"<package-tfms>"
|
44
42
|
].join(" ")
|
45
43
|
|
46
44
|
puts "running NuGet updater:\n" + command
|
@@ -68,8 +66,7 @@ module Dependabot
|
|
68
66
|
"--workspace",
|
69
67
|
workspace_path,
|
70
68
|
"--output",
|
71
|
-
output_path
|
72
|
-
"--verbose"
|
69
|
+
output_path
|
73
70
|
].compact
|
74
71
|
|
75
72
|
command = Shellwords.join(command_parts)
|
@@ -82,8 +79,7 @@ module Dependabot
|
|
82
79
|
"--workspace",
|
83
80
|
"<path-to-workspace>",
|
84
81
|
"--output",
|
85
|
-
"<path-to-output>"
|
86
|
-
"--verbose"
|
82
|
+
"<path-to-output>"
|
87
83
|
].compact.join(" ")
|
88
84
|
|
89
85
|
[command, fingerprint]
|
@@ -127,8 +123,7 @@ module Dependabot
|
|
127
123
|
"--dependency-file-path",
|
128
124
|
dependency_file_path,
|
129
125
|
"--analysis-folder-path",
|
130
|
-
analysis_folder_path
|
131
|
-
"--verbose"
|
126
|
+
analysis_folder_path
|
132
127
|
].compact
|
133
128
|
|
134
129
|
command = Shellwords.join(command_parts)
|
@@ -141,8 +136,7 @@ module Dependabot
|
|
141
136
|
"--dependency-file-path",
|
142
137
|
"<dependency-file-path>",
|
143
138
|
"--analysis-folder-path",
|
144
|
-
"<analysis_folder_path>"
|
145
|
-
"--verbose"
|
139
|
+
"<analysis_folder_path>"
|
146
140
|
].compact.join(" ")
|
147
141
|
|
148
142
|
[command, fingerprint]
|
@@ -191,8 +185,7 @@ module Dependabot
|
|
191
185
|
dependency.previous_version,
|
192
186
|
is_transitive ? "--transitive" : nil,
|
193
187
|
"--result-output-path",
|
194
|
-
result_output_path
|
195
|
-
"--verbose"
|
188
|
+
result_output_path
|
196
189
|
].compact
|
197
190
|
|
198
191
|
command = Shellwords.join(command_parts)
|
@@ -212,8 +205,7 @@ module Dependabot
|
|
212
205
|
"<previous-version>",
|
213
206
|
is_transitive ? "--transitive" : nil,
|
214
207
|
"--result-output-path",
|
215
|
-
"<result-output-path>"
|
216
|
-
"--verbose"
|
208
|
+
"<result-output-path>"
|
217
209
|
].compact.join(" ")
|
218
210
|
|
219
211
|
[command, fingerprint]
|
@@ -273,6 +265,8 @@ module Dependabot
|
|
273
265
|
raise DependencyFileNotFound, T.let(error_details, T.nilable(String))
|
274
266
|
when "UpdateNotPossible"
|
275
267
|
raise UpdateNotPossible, T.let(error_details, T::Array[String])
|
268
|
+
when "Unknown"
|
269
|
+
raise DependabotError, T.let(error_details, String)
|
276
270
|
else
|
277
271
|
raise "Unexpected error type from native tool: #{error_type}: #{error_details}"
|
278
272
|
end
|
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.282.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-24 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.282.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.282.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubyzip
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,28 +134,28 @@ dependencies:
|
|
134
134
|
requirements:
|
135
135
|
- - "~>"
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version: 1.
|
137
|
+
version: 1.67.0
|
138
138
|
type: :development
|
139
139
|
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
142
|
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version: 1.
|
144
|
+
version: 1.67.0
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
146
|
name: rubocop-performance
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
148
148
|
requirements:
|
149
149
|
- - "~>"
|
150
150
|
- !ruby/object:Gem::Version
|
151
|
-
version: 1.
|
151
|
+
version: 1.22.1
|
152
152
|
type: :development
|
153
153
|
prerelease: false
|
154
154
|
version_requirements: !ruby/object:Gem::Requirement
|
155
155
|
requirements:
|
156
156
|
- - "~>"
|
157
157
|
- !ruby/object:Gem::Version
|
158
|
-
version: 1.
|
158
|
+
version: 1.22.1
|
159
159
|
- !ruby/object:Gem::Dependency
|
160
160
|
name: rubocop-rspec
|
161
161
|
requirement: !ruby/object:Gem::Requirement
|
@@ -310,6 +310,7 @@ files:
|
|
310
310
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/RequirementTests.cs
|
311
311
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/SecurityVulnerabilityExtensionsTests.cs
|
312
312
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/VersionFinderTests.cs
|
313
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/DependencySolverEnvironment.cs
|
313
314
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs
|
314
315
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.DotNetToolsJson.cs
|
315
316
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.GlobalJson.cs
|
@@ -336,14 +337,16 @@ files:
|
|
336
337
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestBase.cs
|
337
338
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestExtensions.cs
|
338
339
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestHttpServer.cs
|
340
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestLogger.cs
|
341
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/ExpectedUpdateOperationResult.cs
|
339
342
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/PackagesConfigUpdaterTests.cs
|
340
343
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs
|
341
344
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DirsProj.cs
|
342
345
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DotNetTools.cs
|
343
346
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.GlobalJson.cs
|
344
347
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Mixed.cs
|
348
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackageReference.cs
|
345
349
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs
|
346
|
-
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Sdk.cs
|
347
350
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/AssertEx.cs
|
348
351
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/DiffUtil.cs
|
349
352
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/JsonHelperTests.cs
|
@@ -423,18 +426,19 @@ files:
|
|
423
426
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/DotNetToolsJsonUpdater.cs
|
424
427
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/GlobalJsonUpdater.cs
|
425
428
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/LockFileUpdater.cs
|
429
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackageReferenceUpdater.cs
|
426
430
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackagesConfigUpdater.cs
|
427
|
-
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/SdkPackageUpdater.cs
|
428
431
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdateOperationResult.cs
|
429
432
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdateResult.cs
|
430
433
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs
|
431
434
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/WebApplicationTargetsConditionPatcher.cs
|
432
435
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/XmlFilePreAndPostProcessor.cs
|
436
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ConsoleLogger.cs
|
433
437
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/DependencyConflictResolver.cs
|
434
438
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/HashSetExtensions.cs
|
439
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ILogger.cs
|
435
440
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ImmutableArrayExtensions.cs
|
436
441
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/JsonHelper.cs
|
437
|
-
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/Logger.cs
|
438
442
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs
|
439
443
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/NuGetHelper.cs
|
440
444
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs
|
@@ -493,8 +497,8 @@ licenses:
|
|
493
497
|
- MIT
|
494
498
|
metadata:
|
495
499
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
496
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
497
|
-
post_install_message:
|
500
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.282.0
|
501
|
+
post_install_message:
|
498
502
|
rdoc_options: []
|
499
503
|
require_paths:
|
500
504
|
- lib
|
@@ -510,7 +514,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
510
514
|
version: 3.1.0
|
511
515
|
requirements: []
|
512
516
|
rubygems_version: 3.5.9
|
513
|
-
signing_key:
|
517
|
+
signing_key:
|
514
518
|
specification_version: 4
|
515
519
|
summary: Provides Dependabot support for .NET (NuGet)
|
516
520
|
test_files: []
|
@@ -1,21 +0,0 @@
|
|
1
|
-
namespace NuGetUpdater.Core;
|
2
|
-
|
3
|
-
public sealed class Logger
|
4
|
-
{
|
5
|
-
public bool Verbose { get; set; }
|
6
|
-
private readonly TextWriter _logOutput;
|
7
|
-
|
8
|
-
public Logger(bool verbose)
|
9
|
-
{
|
10
|
-
Verbose = verbose;
|
11
|
-
_logOutput = Console.Out;
|
12
|
-
}
|
13
|
-
|
14
|
-
public void Log(string message)
|
15
|
-
{
|
16
|
-
if (Verbose)
|
17
|
-
{
|
18
|
-
_logOutput.WriteLine(message);
|
19
|
-
}
|
20
|
-
}
|
21
|
-
}
|