dependabot-nuget 0.258.0 → 0.259.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
@@ -1,5 +1,3 @@
|
|
1
|
-
using System.Threading.Tasks;
|
2
|
-
|
3
1
|
using Xunit;
|
4
2
|
|
5
3
|
namespace NuGetUpdater.Core.Test.Update;
|
@@ -12,36 +10,39 @@ public partial class UpdateWorkerTests
|
|
12
10
|
public async Task NoChangeWhenGlobalJsonNotFound()
|
13
11
|
{
|
14
12
|
await TestNoChangeforProject("Microsoft.Build.Traversal", "3.2.0", "4.1.0",
|
13
|
+
packages: [],
|
15
14
|
// initial
|
16
15
|
projectContents: """
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
17
|
+
<PropertyGroup>
|
18
|
+
<TargetFramework>netstandard2.0</TargetFramework>
|
19
|
+
</PropertyGroup>
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
21
|
+
<ItemGroup>
|
22
|
+
<PackageReference Include="Some.Package" Version="13.0.3" />
|
23
|
+
</ItemGroup>
|
24
|
+
</Project>
|
25
|
+
"""
|
26
|
+
);
|
27
27
|
}
|
28
28
|
|
29
29
|
[Fact]
|
30
30
|
public async Task NoChangeWhenDependencyNotFound()
|
31
31
|
{
|
32
32
|
await TestNoChangeforProject("Microsoft.Build.Traversal", "3.2.0", "4.1.0",
|
33
|
+
packages: [],
|
33
34
|
// initial
|
34
35
|
projectContents: """
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
37
|
+
<PropertyGroup>
|
38
|
+
<TargetFramework>netstandard2.0</TargetFramework>
|
39
|
+
</PropertyGroup>
|
39
40
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
<ItemGroup>
|
42
|
+
<PackageReference Include="Some.Package" Version="13.0.3" />
|
43
|
+
</ItemGroup>
|
44
|
+
</Project>
|
45
|
+
""",
|
45
46
|
additionalFiles:
|
46
47
|
[
|
47
48
|
("global.json", """
|
@@ -52,26 +53,28 @@ public partial class UpdateWorkerTests
|
|
52
53
|
}
|
53
54
|
}
|
54
55
|
""")
|
55
|
-
]
|
56
|
+
]
|
57
|
+
);
|
56
58
|
}
|
57
59
|
|
58
60
|
[Fact]
|
59
61
|
public async Task NoChangeWhenGlobalJsonInUnexpectedLocation()
|
60
62
|
{
|
61
63
|
await TestNoChangeforProject("Microsoft.Build.Traversal", "3.2.0", "4.1.0",
|
64
|
+
packages: [],
|
62
65
|
// initial
|
63
66
|
projectFilePath: "src/project/project.csproj",
|
64
67
|
projectContents: """
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
68
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
69
|
+
<PropertyGroup>
|
70
|
+
<TargetFramework>netstandard2.0</TargetFramework>
|
71
|
+
</PropertyGroup>
|
69
72
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
73
|
+
<ItemGroup>
|
74
|
+
<PackageReference Include="Some.Package" Version="13.0.3" />
|
75
|
+
</ItemGroup>>
|
76
|
+
</Project>
|
77
|
+
""",
|
75
78
|
additionalFiles:
|
76
79
|
[
|
77
80
|
("eng/global.json", """
|
@@ -85,26 +88,33 @@ public partial class UpdateWorkerTests
|
|
85
88
|
}
|
86
89
|
}
|
87
90
|
""")
|
88
|
-
]
|
91
|
+
]
|
92
|
+
);
|
89
93
|
}
|
90
94
|
|
91
95
|
[Fact]
|
92
96
|
public async Task UpdateSingleDependency()
|
93
97
|
{
|
94
|
-
await TestUpdateForProject("
|
98
|
+
await TestUpdateForProject("Some.MSBuild.Sdk", "3.2.0", "4.1.0",
|
99
|
+
packages:
|
100
|
+
[
|
101
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.3", "net8.0"),
|
102
|
+
MockNuGetPackage.CreateMSBuildSdkPackage("Some.MSBuild.Sdk", "3.2.0"),
|
103
|
+
MockNuGetPackage.CreateMSBuildSdkPackage("Some.MSBuild.Sdk", "4.1.0"),
|
104
|
+
],
|
95
105
|
// initial
|
96
106
|
projectFilePath: "src/project/project.csproj",
|
97
107
|
projectContents: """
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
108
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
109
|
+
<PropertyGroup>
|
110
|
+
<TargetFramework>net8.0</TargetFramework>
|
111
|
+
</PropertyGroup>
|
102
112
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
113
|
+
<ItemGroup>
|
114
|
+
<PackageReference Include="Some.Package" Version="13.0.3" />
|
115
|
+
</ItemGroup>
|
116
|
+
</Project>
|
117
|
+
""",
|
108
118
|
additionalFiles:
|
109
119
|
[
|
110
120
|
("src/global.json", """
|
@@ -114,23 +124,23 @@ public partial class UpdateWorkerTests
|
|
114
124
|
"rollForward": "latestPatch"
|
115
125
|
},
|
116
126
|
"msbuild-sdks": {
|
117
|
-
"
|
127
|
+
"Some.MSBuild.Sdk": "3.2.0"
|
118
128
|
}
|
119
129
|
}
|
120
130
|
""")
|
121
131
|
],
|
122
132
|
// expected
|
123
133
|
expectedProjectContents: """
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
134
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
135
|
+
<PropertyGroup>
|
136
|
+
<TargetFramework>net8.0</TargetFramework>
|
137
|
+
</PropertyGroup>
|
128
138
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
139
|
+
<ItemGroup>
|
140
|
+
<PackageReference Include="Some.Package" Version="13.0.3" />
|
141
|
+
</ItemGroup>
|
142
|
+
</Project>
|
143
|
+
""",
|
134
144
|
additionalFilesExpected:
|
135
145
|
[
|
136
146
|
("src/global.json", """
|
@@ -140,29 +150,36 @@ public partial class UpdateWorkerTests
|
|
140
150
|
"rollForward": "latestPatch"
|
141
151
|
},
|
142
152
|
"msbuild-sdks": {
|
143
|
-
"
|
153
|
+
"Some.MSBuild.Sdk": "4.1.0"
|
144
154
|
}
|
145
155
|
}
|
146
156
|
""")
|
147
|
-
]
|
157
|
+
]
|
158
|
+
);
|
148
159
|
}
|
149
160
|
|
150
161
|
[Fact]
|
151
162
|
public async Task UpdateDependencyWithComments()
|
152
163
|
{
|
153
|
-
await TestUpdateForProject("
|
164
|
+
await TestUpdateForProject("Some.MSBuild.Sdk", "3.2.0", "4.1.0",
|
165
|
+
packages:
|
166
|
+
[
|
167
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.3", "net8.0"),
|
168
|
+
MockNuGetPackage.CreateMSBuildSdkPackage("Some.MSBuild.Sdk", "3.2.0"),
|
169
|
+
MockNuGetPackage.CreateMSBuildSdkPackage("Some.MSBuild.Sdk", "4.1.0"),
|
170
|
+
],
|
154
171
|
// initial
|
155
172
|
projectContents: """
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
173
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
174
|
+
<PropertyGroup>
|
175
|
+
<TargetFramework>net8.0</TargetFramework>
|
176
|
+
</PropertyGroup>
|
160
177
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
178
|
+
<ItemGroup>
|
179
|
+
<PackageReference Include="Some.Package" Version="13.0.3" />
|
180
|
+
</ItemGroup>
|
181
|
+
</Project>
|
182
|
+
""",
|
166
183
|
additionalFiles:
|
167
184
|
[
|
168
185
|
("global.json", """
|
@@ -174,23 +191,23 @@ public partial class UpdateWorkerTests
|
|
174
191
|
},
|
175
192
|
"msbuild-sdks": {
|
176
193
|
// this is a deep comment
|
177
|
-
"
|
194
|
+
"Some.MSBuild.Sdk": "3.2.0"
|
178
195
|
}
|
179
196
|
}
|
180
197
|
""")
|
181
198
|
],
|
182
199
|
// expected
|
183
200
|
expectedProjectContents: """
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
201
|
+
<Project Sdk="Microsoft.NET.Sdk">
|
202
|
+
<PropertyGroup>
|
203
|
+
<TargetFramework>net8.0</TargetFramework>
|
204
|
+
</PropertyGroup>
|
188
205
|
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
206
|
+
<ItemGroup>
|
207
|
+
<PackageReference Include="Some.Package" Version="13.0.3" />
|
208
|
+
</ItemGroup>
|
209
|
+
</Project>
|
210
|
+
""",
|
194
211
|
additionalFilesExpected:
|
195
212
|
[
|
196
213
|
("global.json", """
|
@@ -202,11 +219,12 @@ public partial class UpdateWorkerTests
|
|
202
219
|
},
|
203
220
|
"msbuild-sdks": {
|
204
221
|
// this is a deep comment
|
205
|
-
"
|
222
|
+
"Some.MSBuild.Sdk": "4.1.0"
|
206
223
|
}
|
207
224
|
}
|
208
225
|
""")
|
209
|
-
]
|
226
|
+
]
|
227
|
+
);
|
210
228
|
}
|
211
229
|
}
|
212
230
|
}
|
@@ -1,5 +1,3 @@
|
|
1
|
-
using System.Threading.Tasks;
|
2
|
-
|
3
1
|
using Xunit;
|
4
2
|
|
5
3
|
namespace NuGetUpdater.Core.Test.Update;
|
@@ -11,74 +9,79 @@ public partial class UpdateWorkerTests
|
|
11
9
|
[Fact]
|
12
10
|
public async Task ForPackagesProject_UpdatePackageReference_InBuildProps()
|
13
11
|
{
|
14
|
-
// update
|
15
|
-
await TestUpdateForProject("
|
12
|
+
// update Some.Package from 7.0.1 to 13.0.1
|
13
|
+
await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
|
14
|
+
packages:
|
15
|
+
[
|
16
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "7.0.1", "net45"),
|
17
|
+
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net45"),
|
18
|
+
],
|
16
19
|
// existing
|
17
20
|
projectContents: """
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
21
|
+
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
22
|
+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
23
|
+
<PropertyGroup>
|
24
|
+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
25
|
+
</PropertyGroup>
|
26
|
+
<ItemGroup>
|
27
|
+
<None Include="packages.config" />
|
28
|
+
</ItemGroup>
|
29
|
+
<ItemGroup>
|
30
|
+
<Reference Include="Some.Package">
|
31
|
+
<HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
|
32
|
+
<Private>True</Private>
|
33
|
+
</Reference>
|
34
|
+
</ItemGroup>
|
35
|
+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
36
|
+
</Project>
|
37
|
+
""",
|
35
38
|
additionalFiles:
|
36
39
|
[
|
37
40
|
("packages.config", """
|
38
41
|
<?xml version="1.0" encoding="utf-8"?>
|
39
42
|
<packages>
|
40
|
-
<package id="
|
43
|
+
<package id="Some.Package" version="13.0.1" targetFramework="net45" />
|
41
44
|
</packages>
|
42
45
|
"""),
|
43
46
|
("Directory.Build.props", """
|
44
47
|
<Project>
|
45
48
|
<ItemGroup>
|
46
|
-
<PackageReference Include="
|
49
|
+
<PackageReference Include="Some.Package" Version="7.0.1" />
|
47
50
|
</ItemGroup>
|
48
51
|
</Project>
|
49
52
|
""")
|
50
53
|
],
|
51
54
|
// expected
|
52
55
|
expectedProjectContents: """
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
56
|
+
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
57
|
+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
58
|
+
<PropertyGroup>
|
59
|
+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
60
|
+
</PropertyGroup>
|
61
|
+
<ItemGroup>
|
62
|
+
<None Include="packages.config" />
|
63
|
+
</ItemGroup>
|
64
|
+
<ItemGroup>
|
65
|
+
<Reference Include="Some.Package">
|
66
|
+
<HintPath>packages\Some.Package.13.0.1\lib\net45\Some.Package.dll</HintPath>
|
67
|
+
<Private>True</Private>
|
68
|
+
</Reference>
|
69
|
+
</ItemGroup>
|
70
|
+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
71
|
+
</Project>
|
72
|
+
""",
|
70
73
|
additionalFilesExpected:
|
71
74
|
[
|
72
75
|
("packages.config", """
|
73
76
|
<?xml version="1.0" encoding="utf-8"?>
|
74
77
|
<packages>
|
75
|
-
<package id="
|
78
|
+
<package id="Some.Package" version="13.0.1" targetFramework="net45" />
|
76
79
|
</packages>
|
77
80
|
"""),
|
78
81
|
("Directory.Build.props", """
|
79
82
|
<Project>
|
80
83
|
<ItemGroup>
|
81
|
-
<PackageReference Include="
|
84
|
+
<PackageReference Include="Some.Package" Version="13.0.1" />
|
82
85
|
</ItemGroup>
|
83
86
|
</Project>
|
84
87
|
""")
|