dependabot-nuget 0.242.1 → 0.243.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/helpers/lib/NuGetUpdater/.editorconfig +37 -28
  3. data/helpers/lib/NuGetUpdater/.gitignore +1 -0
  4. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.CommandLine/AssemblyMetadataExtractor.cs +2 -1
  5. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Program.cs +2 -2
  6. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +178 -176
  7. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/JsonBuildFile.cs +2 -1
  8. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/PackagesConfigBuildFile.cs +1 -0
  9. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/ProjectBuildFile.cs +5 -4
  10. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/CompatabilityChecker.cs +1 -0
  11. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/FrameworkCompatibilityService.cs +10 -5
  12. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/SupportedFrameworks.cs +16 -12
  13. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs +18 -17
  14. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectResolver.cs +7 -7
  15. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/DotNetToolsJsonUpdater.cs +13 -20
  16. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/GlobalJsonUpdater.cs +9 -3
  17. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackagesConfigUpdater.cs +32 -16
  18. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/SdkPackageUpdater.cs +42 -22
  19. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +32 -13
  20. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/WebApplicationTargetsConditionPatcher.cs +47 -0
  21. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/XmlFilePreAndPostProcessor.cs +55 -0
  22. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/JsonHelper.cs +12 -9
  23. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +49 -42
  24. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +16 -3
  25. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ProcessExtensions.cs +6 -6
  26. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/XmlExtensions.cs +11 -0
  27. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/ProjectBuildFileTests.cs +18 -9
  28. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/CompatibilityCheckerFacts.cs +2 -2
  29. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/FrameworkCompatibilityServiceFacts.cs +7 -7
  30. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/SupportedFrameworkFacts.cs +1 -1
  31. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/PackagesConfigUpdaterTests.cs +9 -9
  32. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorker.DirsProj.cs +81 -80
  33. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +22 -9
  34. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DotNetTools.cs +140 -104
  35. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.GlobalJson.cs +25 -25
  36. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Mixed.cs +8 -9
  37. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +198 -22
  38. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Sdk.cs +401 -399
  39. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/JsonHelperTests.cs +17 -15
  40. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +111 -42
  41. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/SdkPackageUpdaterTests.cs +103 -87
  42. data/lib/dependabot/nuget/file_parser/project_file_parser.rb +45 -19
  43. data/lib/dependabot/nuget/file_parser.rb +21 -3
  44. data/lib/dependabot/nuget/file_updater.rb +42 -6
  45. data/lib/dependabot/nuget/native_helpers.rb +27 -8
  46. data/lib/dependabot/nuget/nuget_client.rb +66 -23
  47. data/lib/dependabot/nuget/nuget_config_credential_helpers.rb +7 -3
  48. data/lib/dependabot/nuget/update_checker/compatibility_checker.rb +63 -59
  49. data/lib/dependabot/nuget/update_checker/dependency_finder.rb +2 -2
  50. data/lib/dependabot/nuget/update_checker/nupkg_fetcher.rb +1 -1
  51. data/lib/dependabot/nuget/update_checker/nuspec_fetcher.rb +22 -17
  52. data/lib/dependabot/nuget/update_checker/repository_finder.rb +292 -270
  53. data/lib/dependabot/nuget/update_checker/tfm_comparer.rb +11 -13
  54. data/lib/dependabot/nuget/update_checker/tfm_finder.rb +80 -82
  55. data/lib/dependabot/nuget/update_checker/version_finder.rb +3 -2
  56. data/lib/dependabot/nuget/version.rb +18 -7
  57. data/lib/dependabot/nuget.rb +0 -2
  58. metadata +7 -5
@@ -278,8 +278,8 @@ public partial class UpdateWorkerTests
278
278
  <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
279
279
  </packages>
280
280
  """,
281
- additionalFiles: new[]
282
- {
281
+ additionalFiles:
282
+ [
283
283
  ("app.config", """
284
284
  <configuration>
285
285
  <runtime>
@@ -292,7 +292,7 @@ public partial class UpdateWorkerTests
292
292
  </runtime>
293
293
  </configuration>
294
294
  """)
295
- },
295
+ ],
296
296
  expectedProjectContents: """
297
297
  <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
298
298
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
@@ -320,8 +320,8 @@ public partial class UpdateWorkerTests
320
320
  <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
321
321
  </packages>
322
322
  """,
323
- additionalFilesExpected: new[]
324
- {
323
+ additionalFilesExpected:
324
+ [
325
325
  ("app.config", """
326
326
  <configuration>
327
327
  <runtime>
@@ -334,7 +334,7 @@ public partial class UpdateWorkerTests
334
334
  </runtime>
335
335
  </configuration>
336
336
  """)
337
- });
337
+ ]);
338
338
  }
339
339
 
340
340
  [Fact]
@@ -425,8 +425,8 @@ public partial class UpdateWorkerTests
425
425
  <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
426
426
  </packages>
427
427
  """,
428
- additionalFiles: new[]
429
- {
428
+ additionalFiles:
429
+ [
430
430
  ("web.config", """
431
431
  <configuration>
432
432
  <runtime>
@@ -439,7 +439,7 @@ public partial class UpdateWorkerTests
439
439
  </runtime>
440
440
  </configuration>
441
441
  """)
442
- },
442
+ ],
443
443
  expectedProjectContents: """
444
444
  <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
445
445
  <PropertyGroup>
@@ -525,8 +525,8 @@ public partial class UpdateWorkerTests
525
525
  <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
526
526
  </packages>
527
527
  """,
528
- additionalFilesExpected: new[]
529
- {
528
+ additionalFilesExpected:
529
+ [
530
530
  ("web.config", """
531
531
  <configuration>
532
532
  <runtime>
@@ -539,7 +539,7 @@ public partial class UpdateWorkerTests
539
539
  </runtime>
540
540
  </configuration>
541
541
  """)
542
- });
542
+ ]);
543
543
  }
544
544
 
545
545
  [Fact]
@@ -630,15 +630,15 @@ public partial class UpdateWorkerTests
630
630
  <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
631
631
  </packages>
632
632
  """,
633
- additionalFiles: new[]
634
- {
633
+ additionalFiles:
634
+ [
635
635
  ("web.config", """
636
636
  <configuration>
637
637
  <runtime>
638
638
  </runtime>
639
639
  </configuration>
640
640
  """)
641
- },
641
+ ],
642
642
  expectedProjectContents: """
643
643
  <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
644
644
  <PropertyGroup>
@@ -724,8 +724,8 @@ public partial class UpdateWorkerTests
724
724
  <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
725
725
  </packages>
726
726
  """,
727
- additionalFilesExpected: new[]
728
- {
727
+ additionalFilesExpected:
728
+ [
729
729
  ("web.config", """
730
730
  <configuration>
731
731
  <runtime>
@@ -738,7 +738,7 @@ public partial class UpdateWorkerTests
738
738
  </runtime>
739
739
  </configuration>
740
740
  """)
741
- });
741
+ ]);
742
742
  }
743
743
 
744
744
  [Fact]
@@ -903,7 +903,176 @@ public partial class UpdateWorkerTests
903
903
  """);
904
904
  }
905
905
 
906
- protected static async Task TestUpdateForProject(
906
+ [Fact]
907
+ public async Task PackagesConfigUpdateIsNotThwartedBy_VSToolsPath_PropertyBeingSetInUserCode()
908
+ {
909
+ await TestUpdateForProject("Newtonsoft.Json", "7.0.1", "13.0.1",
910
+ projectContents: """
911
+ <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
912
+ <PropertyGroup>
913
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
914
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
915
+ <ProductVersion>
916
+ </ProductVersion>
917
+ <SchemaVersion>2.0</SchemaVersion>
918
+ <ProjectGuid>68ed3303-52a0-47b8-a687-3abbb07530da</ProjectGuid>
919
+ <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
920
+ <OutputType>Library</OutputType>
921
+ <AppDesignerFolder>Properties</AppDesignerFolder>
922
+ <RootNamespace>TestProject</RootNamespace>
923
+ <AssemblyName>TestProject</AssemblyName>
924
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
925
+ </PropertyGroup>
926
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
927
+ <DebugSymbols>true</DebugSymbols>
928
+ <DebugType>full</DebugType>
929
+ <Optimize>false</Optimize>
930
+ <OutputPath>bin\</OutputPath>
931
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
932
+ <ErrorReport>prompt</ErrorReport>
933
+ <WarningLevel>4</WarningLevel>
934
+ </PropertyGroup>
935
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
936
+ <DebugType>pdbonly</DebugType>
937
+ <Optimize>true</Optimize>
938
+ <OutputPath>bin\</OutputPath>
939
+ <DefineConstants>TRACE</DefineConstants>
940
+ <ErrorReport>prompt</ErrorReport>
941
+ <WarningLevel>4</WarningLevel>
942
+ </PropertyGroup>
943
+ <ItemGroup>
944
+ <Reference Include="Microsoft.CSharp" />
945
+ <Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
946
+ <HintPath>packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
947
+ <Private>True</Private>
948
+ </Reference>
949
+ <Reference Include="System.Web.DynamicData" />
950
+ <Reference Include="System.Web.Entity" />
951
+ <Reference Include="System.Web.ApplicationServices" />
952
+ <Reference Include="System" />
953
+ <Reference Include="System.Data" />
954
+ <Reference Include="System.Core" />
955
+ <Reference Include="System.Data.DataSetExtensions" />
956
+ <Reference Include="System.Web.Extensions" />
957
+ <Reference Include="System.Xml.Linq" />
958
+ <Reference Include="System.Drawing" />
959
+ <Reference Include="System.Web" />
960
+ <Reference Include="System.Xml" />
961
+ <Reference Include="System.Configuration" />
962
+ <Reference Include="System.Web.Services" />
963
+ <Reference Include="System.EnterpriseServices" />
964
+ </ItemGroup>
965
+ <ItemGroup>
966
+ <None Include="packages.config" />
967
+ </ItemGroup>
968
+ <ItemGroup>
969
+ <Compile Include="Properties\AssemblyInfo.cs" />
970
+ </ItemGroup>
971
+ <PropertyGroup>
972
+ <!-- some project files set this property which makes the Microsoft.WebApplication.targets import a few lines down always fail -->
973
+ <VSToolsPath Condition="'$(VSToolsPath)' == ''">C:\some\path\that\does\not\exist</VSToolsPath>
974
+ </PropertyGroup>
975
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
976
+ <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
977
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
978
+ Other similar extension points exist, see Microsoft.Common.targets.
979
+ <Target Name="BeforeBuild">
980
+ </Target>
981
+ <Target Name="AfterBuild">
982
+ </Target>
983
+ -->
984
+ </Project>
985
+ """,
986
+ packagesConfigContents: """
987
+ <packages>
988
+ <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
989
+ </packages>
990
+ """,
991
+ expectedProjectContents: """
992
+ <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
993
+ <PropertyGroup>
994
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
995
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
996
+ <ProductVersion>
997
+ </ProductVersion>
998
+ <SchemaVersion>2.0</SchemaVersion>
999
+ <ProjectGuid>68ed3303-52a0-47b8-a687-3abbb07530da</ProjectGuid>
1000
+ <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
1001
+ <OutputType>Library</OutputType>
1002
+ <AppDesignerFolder>Properties</AppDesignerFolder>
1003
+ <RootNamespace>TestProject</RootNamespace>
1004
+ <AssemblyName>TestProject</AssemblyName>
1005
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1006
+ </PropertyGroup>
1007
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1008
+ <DebugSymbols>true</DebugSymbols>
1009
+ <DebugType>full</DebugType>
1010
+ <Optimize>false</Optimize>
1011
+ <OutputPath>bin\</OutputPath>
1012
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
1013
+ <ErrorReport>prompt</ErrorReport>
1014
+ <WarningLevel>4</WarningLevel>
1015
+ </PropertyGroup>
1016
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
1017
+ <DebugType>pdbonly</DebugType>
1018
+ <Optimize>true</Optimize>
1019
+ <OutputPath>bin\</OutputPath>
1020
+ <DefineConstants>TRACE</DefineConstants>
1021
+ <ErrorReport>prompt</ErrorReport>
1022
+ <WarningLevel>4</WarningLevel>
1023
+ </PropertyGroup>
1024
+ <ItemGroup>
1025
+ <Reference Include="Microsoft.CSharp" />
1026
+ <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
1027
+ <HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
1028
+ <Private>True</Private>
1029
+ </Reference>
1030
+ <Reference Include="System.Web.DynamicData" />
1031
+ <Reference Include="System.Web.Entity" />
1032
+ <Reference Include="System.Web.ApplicationServices" />
1033
+ <Reference Include="System" />
1034
+ <Reference Include="System.Data" />
1035
+ <Reference Include="System.Core" />
1036
+ <Reference Include="System.Data.DataSetExtensions" />
1037
+ <Reference Include="System.Web.Extensions" />
1038
+ <Reference Include="System.Xml.Linq" />
1039
+ <Reference Include="System.Drawing" />
1040
+ <Reference Include="System.Web" />
1041
+ <Reference Include="System.Xml" />
1042
+ <Reference Include="System.Configuration" />
1043
+ <Reference Include="System.Web.Services" />
1044
+ <Reference Include="System.EnterpriseServices" />
1045
+ </ItemGroup>
1046
+ <ItemGroup>
1047
+ <None Include="packages.config" />
1048
+ </ItemGroup>
1049
+ <ItemGroup>
1050
+ <Compile Include="Properties\AssemblyInfo.cs" />
1051
+ </ItemGroup>
1052
+ <PropertyGroup>
1053
+ <!-- some project files set this property which makes the Microsoft.WebApplication.targets import a few lines down always fail -->
1054
+ <VSToolsPath Condition="'$(VSToolsPath)' == ''">C:\some\path\that\does\not\exist</VSToolsPath>
1055
+ </PropertyGroup>
1056
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
1057
+ <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
1058
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
1059
+ Other similar extension points exist, see Microsoft.Common.targets.
1060
+ <Target Name="BeforeBuild">
1061
+ </Target>
1062
+ <Target Name="AfterBuild">
1063
+ </Target>
1064
+ -->
1065
+ </Project>
1066
+ """,
1067
+ expectedPackagesConfigContents: """
1068
+ <?xml version="1.0" encoding="utf-8"?>
1069
+ <packages>
1070
+ <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
1071
+ </packages>
1072
+ """);
1073
+ }
1074
+
1075
+ protected static Task TestUpdateForProject(
907
1076
  string dependencyName,
908
1077
  string oldVersion,
909
1078
  string newVersion,
@@ -914,7 +1083,7 @@ public partial class UpdateWorkerTests
914
1083
  (string Path, string Content)[]? additionalFiles = null,
915
1084
  (string Path, string Content)[]? additionalFilesExpected = null)
916
1085
  {
917
- var realizedAdditionalFiles = new List<(string Path, string Content)>()
1086
+ var realizedAdditionalFiles = new List<(string Path, string Content)>
918
1087
  {
919
1088
  ("packages.config", packagesConfigContents),
920
1089
  };
@@ -923,7 +1092,7 @@ public partial class UpdateWorkerTests
923
1092
  realizedAdditionalFiles.AddRange(additionalFiles);
924
1093
  }
925
1094
 
926
- var realizedAdditionalFilesExpected = new List<(string Path, string Content)>()
1095
+ var realizedAdditionalFilesExpected = new List<(string Path, string Content)>
927
1096
  {
928
1097
  ("packages.config", expectedPackagesConfigContents),
929
1098
  };
@@ -932,7 +1101,14 @@ public partial class UpdateWorkerTests
932
1101
  realizedAdditionalFilesExpected.AddRange(additionalFilesExpected);
933
1102
  }
934
1103
 
935
- await TestUpdateForProject(dependencyName, oldVersion, newVersion, projectContents, expectedProjectContents, additionalFiles: realizedAdditionalFiles.ToArray(), additionalFilesExpected: realizedAdditionalFilesExpected.ToArray());
1104
+ return TestUpdateForProject(
1105
+ dependencyName,
1106
+ oldVersion,
1107
+ newVersion,
1108
+ projectContents,
1109
+ expectedProjectContents,
1110
+ additionalFiles: realizedAdditionalFiles.ToArray(),
1111
+ additionalFilesExpected: realizedAdditionalFilesExpected.ToArray());
936
1112
  }
937
1113
  }
938
1114
  }