dependabot-nuget 0.258.0 → 0.260.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.Packages.props +2 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +255 -191
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +63 -35
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +107 -14
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +9 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +18 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +6 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.DotNetToolsJson.cs +6 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.GlobalJson.cs +6 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.PackagesConfig.cs +11 -21
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Proj.cs +95 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs +204 -62
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +64 -45
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/MockNuGetPackage.cs +419 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/NuGetUpdater.Core.Test.csproj +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TemporaryDirectory.cs +7 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +77 -19
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DirsProj.cs +120 -91
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DotNetTools.cs +132 -97
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.GlobalJson.cs +93 -75
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Mixed.cs +45 -42
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +1089 -956
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Sdk.cs +1624 -1291
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +296 -293
- data/helpers/lib/NuGetUpdater/global.json +6 -0
- data/lib/dependabot/nuget/file_parser.rb +4 -5
- data/lib/dependabot/nuget/file_updater.rb +1 -1
- data/lib/dependabot/nuget/update_checker/dependency_finder.rb +7 -2
- data/lib/dependabot/nuget/update_checker/property_updater.rb +1 -0
- data/lib/dependabot/nuget/update_checker/version_finder.rb +2 -3
- data/lib/dependabot/nuget/update_checker.rb +1 -0
- metadata +8 -5
@@ -11,18 +11,22 @@ public partial class DiscoveryWorkerTests : DiscoveryWorkerTestBase
|
|
11
11
|
public async Task TestProjectFiles(string projectPath)
|
12
12
|
{
|
13
13
|
await TestDiscoveryAsync(
|
14
|
+
packages:
|
15
|
+
[
|
16
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "9.0.1", "net8.0"),
|
17
|
+
],
|
14
18
|
workspacePath: "src",
|
15
19
|
files: new[]
|
16
20
|
{
|
17
21
|
(projectPath, """
|
18
22
|
<Project Sdk="Microsoft.NET.Sdk">
|
19
23
|
<PropertyGroup>
|
20
|
-
<TargetFramework>
|
21
|
-
<
|
24
|
+
<TargetFramework>net8.0</TargetFramework>
|
25
|
+
<SomePackageVersion>9.0.1</SomePackageVersion>
|
22
26
|
</PropertyGroup>
|
23
27
|
|
24
28
|
<ItemGroup>
|
25
|
-
<PackageReference Include="
|
29
|
+
<PackageReference Include="Some.Package" Version="$(SomePackageVersion)" />
|
26
30
|
</ItemGroup>
|
27
31
|
</Project>
|
28
32
|
""")
|
@@ -34,16 +38,16 @@ public partial class DiscoveryWorkerTests : DiscoveryWorkerTestBase
|
|
34
38
|
new()
|
35
39
|
{
|
36
40
|
FilePath = Path.GetFileName(projectPath),
|
37
|
-
TargetFrameworks = ["
|
41
|
+
TargetFrameworks = ["net8.0"],
|
38
42
|
ReferencedProjectPaths = [],
|
39
|
-
ExpectedDependencyCount =
|
43
|
+
ExpectedDependencyCount = 2,
|
40
44
|
Dependencies = [
|
41
45
|
new("Microsoft.NET.Sdk", null, DependencyType.MSBuildSdk),
|
42
|
-
new("
|
46
|
+
new("Some.Package", "9.0.1", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true)
|
43
47
|
],
|
44
48
|
Properties = [
|
45
|
-
new("
|
46
|
-
new("TargetFramework", "
|
49
|
+
new("SomePackageVersion", "9.0.1", projectPath),
|
50
|
+
new("TargetFramework", "net8.0", projectPath),
|
47
51
|
]
|
48
52
|
}
|
49
53
|
]
|
@@ -54,12 +58,15 @@ public partial class DiscoveryWorkerTests : DiscoveryWorkerTestBase
|
|
54
58
|
[Fact]
|
55
59
|
public async Task TestPackageConfig()
|
56
60
|
{
|
57
|
-
var projectPath = "src/project.csproj";
|
58
61
|
await TestDiscoveryAsync(
|
59
|
-
|
62
|
+
packages:
|
63
|
+
[
|
64
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "7.0.1", "net45"),
|
65
|
+
],
|
66
|
+
workspacePath: "src",
|
60
67
|
files: new[]
|
61
68
|
{
|
62
|
-
(
|
69
|
+
("src/project.csproj", """
|
63
70
|
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
64
71
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
65
72
|
<PropertyGroup>
|
@@ -69,8 +76,8 @@ public partial class DiscoveryWorkerTests : DiscoveryWorkerTestBase
|
|
69
76
|
<None Include="packages.config" />
|
70
77
|
</ItemGroup>
|
71
78
|
<ItemGroup>
|
72
|
-
<Reference Include="
|
73
|
-
<HintPath>packages\
|
79
|
+
<Reference Include="Some.Package">
|
80
|
+
<HintPath>packages\Some.Package.7.0.1\lib\net45\Some.Package.dll</HintPath>
|
74
81
|
<Private>True</Private>
|
75
82
|
</Reference>
|
76
83
|
</ItemGroup>
|
@@ -79,25 +86,26 @@ public partial class DiscoveryWorkerTests : DiscoveryWorkerTestBase
|
|
79
86
|
"""),
|
80
87
|
("src/packages.config", """
|
81
88
|
<packages>
|
82
|
-
<package id="
|
89
|
+
<package id="Some.Package" version="7.0.1" targetFramework="net45" />
|
83
90
|
</packages>
|
84
91
|
"""),
|
85
92
|
},
|
86
93
|
expectedResult: new()
|
87
94
|
{
|
88
|
-
FilePath = "",
|
95
|
+
FilePath = "src",
|
89
96
|
Projects = [
|
90
97
|
new()
|
91
98
|
{
|
92
|
-
FilePath =
|
99
|
+
FilePath = "project.csproj",
|
93
100
|
TargetFrameworks = ["net45"],
|
94
101
|
ReferencedProjectPaths = [],
|
95
|
-
ExpectedDependencyCount = 2,
|
102
|
+
ExpectedDependencyCount = 2,
|
96
103
|
Dependencies = [
|
97
|
-
new("
|
104
|
+
new("Microsoft.NETFramework.ReferenceAssemblies", "1.0.3", DependencyType.Unknown, TargetFrameworks: ["net45"], IsTransitive: true),
|
105
|
+
new("Some.Package", "7.0.1", DependencyType.PackagesConfig, TargetFrameworks: ["net45"]),
|
98
106
|
],
|
99
107
|
Properties = [
|
100
|
-
new("TargetFrameworkVersion", "v4.5",
|
108
|
+
new("TargetFrameworkVersion", "v4.5", "src/project.csproj"),
|
101
109
|
]
|
102
110
|
}
|
103
111
|
]
|
@@ -108,61 +116,66 @@ public partial class DiscoveryWorkerTests : DiscoveryWorkerTestBase
|
|
108
116
|
[Fact]
|
109
117
|
public async Task TestProps()
|
110
118
|
{
|
111
|
-
var projectPath = "src/project.csproj";
|
112
119
|
await TestDiscoveryAsync(
|
113
|
-
|
120
|
+
packages:
|
121
|
+
[
|
122
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "9.0.1", "net8.0"),
|
123
|
+
],
|
124
|
+
workspacePath: "src",
|
114
125
|
files: new[]
|
115
126
|
{
|
116
|
-
(
|
127
|
+
("src/project.csproj", """
|
117
128
|
<Project Sdk="Microsoft.NET.Sdk">
|
118
129
|
<PropertyGroup>
|
119
|
-
<TargetFramework>
|
130
|
+
<TargetFramework>net8.0</TargetFramework>
|
120
131
|
</PropertyGroup>
|
121
132
|
|
122
133
|
<ItemGroup>
|
123
|
-
<PackageReference Include="
|
134
|
+
<PackageReference Include="Some.Package" />
|
124
135
|
</ItemGroup>
|
125
136
|
</Project>
|
126
137
|
"""),
|
138
|
+
("Directory.Build.props", "<Project />"),
|
127
139
|
("Directory.Packages.props", """
|
128
140
|
<Project>
|
129
141
|
<PropertyGroup>
|
130
142
|
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
131
|
-
<
|
143
|
+
<SomePackageVersion>9.0.1</SomePackageVersion>
|
132
144
|
</PropertyGroup>
|
133
145
|
|
134
146
|
<ItemGroup>
|
135
|
-
<PackageVersion Include="
|
147
|
+
<PackageVersion Include="Some.Package" Version="$(SomePackageVersion)" />
|
136
148
|
</ItemGroup>
|
137
149
|
</Project>
|
138
150
|
""")
|
139
151
|
},
|
140
152
|
expectedResult: new()
|
141
153
|
{
|
142
|
-
FilePath = "",
|
154
|
+
FilePath = "src",
|
155
|
+
ExpectedProjectCount = 2,
|
143
156
|
Projects = [
|
144
157
|
new()
|
145
158
|
{
|
146
|
-
FilePath =
|
147
|
-
TargetFrameworks = ["
|
159
|
+
FilePath = "project.csproj",
|
160
|
+
TargetFrameworks = ["net8.0"],
|
148
161
|
ReferencedProjectPaths = [],
|
149
|
-
ExpectedDependencyCount =
|
162
|
+
ExpectedDependencyCount = 2,
|
150
163
|
Dependencies = [
|
151
164
|
new("Microsoft.NET.Sdk", null, DependencyType.MSBuildSdk),
|
152
|
-
new("
|
165
|
+
new("Some.Package", "9.0.1", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true)
|
153
166
|
],
|
154
167
|
Properties = [
|
155
168
|
new("ManagePackageVersionsCentrally", "true", "Directory.Packages.props"),
|
156
|
-
new("
|
157
|
-
new("TargetFramework", "
|
169
|
+
new("SomePackageVersion", "9.0.1", "Directory.Packages.props"),
|
170
|
+
new("TargetFramework", "net8.0", "src/project.csproj"),
|
158
171
|
]
|
159
172
|
}
|
160
173
|
],
|
161
174
|
DirectoryPackagesProps = new()
|
162
175
|
{
|
163
|
-
FilePath = "Directory.Packages.props",
|
176
|
+
FilePath = "../Directory.Packages.props",
|
164
177
|
Dependencies = [
|
165
|
-
new("
|
178
|
+
new("Some.Package", "9.0.1", DependencyType.PackageVersion, IsDirect: true)
|
166
179
|
],
|
167
180
|
}
|
168
181
|
}
|
@@ -174,29 +187,34 @@ public partial class DiscoveryWorkerTests : DiscoveryWorkerTestBase
|
|
174
187
|
{
|
175
188
|
var solutionPath = "solution.sln";
|
176
189
|
await TestDiscoveryAsync(
|
190
|
+
packages:
|
191
|
+
[
|
192
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "9.0.1", "net8.0"),
|
193
|
+
],
|
177
194
|
workspacePath: "",
|
178
195
|
files: new[]
|
179
196
|
{
|
180
197
|
("src/project.csproj", """
|
181
198
|
<Project Sdk="Microsoft.NET.Sdk">
|
182
199
|
<PropertyGroup>
|
183
|
-
<TargetFrameworks>
|
200
|
+
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
|
184
201
|
</PropertyGroup>
|
185
202
|
|
186
203
|
<ItemGroup>
|
187
|
-
<PackageReference Include="
|
204
|
+
<PackageReference Include="Some.Package" />
|
188
205
|
</ItemGroup>
|
189
206
|
</Project>
|
190
207
|
"""),
|
208
|
+
("Directory.Build.props", "<Project />"),
|
191
209
|
("Directory.Packages.props", """
|
192
210
|
<Project>
|
193
211
|
<PropertyGroup>
|
194
212
|
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
195
|
-
<
|
213
|
+
<SomePackageVersion>9.0.1</SomePackageVersion>
|
196
214
|
</PropertyGroup>
|
197
215
|
|
198
216
|
<ItemGroup>
|
199
|
-
<PackageVersion Include="
|
217
|
+
<PackageVersion Include="Some.Package" Version="$(SomePackageVersion)" />
|
200
218
|
</ItemGroup>
|
201
219
|
</Project>
|
202
220
|
"""),
|
@@ -259,20 +277,21 @@ public partial class DiscoveryWorkerTests : DiscoveryWorkerTestBase
|
|
259
277
|
expectedResult: new()
|
260
278
|
{
|
261
279
|
FilePath = "",
|
280
|
+
ExpectedProjectCount = 2,
|
262
281
|
Projects = [
|
263
282
|
new()
|
264
283
|
{
|
265
284
|
FilePath = "src/project.csproj",
|
266
|
-
TargetFrameworks = ["
|
267
|
-
ExpectedDependencyCount =
|
285
|
+
TargetFrameworks = ["net7.0", "net8.0"],
|
286
|
+
ExpectedDependencyCount = 2,
|
268
287
|
Dependencies = [
|
269
288
|
new("Microsoft.NET.Sdk", null, DependencyType.MSBuildSdk),
|
270
|
-
new("
|
289
|
+
new("Some.Package", "9.0.1", DependencyType.PackageReference, TargetFrameworks: ["net7.0", "net8.0"], IsDirect: true)
|
271
290
|
],
|
272
291
|
Properties = [
|
273
292
|
new("ManagePackageVersionsCentrally", "true", "Directory.Packages.props"),
|
274
|
-
new("
|
275
|
-
new("TargetFrameworks", "
|
293
|
+
new("SomePackageVersion", "9.0.1", "Directory.Packages.props"),
|
294
|
+
new("TargetFrameworks", "net7.0;net8.0", "src/project.csproj"),
|
276
295
|
]
|
277
296
|
}
|
278
297
|
],
|
@@ -280,7 +299,7 @@ public partial class DiscoveryWorkerTests : DiscoveryWorkerTestBase
|
|
280
299
|
{
|
281
300
|
FilePath = "Directory.Packages.props",
|
282
301
|
Dependencies = [
|
283
|
-
new("
|
302
|
+
new("Some.Package", "9.0.1", DependencyType.PackageVersion, IsDirect: true)
|
284
303
|
],
|
285
304
|
},
|
286
305
|
GlobalJson = new()
|