Skip to content

Commit 7c2f505

Browse files
PerkseyHurricanKai
andauthored
3.0 SilkTouch tweaks (#878)
* Use Central Package Version Management (CPVM) * Remove SilkTouch editor options * Use MS.Ext.Configuration instead + other SilkTouch shared infra changes * Minor fixes * Commit as I'm going away this weekend and want to be able to work on it Co-authored-by: Kai Jellinghaus <[email protected]>
1 parent ea5eca6 commit 7c2f505

File tree

42 files changed

+615
-543
lines changed

Some content is hidden

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

42 files changed

+615
-543
lines changed

.editorconfig

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,6 @@ resharper_web_config_module_not_resolved_highlighting = warning
7272
resharper_web_config_type_not_resolved_highlighting = warning
7373
resharper_web_config_wrong_module_highlighting = warning
7474

75-
# Silk Touch options
76-
silk_touch_vtable_generate = true
77-
silk_touch_vtable_tree_emit_assert = true
78-
silk_touch_sealed_vtable_creation = true
79-
silk_touch_vtable_preload = false
80-
silk_touch_telemetry = false
81-
silk_touch_compact_file_format = true
82-
8375
[*.{appxmanifest,asax,ascx,aspx,build,config,cs,cshtml,csproj,dbml,discomap,dtd,fs,fsi,fsscript,fsx,htm,html,jsproj,lsproj,master,ml,mli,njsproj,nuspec,proj,props,razor,resw,resx,skin,StyleCop,targets,tasks,vb,vbproj,xaml,xamlx,xml,xoml,xsd}]
8476
indent_style = space
8577
indent_size = 4

Directory.Build.props

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project>
2+
<PropertyGroup>
3+
<!-- See https://github.com/NuGet/Home/wiki/Centrally-managing-NuGet-package-versions -->
4+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
5+
6+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
</Project>

Directory.Packages.props

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<Project>
2+
<!--
3+
This file tracks all package versions used in Silk.NET, including tests.
4+
For more information what this is see https://github.com/NuGet/Home/wiki/Centrally-managing-NuGet-package-versions
5+
-->
6+
<ItemGroup>
7+
<PackageVersion Include="BenchmarkDotNet" Version="0.12.1" />
8+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.0-2.final" />
9+
<PackageVersion Include="System.Text.Json" Version="6.0.0-preview.6.21352.12" />
10+
<PackageVersion Include="ClangSharp.PInvokeGenerator" Version="12.0.0-beta2" />
11+
<PackageVersion Include="Microsoft.Build.Locator" Version="1.4.1" />
12+
<PackageVersion Include="Microsoft.Extensions.FileSystemGlobbing" Version="6.0.0-preview.6.21352.12" />
13+
<PackageVersion Include="Microsoft.Build.Framework" Version="16.10.0" />
14+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.0.0-2.final" />
15+
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.0.0-2.final" />
16+
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta1.21308.1" />
17+
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
18+
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
19+
<PackageVersion Include="NuGet.Protocol" Version="5.8.0" />
20+
<PackageVersion Include="Nuke.Common" Version="6.0.1" />
21+
<PackageVersion Include="Ultz.Bcl.Half" Version="1.0.0" />
22+
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="1.1.0" />
23+
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.1" />
24+
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="6.0.0" />
25+
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
26+
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
27+
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
28+
<PackageVersion Include="Microsoft.Extensions.Options" Version="6.0.0" />
29+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
30+
<PackageVersion Include="xunit" Version="2.4.1" />
31+
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.3" />
32+
<PackageVersion Include="Statiq.Core" Version="1.0.0-beta.48" />
33+
<PackageVersion Include="HtmlAgilityPack" Version="1.11.42" />
34+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="3.11.0" />
35+
<PackageVersion Include="Statiq.App" Version="1.0.0-beta.48" />
36+
<PackageVersion Include="Statiq.Feeds" Version="1.0.0-beta.48" />
37+
<PackageVersion Include="Statiq.Markdown" Version="1.0.0-beta.48" />
38+
<PackageVersion Include="Statiq.Razor" Version="1.0.0-beta.48" />
39+
<PackageVersion Include="Statiq.Yaml" Version="1.0.0-beta.48" />
40+
<PackageVersion Include="Humanizer.Core" Version="2.14.1" />
41+
</ItemGroup>
42+
</Project>

Silk.NET.sln

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.Maths", "src\libra
2222
EndProject
2323
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarks", "benchmarks", "{FD15E196-1C63-47D6-8AD5-64F015120B4B}"
2424
EndProject
25-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "experiments", "experiments", "{1565E50D-3BF1-407E-842A-169F4F86513D}"
26-
EndProject
2725
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "infrastructure", "infrastructure", "{F07CABFC-DC6A-4B5B-BC56-B10EEC2C0BFA}"
2826
ProjectSection(SolutionItems) = preProject
2927
src\infrastructure\.gitignore = src\infrastructure\.gitignore
@@ -71,6 +69,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.Core", "src\librar
7169
EndProject
7270
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.Vulkan", "src\bindings\Silk.NET.Vulkan\Silk.NET.Vulkan.csproj", "{AF6E05E0-9C51-4D52-AC7E-056714CAC5F4}"
7371
EndProject
72+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{94D5D1E1-B998-4CB1-9D04-DA138A2B0F3C}"
73+
EndProject
74+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.Maths.Tests", "tests\Silk.NET.Maths.Tests\Silk.NET.Maths.Tests.csproj", "{A0726B46-F2F6-4996-A640-1BD01EEBAF07}"
75+
EndProject
7476
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.Statiq", "src\infrastructure\Silk.NET.Statiq\Silk.NET.Statiq.csproj", "{ED11DCF5-E925-417A-99E0-B8AD615874EA}"
7577
EndProject
7678
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.Statiq.TableOfContents", "src\infrastructure\Silk.NET.Statiq.TableOfContents\Silk.NET.Statiq.TableOfContents.csproj", "{A11CC2E1-51C3-4DE8-A4B3-F05D37EDAB8C}"
@@ -271,6 +273,18 @@ Global
271273
{AF6E05E0-9C51-4D52-AC7E-056714CAC5F4}.Release|x64.Build.0 = Release|Any CPU
272274
{AF6E05E0-9C51-4D52-AC7E-056714CAC5F4}.Release|x86.ActiveCfg = Release|Any CPU
273275
{AF6E05E0-9C51-4D52-AC7E-056714CAC5F4}.Release|x86.Build.0 = Release|Any CPU
276+
{A0726B46-F2F6-4996-A640-1BD01EEBAF07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
277+
{A0726B46-F2F6-4996-A640-1BD01EEBAF07}.Debug|Any CPU.Build.0 = Debug|Any CPU
278+
{A0726B46-F2F6-4996-A640-1BD01EEBAF07}.Debug|x64.ActiveCfg = Debug|Any CPU
279+
{A0726B46-F2F6-4996-A640-1BD01EEBAF07}.Debug|x64.Build.0 = Debug|Any CPU
280+
{A0726B46-F2F6-4996-A640-1BD01EEBAF07}.Debug|x86.ActiveCfg = Debug|Any CPU
281+
{A0726B46-F2F6-4996-A640-1BD01EEBAF07}.Debug|x86.Build.0 = Debug|Any CPU
282+
{A0726B46-F2F6-4996-A640-1BD01EEBAF07}.Release|Any CPU.ActiveCfg = Release|Any CPU
283+
{A0726B46-F2F6-4996-A640-1BD01EEBAF07}.Release|Any CPU.Build.0 = Release|Any CPU
284+
{A0726B46-F2F6-4996-A640-1BD01EEBAF07}.Release|x64.ActiveCfg = Release|Any CPU
285+
{A0726B46-F2F6-4996-A640-1BD01EEBAF07}.Release|x64.Build.0 = Release|Any CPU
286+
{A0726B46-F2F6-4996-A640-1BD01EEBAF07}.Release|x86.ActiveCfg = Release|Any CPU
287+
{A0726B46-F2F6-4996-A640-1BD01EEBAF07}.Release|x86.Build.0 = Release|Any CPU
274288
{ED11DCF5-E925-417A-99E0-B8AD615874EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
275289
{ED11DCF5-E925-417A-99E0-B8AD615874EA}.Debug|Any CPU.Build.0 = Debug|Any CPU
276290
{ED11DCF5-E925-417A-99E0-B8AD615874EA}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -340,7 +354,6 @@ Global
340354
{C9718C94-2F21-4E8D-B55D-8F0B1A131346} = {EA3CA547-452A-4D9E-BDB3-3BC5D7F15ACA}
341355
{7A2A3176-DBA1-4026-AF65-8E36B4F09B01} = {C9718C94-2F21-4E8D-B55D-8F0B1A131346}
342356
{FD15E196-1C63-47D6-8AD5-64F015120B4B} = {EA3CA547-452A-4D9E-BDB3-3BC5D7F15ACA}
343-
{1565E50D-3BF1-407E-842A-169F4F86513D} = {EA3CA547-452A-4D9E-BDB3-3BC5D7F15ACA}
344357
{F07CABFC-DC6A-4B5B-BC56-B10EEC2C0BFA} = {EA3CA547-452A-4D9E-BDB3-3BC5D7F15ACA}
345358
{9020C7C6-C366-4BD3-8C8A-F81394EC7174} = {EA3CA547-452A-4D9E-BDB3-3BC5D7F15ACA}
346359
{8238D9F3-E158-4633-8017-B29AA3AD61F7} = {EA3CA547-452A-4D9E-BDB3-3BC5D7F15ACA}
@@ -358,6 +371,7 @@ Global
358371
{46A89F89-77B3-4679-A82F-04A552545B16} = {8238D9F3-E158-4633-8017-B29AA3AD61F7}
359372
{69CF4437-59F7-4304-9AE1-4B58E1A93367} = {C9718C94-2F21-4E8D-B55D-8F0B1A131346}
360373
{AF6E05E0-9C51-4D52-AC7E-056714CAC5F4} = {9020C7C6-C366-4BD3-8C8A-F81394EC7174}
374+
{A0726B46-F2F6-4996-A640-1BD01EEBAF07} = {94D5D1E1-B998-4CB1-9D04-DA138A2B0F3C}
361375
{ED11DCF5-E925-417A-99E0-B8AD615874EA} = {F07CABFC-DC6A-4B5B-BC56-B10EEC2C0BFA}
362376
{A11CC2E1-51C3-4DE8-A4B3-F05D37EDAB8C} = {F07CABFC-DC6A-4B5B-BC56-B10EEC2C0BFA}
363377
{62901DA5-46F5-40E6-B680-D55F3AAE0323} = {F07CABFC-DC6A-4B5B-BC56-B10EEC2C0BFA}

documentation/for-contributors/generators/shared-infrastructure.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ All JSON configuration structures are represented by C# records in the Silk.NET.
1212

1313
### Project Configuration
1414

15-
Each project has its own JSON configuration file which defines what each generator does for that particular project. This file should be added by the user as an `AdditionalFiles` file, with the name `silktouch.json` unless the `silktouch_config_file` `.editorconfig` option is used to override this with a new file name or file path (either absolute or relative).
15+
Each project has its own JSON configuration file which defines what each generator does for that particular project. This file should be added by the user as an `AdditionalFiles` file, with the name `silktouch.json` unless the `silktouch_config_file` `.editorconfig` option in the source generator format factor or the `config` option in the CLI form factor are used to override this with a new file name or file path (either absolute or relative).
1616

1717
Each generator has its own specific configuration structure, which is outlined in XML documentation in the `Config.cs` file as well as the markdown documents for each individual generator.
1818

@@ -22,6 +22,13 @@ The project configuration also provides a (relative or absolute) path to a file
2222

2323
The global configuration contains variables which aren't specific to a particular project or generation process/job. Stuff like the License Header, which doesn't need to be duplicated across every single project configuration.
2424

25+
### CLI Configuration
26+
The CLI has 3 ways to be configured:
27+
- Command line parameters, possible formats are "key1=value1 --key2=value2 /key3=value3 --key4 value4 /key5 value5"
28+
- A JSON file, with the path taken either from the config option `config` or by default silktouch.json (in the working directory)
29+
- Environment Variables, prefixed with SilkTouch_ (to configure hierarchical data, use two underscores like `set SilkTouch_Parent__Root=value`)
30+
The CLI uses the Microsoft.Extensions.Configuration package for this, for more information on how to use the above options see [here](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/) (note that we do not use user secrets)
31+
2532
## Generation
2633

2734
### SilkTouch "Context"

src/Directory.Build.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@
4848
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
4949
</PropertyGroup>
5050
<ItemGroup Condition="'$(SilkEnableSourceLink)' != 'false' And '$(SilkSourceLinkExempt)' == ''">
51-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
51+
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All"/>
5252
</ItemGroup>
5353
<PropertyGroup Condition="'$(SilkSourceLinkExempt)' != ''">
5454
<IncludeSymbols>false</IncludeSymbols>
5555
<SymbolPackageFormat></SymbolPackageFormat>
5656
</PropertyGroup>
57+
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
5758
</Project>

src/benchmarks/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<NoWarn>1591</NoWarn>
3+
<NoWarn>1591;$(NoWarn)</NoWarn>
44
</PropertyGroup>
55
<Import Project="$(MSBuildThisFileDirectory)../Directory.Build.props" />
66
</Project>

src/benchmarks/Silk.NET.Maths.Benchmarks/Silk.NET.Maths.Benchmarks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
12+
<PackageReference Include="BenchmarkDotNet" />
1313
</ItemGroup>
1414

1515
<ItemGroup>

src/generators/Silk.NET.SilkTouch.Common/Configuration/Config.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
using Microsoft.CodeAnalysis.Diagnostics;
1313
using Microsoft.CodeAnalysis.Text;
1414
using Silk.NET.SilkTouch.Configuration.Json;
15-
using Ultz.Extensions.Logging;
1615

1716
namespace Silk.NET.SilkTouch.Configuration
1817
{

src/generators/Silk.NET.SilkTouch.Common/Generation/SilkTouchContext.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System;
45
using System.Collections.Generic;
56
using Microsoft.CodeAnalysis;
67
using Silk.NET.SilkTouch.Configuration;
@@ -12,10 +13,6 @@ namespace Silk.NET.SilkTouch.Generation
1213
/// </summary>
1314
/// <param name="AssemblyName">The name of the assembly represented by the C# project.</param>
1415
/// <param name="Compilation">The Roslyn compilation, containing all C# compiler info (such as syntax trees)</param>
15-
/// <param name="Configuration">The project-specific configuration for this project.</param>
16-
/// <param name="GlobalConfiguration">
17-
/// The global/common configuration referenced by the <see cref="Configuration"/>'s
18-
/// <see cref="ProjectConfiguration.GlobalConfigFile"/>.</param>
1916
/// <param name="BaseDirectory">
2017
/// The "base directory", used as the root for all relative paths referenced elsewhere in the configuration. This is
2118
/// usually the same folder in which the C# project file (<c>csproj</c>) is contained.
@@ -24,9 +21,8 @@ public sealed record SilkTouchContext
2421
(
2522
string AssemblyName,
2623
Compilation Compilation,
27-
ProjectConfiguration Configuration,
28-
GlobalConfiguration? GlobalConfiguration,
29-
string BaseDirectory
24+
string BaseDirectory,
25+
IServiceProvider ServiceProvider
3026
)
3127
{
3228
// Internal Properties

0 commit comments

Comments
 (0)