dependabot-nuget 0.355.0 → 0.356.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.
- checksums.yaml +4 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/PackagesConfigDiscovery.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/RefreshGroupUpdatePullRequestHandler.cs +49 -46
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs +6 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/FileWriters/FileWriterWorker.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackagesConfigUpdater.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ProjectHelper.cs +25 -13
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdateHandlers/RefreshGroupUpdatePullRequestHandlerTests.cs +104 -57
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/BindingRedirectsTests.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/PathHelperTests.cs +18 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/ProjectHelperTests.cs +28 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 56027ed62ebd863237630c55bc289bd083c5606979410af2925657c88dcbcf75
|
|
4
|
+
data.tar.gz: bb8377eb0d13add9bc1c6b8240c1d832ac5b2d641b817f19feaa6762b81cb90b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 85d78b0b4d3535e570193ea3e19b8ffec884377d46eb1400ad5d6ac2f69d69fd9e9ab883f2f185360f40506500212bcdc4cf9044a2317a4359bee2e4b7942662
|
|
7
|
+
data.tar.gz: e51b2ff7c2cba64483a1f941c2707b4d2d8dfc7dee7221b1c13aa6cce4766e3b30816858711a7812a0a99e55d4e2a7abd7fb207af4ac2231030a3b4be388f255
|
|
@@ -9,8 +9,8 @@ internal static class PackagesConfigDiscovery
|
|
|
9
9
|
public static async Task<PackagesConfigDiscoveryResult?> Discover(string repoRootPath, string workspacePath, string projectPath, ILogger logger)
|
|
10
10
|
{
|
|
11
11
|
var projectDirectory = Path.GetDirectoryName(projectPath)!;
|
|
12
|
-
var additionalFiles = ProjectHelper.GetAllAdditionalFilesFromProject(projectPath, ProjectHelper.PathFormat.Full);
|
|
13
|
-
var packagesConfigPath = additionalFiles.FirstOrDefault(p => Path.GetFileName(p).Equals(ProjectHelper.PackagesConfigFileName, StringComparison.
|
|
12
|
+
var additionalFiles = ProjectHelper.GetAllAdditionalFilesFromProject(repoRootPath, projectPath, ProjectHelper.PathFormat.Full);
|
|
13
|
+
var packagesConfigPath = additionalFiles.FirstOrDefault(p => Path.GetFileName(p).Equals(ProjectHelper.PackagesConfigFileName, StringComparison.OrdinalIgnoreCase));
|
|
14
14
|
|
|
15
15
|
if (packagesConfigPath is null)
|
|
16
16
|
{
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
using System.Collections.Immutable;
|
|
2
|
+
|
|
1
3
|
using NuGetUpdater.Core.Run.ApiModel;
|
|
2
4
|
using NuGetUpdater.Core.Updater;
|
|
3
5
|
|
|
@@ -59,9 +61,13 @@ internal class RefreshGroupUpdatePullRequestHandler : IUpdateHandler
|
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
logger.Info($"Starting update for group {group.Name}");
|
|
64
|
+
await this.ReportUpdaterStarted(apiHandler);
|
|
62
65
|
|
|
63
66
|
var groupMatcher = group.GetGroupMatcher();
|
|
64
67
|
var jobDependencies = job.Dependencies.ToHashSet(StringComparer.OrdinalIgnoreCase);
|
|
68
|
+
var updateOperationsPerformed = new List<UpdateOperationBase>();
|
|
69
|
+
var updatedDependencies = new List<ReportedDependency>();
|
|
70
|
+
var allUpdatedDependencyFiles = ImmutableArray.Create<DependencyFile>();
|
|
65
71
|
foreach (var directory in job.GetAllDirectories(repoContentsPath.FullName))
|
|
66
72
|
{
|
|
67
73
|
var discoveryResult = await discoveryWorker.RunAsync(repoContentsPath.FullName, directory);
|
|
@@ -74,10 +80,7 @@ internal class RefreshGroupUpdatePullRequestHandler : IUpdateHandler
|
|
|
74
80
|
|
|
75
81
|
var updatedDependencyList = RunWorker.GetUpdatedDependencyListFromDiscovery(discoveryResult, originalRepoContentsPath.FullName, logger);
|
|
76
82
|
await apiHandler.UpdateDependencyList(updatedDependencyList);
|
|
77
|
-
await this.ReportUpdaterStarted(apiHandler);
|
|
78
83
|
|
|
79
|
-
var updateOperationsPerformed = new List<UpdateOperationBase>();
|
|
80
|
-
var updatedDependencies = new List<ReportedDependency>();
|
|
81
84
|
var updateOperationsToPerform = RunWorker.GetUpdateOperations(discoveryResult).ToArray();
|
|
82
85
|
var groupedUpdateOperationsToPerform = updateOperationsToPerform
|
|
83
86
|
.GroupBy(o => o.Dependency.Name, StringComparer.OrdinalIgnoreCase)
|
|
@@ -143,53 +146,53 @@ internal class RefreshGroupUpdatePullRequestHandler : IUpdateHandler
|
|
|
143
146
|
}
|
|
144
147
|
|
|
145
148
|
var updatedDependencyFiles = await tracker.StopTrackingAsync();
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
{
|
|
149
|
-
var close = ClosePullRequest.WithUpdateNoLongerPossible(job);
|
|
150
|
-
logger.Info(close.GetReport());
|
|
151
|
-
await apiHandler.ClosePullRequest(close);
|
|
152
|
-
continue;
|
|
153
|
-
}
|
|
149
|
+
allUpdatedDependencyFiles = ModifiedFilesTracker.MergeUpdatedFileSet(allUpdatedDependencyFiles, updatedDependencyFiles);
|
|
150
|
+
}
|
|
154
151
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
var
|
|
159
|
-
|
|
152
|
+
var rawDependencies = updatedDependencies.Select(d => new Dependency(d.Name, d.Version, DependencyType.Unknown)).ToArray();
|
|
153
|
+
if (rawDependencies.Length == 0)
|
|
154
|
+
{
|
|
155
|
+
var close = ClosePullRequest.WithUpdateNoLongerPossible(job);
|
|
156
|
+
logger.Info(close.GetReport());
|
|
157
|
+
await apiHandler.ClosePullRequest(close);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
var commitMessage = PullRequestTextGenerator.GetPullRequestCommitMessage(job, [.. updateOperationsPerformed], null);
|
|
162
|
+
var prTitle = PullRequestTextGenerator.GetPullRequestTitle(job, [.. updateOperationsPerformed], null);
|
|
163
|
+
var prBody = await PullRequestTextGenerator.GetPullRequestBodyAsync(job, [.. updateOperationsPerformed], [.. updatedDependencies], experimentsManager);
|
|
164
|
+
var existingPullRequest = job.GetExistingPullRequestForDependencies(rawDependencies, considerVersions: true);
|
|
165
|
+
if (existingPullRequest is not null)
|
|
166
|
+
{
|
|
167
|
+
await apiHandler.UpdatePullRequest(new UpdatePullRequest()
|
|
160
168
|
{
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
169
|
+
DependencyNames = [.. jobDependencies.OrderBy(n => n, StringComparer.OrdinalIgnoreCase)],
|
|
170
|
+
DependencyGroup = group.Name,
|
|
171
|
+
UpdatedDependencyFiles = [.. allUpdatedDependencyFiles],
|
|
172
|
+
BaseCommitSha = baseCommitSha,
|
|
173
|
+
CommitMessage = commitMessage,
|
|
174
|
+
PrTitle = prTitle,
|
|
175
|
+
PrBody = prBody,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
else
|
|
179
|
+
{
|
|
180
|
+
var existingPrButDifferent = job.GetExistingPullRequestForDependencies(rawDependencies, considerVersions: false);
|
|
181
|
+
if (existingPrButDifferent is not null)
|
|
174
182
|
{
|
|
175
|
-
|
|
176
|
-
if (existingPrButDifferent is not null)
|
|
177
|
-
{
|
|
178
|
-
await apiHandler.ClosePullRequest(ClosePullRequest.WithDependenciesChanged(job));
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
await apiHandler.CreatePullRequest(new CreatePullRequest()
|
|
182
|
-
{
|
|
183
|
-
Dependencies = [.. updatedDependencies],
|
|
184
|
-
UpdatedDependencyFiles = [.. updatedDependencyFiles],
|
|
185
|
-
BaseCommitSha = baseCommitSha,
|
|
186
|
-
CommitMessage = commitMessage,
|
|
187
|
-
PrTitle = prTitle,
|
|
188
|
-
PrBody = prBody,
|
|
189
|
-
DependencyGroup = group.Name,
|
|
190
|
-
});
|
|
191
|
-
continue;
|
|
183
|
+
await apiHandler.ClosePullRequest(ClosePullRequest.WithDependenciesChanged(job));
|
|
192
184
|
}
|
|
185
|
+
|
|
186
|
+
await apiHandler.CreatePullRequest(new CreatePullRequest()
|
|
187
|
+
{
|
|
188
|
+
Dependencies = [.. updatedDependencies],
|
|
189
|
+
UpdatedDependencyFiles = [.. allUpdatedDependencyFiles],
|
|
190
|
+
BaseCommitSha = baseCommitSha,
|
|
191
|
+
CommitMessage = commitMessage,
|
|
192
|
+
PrTitle = prTitle,
|
|
193
|
+
PrBody = prBody,
|
|
194
|
+
DependencyGroup = group.Name,
|
|
195
|
+
});
|
|
193
196
|
}
|
|
194
197
|
}
|
|
195
198
|
}
|
|
@@ -31,13 +31,14 @@ internal static class BindingRedirectManager
|
|
|
31
31
|
/// See: https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions
|
|
32
32
|
/// https://learn.microsoft.com/en-us/nuget/resources/check-project-format
|
|
33
33
|
/// </remarks>
|
|
34
|
+
/// <param name="repoRootPath">The root of the cloned repository</param>
|
|
34
35
|
/// <param name="projectBuildFile">The project build file (*.xproj) to be updated</param>
|
|
35
36
|
/// <param name="updatedPackageName"/>The name of the package that was updated</param>
|
|
36
37
|
/// <param name="updatedPackageVersion">The version of the package that was updated</param>
|
|
37
38
|
/// <returns>The updated files.</returns>
|
|
38
|
-
public static async ValueTask<ImmutableArray<string>> UpdateBindingRedirectsAsync(ProjectBuildFile projectBuildFile, string updatedPackageName, string updatedPackageVersion)
|
|
39
|
+
public static async ValueTask<ImmutableArray<string>> UpdateBindingRedirectsAsync(string repoRootPath, ProjectBuildFile projectBuildFile, string updatedPackageName, string updatedPackageVersion)
|
|
39
40
|
{
|
|
40
|
-
var configFile = await TryGetRuntimeConfigurationFile(projectBuildFile.Path);
|
|
41
|
+
var configFile = await TryGetRuntimeConfigurationFile(repoRootPath, projectBuildFile.Path);
|
|
41
42
|
if (configFile is null)
|
|
42
43
|
{
|
|
43
44
|
// no runtime config file so no need to add binding redirects
|
|
@@ -63,7 +64,7 @@ internal static class BindingRedirectManager
|
|
|
63
64
|
// finally we pull out the assembly `HintPath` values for _all_ references relative to the project file in a unix-style value
|
|
64
65
|
// e.g., ../packages/Some.Other.Package/4.5.6/lib/net45/Some.Other.Package.dll
|
|
65
66
|
// all of that is passed to `AddBindingRedirects()` so we can ensure binding redirects for the relevant assemblies
|
|
66
|
-
var packagesConfigPath = ProjectHelper.GetPackagesConfigPathFromProject(projectBuildFile.Path, ProjectHelper.PathFormat.Full);
|
|
67
|
+
var packagesConfigPath = ProjectHelper.GetPackagesConfigPathFromProject(repoRootPath, projectBuildFile.Path, ProjectHelper.PathFormat.Full);
|
|
67
68
|
var packagesDirectory = PackagesConfigUpdater.GetPathToPackagesDirectory(projectBuildFile, updatedPackageName, updatedPackageVersion, packagesConfigPath)!;
|
|
68
69
|
var assemblyPathPrefix = Path.Combine(packagesDirectory, $"{updatedPackageName}.{updatedPackageVersion}").NormalizePathToUnix().EnsureSuffix("/");
|
|
69
70
|
var assemblyPaths = references.Select(static x => x.HintPath).Select(x => Path.GetRelativePath(Path.GetDirectoryName(projectBuildFile.Path)!, x).NormalizePathToUnix()).ToList();
|
|
@@ -130,9 +131,9 @@ internal static class BindingRedirectManager
|
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
133
|
|
|
133
|
-
private static async ValueTask<ConfigurationFile?> TryGetRuntimeConfigurationFile(string fullProjectPath)
|
|
134
|
+
private static async ValueTask<ConfigurationFile?> TryGetRuntimeConfigurationFile(string repoRootPath, string fullProjectPath)
|
|
134
135
|
{
|
|
135
|
-
var additionalFiles = ProjectHelper.GetAdditionalFilesFromProjectContent(fullProjectPath, ProjectHelper.PathFormat.Full);
|
|
136
|
+
var additionalFiles = ProjectHelper.GetAdditionalFilesFromProjectContent(repoRootPath, fullProjectPath, ProjectHelper.PathFormat.Full);
|
|
136
137
|
var configFilePath = additionalFiles
|
|
137
138
|
.FirstOrDefault(p =>
|
|
138
139
|
{
|
|
@@ -112,7 +112,7 @@ public class FileWriterWorker
|
|
|
112
112
|
NuGetVersion newDependencyVersion
|
|
113
113
|
)
|
|
114
114
|
{
|
|
115
|
-
var additionalFiles = ProjectHelper.GetAllAdditionalFilesFromProject(projectPath.FullName, ProjectHelper.PathFormat.Full);
|
|
115
|
+
var additionalFiles = ProjectHelper.GetAllAdditionalFilesFromProject(repoContentsPath.FullName, projectPath.FullName, ProjectHelper.PathFormat.Full);
|
|
116
116
|
var packagesConfigFullPath = additionalFiles.Where(p => Path.GetFileName(p).Equals(ProjectHelper.PackagesConfigFileName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
|
|
117
117
|
if (packagesConfigFullPath is null)
|
|
118
118
|
{
|
|
@@ -96,7 +96,7 @@ internal static partial class PackagesConfigUpdater
|
|
|
96
96
|
projectBuildFile.NormalizeDirectorySeparatorsInProject();
|
|
97
97
|
|
|
98
98
|
// Update binding redirects
|
|
99
|
-
var updatedConfigFiles = await BindingRedirectManager.UpdateBindingRedirectsAsync(projectBuildFile, dependencyName, newDependencyVersion);
|
|
99
|
+
var updatedConfigFiles = await BindingRedirectManager.UpdateBindingRedirectsAsync(repoRootPath, projectBuildFile, dependencyName, newDependencyVersion);
|
|
100
100
|
|
|
101
101
|
logger.Info(" Writing project file back to disk");
|
|
102
102
|
await projectBuildFile.SaveAsync();
|
|
@@ -256,6 +256,7 @@ internal static class PathHelper
|
|
|
256
256
|
// translate pattern to regex
|
|
257
257
|
searchPattern = searchPattern.Replace("\\", "/"); // unix-style paths make things easier
|
|
258
258
|
searchPattern = searchPattern.TrimStart('/'); // pattern shouldn't be rooted
|
|
259
|
+
searchPattern = searchPattern.TrimEnd('/'); // trailing slash is meaningless for directory matching
|
|
259
260
|
if (searchPattern == string.Empty)
|
|
260
261
|
{
|
|
261
262
|
searchPattern = "/"; // special case repo root
|
|
@@ -17,20 +17,22 @@ internal static class ProjectHelper
|
|
|
17
17
|
Full,
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
public static ImmutableArray<string> GetAllAdditionalFilesFromProject(string fullProjectPath, PathFormat pathFormat)
|
|
20
|
+
public static ImmutableArray<string> GetAllAdditionalFilesFromProject(string repoRootPath, string fullProjectPath, PathFormat pathFormat)
|
|
21
21
|
{
|
|
22
|
-
return GetAdditionalFilesFromProjectContent(fullProjectPath, pathFormat)
|
|
23
|
-
.
|
|
22
|
+
return GetAdditionalFilesFromProjectContent(repoRootPath, fullProjectPath, pathFormat)
|
|
23
|
+
.Concat(GetAdditionalFilesFromProjectLocation(fullProjectPath, pathFormat))
|
|
24
|
+
.OrderBy(p => p, StringComparer.Ordinal)
|
|
25
|
+
.ToImmutableArray();
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
public static ImmutableArray<string> GetAdditionalFilesFromProjectContent(string fullProjectPath, PathFormat pathFormat)
|
|
28
|
+
public static ImmutableArray<string> GetAdditionalFilesFromProjectContent(string repoRootPath, string fullProjectPath, PathFormat pathFormat)
|
|
27
29
|
{
|
|
28
30
|
var projectRootElement = ProjectRootElement.Open(fullProjectPath);
|
|
29
31
|
var additionalFilesWithFullPaths = new[]
|
|
30
32
|
{
|
|
31
|
-
projectRootElement.GetItemPathWithFileName(PackagesConfigFileName),
|
|
32
|
-
projectRootElement.GetItemPathWithFileName(AppConfigFileName),
|
|
33
|
-
projectRootElement.GetItemPathWithFileName(WebConfigFileName),
|
|
33
|
+
projectRootElement.GetItemPathWithFileName(repoRootPath, PackagesConfigFileName),
|
|
34
|
+
projectRootElement.GetItemPathWithFileName(repoRootPath, AppConfigFileName),
|
|
35
|
+
projectRootElement.GetItemPathWithFileName(repoRootPath, WebConfigFileName),
|
|
34
36
|
}.Where(p => p is not null).Cast<string>().ToImmutableArray();
|
|
35
37
|
|
|
36
38
|
var additionalFiles = additionalFilesWithFullPaths
|
|
@@ -52,10 +54,10 @@ internal static class ProjectHelper
|
|
|
52
54
|
return additionalFiles;
|
|
53
55
|
}
|
|
54
56
|
|
|
55
|
-
public static string? GetPackagesConfigPathFromProject(string fullProjectPath, PathFormat pathFormat)
|
|
57
|
+
public static string? GetPackagesConfigPathFromProject(string repoRootPath, string fullProjectPath, PathFormat pathFormat)
|
|
56
58
|
{
|
|
57
|
-
var additionalFiles = GetAdditionalFilesFromProjectContent(fullProjectPath, pathFormat);
|
|
58
|
-
var packagesConfigFile = additionalFiles.FirstOrDefault(p => Path.GetFileName(p).Equals(PackagesConfigFileName, StringComparison.
|
|
59
|
+
var additionalFiles = GetAdditionalFilesFromProjectContent(repoRootPath, fullProjectPath, pathFormat);
|
|
60
|
+
var packagesConfigFile = additionalFiles.FirstOrDefault(p => Path.GetFileName(p).Equals(PackagesConfigFileName, StringComparison.OrdinalIgnoreCase));
|
|
59
61
|
return packagesConfigFile;
|
|
60
62
|
}
|
|
61
63
|
|
|
@@ -71,7 +73,7 @@ internal static class ProjectHelper
|
|
|
71
73
|
return updatedPath.NormalizePathToUnix();
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
private static string? GetItemPathWithFileName(this ProjectRootElement projectRootElement, string itemFileName)
|
|
76
|
+
private static string? GetItemPathWithFileName(this ProjectRootElement projectRootElement, string repoRootPath, string itemFileName)
|
|
75
77
|
{
|
|
76
78
|
var projectDirectory = Path.GetDirectoryName(projectRootElement.FullPath)!;
|
|
77
79
|
var itemPath = projectRootElement.Items
|
|
@@ -80,7 +82,17 @@ internal static class ProjectHelper
|
|
|
80
82
|
.Where(i => !string.IsNullOrEmpty(i.Include))
|
|
81
83
|
.Select(i => Path.GetFullPath(Path.Combine(projectDirectory, i.Include.NormalizePathToUnix())))
|
|
82
84
|
.Where(p => Path.GetFileName(p).Equals(itemFileName, StringComparison.OrdinalIgnoreCase))
|
|
83
|
-
.
|
|
85
|
+
.Select(p =>
|
|
86
|
+
{
|
|
87
|
+
var candidateFiles = PathHelper.ResolveCaseInsensitivePathsInsideRepoRoot(p, repoRootPath) ?? []; // case correct
|
|
88
|
+
if (candidateFiles.Count == 1)
|
|
89
|
+
{
|
|
90
|
+
return candidateFiles[0];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return null;
|
|
94
|
+
})
|
|
95
|
+
.Where(p => p is not null)
|
|
84
96
|
.FirstOrDefault();
|
|
85
97
|
return itemPath;
|
|
86
98
|
}
|
|
@@ -89,7 +101,7 @@ internal static class ProjectHelper
|
|
|
89
101
|
{
|
|
90
102
|
var projectDirectory = Path.GetDirectoryName(fullProjectPath)!;
|
|
91
103
|
var filePath = Directory.EnumerateFiles(projectDirectory)
|
|
92
|
-
.Where(p => Path.GetFileName(p).Equals(fileName, StringComparison.
|
|
104
|
+
.Where(p => Path.GetFileName(p).Equals(fileName, StringComparison.OrdinalIgnoreCase))
|
|
93
105
|
.FirstOrDefault();
|
|
94
106
|
return filePath;
|
|
95
107
|
}
|
|
@@ -24,20 +24,37 @@ public class RefreshGroupUpdatePullRequestHandlerTests : UpdateHandlersTestsBase
|
|
|
24
24
|
DependencyGroups = [new() { Name = "test_group" }],
|
|
25
25
|
DependencyGroupToRefresh = "test_group",
|
|
26
26
|
ExistingPullRequests = [new() { Dependencies = [new() { DependencyName = "Some.Dependency", DependencyVersion = NuGetVersion.Parse("2.0.0") }] }],
|
|
27
|
-
Source = CreateJobSource("/
|
|
27
|
+
Source = CreateJobSource("/src1", "/src2"),
|
|
28
28
|
UpdatingAPullRequest = true,
|
|
29
29
|
},
|
|
30
30
|
files: [
|
|
31
|
-
("
|
|
31
|
+
("src1/project1.csproj", "initial contents"),
|
|
32
|
+
("src2/project2.csproj", "initial contents"),
|
|
32
33
|
],
|
|
33
34
|
discoveryWorker: TestDiscoveryWorker.FromResults(
|
|
34
|
-
("/
|
|
35
|
+
("/src1", new WorkspaceDiscoveryResult()
|
|
35
36
|
{
|
|
36
|
-
Path = "/
|
|
37
|
+
Path = "/src1",
|
|
37
38
|
Projects = [
|
|
38
39
|
new()
|
|
39
40
|
{
|
|
40
|
-
FilePath = "
|
|
41
|
+
FilePath = "project1.csproj",
|
|
42
|
+
Dependencies = [
|
|
43
|
+
new("Some.Dependency", "1.0.0", DependencyType.PackageReference, TargetFrameworks: ["net9.0"]),
|
|
44
|
+
new("Unrelated.Dependency", "3.0.0", DependencyType.PackageReference, TargetFrameworks: ["net9.0"]),
|
|
45
|
+
],
|
|
46
|
+
ImportedFiles = [],
|
|
47
|
+
AdditionalFiles = [],
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
}),
|
|
51
|
+
("/src2", new WorkspaceDiscoveryResult()
|
|
52
|
+
{
|
|
53
|
+
Path = "/src2",
|
|
54
|
+
Projects = [
|
|
55
|
+
new()
|
|
56
|
+
{
|
|
57
|
+
FilePath = "project2.csproj",
|
|
41
58
|
Dependencies = [
|
|
42
59
|
new("Some.Dependency", "1.0.0", DependencyType.PackageReference, TargetFrameworks: ["net9.0"]),
|
|
43
60
|
new("Unrelated.Dependency", "3.0.0", DependencyType.PackageReference, TargetFrameworks: ["net9.0"]),
|
|
@@ -78,11 +95,20 @@ public class RefreshGroupUpdatePullRequestHandlerTests : UpdateHandlersTestsBase
|
|
|
78
95
|
|
|
79
96
|
return new UpdateOperationResult()
|
|
80
97
|
{
|
|
81
|
-
UpdateOperations = [new DirectUpdate() { DependencyName = "Some.Dependency", NewVersion = NuGetVersion.Parse("2.0.0"), UpdatedFiles = [
|
|
98
|
+
UpdateOperations = [new DirectUpdate() { DependencyName = "Some.Dependency", NewVersion = NuGetVersion.Parse("2.0.0"), UpdatedFiles = [workspacePath] }],
|
|
82
99
|
};
|
|
83
100
|
}),
|
|
84
101
|
expectedUpdateHandler: RefreshGroupUpdatePullRequestHandler.Instance,
|
|
85
102
|
expectedApiMessages: [
|
|
103
|
+
new IncrementMetric()
|
|
104
|
+
{
|
|
105
|
+
Metric = "updater.started",
|
|
106
|
+
Tags = new()
|
|
107
|
+
{
|
|
108
|
+
["operation"] = "update_version_group_pr",
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
// for `/src1`
|
|
86
112
|
new UpdatedDependencyList()
|
|
87
113
|
{
|
|
88
114
|
Dependencies = [
|
|
@@ -91,7 +117,7 @@ public class RefreshGroupUpdatePullRequestHandlerTests : UpdateHandlersTestsBase
|
|
|
91
117
|
Name = "Some.Dependency",
|
|
92
118
|
Version = "1.0.0",
|
|
93
119
|
Requirements = [
|
|
94
|
-
new() { Requirement = "1.0.0", File = "/
|
|
120
|
+
new() { Requirement = "1.0.0", File = "/src1/project1.csproj", Groups = ["dependencies"] },
|
|
95
121
|
],
|
|
96
122
|
},
|
|
97
123
|
new()
|
|
@@ -99,19 +125,34 @@ public class RefreshGroupUpdatePullRequestHandlerTests : UpdateHandlersTestsBase
|
|
|
99
125
|
Name = "Unrelated.Dependency",
|
|
100
126
|
Version = "3.0.0",
|
|
101
127
|
Requirements = [
|
|
102
|
-
new() { Requirement = "3.0.0", File = "/
|
|
128
|
+
new() { Requirement = "3.0.0", File = "/src1/project1.csproj", Groups = ["dependencies"] },
|
|
103
129
|
],
|
|
104
130
|
},
|
|
105
131
|
],
|
|
106
|
-
DependencyFiles = ["/
|
|
132
|
+
DependencyFiles = ["/src1/project1.csproj"],
|
|
107
133
|
},
|
|
108
|
-
|
|
134
|
+
// for `/src2`
|
|
135
|
+
new UpdatedDependencyList()
|
|
109
136
|
{
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
137
|
+
Dependencies = [
|
|
138
|
+
new()
|
|
139
|
+
{
|
|
140
|
+
Name = "Some.Dependency",
|
|
141
|
+
Version = "1.0.0",
|
|
142
|
+
Requirements = [
|
|
143
|
+
new() { Requirement = "1.0.0", File = "/src2/project2.csproj", Groups = ["dependencies"] },
|
|
144
|
+
],
|
|
145
|
+
},
|
|
146
|
+
new()
|
|
147
|
+
{
|
|
148
|
+
Name = "Unrelated.Dependency",
|
|
149
|
+
Version = "3.0.0",
|
|
150
|
+
Requirements = [
|
|
151
|
+
new() { Requirement = "3.0.0", File = "/src2/project2.csproj", Groups = ["dependencies"] },
|
|
152
|
+
],
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
DependencyFiles = ["/src2/project2.csproj"],
|
|
115
156
|
},
|
|
116
157
|
new UpdatePullRequest()
|
|
117
158
|
{
|
|
@@ -120,8 +161,14 @@ public class RefreshGroupUpdatePullRequestHandlerTests : UpdateHandlersTestsBase
|
|
|
120
161
|
UpdatedDependencyFiles = [
|
|
121
162
|
new()
|
|
122
163
|
{
|
|
123
|
-
Directory = "/
|
|
124
|
-
Name = "
|
|
164
|
+
Directory = "/src1",
|
|
165
|
+
Name = "project1.csproj",
|
|
166
|
+
Content = "updated contents",
|
|
167
|
+
},
|
|
168
|
+
new()
|
|
169
|
+
{
|
|
170
|
+
Directory = "/src2",
|
|
171
|
+
Name = "project2.csproj",
|
|
125
172
|
Content = "updated contents",
|
|
126
173
|
}
|
|
127
174
|
],
|
|
@@ -221,6 +268,14 @@ public class RefreshGroupUpdatePullRequestHandlerTests : UpdateHandlersTestsBase
|
|
|
221
268
|
}),
|
|
222
269
|
expectedUpdateHandler: RefreshGroupUpdatePullRequestHandler.Instance,
|
|
223
270
|
expectedApiMessages: [
|
|
271
|
+
new IncrementMetric()
|
|
272
|
+
{
|
|
273
|
+
Metric = "updater.started",
|
|
274
|
+
Tags = new()
|
|
275
|
+
{
|
|
276
|
+
["operation"] = "update_version_group_pr",
|
|
277
|
+
}
|
|
278
|
+
},
|
|
224
279
|
new UpdatedDependencyList()
|
|
225
280
|
{
|
|
226
281
|
Dependencies = [
|
|
@@ -259,14 +314,6 @@ public class RefreshGroupUpdatePullRequestHandlerTests : UpdateHandlersTestsBase
|
|
|
259
314
|
],
|
|
260
315
|
DependencyFiles = ["/src/project1.csproj", "/src/project2.csproj"],
|
|
261
316
|
},
|
|
262
|
-
new IncrementMetric()
|
|
263
|
-
{
|
|
264
|
-
Metric = "updater.started",
|
|
265
|
-
Tags = new()
|
|
266
|
-
{
|
|
267
|
-
["operation"] = "update_version_group_pr",
|
|
268
|
-
}
|
|
269
|
-
},
|
|
270
317
|
new UpdatePullRequest()
|
|
271
318
|
{
|
|
272
319
|
DependencyNames = ["Some.Dependency"],
|
|
@@ -376,6 +423,14 @@ public class RefreshGroupUpdatePullRequestHandlerTests : UpdateHandlersTestsBase
|
|
|
376
423
|
}),
|
|
377
424
|
expectedUpdateHandler: RefreshGroupUpdatePullRequestHandler.Instance,
|
|
378
425
|
expectedApiMessages: [
|
|
426
|
+
new IncrementMetric()
|
|
427
|
+
{
|
|
428
|
+
Metric = "updater.started",
|
|
429
|
+
Tags = new()
|
|
430
|
+
{
|
|
431
|
+
["operation"] = "update_version_group_pr",
|
|
432
|
+
}
|
|
433
|
+
},
|
|
379
434
|
new UpdatedDependencyList()
|
|
380
435
|
{
|
|
381
436
|
Dependencies = [
|
|
@@ -414,14 +469,6 @@ public class RefreshGroupUpdatePullRequestHandlerTests : UpdateHandlersTestsBase
|
|
|
414
469
|
],
|
|
415
470
|
DependencyFiles = ["/src/project1.csproj", "/src/project2.csproj"],
|
|
416
471
|
},
|
|
417
|
-
new IncrementMetric()
|
|
418
|
-
{
|
|
419
|
-
Metric = "updater.started",
|
|
420
|
-
Tags = new()
|
|
421
|
-
{
|
|
422
|
-
["operation"] = "update_version_group_pr",
|
|
423
|
-
}
|
|
424
|
-
},
|
|
425
472
|
new UpdatePullRequest()
|
|
426
473
|
{
|
|
427
474
|
DependencyNames = ["Some.Dependency"],
|
|
@@ -497,6 +544,14 @@ public class RefreshGroupUpdatePullRequestHandlerTests : UpdateHandlersTestsBase
|
|
|
497
544
|
updaterWorker: new TestUpdaterWorker(input => throw new NotImplementedException("test shouldn't get this far")),
|
|
498
545
|
expectedUpdateHandler: RefreshGroupUpdatePullRequestHandler.Instance,
|
|
499
546
|
expectedApiMessages: [
|
|
547
|
+
new IncrementMetric()
|
|
548
|
+
{
|
|
549
|
+
Metric = "updater.started",
|
|
550
|
+
Tags = new()
|
|
551
|
+
{
|
|
552
|
+
["operation"] = "update_version_group_pr",
|
|
553
|
+
}
|
|
554
|
+
},
|
|
500
555
|
new UpdatedDependencyList()
|
|
501
556
|
{
|
|
502
557
|
Dependencies = [
|
|
@@ -511,14 +566,6 @@ public class RefreshGroupUpdatePullRequestHandlerTests : UpdateHandlersTestsBase
|
|
|
511
566
|
],
|
|
512
567
|
DependencyFiles = ["/src/project.csproj"],
|
|
513
568
|
},
|
|
514
|
-
new IncrementMetric()
|
|
515
|
-
{
|
|
516
|
-
Metric = "updater.started",
|
|
517
|
-
Tags = new()
|
|
518
|
-
{
|
|
519
|
-
["operation"] = "update_version_group_pr",
|
|
520
|
-
}
|
|
521
|
-
},
|
|
522
569
|
new ClosePullRequest() { DependencyNames = ["Some.Dependency"], Reason = "update_no_longer_possible" },
|
|
523
570
|
new MarkAsProcessed("TEST-COMMIT-SHA"),
|
|
524
571
|
]
|
|
@@ -604,6 +651,14 @@ public class RefreshGroupUpdatePullRequestHandlerTests : UpdateHandlersTestsBase
|
|
|
604
651
|
}),
|
|
605
652
|
expectedUpdateHandler: RefreshGroupUpdatePullRequestHandler.Instance,
|
|
606
653
|
expectedApiMessages: [
|
|
654
|
+
new IncrementMetric()
|
|
655
|
+
{
|
|
656
|
+
Metric = "updater.started",
|
|
657
|
+
Tags = new()
|
|
658
|
+
{
|
|
659
|
+
["operation"] = "update_version_group_pr",
|
|
660
|
+
}
|
|
661
|
+
},
|
|
607
662
|
new UpdatedDependencyList()
|
|
608
663
|
{
|
|
609
664
|
Dependencies = [
|
|
@@ -626,14 +681,6 @@ public class RefreshGroupUpdatePullRequestHandlerTests : UpdateHandlersTestsBase
|
|
|
626
681
|
],
|
|
627
682
|
DependencyFiles = ["/src/project.csproj"],
|
|
628
683
|
},
|
|
629
|
-
new IncrementMetric()
|
|
630
|
-
{
|
|
631
|
-
Metric = "updater.started",
|
|
632
|
-
Tags = new()
|
|
633
|
-
{
|
|
634
|
-
["operation"] = "update_version_group_pr",
|
|
635
|
-
}
|
|
636
|
-
},
|
|
637
684
|
new ClosePullRequest() { DependencyNames = ["Some.Dependency", "Some.Other.Dependency"], Reason = "dependencies_changed" },
|
|
638
685
|
new CreatePullRequest()
|
|
639
686
|
{
|
|
@@ -759,6 +806,14 @@ public class RefreshGroupUpdatePullRequestHandlerTests : UpdateHandlersTestsBase
|
|
|
759
806
|
}),
|
|
760
807
|
expectedUpdateHandler: RefreshGroupUpdatePullRequestHandler.Instance,
|
|
761
808
|
expectedApiMessages: [
|
|
809
|
+
new IncrementMetric()
|
|
810
|
+
{
|
|
811
|
+
Metric = "updater.started",
|
|
812
|
+
Tags = new()
|
|
813
|
+
{
|
|
814
|
+
["operation"] = "update_version_group_pr",
|
|
815
|
+
}
|
|
816
|
+
},
|
|
762
817
|
new UpdatedDependencyList()
|
|
763
818
|
{
|
|
764
819
|
Dependencies = [
|
|
@@ -773,14 +828,6 @@ public class RefreshGroupUpdatePullRequestHandlerTests : UpdateHandlersTestsBase
|
|
|
773
828
|
],
|
|
774
829
|
DependencyFiles = ["/src/project.csproj"],
|
|
775
830
|
},
|
|
776
|
-
new IncrementMetric()
|
|
777
|
-
{
|
|
778
|
-
Metric = "updater.started",
|
|
779
|
-
Tags = new()
|
|
780
|
-
{
|
|
781
|
-
["operation"] = "update_version_group_pr",
|
|
782
|
-
}
|
|
783
|
-
},
|
|
784
831
|
new CreatePullRequest()
|
|
785
832
|
{
|
|
786
833
|
Dependencies = [
|
|
@@ -216,7 +216,7 @@ public class BindingRedirectsTests : TestBase
|
|
|
216
216
|
await File.WriteAllTextAsync(configFilePath, configContents);
|
|
217
217
|
|
|
218
218
|
var projectBuildFile = ProjectBuildFile.Open(tempDir.DirectoryPath, projectFilePath);
|
|
219
|
-
await BindingRedirectManager.UpdateBindingRedirectsAsync(projectBuildFile, updatedPackageName, updatedPackageVersion);
|
|
219
|
+
await BindingRedirectManager.UpdateBindingRedirectsAsync(tempDir.DirectoryPath, projectBuildFile, updatedPackageName, updatedPackageVersion);
|
|
220
220
|
|
|
221
221
|
var actualConfigContents = (await File.ReadAllTextAsync(configFilePath)).Replace("\r", "");
|
|
222
222
|
expectedConfigContents = expectedConfigContents.Replace("\r", "");
|
|
@@ -283,6 +283,24 @@ public class PathHelperTests
|
|
|
283
283
|
"/src/client/ios/ui"
|
|
284
284
|
}
|
|
285
285
|
];
|
|
286
|
+
|
|
287
|
+
// leading and trailing slashes
|
|
288
|
+
yield return
|
|
289
|
+
[
|
|
290
|
+
// searchPattern
|
|
291
|
+
"/src/",
|
|
292
|
+
// directoriesOnDisk
|
|
293
|
+
new[]
|
|
294
|
+
{
|
|
295
|
+
"src",
|
|
296
|
+
"tests"
|
|
297
|
+
},
|
|
298
|
+
// expectedDirectories
|
|
299
|
+
new[]
|
|
300
|
+
{
|
|
301
|
+
"/src"
|
|
302
|
+
}
|
|
303
|
+
];
|
|
286
304
|
}
|
|
287
305
|
|
|
288
306
|
[LinuxOnlyFact]
|
|
@@ -13,7 +13,7 @@ public class ProjectHelperTests : TestBase
|
|
|
13
13
|
using var tempDirectory = await TemporaryDirectory.CreateWithContentsAsync(files);
|
|
14
14
|
var fullProjectPath = Path.Join(tempDirectory.DirectoryPath, projectPath);
|
|
15
15
|
|
|
16
|
-
var actualAdditionalFiles = ProjectHelper.GetAllAdditionalFilesFromProject(fullProjectPath, ProjectHelper.PathFormat.Relative);
|
|
16
|
+
var actualAdditionalFiles = ProjectHelper.GetAllAdditionalFilesFromProject(tempDirectory.DirectoryPath, fullProjectPath, ProjectHelper.PathFormat.Relative);
|
|
17
17
|
AssertEx.Equal(expectedAdditionalFiles, actualAdditionalFiles);
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -61,5 +61,32 @@ public class ProjectHelperTests : TestBase
|
|
|
61
61
|
"../unexpected-path/packages.config"
|
|
62
62
|
}
|
|
63
63
|
];
|
|
64
|
+
|
|
65
|
+
// files with different casing
|
|
66
|
+
yield return
|
|
67
|
+
[
|
|
68
|
+
// project path
|
|
69
|
+
"src/project.csproj",
|
|
70
|
+
// files
|
|
71
|
+
new[]
|
|
72
|
+
{
|
|
73
|
+
("src/project.csproj", """
|
|
74
|
+
<Project>
|
|
75
|
+
<ItemGroup>
|
|
76
|
+
<None Include="PACKAGES.CONFIG" />
|
|
77
|
+
<None Include="APP.CONFIG" />
|
|
78
|
+
</ItemGroup>
|
|
79
|
+
</Project>
|
|
80
|
+
"""),
|
|
81
|
+
("src/app.config", "contents irrelevant"),
|
|
82
|
+
("src/packages.config", "contents irrelevant"),
|
|
83
|
+
},
|
|
84
|
+
// expected additional files
|
|
85
|
+
new[]
|
|
86
|
+
{
|
|
87
|
+
"app.config",
|
|
88
|
+
"packages.config"
|
|
89
|
+
}
|
|
90
|
+
];
|
|
64
91
|
}
|
|
65
92
|
}
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dependabot-nuget
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.356.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dependabot
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.
|
|
18
|
+
version: 0.356.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.
|
|
25
|
+
version: 0.356.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: debug
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -553,7 +553,7 @@ licenses:
|
|
|
553
553
|
- MIT
|
|
554
554
|
metadata:
|
|
555
555
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
|
556
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
|
556
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.356.0
|
|
557
557
|
rdoc_options: []
|
|
558
558
|
require_paths:
|
|
559
559
|
- lib
|