Skip to content

Commit f5ca580

Browse files
committed
Updating infrastructure files to match the latest conventions
1 parent fa85555 commit f5ca580

25 files changed

+423
-212
lines changed

.editorconfig

Lines changed: 242 additions & 144 deletions
Large diffs are not rendered by default.

.github/workflows/ci.yml

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
configuration: [ debug, release ]
1616
os: [ windows ]
1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v3
1919
- run: ./scripts/cibuild.cmd -configuration ${{ matrix.configuration }} -architecture ${{ matrix.architecture }}
2020
shell: cmd
21-
- uses: actions/upload-artifact@v2
21+
- uses: actions/upload-artifact@v3
2222
with:
2323
name: ${{ matrix.os }}_${{ matrix.configuration }}_${{ matrix.architecture }}
2424
path: |
@@ -35,10 +35,10 @@ jobs:
3535
configuration: [ debug, release ]
3636
os: [ windows ]
3737
steps:
38-
- uses: actions/checkout@v2
38+
- uses: actions/checkout@v3
3939
- run: ./scripts/cibuild.cmd -configuration ${{ matrix.configuration }} -architecture ${{ matrix.architecture }} /p:PlatformTarget=${{ matrix.architecture }}
4040
shell: cmd
41-
- uses: actions/upload-artifact@v2
41+
- uses: actions/upload-artifact@v3
4242
with:
4343
name: ${{ matrix.os }}_${{ matrix.configuration }}_x86
4444
path: |
@@ -55,10 +55,10 @@ jobs:
5555
configuration: [ debug, release ]
5656
os: [ ubuntu ]
5757
steps:
58-
- uses: actions/checkout@v2
58+
- uses: actions/checkout@v3
5959
- run: ./scripts/cibuild.sh --configuration ${{ matrix.configuration }} --architecture ${{ matrix.architecture }}
6060
shell: bash
61-
- uses: actions/upload-artifact@v2
61+
- uses: actions/upload-artifact@v3
6262
with:
6363
name: ${{ matrix.os }}_${{ matrix.configuration }}_${{ matrix.architecture }}
6464
path: |
@@ -75,10 +75,10 @@ jobs:
7575
configuration: [ debug, release ]
7676
os: [ macos ]
7777
steps:
78-
- uses: actions/checkout@v2
78+
- uses: actions/checkout@v3
7979
- run: ./scripts/cibuild.sh --configuration ${{ matrix.configuration }} --architecture ${{ matrix.architecture }}
8080
shell: bash
81-
- uses: actions/upload-artifact@v2
81+
- uses: actions/upload-artifact@v3
8282
with:
8383
name: ${{ matrix.os }}_${{ matrix.configuration }}_${{ matrix.architecture }}
8484
path: |
@@ -90,13 +90,21 @@ jobs:
9090
build-nuget-preview:
9191
runs-on: windows-latest
9292
steps:
93-
- uses: actions/checkout@v2
93+
- uses: actions/checkout@v3
9494
- run: ./scripts/cibuild.cmd -configuration release -architecture x64
9595
shell: cmd
9696
env:
9797
EXCLUDE_RUN_ID_FROM_PACKAGE: true
9898
EXCLUDE_SUFFIX_FROM_VERSION: false
99-
- uses: actions/upload-artifact@v2
99+
- uses: actions/setup-dotnet@v2
100+
if: ${{ github.event_name == 'push' }}
101+
with:
102+
dotnet-version: '6.0.x'
103+
- run: dotnet tool install --tool-path ./artifacts/tools SignClient
104+
if: ${{ github.event_name == 'push' }}
105+
- run: ./artifacts/tools/SignClient "Sign" --baseDirectory "${{ github.workspace }}/artifacts/pkg" --input "**/*.nupkg" --config "${{ github.workspace }}/scripts/SignClientSettings.json" --filelist "${{ github.workspace }}/scripts/SignClientFileList.txt" --user "${{ secrets.SC_USER }}" --secret "${{ secrets.SC_PASS }}" --name "ClangSharp" --description "ClangSharp" --descriptionUrl "https://github.com/dotnet/clangsharp"
106+
if: ${{ github.event_name == 'push' }}
107+
- uses: actions/upload-artifact@v3
100108
with:
101109
name: nuget_preview
102110
path: |
@@ -107,15 +115,22 @@ jobs:
107115
if-no-files-found: error
108116
build-nuget-release:
109117
runs-on: windows-latest
110-
if: false
111118
steps:
112-
- uses: actions/checkout@v2
119+
- uses: actions/checkout@v3
113120
- run: ./scripts/cibuild.cmd -configuration release -architecture x64
114121
shell: cmd
115122
env:
116123
EXCLUDE_RUN_ID_FROM_PACKAGE: true
117124
EXCLUDE_SUFFIX_FROM_VERSION: true
118-
- uses: actions/upload-artifact@v2
125+
- uses: actions/setup-dotnet@v2
126+
if: ${{ github.event_name == 'push' }}
127+
with:
128+
dotnet-version: '6.0.x'
129+
- run: dotnet tool install --tool-path ./artifacts/tools SignClient
130+
if: ${{ github.event_name == 'push' }}
131+
- run: ./artifacts/tools/SignClient "Sign" --baseDirectory "${{ github.workspace }}/artifacts/pkg" --input "**/*.nupkg" --config "${{ github.workspace }}/scripts/SignClientSettings.json" --filelist "${{ github.workspace }}/scripts/SignClientFileList.txt" --user "${{ secrets.SC_USER }}" --secret "${{ secrets.SC_PASS }}" --name "ClangSharp" --description "ClangSharp" --descriptionUrl "https://github.com/dotnet/clangsharp"
132+
if: ${{ github.event_name == 'push' }}
133+
- uses: actions/upload-artifact@v3
119134
with:
120135
name: nuget_release
121136
path: |
@@ -133,7 +148,7 @@ jobs:
133148
with:
134149
name: windows_release_x64
135150
path: ./artifacts
136-
- uses: actions/setup-dotnet@v1
151+
- uses: actions/setup-dotnet@v2
137152
with:
138153
dotnet-version: '6.0.x'
139154
source-url: https://pkgs.clangsharp.dev/index.json
@@ -149,7 +164,7 @@ jobs:
149164
with:
150165
name: windows_release_x64
151166
path: ./artifacts
152-
- uses: actions/setup-dotnet@v1
167+
- uses: actions/setup-dotnet@v2
153168
with:
154169
dotnet-version: '6.0.x'
155170
- run: dotnet nuget push "./artifacts/pkg/Release/*.nupkg" --source https://nuget.pkg.github.com/dotnet/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
# Build Artifacts
33
###############################################################################
44
artifacts/
5+
build/
56
*.binlog
67
*.dll
78
*.dylib
9+
*.nupkg
810
*.so
911

1012
###############################################################################
@@ -18,3 +20,9 @@ obj/
1820
###############################################################################
1921
.vs/
2022
*.csproj.user
23+
24+
###############################################################################
25+
# Rider
26+
###############################################################################
27+
.idea/
28+
*.DotSettings.user

Directory.Build.props

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@
2020
<!-- Default settings that explicitly differ from the Sdk.props defaults -->
2121
<PropertyGroup>
2222
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
23+
<AnalysisLevel>preview</AnalysisLevel>
2324
<BaseIntermediateOutputPath>$(BaseArtifactsPath)obj/$(BaseArtifactsPathSuffix)/</BaseIntermediateOutputPath>
2425
<DebugType>embedded</DebugType>
2526
<EnableDefaultNoneItems>false</EnableDefaultNoneItems>
26-
<NoWarn>CS0659;$(NoWarn)</NoWarn>
27+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
28+
<Nullable>disable</Nullable>
2729
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
2830
<SignAssembly>true</SignAssembly>
2931
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
@@ -42,6 +44,7 @@
4244
<ContinuousIntegrationBuild Condition="'$(GITHUB_RUN_ID)' != ''">true</ContinuousIntegrationBuild>
4345
<PackageOutputPath>$(BaseArtifactsPath)pkg/$(Configuration)/</PackageOutputPath>
4446
<Product>LLVMSharp</Product>
47+
<RootNamespace>LLVMSharp</RootNamespace>
4548
<VersionPrefix>14.0.0</VersionPrefix>
4649
<VersionSuffix Condition="'$(EXCLUDE_SUFFIX_FROM_VERSION)' != 'true'">beta1</VersionSuffix>
4750
<VersionSuffix Condition="'$(GITHUB_EVENT_NAME)' == 'pull_request'">pr</VersionSuffix>
@@ -65,9 +68,7 @@
6568
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
6669
<PublicSign>false</PublicSign>
6770
<RepositoryType>git</RepositoryType>
68-
<RestoreSources>
69-
https://api.nuget.org/v3/index.json;
70-
</RestoreSources>
71+
<RestoreConfigFile>$(MSBuildThisFileDirectory)NuGet.config</RestoreConfigFile>
7172
<UseSharedCompilation>true</UseSharedCompilation>
7273
</PropertyGroup>
7374

Directory.Build.targets

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,29 @@
1212

1313
<!-- Settings that append the existing setting value -->
1414
<PropertyGroup>
15-
<DefineConstants>$(DefineConstants);$(OS)</DefineConstants>
15+
<NoWarn>$(NoWarn)</NoWarn>
1616
</PropertyGroup>
1717

1818
<!-- Settings that are only set for CI builds -->
1919
<PropertyGroup Condition="'$(GITHUB_RUN_ID)' != ''">
2020
<PackageVersion Condition="'$(EXCLUDE_RUN_ID_FROM_PACKAGE)' != 'true'">$(Version).$(GITHUB_RUN_ID)</PackageVersion>
2121
</PropertyGroup>
2222

23-
<!-- Settings that allow testing to work by default -->
24-
<PropertyGroup Condition="'$(RuntimeIdentifier)' == '' AND '$(Contin)' != 'true'">
23+
<!-- Settings that are only set for executables -->
24+
<PropertyGroup Condition="'$(OutputType)' != 'Library' AND '$(UseWindowsForms)' != 'true' AND '$(PackAsTool)' != 'true'">
25+
<PublishTrimmed>true</PublishTrimmed>
26+
</PropertyGroup>
27+
28+
<!-- Settings that are only set for libraries -->
29+
<PropertyGroup Condition="'$(OutputType)' == 'Library'">
30+
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
31+
<IsTrimmable>true</IsTrimmable>
32+
</PropertyGroup>
33+
34+
<!-- Settings that allow testing and packing to work by default -->
35+
<PropertyGroup Condition="'$(RuntimeIdentifier)' == ''">
2536
<RuntimeIdentifier>$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>
2637
<RuntimeIdentifier Condition="'$(OVERRIDE_RUNTIME_IDENTIFIER)' != ''">$(OVERRIDE_RUNTIME_IDENTIFIER)</RuntimeIdentifier>
2738
</PropertyGroup>
2839

29-
<!-- Package versions for package references across all projects -->
30-
<ItemGroup>
31-
<PackageReference Update="libLLVM" Version="14.0.0" />
32-
<PackageReference Update="Microsoft.Bcl.HashCode" Version="1.1.1" />
33-
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.1.0" />
34-
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="1.1.1" />
35-
<PackageReference Update="NUnit" Version="3.13.3" />
36-
<PackageReference Update="NUnit3TestAdapter" Version="4.2.1" />
37-
<PackageReference Update="System.Memory" Version="4.5.4" />
38-
</ItemGroup>
39-
4040
</Project>

Directory.Packages.props

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project>
3+
4+
<!--
5+
Directory.Packages.props is automatically picked up and imported by
6+
Microsoft.Common.targets. This file needs to exist, even if empty so that
7+
files in the parent directory tree, with the same name, are not imported
8+
instead. The import fairly late and most other props/targets will have been
9+
imported beforehand. We also don't need to add ourselves to
10+
MSBuildAllProjects, as that is done by the file that imports us.
11+
-->
12+
13+
<!-- Package versions for package references across all projects -->
14+
<ItemGroup>
15+
<PackageVersion Include="libLLVM" Version="14.0.0" />
16+
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
17+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
18+
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
19+
<PackageVersion Include="NUnit" Version="3.13.3" />
20+
<PackageVersion Include="NUnit3TestAdapter" Version="4.2.1" />
21+
<PackageVersion Include="System.Memory" Version="4.5.5" />
22+
</ItemGroup>
23+
24+
</Project>

LLVMSharp.sln

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1313
CODE_OF_CONDUCT.md = CODE_OF_CONDUCT.md
1414
Directory.Build.props = Directory.Build.props
1515
Directory.Build.targets = Directory.Build.targets
16+
Directory.Packages.props = Directory.Packages.props
1617
LICENSE.md = LICENSE.md
1718
NOTICE.md = NOTICE.md
19+
NuGet.config = NuGet.config
20+
Open.snk = Open.snk
1821
pack.cmd = pack.cmd
1922
pack.sh = pack.sh
2023
README.md = README.md
@@ -46,6 +49,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{9BF3
4649
scripts\build.sh = scripts\build.sh
4750
scripts\cibuild.cmd = scripts\cibuild.cmd
4851
scripts\cibuild.sh = scripts\cibuild.sh
52+
scripts\SignClientFileList.txt = scripts\SignClientFileList.txt
53+
scripts\SignClientSettings.json = scripts\SignClientSettings.json
4954
EndProjectSection
5055
EndProject
5156
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "packages", "packages", "{CD611531-75EA-4328-8C25-8D0496E61EC2}"

NuGet.config

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSourceMapping>
4+
<packageSource key="nuget">
5+
<package pattern="*" />
6+
</packageSource>
7+
</packageSourceMapping>
8+
<packageSources>
9+
<clear />
10+
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
11+
</packageSources>
12+
</configuration>

build.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
@ECHO OFF
2-
powershell.exe -NoLogo -NoProfile -ExecutionPolicy ByPass -Command "& """%~dp0scripts\build.ps1""" -build %*"
2+
pwsh.exe -NoLogo -NoProfile -ExecutionPolicy ByPass -Command "& """%~dp0scripts\build.ps1""" -build %*"
33
EXIT /B %ERRORLEVEL%

pack.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
@ECHO OFF
2-
powershell.exe -NoLogo -NoProfile -ExecutionPolicy ByPass -Command "& """%~dp0scripts\build.ps1""" -pack %*"
2+
pwsh.exe -NoLogo -NoProfile -ExecutionPolicy ByPass -Command "& """%~dp0scripts\build.ps1""" -pack %*"
33
EXIT /B %ERRORLEVEL%

restore.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
@ECHO OFF
2-
powershell.exe -NoLogo -NoProfile -ExecutionPolicy ByPass -Command "& """%~dp0scripts\build.ps1""" -restore %*"
2+
pwsh.exe -NoLogo -NoProfile -ExecutionPolicy ByPass -Command "& """%~dp0scripts\build.ps1""" -restore %*"
33
EXIT /B %ERRORLEVEL%

scripts/SignClientFileList.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/LLVMSharp*

scripts/SignClientSettings.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"SignClient": {
3+
"AzureAd": {
4+
"AADInstance": "https://login.microsoftonline.com/",
5+
"ClientId": "c248d68a-ba6f-4aa9-8a68-71fe872063f8",
6+
"TenantId": "16076fdc-fcc1-4a15-b1ca-32c9a255900e"
7+
},
8+
"Service": {
9+
"Url": "https://codesign.dotnetfoundation.org/",
10+
"ResourceId": "https://SignService/3c30251f-36f3-490b-a955-520addb85001"
11+
}
12+
}
13+
}

scripts/build.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ try {
124124
Create-Directory -Path $DotNetInstallDirectory
125125

126126
& $DotNetInstallScript -Channel 6.0 -Version latest -InstallDir $DotNetInstallDirectory -Architecture $architecture
127+
& $DotNetInstallScript -Channel 7.0 -Version latest -InstallDir $DotNetInstallDirectory -Architecture $architecture -Quality preview
127128

128129
$env:PATH="$DotNetInstallDirectory;$env:PATH"
129130
}

scripts/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ if [[ ! -z "$architecture" ]]; then
205205
CreateDirectory "$DotNetInstallDirectory"
206206

207207
. "$DotNetInstallScript" --channel 6.0 --version latest --install-dir "$DotNetInstallDirectory" --architecture "$architecture"
208+
. "$DotNetInstallScript" --channel 7.0 --version latest --install-dir "$DotNetInstallDirectory" --architecture "$architecture" --quality preview
208209

209210
PATH="$DotNetInstallDirectory:$PATH:"
210211
fi

scripts/cibuild.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
@ECHO OFF
2-
powershell.exe -NoLogo -NoProfile -ExecutionPolicy ByPass -Command "& """%~dp0build.ps1""" -ci %*"
2+
pwsh.exe -NoLogo -NoProfile -ExecutionPolicy ByPass -Command "& """%~dp0build.ps1""" -ci %*"
33
EXIT /B %ERRORLEVEL%

sources/Directory.Build.props

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
<PropertyGroup>
1414
<EmbedUntrackedSources>true</EmbedUntrackedSources>
15-
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileDirectory)..\Directory.Build.props</MSBuildAllProjects>
1615
<LLVMSharpProjectCategory>sources</LLVMSharpProjectCategory>
1716
</PropertyGroup>
1817

@@ -23,7 +22,7 @@
2322
</ItemGroup>
2423

2524
<ItemGroup>
26-
<PackageReference Include="Microsoft.SourceLink.GitHub" IsImplicitlyDefined="true" PrivateAssets="all" />
25+
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="all" />
2726
</ItemGroup>
2827

2928
</Project>

sources/Directory.Build.targets

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
MSBuildAllProjects, as that is done by the file that imports us.
1111
-->
1212

13-
<PropertyGroup>
14-
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileDirectory)..\Directory.Build.targets</MSBuildAllProjects>
15-
</PropertyGroup>
16-
1713
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.targets" />
1814

1915
<PropertyGroup>
@@ -27,15 +23,17 @@
2723
// the code is regenerated.
2824
// </auto-generated>
2925
//------------------------------------------------------------------------------
26+
3027
[module: System.Runtime.CompilerServices.SkipLocalsInitAttribute]
28+
3129
// Generated by the MSBuild WriteLinesToFile class.]]>
3230
</GeneratedSkipLocalsInitFileLines>
3331
</PropertyGroup>
3432

3533
<Target Name="GenerateSkipLocalsInit"
3634
BeforeTargets="BeforeCompile;CoreCompile"
3735
DependsOnTargets="PrepareForBuild"
38-
Condition="'$(Language)' == 'C#' And '$(TargetFramework)' == 'net5.0'"
36+
Condition="'$(Language)' == 'C#'"
3937
Inputs="$(MSBuildAllProjects)"
4038
Outputs="$(GeneratedSkipLocalsInitFile)">
4139
<WriteLinesToFile Lines="$(GeneratedSkipLocalsInitFileLines)" Overwrite="true" WriteOnlyWhenDifferent="true" File="$(GeneratedSkipLocalsInitFile)" />

0 commit comments

Comments
 (0)