Skip to content

Commit 8dc9c95

Browse files
authored
Merge pull request #16376 from github/criemen/dotnet-paket
C#/C++: Convert C# code to use `paket` package manager
2 parents 2dd42f7 + 74e446e commit 8dc9c95

File tree

44 files changed

+1285
-111
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1285
-111
lines changed

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,8 @@ python/ql/lib/semmle/python/frameworks/data/internal/subclass-capture/*.yml ling
7373
# auto-generated bazel lock file
7474
ruby/extractor/cargo-bazel-lock.json linguist-generated=true
7575
ruby/extractor/cargo-bazel-lock.json -merge
76+
77+
# auto-generated files for the C# build
78+
csharp/paket.lock linguist-generated=true
79+
# needs eol=crlf, as `paket` touches this file and saves it als crlf
80+
csharp/.paket/Paket.Restore.targets linguist-generated=true eol=crlf

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ jobs:
5656
# uses a compiled language
5757

5858
- run: |
59-
dotnet build csharp
59+
cd csharp
60+
dotnet tool restore
61+
dotnet build .
6062
6163
- name: Perform CodeQL Analysis
6264
uses: github/codeql-action/analyze@main

.github/workflows/csharp-qltest.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,11 @@ jobs:
8181
dotnet-version: 8.0.101
8282
- name: Extractor unit tests
8383
run: |
84+
dotnet tool restore
8485
dotnet test -p:RuntimeFrameworkVersion=8.0.1 extractor/Semmle.Util.Tests
8586
dotnet test -p:RuntimeFrameworkVersion=8.0.1 extractor/Semmle.Extraction.Tests
8687
dotnet test -p:RuntimeFrameworkVersion=8.0.1 autobuilder/Semmle.Autobuild.CSharp.Tests
87-
dotnet test -p:RuntimeFrameworkVersion=8.0.1 "${{ github.workspace }}/csharp/autobuilder/Semmle.Autobuild.Cpp.Tests"
88+
dotnet test -p:RuntimeFrameworkVersion=8.0.1 autobuilder/Semmle.Autobuild.Cpp.Tests
8889
shell: bash
8990
stubgentest:
9091
runs-on: ubuntu-latest

csharp/.config/dotnet-tools.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"paket": {
6+
"version": "8.0.3",
7+
"commands": [
8+
"paket"
9+
]
10+
}
11+
}
12+
}

csharp/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ csharp.log
1414
.vscode/launch.json
1515

1616
extractor/Semmle.Extraction.CSharp.Driver/Properties/launchSettings.json
17-
extractor-pack
17+
extractor-pack
18+
paket-files/

csharp/.paket/Paket.Restore.targets

Lines changed: 560 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

csharp/Directory.Build.targets

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Project>
2+
<Import Project=".paket\Paket.Restore.targets" />
3+
</Project>

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,6 @@
55
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>
8-
<ItemGroup>
9-
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
10-
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
11-
<PackageReference Include="xunit" Version="2.6.2" />
12-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4">
13-
<PrivateAssets>all</PrivateAssets>
14-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
15-
</PackageReference>
16-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
17-
</ItemGroup>
188
<ItemGroup>
199
<ProjectReference Include="..\Semmle.Autobuild.CSharp\Semmle.Autobuild.CSharp.csproj" />
2010
<ProjectReference Include="..\Semmle.Autobuild.Shared\Semmle.Autobuild.Shared.csproj" />
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
System.IO.FileSystem
2+
xunit
3+
xunit.runner.visualstudio
4+
Microsoft.NET.Test.Sdk
Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
12
<Project Sdk="Microsoft.NET.Sdk">
2-
<PropertyGroup>
3-
<TargetFramework>net8.0</TargetFramework>
4-
<AssemblyName>Semmle.Autobuild.CSharp</AssemblyName>
5-
<RootNamespace>Semmle.Autobuild.CSharp</RootNamespace>
6-
<ApplicationIcon />
7-
<OutputType>Exe</OutputType>
8-
<StartupObject />
9-
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
10-
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
11-
<Nullable>enable</Nullable>
12-
</PropertyGroup>
13-
<ItemGroup>
14-
<Folder Include="Properties\" />
15-
</ItemGroup>
16-
<ItemGroup>
17-
<PackageReference Include="Microsoft.Build" Version="17.8.3" />
18-
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
19-
</ItemGroup>
20-
<ItemGroup>
21-
<ProjectReference Include="..\..\extractor\Semmle.Util\Semmle.Util.csproj" />
22-
<ProjectReference Include="..\..\extractor\Semmle.Extraction.CSharp\Semmle.Extraction.CSharp.csproj" />
23-
<ProjectReference Include="..\..\extractor\Semmle.Extraction.CSharp.DependencyFetching\Semmle.Extraction.CSharp.DependencyFetching.csproj" />
24-
<ProjectReference Include="..\Semmle.Autobuild.Shared\Semmle.Autobuild.Shared.csproj" />
25-
</ItemGroup>
26-
</Project>
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<AssemblyName>Semmle.Autobuild.CSharp</AssemblyName>
6+
<RootNamespace>Semmle.Autobuild.CSharp</RootNamespace>
7+
<ApplicationIcon />
8+
<OutputType>Exe</OutputType>
9+
<StartupObject />
10+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
11+
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
12+
<Nullable>enable</Nullable>
13+
</PropertyGroup>
14+
<ItemGroup>
15+
<Folder Include="Properties\" />
16+
</ItemGroup>
17+
<ItemGroup>
18+
<ProjectReference Include="..\..\extractor\Semmle.Util\Semmle.Util.csproj" />
19+
<ProjectReference Include="..\..\extractor\Semmle.Extraction.CSharp\Semmle.Extraction.CSharp.csproj" />
20+
<ProjectReference Include="..\..\extractor\Semmle.Extraction.CSharp.DependencyFetching\Semmle.Extraction.CSharp.DependencyFetching.csproj" />
21+
<ProjectReference Include="..\Semmle.Autobuild.Shared\Semmle.Autobuild.Shared.csproj" />
22+
</ItemGroup>
23+
</Project>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Newtonsoft.Json
2+
Microsoft.Build

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,8 @@
88
<Nullable>enable</Nullable>
99
</PropertyGroup>
1010

11-
<ItemGroup>
12-
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
13-
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
14-
<PackageReference Include="xunit" Version="2.6.2" />
15-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4">
16-
<PrivateAssets>all</PrivateAssets>
17-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
18-
</PackageReference>
19-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
20-
</ItemGroup>
21-
2211
<ItemGroup>
2312
<ProjectReference Include="..\Semmle.Autobuild.Cpp\Semmle.Autobuild.Cpp.csproj" />
24-
<ProjectReference Include="..\..\autobuilder\Semmle.Autobuild.Shared\Semmle.Autobuild.Shared.csproj" />
13+
<ProjectReference Include="..\Semmle.Autobuild.Shared\Semmle.Autobuild.Shared.csproj" />
2514
</ItemGroup>
2615
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
System.IO.FileSystem
2+
xunit
3+
xunit.runner.visualstudio
4+
Microsoft.NET.Test.Sdk

csharp/autobuilder/Semmle.Autobuild.Cpp/Semmle.Autobuild.Cpp.csproj

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,8 @@
1616
<Folder Include="Properties\" />
1717
</ItemGroup>
1818

19-
<ItemGroup>
20-
<PackageReference Include="Microsoft.Build" Version="17.8.3" />
21-
</ItemGroup>
22-
2319
<ItemGroup>
2420
<ProjectReference Include="..\..\extractor\Semmle.Util\Semmle.Util.csproj" />
25-
<ProjectReference Include="..\..\autobuilder\Semmle.Autobuild.Shared\Semmle.Autobuild.Shared.csproj" />
21+
<ProjectReference Include="..\Semmle.Autobuild.Shared\Semmle.Autobuild.Shared.csproj" />
2622
</ItemGroup>
27-
2823
</Project>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Microsoft.Build

csharp/autobuilder/Semmle.Autobuild.Shared/Semmle.Autobuild.Shared.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
<ItemGroup>
1111
<Folder Include="Properties\" />
1212
</ItemGroup>
13-
<ItemGroup>
14-
<PackageReference Include="Microsoft.Build" Version="17.8.3" />
15-
</ItemGroup>
1613
<ItemGroup>
1714
<ProjectReference Include="..\..\extractor\Semmle.Util\Semmle.Util.csproj" />
1815
</ItemGroup>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Microsoft.Build

csharp/before.CSharp.sln.targets

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Project InitialTargets="LocalToolRestore">
2+
<Target Name="LocalToolRestore">
3+
<Message Text="Restoring tools" Importance="High" />
4+
<Exec Command="dotnet tool restore" />
5+
</Target>
6+
</Project>

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/Semmle.Extraction.CSharp.DependencyFetching.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@
1919
<ItemGroup>
2020
<Folder Include="Properties\" />
2121
</ItemGroup>
22-
2322
</Project>

csharp/extractor/Semmle.Extraction.CSharp.DependencyFetching/paket.references

Whitespace-only changes.

csharp/extractor/Semmle.Extraction.CSharp.DependencyStubGenerator/Semmle.Extraction.CSharp.DependencyStubGenerator.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,4 @@
1414
<ProjectReference Include="..\Semmle.Extraction.CSharp.DependencyFetching\Semmle.Extraction.CSharp.DependencyFetching.csproj" />
1515
<ProjectReference Include="..\Semmle.Extraction.CSharp.StubGenerator\Semmle.Extraction.CSharp.StubGenerator.csproj" />
1616
</ItemGroup>
17-
1817
</Project>

csharp/extractor/Semmle.Extraction.CSharp.DependencyStubGenerator/paket.references

Whitespace-only changes.

csharp/extractor/Semmle.Extraction.CSharp.Driver/Semmle.Extraction.CSharp.Driver.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@
1212
<ItemGroup>
1313
<ProjectReference Include="..\Semmle.Extraction.CSharp\Semmle.Extraction.CSharp.csproj" />
1414
</ItemGroup>
15-
1615
</Project>

csharp/extractor/Semmle.Extraction.CSharp.Driver/paket.references

Whitespace-only changes.

csharp/extractor/Semmle.Extraction.CSharp.Standalone/Semmle.Extraction.CSharp.Standalone.csproj

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,4 @@
1818
<ItemGroup>
1919
<Folder Include="Properties\" />
2020
</ItemGroup>
21-
<ItemGroup>
22-
<PackageReference Include="Microsoft.Build" Version="17.8.3" />
23-
<PackageReference Include="Microsoft.Win32.Primitives" Version="4.3.0" />
24-
<PackageReference Include="System.Net.Primitives" Version="4.3.1" />
25-
<PackageReference Include="System.Security.Principal" Version="4.3.0" />
26-
<PackageReference Include="System.Threading.ThreadPool" Version="4.3.0" />
27-
</ItemGroup>
2821
</Project>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Microsoft.Build
2+
Microsoft.Win32.Primitives
3+
System.Net.Primitives
4+
System.Security.Principal
5+
System.Threading.ThreadPool

csharp/extractor/Semmle.Extraction.CSharp.StubGenerator/Semmle.Extraction.CSharp.StubGenerator.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,4 @@
1212
<ProjectReference Include="..\Semmle.Extraction.CSharp.DependencyFetching\Semmle.Extraction.CSharp.DependencyFetching.csproj" />
1313
<ProjectReference Include="..\Semmle.Extraction.CSharp.Util\Semmle.Extraction.CSharp.Util.csproj" />
1414
</ItemGroup>
15-
<ItemGroup>
16-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
17-
</ItemGroup>
1815
</Project>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Microsoft.CodeAnalysis.CSharp

csharp/extractor/Semmle.Extraction.CSharp.Util/Semmle.Extraction.CSharp.Util.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,4 @@
1111
<ItemGroup>
1212
<ProjectReference Include="..\Semmle.Util\Semmle.Util.csproj" />
1313
</ItemGroup>
14-
<ItemGroup>
15-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
16-
</ItemGroup>
1714
</Project>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Microsoft.CodeAnalysis.CSharp

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,4 @@
1616
<ItemGroup>
1717
<Folder Include="Properties\" />
1818
</ItemGroup>
19-
<ItemGroup>
20-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
21-
<PackageReference Include="Microsoft.Build" Version="17.8.3" />
22-
</ItemGroup>
2319
</Project>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Microsoft.Build
2+
Microsoft.CodeAnalysis.CSharp
3+

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,6 @@
55
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>
8-
<ItemGroup>
9-
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
10-
<PackageReference Include="System.IO.FileSystem.Primitives" Version="4.3.0" />
11-
<PackageReference Include="xunit" Version="2.6.2" />
12-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4">
13-
<PrivateAssets>all</PrivateAssets>
14-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
15-
</PackageReference>
16-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
17-
</ItemGroup>
188
<ItemGroup>
199
<ProjectReference Include="..\Semmle.Extraction.CSharp.StubGenerator\Semmle.Extraction.CSharp.StubGenerator.csproj" />
2010
<ProjectReference Include="..\Semmle.Extraction.CSharp.Standalone\Semmle.Extraction.CSharp.Standalone.csproj" />
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
System.IO.FileSystem
2+
xunit
3+
xunit.runner.visualstudio
4+
Microsoft.NET.Test.Sdk

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@
1111
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
1212
<DefineConstants>TRACE;DEBUG;DEBUG_LABELS</DefineConstants>
1313
</PropertyGroup>
14-
<ItemGroup>
15-
<PackageReference Include="Microsoft.Build" Version="17.8.3" />
16-
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.8.0" />
17-
<PackageReference Include="GitInfo" Version="3.3.3">
18-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
19-
<PrivateAssets>all</PrivateAssets>
20-
</PackageReference>
21-
</ItemGroup>
2214
<ItemGroup>
2315
<ProjectReference Include="..\Semmle.Util\Semmle.Util.csproj" />
2416
</ItemGroup>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Microsoft.Build
2+
Microsoft.CodeAnalysis
3+
GitInfo

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@
55
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>
8-
<ItemGroup>
9-
<PackageReference Include="xunit" Version="2.6.2" />
10-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4">
11-
<PrivateAssets>all</PrivateAssets>
12-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
13-
</PackageReference>
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
15-
</ItemGroup>
168
<ItemGroup>
179
<ProjectReference Include="..\Semmle.Util\Semmle.Util.csproj" />
1810
</ItemGroup>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
xunit
2+
xunit.runner.visualstudio
3+
Microsoft.NET.Test.Sdk

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,4 @@
1212
<ItemGroup>
1313
<Folder Include="Properties\" />
1414
</ItemGroup>
15-
16-
<ItemGroup>
17-
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
18-
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
19-
</ItemGroup>
20-
2115
</Project>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Mono.Posix.NETStandard
2+
Newtonsoft.Json

csharp/paket.dependencies

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
framework: net8.0
2+
storage: none
3+
source https://api.nuget.org/v3/index.json
4+
# behave like nuget in choosing transitive dependency versions
5+
strategy: min
6+
7+
nuget Mono.Posix.NETStandard 1.0.0
8+
nuget Newtonsoft.Json 13.0.3
9+
nuget xunit 2.6.2
10+
nuget xunit.runner.visualstudio 2.5.4
11+
nuget Microsoft.NET.Test.Sdk 17.8.0
12+
nuget Microsoft.CodeAnalysis.CSharp 4.8.0
13+
nuget Microsoft.CodeAnalysis 4.8.0
14+
nuget Microsoft.Build 17.8.3
15+
nuget Microsoft.Win32.Primitives 4.3.0
16+
nuget System.Net.Primitives 4.3.1
17+
nuget System.Security.Principal 4.3.0
18+
nuget System.Threading.ThreadPool 4.3.0
19+
nuget System.IO.FileSystem 4.3.0
20+
nuget GitInfo 3.3.3

0 commit comments

Comments
 (0)