Skip to content

Use various modern dotnet build files #253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ jobs:
- name: Install and start RabbitMQ
run: ./.ci/install.ps1
- name: Restore
run: dotnet restore --verbosity=normal
run: dotnet restore ./Build.csproj --verbosity=normal
- name: Build
run: dotnet build --no-restore --verbosity=normal
run: dotnet build ./Build.csproj --no-restore --verbosity=normal
- name: Verify
run: dotnet format --no-restore --verbosity=diagnostic --verify-no-changes
run: dotnet format ./rabbitmq-stream-dotnet-client.sln --no-restore --verbosity=diagnostic --verify-no-changes
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI dotnet format does not yet support Traversal projects.

- name: Test
run: dotnet test --no-build --logger "console;verbosity=detailed"
run: dotnet test ./Build.csproj --no-build --logger "console;verbosity=detailed"
build:
name: build/test on ubuntu-latest
runs-on: ubuntu-latest
Expand Down Expand Up @@ -70,12 +70,12 @@ jobs:
- name: Enable RabbitMQ Plugins
run: docker exec ${{ job.services.rabbitmq.id }} rabbitmq-plugins enable rabbitmq_stream rabbitmq_stream_management rabbitmq_amqp1_0
- name: Restore
run: dotnet restore --verbosity=normal
run: dotnet restore ./Build.csproj --verbosity=normal
- name: Build
run: dotnet build --no-restore --verbosity=normal
run: dotnet build ./Build.csproj --no-restore --verbosity=normal
- name: Verify
run: dotnet format --no-restore --verbosity=diagnostic --verify-no-changes
run: dotnet format ./rabbitmq-stream-dotnet-client.sln --no-restore --verbosity=diagnostic --verify-no-changes
- name: Test
run: dotnet test --no-build --logger "console;verbosity=detailed" /p:AltCover=true
run: dotnet test ./Build.csproj --no-build --logger "console;verbosity=detailed" /p:AltCover=true
- name: Upload code coverage to Codecov
run: bash <(curl -s https://codecov.io/bash)
2 changes: 1 addition & 1 deletion .github/workflows/publish-nuget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ jobs:
restore-keys: |
${{ runner.os }}-v2-nuget-
- name: Build (Release)
run: dotnet build --configuration=Release --verbosity=normal
run: dotnet build ./Build.csproj --verbosity=normal --configuration=Release /p:CI=true
- name: Publish to NuGet
run: dotnet nuget push --skip-duplicate --api-key ${{secrets.NUGET_API_KEY}} --source 'https://api.nuget.org/v3/index.json' ${{github.workspace}}/packages/RabbitMQ.Stream.Client.*.nupkg
17 changes: 17 additions & 0 deletions Build.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.Build.Traversal/3.2.0">

<PropertyGroup>
<IsPackable>false</IsPackable>
<MinVerSkip>true</MinVerSkip>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="docs/Documentation/Documentation.csproj" />
<ProjectReference Include="docs/SuperStream/SuperStream.csproj" />
<ProjectReference Include="Examples/Performances/Performances.csproj" />
<ProjectReference Include="RabbitMQ.Stream.Client.PerfTest/RabbitMQ.Stream.Client.PerfTest.fsproj" />
<ProjectReference Include="RabbitMQ.Stream.Client/RabbitMQ.Stream.Client.csproj" />
<ProjectReference Include="Tests/Tests.csproj" />
</ItemGroup>

</Project>
39 changes: 39 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!-- vim: set ft=xml: -->
<Project>

<PropertyGroup>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)rabbit.snk</AssemblyOriginatorKeyFile>
<Authors>VMware</Authors>
<Company>VMware, Inc. or its affiliates.</Company>
<Copyright>Copyright © 2007-$([System.DateTime]::Now.Year) VMware, Inc. or its affiliates.</Copyright>
<DebugSymbols>true</DebugSymbols>
<DebugType>embedded</DebugType>
<DefaultLanguage>en-US</DefaultLanguage>
<DisableCheckingDuplicateNuGetItems>false</DisableCheckingDuplicateNuGetItems>
<Features>strict</Features>
<IncludeSymbols>true</IncludeSymbols>
<IsPackable>false</IsPackable>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<PackageId>$(AssemblyName)</PackageId>
<PackageProjectUrl>https://github.com/rabbitmq/rabbitmq-stream-dotnet-client</PackageProjectUrl>
<PackageReleaseNotes>https://github.com/rabbitmq/rabbitmq-stream-dotnet-client/releases/latest</PackageReleaseNotes>
<PackageTags>rabbitmq, stream</PackageTags>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/rabbitmq/rabbitmq-stream-dotnet-client</RepositoryUrl>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release' And '$(CI)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<Deterministic>true</Deterministic>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>

<ItemGroup Condition="'$(Configuration)' == 'Release' and '$(SourceRoot)' == ''">
<SourceRoot Include="$(MSBuildThisFileDirectory)/"/>
</ItemGroup>

</Project>
6 changes: 6 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!-- vim: set ft=xml: -->
<Project>
<ItemGroup>
<EmbeddedFiles Include="$(GeneratedAssemblyInfoFile)"/>
</ItemGroup>
</Project>
28 changes: 28 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<!-- RabbitMQ.Stream.Client -->
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.3" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="MinVer" Version="3.1.0" />
<PackageVersion Include="System.IO.Pipelines" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />

<!-- Tests -->
<PackageVersion Include="AltCover" Version="8.2.837" />
<PackageVersion Include="AmqpNetLite" Version="2.4.5" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageVersion Include="RabbitMQ.Client" Version="6.4.0" />
<PackageVersion Include="xunit" Version="2.4.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageVersion Include="Xunit.SkippableFact" Version="1.4.13" />
<PackageVersion Include="coverlet.collector" Version="3.1.2" />

<!-- docs/**/*.csproj -->
<PackageVersion Include="K4os.Compression.LZ4.Streams" Version="1.2.16" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
</ItemGroup>
</Project>
20 changes: 11 additions & 9 deletions Examples/Performances/Performances.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
<MinVerSkip>true</MinVerSkip>
<Nullable>enable</Nullable>
<NoWarn>$(NoWarn);CA2007</NoWarn>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\RabbitMQ.Stream.Client\RabbitMQ.Stream.Client.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\RabbitMQ.Stream.Client\RabbitMQ.Stream.Client.csproj" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
all: format test

format:
dotnet format
dotnet format $(CURDIR)/rabbitmq-stream-dotnet-client.sln

build:
dotnet build
dotnet build $(CURDIR)/Build.csproj

test: build
dotnet test Tests/Tests.csproj --no-build --logger "console;verbosity=detailed" /p:AltCover=true
dotnet test $(CURDIR)/Tests/Tests.csproj --no-build --logger "console;verbosity=detailed" /p:AltCover=true

rabbitmq-server:
docker run -it --rm --name rabbitmq-stream-docker \
Expand Down
9 changes: 9 additions & 0 deletions NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear/>
<!--<add key="localNuget" value="c:\code\LocalNuget" />-->
<!--<add key="MyGet" value="https://www.myget.org/F/rabbitmq/api/v3/index.json" />-->
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
12 changes: 12 additions & 0 deletions RabbitMQ.Stream.Client.PerfTest/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project>
<ItemGroup Condition=" '$(EnableCentralPackageVersions)' != 'false' ">
<!--
https://github.com/NuGet/Home/issues/11949#issuecomment-1184772230
Workaround the issue where FSharp SDK adds implicit PackageReference items but doesn't mark them as such
https://github.com/microsoft/MSBuildSdks/issues/90
-->
<PackageReference Update="FSharp.Core"
Condition="'$(MSBuildProjectExtension)' == '.fsproj' And '$(DisableImplicitFSharpCoreReference)' != 'true' And '$(UpdateImplicitFSharpCoreReference)' != 'false'"
IsImplicitlyDefined="true" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<RootNamespace>RabbitMQ.Stream.Client.Cmd</RootNamespace>
</PropertyGroup>
<PropertyGroup>
<IsPackable>false</IsPackable>
<MinVerSkip>true</MinVerSkip>
<OutputType>Exe</OutputType>
<RootNamespace>RabbitMQ.Stream.Client.Cmd</RootNamespace>
</PropertyGroup>

<ItemGroup>
<Compile Include="Program.fs" />
<Content Include="README.md" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.fs" />
<Content Include="README.md" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\RabbitMQ.Stream.Client\RabbitMQ.Stream.Client.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="FSharp.Core" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RabbitMQ.Stream.Client\RabbitMQ.Stream.Client.csproj" />
</ItemGroup>

</Project>
31 changes: 8 additions & 23 deletions RabbitMQ.Stream.Client/RabbitMQ.Stream.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,26 @@
<AssemblyName>RabbitMQ.Stream.Client</AssemblyName>
<AssemblyOriginatorKeyFile>../rabbit.snk</AssemblyOriginatorKeyFile>
<AssemblyTitle>RabbitMQ Stream Client Library for .NET</AssemblyTitle>
<Authors>VMware</Authors>
<Company>VMware, Inc. or its affiliates.</Company>
<Copyright>Copyright © 2007-2022 VMware, Inc. or its affiliates.</Copyright>
<Description>The RabbitMQ Stream .NET client is the official client library for C# (and, implicitly, other .NET languages)</Description>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IncludeSymbols>true</IncludeSymbols>
<IsPackable>true</IsPackable>
<MinVerTagPrefix>v</MinVerTagPrefix>
<MinVerVerbosity>normal</MinVerVerbosity>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<PackageDescription>The RabbitMQ Stream .NET client is the official client library for C# (and, implicitly, other .NET languages)</PackageDescription>
<PackageIcon>icon.png</PackageIcon>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageOutputPath>..\packages</PackageOutputPath>
<PackageProjectUrl>https://github.com/rabbitmq/rabbitmq-stream-dotnet-client</PackageProjectUrl>
<PackageTags>rabbitmq, stream</PackageTags>
<RepositoryUrl>https://github.com/rabbitmq/rabbitmq-stream-dotnet-client</RepositoryUrl>
<RootNamespace>RabbitMQ.Stream.Client</RootNamespace>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<Title>RabbitMQ Stream Client Library for .NET</Title>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<PropertyGroup Condition="'$(CI)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<Deterministic>true</Deterministic>
</PropertyGroup>

<ItemGroup>
<None Remove="icon.png" />
<Content Include="icon.png" PackagePath="" />
<None Include="..\LICENSE" Pack="true" PackagePath="" />
<Content Include="icon.png" PackagePath="icon.png" />
<None Include="$(MSBuildThisFileDirectory)..\LICENSE" Pack="true" Visible="false" PackagePath="" />
</ItemGroup>

<ItemGroup>
Expand All @@ -48,20 +33,20 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.3">
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PackageReference Include="Microsoft.SourceLink.GitHub">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="MinVer" Version="3.1.0">
<PackageReference Include="MinVer">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="System.IO.Pipelines" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="System.IO.Pipelines" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
</ItemGroup>

</Project>
20 changes: 10 additions & 10 deletions Tests/Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<MinVerSkip>true</MinVerSkip>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AltCover" Version="8.2.837" />
<PackageReference Include="AmqpNetLite" Version="2.4.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="RabbitMQ.Client" Version="6.4.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="AltCover" />
<PackageReference Include="AmqpNetLite" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="RabbitMQ.Client" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Xunit.SkippableFact" Version="1.4.13" />
<PackageReference Include="coverlet.collector" Version="3.1.2">
<PackageReference Include="Xunit.SkippableFact" />
<PackageReference Include="coverlet.collector">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand All @@ -26,6 +25,7 @@
<ItemGroup>
<ProjectReference Include="..\RabbitMQ.Stream.Client\RabbitMQ.Stream.Client.csproj" />
</ItemGroup>

<ItemGroup>
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
Expand Down
4 changes: 0 additions & 4 deletions build.bat

This file was deleted.

25 changes: 25 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[CmdletBinding(PositionalBinding=$false)]
param(
[switch]$RunTests
)

Write-Host "Run Parameters:" -ForegroundColor Cyan
Write-Host "`tPSScriptRoot: $PSScriptRoot"
Write-Host "`tRunTests: $RunTests"
Write-Host "`tdotnet --version: $(dotnet --version)"

Write-Host "Building all projects (Build.csproj traversal)..." -ForegroundColor "Magenta"
dotnet build "$PSScriptRoot\Build.csproj"
Write-Host "Done building." -ForegroundColor "Green"

if ($RunTests) {
Write-Host "Running tests: Build.csproj traversal (all frameworks)" -ForegroundColor "Magenta"
dotnet test "$PSScriptRoot\Build.csproj" --no-build --logger "console;verbosity=detailed"
if ($LastExitCode -ne 0) {
Write-Host "Error with tests, aborting build." -Foreground "Red"
Exit 1
}
Write-Host "Tests passed!" -ForegroundColor "Green"
}

Write-Host "Done."
Loading