Skip to content

Commit e93b72d

Browse files
authored
Merge pull request github#5459 from hvitved/csharp/update-nuget
C#: Update more nuget packages
2 parents 208d515 + f100c8a commit e93b72d

File tree

6 files changed

+37
-10
lines changed

6 files changed

+37
-10
lines changed

cpp/autobuilder/Semmle.Autobuild.Cpp.Tests/BuildScripts.cs

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Linq;
66
using Microsoft.Build.Construction;
77
using System.Xml;
8+
using System.IO;
89

910
namespace Semmle.Autobuild.Cpp.Tests
1011
{
@@ -43,6 +44,8 @@ bool IBuildActions.FileExists(string file)
4344
public IDictionary<string, int> RunProcess = new Dictionary<string, int>();
4445
public IDictionary<string, string> RunProcessOut = new Dictionary<string, string>();
4546
public IDictionary<string, string> RunProcessWorkingDirectory = new Dictionary<string, string>();
47+
public HashSet<string> CreateDirectories { get; } = new HashSet<string>();
48+
public HashSet<(string, string)> DownloadFiles { get; } = new HashSet<(string, string)>();
4649

4750
int IBuildActions.RunProcess(string cmd, string args, string? workingDirectory, IDictionary<string, string>? env, out IList<string> stdOut)
4851
{
@@ -135,6 +138,14 @@ string IBuildActions.PathCombine(params string[] parts)
135138

136139
string IBuildActions.GetFullPath(string path) => path;
137140

141+
string? IBuildActions.GetFileName(string? path) => Path.GetFileName(path?.Replace('\\', '/'));
142+
143+
public string? GetDirectoryName(string? path)
144+
{
145+
var dir = Path.GetDirectoryName(path?.Replace('\\', '/'));
146+
return dir is null ? path : path?.Substring(0, dir.Length);
147+
}
148+
138149
void IBuildActions.WriteAllText(string filename, string contents)
139150
{
140151
}
@@ -153,6 +164,18 @@ public string EnvironmentExpandEnvironmentVariables(string s)
153164
s = s.Replace($"%{kvp.Key}%", kvp.Value);
154165
return s;
155166
}
167+
168+
public void CreateDirectory(string path)
169+
{
170+
if (!CreateDirectories.Contains(path))
171+
throw new ArgumentException($"Missing CreateDirectory, {path}");
172+
}
173+
174+
public void DownloadFile(string address, string fileName)
175+
{
176+
if (!DownloadFiles.Contains((address, fileName)))
177+
throw new ArgumentException($"Missing DownloadFile, {address}, {fileName}");
178+
}
156179
}
157180

158181
/// <summary>
@@ -213,6 +236,7 @@ CppAutobuilder CreateAutoBuilder(bool isWindows,
213236
Actions.GetEnvironmentVariable[$"CODEQL_EXTRACTOR_{codeqlUpperLanguage}_SOURCE_ARCHIVE_DIR"] = "";
214237
Actions.GetEnvironmentVariable[$"CODEQL_EXTRACTOR_{codeqlUpperLanguage}_ROOT"] = $@"C:\codeql\{codeqlUpperLanguage.ToLowerInvariant()}";
215238
Actions.GetEnvironmentVariable["CODEQL_JAVA_HOME"] = @"C:\codeql\tools\java";
239+
Actions.GetEnvironmentVariable["CODEQL_PLATFORM"] = "win64";
216240
Actions.GetEnvironmentVariable["SEMMLE_DIST"] = @"C:\odasa";
217241
Actions.GetEnvironmentVariable["SEMMLE_JAVA_HOME"] = @"C:\odasa\tools\java";
218242
Actions.GetEnvironmentVariable["SEMMLE_PLATFORM_TOOLS"] = @"C:\odasa\tools";
@@ -273,7 +297,8 @@ public void TestDefaultCppAutobuilder()
273297
[Fact]
274298
public void TestCppAutobuilderSuccess()
275299
{
276-
Actions.RunProcess[@"cmd.exe /C C:\odasa\tools\csharp\nuget\nuget.exe restore C:\Project\test.sln"] = 1;
300+
Actions.RunProcess[@"cmd.exe /C nuget restore C:\Project\test.sln -DisableParallelProcessing"] = 1;
301+
Actions.RunProcess[@"cmd.exe /C C:\Project\.nuget\nuget.exe restore C:\Project\test.sln -DisableParallelProcessing"] = 0;
277302
Actions.RunProcess[@"cmd.exe /C CALL ^""C:\Program Files ^(x86^)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat^"" && set Platform=&& type NUL && C:\odasa\tools\odasa index --auto msbuild C:\Project\test.sln /p:UseSharedCompilation=false /t:rebuild /p:Platform=""x86"" /p:Configuration=""Release"" /p:MvcBuildViews=true"] = 0;
278303
Actions.RunProcessOut[@"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe -prerelease -legacy -property installationPath"] = "";
279304
Actions.RunProcess[@"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe -prerelease -legacy -property installationPath"] = 1;
@@ -286,11 +311,13 @@ public void TestCppAutobuilderSuccess()
286311
Actions.FileExists[@"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"] = true;
287312
Actions.EnumerateFiles[@"C:\Project"] = "foo.cs\ntest.slx";
288313
Actions.EnumerateDirectories[@"C:\Project"] = "";
314+
Actions.CreateDirectories.Add(@"C:\Project\.nuget");
315+
Actions.DownloadFiles.Add(("https://dist.nuget.org/win-x86-commandline/latest/nuget.exe", @"C:\Project\.nuget\nuget.exe"));
289316

290317
var autobuilder = CreateAutoBuilder(true);
291318
var solution = new TestSolution(@"C:\Project\test.sln");
292319
autobuilder.ProjectsOrSolutionsToBuild.Add(solution);
293-
TestAutobuilderScript(autobuilder, 0, 2);
320+
TestAutobuilderScript(autobuilder, 0, 3);
294321
}
295322
}
296323
}

csharp/autobuilder/Semmle.Autobuild.CSharp.Tests/Semmle.Autobuild.CSharp.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<OutputType>Exe</OutputType>
54
<TargetFramework>net5.0</TargetFramework>
65
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
76
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
@@ -12,10 +11,11 @@
1211
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
1312
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
1413
<PackageReference Include="xunit" Version="2.4.1" />
15-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
14+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
1615
<PrivateAssets>all</PrivateAssets>
1716
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
1817
</PackageReference>
18+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
1919
</ItemGroup>
2020

2121
<ItemGroup>

csharp/autobuilder/Semmle.Autobuild.CSharp/Semmle.Autobuild.CSharp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
<ItemGroup>
2020
<PackageReference Include="Microsoft.Build" Version="16.9.0" />
21-
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
21+
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
2222
</ItemGroup>
2323

2424
<ItemGroup>

csharp/extractor/Semmle.Extraction.Tests/Semmle.Extraction.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<OutputType>Exe</OutputType>
54
<TargetFramework>net5.0</TargetFramework>
65
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
76
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
@@ -12,10 +11,11 @@
1211
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
1312
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
1413
<PackageReference Include="xunit" Version="2.4.1" />
15-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
14+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
1615
<PrivateAssets>all</PrivateAssets>
1716
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
1817
</PackageReference>
18+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
1919
</ItemGroup>
2020

2121
<ItemGroup>

csharp/extractor/Semmle.Extraction/Semmle.Extraction.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
<ItemGroup>
1818
<PackageReference Include="Microsoft.CodeAnalysis" Version="3.9.0" />
19-
<PackageReference Include="GitInfo" Version="2.0.20">
19+
<PackageReference Include="GitInfo" Version="2.1.2">
2020
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2121
<PrivateAssets>all</PrivateAssets>
2222
</PackageReference>

csharp/extractor/Semmle.Util.Tests/Semmle.Util.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<OutputType>Exe</OutputType>
54
<TargetFramework>net5.0</TargetFramework>
65
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
76
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
@@ -10,10 +9,11 @@
109

1110
<ItemGroup>
1211
<PackageReference Include="xunit" Version="2.4.1" />
13-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
12+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
1413
<PrivateAssets>all</PrivateAssets>
1514
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
1615
</PackageReference>
16+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
1717
</ItemGroup>
1818

1919
<ItemGroup>

0 commit comments

Comments
 (0)