dependabot-nuget 0.240.0 → 0.242.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/helpers/build +45 -0
  3. data/helpers/lib/NuGetUpdater/.editorconfig +364 -0
  4. data/helpers/lib/NuGetUpdater/.gitignore +5 -0
  5. data/helpers/lib/NuGetUpdater/Directory.Build.props +10 -0
  6. data/helpers/lib/NuGetUpdater/Directory.Common.props +16 -0
  7. data/helpers/lib/NuGetUpdater/NuGetProjects/Directory.Build.props +14 -0
  8. data/helpers/lib/NuGetUpdater/NuGetProjects/Directory.Build.targets +7 -0
  9. data/helpers/lib/NuGetUpdater/NuGetProjects/Directory.Packages.props +29 -0
  10. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Build.Tasks/NuGet.Build.Tasks.csproj +27 -0
  11. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.CommandLine/AssemblyMetadataExtractor.cs +203 -0
  12. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.CommandLine/NuGet.CommandLine.csproj +33 -0
  13. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Commands/NuGet.Commands.csproj +26 -0
  14. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Common/NuGet.Common.csproj +21 -0
  15. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Config +6 -0
  16. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Configuration/NuGet.Configuration.csproj +24 -0
  17. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Credentials/NuGet.Credentials.csproj +20 -0
  18. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.DependencyResolver.Core/NuGet.DependencyResolver.Core.csproj +22 -0
  19. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Frameworks/NuGet.Frameworks.csproj +17 -0
  20. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.LibraryModel/NuGet.LibraryModel.csproj +17 -0
  21. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.PackageManagement/NuGet.PackageManagement.csproj +27 -0
  22. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Packaging/NuGet.Packaging.csproj +28 -0
  23. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.ProjectModel/NuGet.ProjectModel.csproj +20 -0
  24. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Protocol/NuGet.Protocol.csproj +21 -0
  25. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Resolver/NuGet.Resolver.csproj +20 -0
  26. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Versioning/NuGet.Versioning.csproj +17 -0
  27. data/helpers/lib/NuGetUpdater/NuGetProjects/README.md +1 -0
  28. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/FrameworkCheckCommand.cs +35 -0
  29. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/UpdateCommand.cs +43 -0
  30. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/NuGetUpdater.Cli.csproj +20 -0
  31. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Program.cs +31 -0
  32. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.FrameworkCheck.cs +42 -0
  33. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +323 -0
  34. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/NuGetUpdater.Cli.Test.csproj +24 -0
  35. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Dependency.cs +3 -0
  36. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencyType.cs +12 -0
  37. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/BuildFile.cs +97 -0
  38. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/DotNetToolsJsonBuildFile.cs +23 -0
  39. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/GlobalJsonBuildFile.cs +36 -0
  40. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/JsonBuildFile.cs +47 -0
  41. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/PackagesConfigBuildFile.cs +31 -0
  42. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/ProjectBuildFile.cs +94 -0
  43. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/XmlBuildFile.cs +14 -0
  44. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/CompatabilityChecker.cs +39 -0
  45. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/FrameworkCompatibilityService.cs +73 -0
  46. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/SupportedFrameworks.cs +146 -0
  47. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/NuGetUpdater.Core.csproj +27 -0
  48. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs +316 -0
  49. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectResolver.cs +87 -0
  50. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/ConfigurationFile.cs +3 -0
  51. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/DotNetToolsJsonUpdater.cs +66 -0
  52. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/GlobalJsonUpdater.cs +48 -0
  53. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackagesConfigUpdater.cs +172 -0
  54. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/SdkPackageUpdater.cs +498 -0
  55. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdateResult.cs +7 -0
  56. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +105 -0
  57. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/JsonHelper.cs +222 -0
  58. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/Logger.cs +24 -0
  59. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +460 -0
  60. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/NuGetHelper.cs +15 -0
  61. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +69 -0
  62. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ProcessExtensions.cs +83 -0
  63. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/XmlExtensions.cs +124 -0
  64. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/DotNetToolsJsonBuildFileTests.cs +53 -0
  65. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/GlobalJsonBuildFileTests.cs +80 -0
  66. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/PackagesConfigBuildFileTests.cs +63 -0
  67. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/ProjectBuildFileTests.cs +154 -0
  68. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/CompatibilityCheckerFacts.cs +64 -0
  69. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/FrameworkCompatibilityServiceFacts.cs +122 -0
  70. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/SupportedFrameworkFacts.cs +68 -0
  71. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/NuGetUpdater.Core.Test.csproj +23 -0
  72. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TemporaryDirectory.cs +36 -0
  73. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestExtensions.cs +15 -0
  74. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/PackagesConfigUpdaterTests.cs +79 -0
  75. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorker.DirsProj.cs +201 -0
  76. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +147 -0
  77. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DotNetTools.cs +225 -0
  78. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.GlobalJson.cs +217 -0
  79. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Mixed.cs +94 -0
  80. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +938 -0
  81. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Sdk.cs +2177 -0
  82. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/JsonHelperTests.cs +239 -0
  83. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +598 -0
  84. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/SdkPackageUpdaterHelperTests.cs +179 -0
  85. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/SdkPackageUpdaterTests.cs +238 -0
  86. data/helpers/lib/NuGetUpdater/NuGetUpdater.sln +152 -0
  87. data/helpers/lib/NuGetUpdater/xunit.runner.json +4 -0
  88. data/lib/dependabot/nuget/metadata_finder.rb +4 -4
  89. metadata +91 -5
@@ -0,0 +1,239 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using NuGetUpdater.Core.Utilities;
4
+ using Xunit;
5
+
6
+ namespace NuGetUpdater.Core.Test.Utilities;
7
+
8
+ public class JsonHelperTests
9
+ {
10
+ [Theory]
11
+ [MemberData(nameof(JsonUpdaterTestData))]
12
+ public void UpdateJsonPreservingComments(string json, string[] propertyPath, string newValue, string expectedJson)
13
+ {
14
+ var updatedJson = JsonHelper.UpdateJsonProperty(json, propertyPath, newValue, StringComparison.OrdinalIgnoreCase).Replace("\r", string.Empty);
15
+ expectedJson = expectedJson.Replace("\r", string.Empty);
16
+ Assert.Equal(expectedJson, updatedJson);
17
+ }
18
+
19
+ public static IEnumerable<object[]> JsonUpdaterTestData()
20
+ {
21
+ yield return new object[]
22
+ {
23
+ // json
24
+ """
25
+ {
26
+ // this is a comment
27
+ "version": 1,
28
+ "isRoot": true,
29
+ "tools": {
30
+ "microsoft.botsay": {
31
+ // this is a deep comment
32
+ "version": "1.0.0",
33
+ "commands": [
34
+ "botsay"
35
+ ]
36
+ },
37
+ "dotnetsay": {
38
+ "version": "2.1.3",
39
+ "commands": [ // end of line comment
40
+ "dotnetsay"
41
+ ]
42
+ }
43
+ }
44
+ }
45
+ """,
46
+ // property path
47
+ new[]
48
+ {
49
+ "tools",
50
+ "microsoft.botsay",
51
+ "version"
52
+ },
53
+ // new value
54
+ "1.1.0",
55
+ // expected json
56
+ """
57
+ {
58
+ // this is a comment
59
+ "version": 1,
60
+ "isRoot": true,
61
+ "tools": {
62
+ "microsoft.botsay": {
63
+ // this is a deep comment
64
+ "version": "1.1.0",
65
+ "commands": [
66
+ "botsay"
67
+ ]
68
+ },
69
+ "dotnetsay": {
70
+ "version": "2.1.3",
71
+ "commands": [ // end of line comment
72
+ "dotnetsay"
73
+ ]
74
+ }
75
+ }
76
+ }
77
+ """
78
+ };
79
+
80
+ yield return new object[]
81
+ {
82
+ // json
83
+ """
84
+ {
85
+ // Defines version of MSBuild project SDKs to use
86
+ // https://docs.microsoft.com/en-us/visualstudio/msbuild/how-to-use-project-sdk?view=vs-2017#how-project-sdks-are-resolved
87
+ // https://docs.microsoft.com/en-us/dotnet/core/tools/global-json#globaljson-schema
88
+ "msbuild-sdks": {
89
+ "Microsoft.Build.Traversal": "4.1.0",
90
+ "Microsoft.Build.NoTargets": "3.6.0"
91
+ },
92
+ "sdk": {
93
+ "version": "6.0.400",
94
+ "rollForward": "latestMajor"
95
+ }
96
+ }
97
+ """,
98
+ // property path
99
+ new[]
100
+ {
101
+ "msbuild-sdks",
102
+ "Microsoft.Build.NoTargets"
103
+ },
104
+ // new value
105
+ "3.7.0",
106
+ // expected json
107
+ """
108
+ {
109
+ // Defines version of MSBuild project SDKs to use
110
+ // https://docs.microsoft.com/en-us/visualstudio/msbuild/how-to-use-project-sdk?view=vs-2017#how-project-sdks-are-resolved
111
+ // https://docs.microsoft.com/en-us/dotnet/core/tools/global-json#globaljson-schema
112
+ "msbuild-sdks": {
113
+ "Microsoft.Build.Traversal": "4.1.0",
114
+ "Microsoft.Build.NoTargets": "3.7.0"
115
+ },
116
+ "sdk": {
117
+ "version": "6.0.400",
118
+ "rollForward": "latestMajor"
119
+ }
120
+ }
121
+ """
122
+ };
123
+
124
+ // differing case between `propertyPath` and the actual property values
125
+ yield return new object[]
126
+ {
127
+ // json
128
+ """
129
+ {
130
+ "version": 1,
131
+ "isRoot": true,
132
+ "tools": {
133
+ "microsoft.botsay": {
134
+ // some comment
135
+ "version": "1.0.0",
136
+ "commands": [
137
+ "botsay"
138
+ ]
139
+ },
140
+ "dotnetsay": {
141
+ "version": "2.1.3",
142
+ "commands": [
143
+ "dotnetsay"
144
+ ]
145
+ }
146
+ }
147
+ }
148
+ """,
149
+ // property path
150
+ new[]
151
+ {
152
+ "tools",
153
+ "Microsoft.BotSay",
154
+ "version"
155
+ },
156
+ // new value
157
+ "1.1.0",
158
+ // expected json
159
+ """
160
+ {
161
+ "version": 1,
162
+ "isRoot": true,
163
+ "tools": {
164
+ "microsoft.botsay": {
165
+ // some comment
166
+ "version": "1.1.0",
167
+ "commands": [
168
+ "botsay"
169
+ ]
170
+ },
171
+ "dotnetsay": {
172
+ "version": "2.1.3",
173
+ "commands": [
174
+ "dotnetsay"
175
+ ]
176
+ }
177
+ }
178
+ }
179
+ """
180
+ };
181
+
182
+ // shallow property path
183
+ yield return new object[]
184
+ {
185
+ // original json
186
+ """
187
+ {
188
+ "path1": {
189
+ "subpath1": "value1",
190
+ "subpath2": "value2"
191
+ },
192
+ "path2": "old-value"
193
+ }
194
+ """,
195
+ // property path
196
+ new[]
197
+ {
198
+ "path2"
199
+ },
200
+ // new value
201
+ "new-value",
202
+ // expected json
203
+ """
204
+ {
205
+ "path1": {
206
+ "subpath1": "value1",
207
+ "subpath2": "value2"
208
+ },
209
+ "path2": "new-value"
210
+ }
211
+ """
212
+ };
213
+
214
+ // line comment after comma
215
+ yield return new object[]
216
+ {
217
+ // original json
218
+ """
219
+ {
220
+ "property1": "value1",
221
+ // some comment
222
+ "property2": "value2"
223
+ }
224
+ """,
225
+ // property path
226
+ new[] { "property2" },
227
+ // new value
228
+ "updated-value",
229
+ // expected json
230
+ """
231
+ {
232
+ "property1": "value1",
233
+ // some comment
234
+ "property2": "updated-value"
235
+ }
236
+ """
237
+ };
238
+ }
239
+ }