Skip to content

Commit fc6d743

Browse files
Updating to support .NET 5 and to use Open.snk (#155)
* Updating to support .NET 5 and to use Open.snk * Don't set RuntimeIdentifier at the solution level * Ensure pError is null initialized * Adding a job to build the release nuget packages
1 parent f5b61b9 commit fc6d743

21 files changed

+110
-91
lines changed

Directory.Build.props

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<EnableDefaultNoneItems>false</EnableDefaultNoneItems>
2626
<NoWarn>CS0659;$(NoWarn)</NoWarn>
2727
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
28+
<SignAssembly>true</SignAssembly>
2829
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
2930
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
3031
</PropertyGroup>
@@ -38,20 +39,25 @@
3839
<Authors>Microsoft and Contributors</Authors>
3940
<BaseOutputPath>$(BaseArtifactsPath)bin/$(BaseArtifactsPathSuffix)/</BaseOutputPath>
4041
<Company>Microsoft</Company>
42+
<ContinuousIntegrationBuild Condition="'$(BUILD_BUILDNUMBER)' != ''">true</ContinuousIntegrationBuild>
4143
<PackageOutputPath>$(BaseArtifactsPath)pkg/$(Configuration)/</PackageOutputPath>
4244
<Product>LLVMSharp</Product>
4345
<VersionPrefix>11.0.0</VersionPrefix>
4446
<VersionSuffix>beta</VersionSuffix>
47+
<VersionSuffix Condition="'$(BUILD_REASON)' == 'PullRequest'">pr</VersionSuffix>
4548
</PropertyGroup>
4649

4750
<!-- Default settings that are otherwise undefined -->
4851
<PropertyGroup>
52+
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)Open.snk</AssemblyOriginatorKeyFile>
53+
<AssemblyOriginatorPublicKey>00240000048000009400000006020000002400005253413100040000010001004b86c4cb78549b34bab61a3b1800e23bfeb5b3ec390074041536a7e3cbd97f5f04cf0f857155a8928eaa29ebfd11cfbbad3ba70efea7bda3226c6a8d370a4cd303f714486b6ebc225985a638471e6ef571cc92a4613c00b8fa65d61ccee0cbe5f36330c9a01f4183559f1bef24cc2917c6d913e3a541333a1d05d9bed22b38cb</AssemblyOriginatorPublicKey>
4954
<Copyright>Copyright © Microsoft and Contributors</Copyright>
5055
<Description>LLVMSharp is a multi-platform .NET Standard library for accessing the LLVM infrastructure.</Description>
5156
<Features>strict</Features>
5257
<GenerateDocumentationFile>false</GenerateDocumentationFile>
5358
<HighEntropyVA>true</HighEntropyVA>
54-
<LangVersion>preview</LangVersion>
59+
<LangVersion>latest</LangVersion>
60+
<MinClientVersion>4.3</MinClientVersion>
5561
<NeutralLanguage>en-US</NeutralLanguage>
5662
<OverwriteReadOnlyFiles>true</OverwriteReadOnlyFiles>
5763
<PackageLicenseExpression>NCSA</PackageLicenseExpression>
@@ -65,9 +71,4 @@
6571
<UseSharedCompilation>true</UseSharedCompilation>
6672
</PropertyGroup>
6773

68-
<!-- Package references which are consumed by all projects -->
69-
<ItemGroup>
70-
<PackageReference Include="Microsoft.Net.Compilers.Toolset" IsImplicitlyDefined="true" PrivateAssets="all" />
71-
</ItemGroup>
72-
7374
</Project>

Directory.Build.targets

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,25 @@
1515
<DefineConstants>$(DefineConstants);$(OS)</DefineConstants>
1616
</PropertyGroup>
1717

18+
<!-- Settings that are only set for CI builds -->
19+
<PropertyGroup Condition="'$(BUILD_BUILDNUMBER)' != ''">
20+
<PackageVersion Condition="'$(EXCLUDE_BUILDNUMBER_FROM_PACKAGE)' == ''">$(Version)-$(BUILD_BUILDNUMBER)</PackageVersion>
21+
</PropertyGroup>
22+
1823
<!-- Settings that allow testing to work by default -->
19-
<PropertyGroup>
20-
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == ''">$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>
24+
<PropertyGroup Condition="'$(RuntimeIdentifier)' == '' AND '$(Contin)' != 'true'">
25+
<RuntimeIdentifier>$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>
26+
<RuntimeIdentifier Condition="'$(OVERRIDE_RUNTIME_IDENTIFIER)' != ''">$(OVERRIDE_RUNTIME_IDENTIFIER)</RuntimeIdentifier>
2127
</PropertyGroup>
2228

2329
<!-- Package versions for package references across all projects -->
2430
<ItemGroup>
2531
<PackageReference Update="libLLVM" Version="11.0.0" />
26-
<PackageReference Update="Microsoft.Bcl.HashCode" Version="1.1.0" />
27-
<PackageReference Update="Microsoft.Net.Compilers.Toolset" Version="3.5.0" />
28-
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.5.0" />
29-
<PackageReference Update="NUnit" Version="3.12.0" />
30-
<PackageReference Update="NUnit3TestAdapter" Version="3.16.1" />
32+
<PackageReference Update="Microsoft.Bcl.HashCode" Version="1.1.1" />
33+
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.8.3" />
34+
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="1.0.0" />
35+
<PackageReference Update="NUnit" Version="3.13.1" />
36+
<PackageReference Update="NUnit3TestAdapter" Version="3.17.0" />
3137
<PackageReference Update="System.Memory" Version="4.5.4" />
3238
</ItemGroup>
3339

Open.snk

596 Bytes
Binary file not shown.

scripts/azure-pipelines.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,29 @@ jobs:
3333
configuration: Release
3434
architecture: x64
3535

36+
- template: azure-windows.yml
37+
parameters:
38+
name: build_nuget
39+
pool: windows-latest
40+
configuration: Release
41+
architecture: x64
42+
EXCLUDE_BUILDNUMBER_FROM_PACKAGE: true
43+
3644
- template: azure-unix.yml
3745
parameters:
3846
name: ubuntu_debug_x64
3947
pool: ubuntu-latest
4048
configuration: Debug
4149
architecture: x64
42-
rid: ubuntu.18.04-x64
50+
OVERRIDE_RUNTIME_IDENTIFIER: ubuntu.18.04-x64
4351

4452
- template: azure-unix.yml
4553
parameters:
4654
name: ubuntu_release_x64
4755
pool: ubuntu-latest
4856
configuration: Release
4957
architecture: x64
50-
rid: ubuntu.18.04-x64
58+
OVERRIDE_RUNTIME_IDENTIFIER: ubuntu.18.04-x64
5159

5260
- template: azure-unix.yml
5361
parameters:

scripts/azure-unix.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ jobs:
2626
ArtifactName: packages
2727
publishLocation: Container
2828
variables:
29-
RuntimeIdentifier: ${{parameters.rid}}
29+
EXCLUDE_BUILDNUMBER_FROM_PACKAGE: ${{parameters.EXCLUDE_BUILDNUMBER_FROM_PACKAGE}}
30+
OVERRIDE_RUNTIME_IDENTIFIER: ${{parameters.OVERRIDE_RUNTIME_IDENTIFIER}}

scripts/azure-windows.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ jobs:
2424
PathtoPublish: artifacts/pkg/${{parameters.configuration}}
2525
ArtifactName: packages
2626
publishLocation: Container
27+
variables:
28+
EXCLUDE_BUILDNUMBER_FROM_PACKAGE: ${{parameters.EXCLUDE_BUILDNUMBER_FROM_PACKAGE}}
29+
OVERRIDE_RUNTIME_IDENTIFIER: ${{parameters.OVERRIDE_RUNTIME_IDENTIFIER}}

scripts/build.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ try {
120120
$DotNetInstallDirectory = Join-Path -Path $ArtifactsDir -ChildPath "dotnet"
121121
Create-Directory -Path $DotNetInstallDirectory
122122

123-
& $DotNetInstallScript -Channel 3.1 -Version latest -InstallDir $DotNetInstallDirectory -Architecture $architecture
124-
& $DotNetInstallScript -Channel 2.1 -Version latest -InstallDir $DotNetInstallDirectory -Architecture $architecture -Runtime dotnet
123+
& $DotNetInstallScript -Channel 5.0 -Version latest -InstallDir $DotNetInstallDirectory -Architecture $architecture
124+
& $DotNetInstallScript -Channel 3.1 -Version latest -InstallDir $DotNetInstallDirectory -Architecture $architecture -Runtime dotnet
125125

126126
$env:PATH="$DotNetInstallDirectory;$env:PATH"
127127
}

scripts/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ if [[ ! -z "$architecture" ]]; then
204204
DotNetInstallDirectory="$ArtifactsDir/dotnet"
205205
CreateDirectory "$DotNetInstallDirectory"
206206

207-
. "$DotNetInstallScript" --channel 3.1 --version latest --install-dir "$DotNetInstallDirectory" --architecture "$architecture"
208-
. "$DotNetInstallScript" --channel 2.1 --version latest --install-dir "$DotNetInstallDirectory" --architecture "$architecture" --runtime dotnet
207+
. "$DotNetInstallScript" --channel 5.0 --version latest --install-dir "$DotNetInstallDirectory" --architecture "$architecture"
208+
. "$DotNetInstallScript" --channel 3.1 --version latest --install-dir "$DotNetInstallDirectory" --architecture "$architecture" --runtime dotnet
209209

210210
PATH="$DotNetInstallDirectory:$PATH:"
211211
fi

sources/Directory.Build.props

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,19 @@
1111
-->
1212

1313
<PropertyGroup>
14+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
1415
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileDirectory)..\Directory.Build.props</MSBuildAllProjects>
1516
<LLVMSharpProjectCategory>sources</LLVMSharpProjectCategory>
1617
</PropertyGroup>
1718

1819
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.props" />
1920

2021
<ItemGroup>
21-
<InternalsVisibleTo Include="$(MSBuildProjectName).UnitTests" />
22+
<InternalsVisibleTo Include="$(MSBuildProjectName).UnitTests" Key="$(AssemblyOriginatorPublicKey)" />
23+
</ItemGroup>
24+
25+
<ItemGroup>
26+
<PackageReference Include="Microsoft.SourceLink.GitHub" IsImplicitlyDefined="true" PrivateAssets="all" />
2227
</ItemGroup>
2328

2429
</Project>

sources/Directory.Build.targets

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,32 @@
1717
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.targets" />
1818

1919
<PropertyGroup>
20-
<GeneratedInternalsVisibleToFile Condition="'$(GeneratedInternalsVisibleToFile)' == ''">$(IntermediateOutputPath)$(MSBuildProjectName).InternalsVisibleTo$(DefaultLanguageSourceExtension)</GeneratedInternalsVisibleToFile>
20+
<GeneratedSkipLocalsInitFile Condition="'$(GeneratedSkipLocalsInitFile)' == ''">$(IntermediateOutputPath)$(MSBuildProjectName).SkipLocalsInit$(DefaultLanguageSourceExtension)</GeneratedSkipLocalsInitFile>
21+
<GeneratedSkipLocalsInitFileLines>
22+
<![CDATA[//------------------------------------------------------------------------------
23+
// <auto-generated>
24+
// This code was generated by a tool.
25+
//
26+
// Changes to this file may cause incorrect behavior and will be lost if
27+
// the code is regenerated.
28+
// </auto-generated>
29+
//------------------------------------------------------------------------------
30+
[module: System.Runtime.CompilerServices.SkipLocalsInitAttribute]
31+
// Generated by the MSBuild WriteLinesToFile class.]]>
32+
</GeneratedSkipLocalsInitFileLines>
2133
</PropertyGroup>
2234

23-
<ItemDefinitionGroup>
24-
<InternalsVisibleTo>
25-
<Visible>false</Visible>
26-
</InternalsVisibleTo>
27-
</ItemDefinitionGroup>
28-
29-
<Target Name="GenerateInternalsVisibleTo"
30-
BeforeTargets="CoreCompile"
31-
DependsOnTargets="PrepareForBuild;CoreGenerateInternalsVisibleTo"
32-
Condition="'@(InternalsVisibleTo)' != ''" />
33-
34-
<Target Name="CoreGenerateInternalsVisibleTo"
35-
Condition="'$(Language)' == 'VB' or '$(Language)' == 'C#'"
35+
<Target Name="GenerateSkipLocalsInit"
36+
BeforeTargets="BeforeCompile;CoreCompile"
37+
DependsOnTargets="PrepareForBuild"
38+
Condition="'$(Language)' == 'C#' And '$(TargetFramework)' == 'net5.0'"
3639
Inputs="$(MSBuildAllProjects)"
37-
Outputs="$(GeneratedInternalsVisibleToFile)">
38-
<CreateItem Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute" AdditionalMetadata="_Parameter1=%(InternalsVisibleTo.Identity)" Condition="'%(InternalsVisibleTo.PublicKey)' == ''">
39-
<Output TaskParameter="Include" ItemName="InternalsVisibleToAttribute" />
40-
</CreateItem>
41-
<CreateItem Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute" AdditionalMetadata="_Parameter1=%(InternalsVisibleTo.Identity), PublicKey=%(InternalsVisibleTo.PublicKey)" Condition="'%(InternalsVisibleTo.PublicKey)' != ''">
42-
<Output TaskParameter="Include" ItemName="InternalsVisibleToAttribute" />
43-
</CreateItem>
40+
Outputs="$(GeneratedSkipLocalsInitFile)">
41+
<WriteLinesToFile Lines="$(GeneratedSkipLocalsInitFileLines)" Overwrite="true" WriteOnlyWhenDifferent="true" File="$(GeneratedSkipLocalsInitFile)" />
4442

45-
<WriteCodeFragment AssemblyAttributes="@(InternalsVisibleToAttribute)" Language="$(Language)" OutputFile="$(GeneratedInternalsVisibleToFile)">
46-
<Output TaskParameter="OutputFile" ItemName="Compile" />
47-
<Output TaskParameter="OutputFile" ItemName="FileWrites" />
48-
</WriteCodeFragment>
43+
<ItemGroup>
44+
<Compile Include="$(GeneratedSkipLocalsInitFile)" />
45+
</ItemGroup>
4946
</Target>
5047

51-
<!-- Empty target so that `dotnet test` will work on the solution -->
52-
<!-- https://github.com/Microsoft/vstest/issues/411 -->
53-
<Target Name="VSTest" />
54-
5548
</Project>

0 commit comments

Comments
 (0)