Skip to content

Generate assembly attributes using MinVer and csproj #779

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 5 commits into from
Mar 26, 2020

Conversation

lukebakken
Copy link
Collaborator

Fixes #768

@lukebakken lukebakken self-assigned this Mar 25, 2020
@lukebakken lukebakken added this to the 6.0.0 milestone Mar 25, 2020
@@ -57,7 +57,6 @@ class BlockingCell<T>
{
private readonly ManualResetEventSlim _manualResetEventSlim = new ManualResetEventSlim(false);
private T _value = default;
public EventHandler<T> ContinueUsingValue;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed since this is unused. Build failed with the following (no idea why it started now):

src\util\BlockingCell.cs(60,32): error CS0649: Field 'BlockingCell<T>.ContinueUsingValue' is never assigned to, and will always have its default value null [C:\Users\lbakken\development\rabbitmq\rabbitmq-dotnet-client\projects\client\RabbitMQ.Client\Ra
bbitMQ.Client.csproj]

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not seeing a failure related to this, but if it's not being used, no harm in removing it.

@lukebakken lukebakken force-pushed the rabbitmq-dotnet-client-768 branch 2 times, most recently from 461dea1 to 03c4627 Compare March 26, 2020 14:56
@lukebakken lukebakken force-pushed the rabbitmq-dotnet-client-768 branch from 03c4627 to 735b010 Compare March 26, 2020 15:51
@bording
Copy link
Collaborator

bording commented Mar 26, 2020

@lukebakken Let me know if/when you'd like a review of this.

Alternatively, I have a branch ready to go with MinVer added if you'd like me to push that up.

@lukebakken
Copy link
Collaborator Author

lukebakken commented Mar 26, 2020

@bording this PR appears to be working fine, but I need to edit all the internal CI stuff to work with it now and re-think how the myget / nuget packages are built (auto vs manual)

@bording
Copy link
Collaborator

bording commented Mar 26, 2020

@bording this PR appears to be working fine, but I need to edit all the internal CI stuff to work with it now and re-think how the myget / nuget packages are built (auto vs manual)

Ok, then I'll do a review pass on it if you don't mind, because there are some things I think need to be tweaked.

@lukebakken lukebakken marked this pull request as ready for review March 26, 2020 16:50
@lukebakken
Copy link
Collaborator Author

Sure, go right ahead. I just invited you as a collaborator, so feel free to push right to this branch.

Copy link
Collaborator

@bording bording left a comment

Choose a reason for hiding this comment

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

Also, it's a nitpick, but you removed all the blank lines I just intentionally added in my most recent PR. Having that spacing really improves the readability!

@@ -1,43 +1,49 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<VersionPrefix>6.0.0</VersionPrefix>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be removed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, we're using this as part of our CI scripts but I think that's going to change quite a bit. I'll remove it.

<Copyright>Copyright © 2007-2020 VMware, Inc. or its affiliates.</Copyright>
<Description>The RabbitMQ .NET client is the official client library for C# (and, implicitly, other .NET languages)</Description>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be removed.

<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<RepositoryUrl>https://github.com/rabbitmq/rabbitmq-dotnet-client</RepositoryUrl>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be removed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was added by Visual Studio when I filled-out the project properties via the built-in properties editor. I'm assuming there's no harm in having it there.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's being filled in already by Source Link, so you don't want to have it in the project file.

<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<RepositoryUrl>https://github.com/rabbitmq/rabbitmq-dotnet-client</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be removed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was added by Visual Studio when I filled-out the project properties via the built-in properties editor. I'm assuming there's no harm in having it there.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Same reply.

<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<AssemblyOriginatorKeyFile>../rabbit.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<MinVerTagPrefix>v</MinVerTagPrefix>
<MinVerVerbosity>detailed</MinVerVerbosity>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I actually think it's a good idea to generate a package all the time, so I'd set this to true. It also makes sense to set PackageOutputPath to move the location of where they get created.

Something like <PackageOutputPath>..\..\..\packages</PackageOutputPath> for example.

</ItemGroup>

<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is how you have to do this now, but there is better syntax coming for this soon! I think it might arrive in the 3.1.200 SDK

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep I tried the new syntax which of course failed on 2.1 builds

<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="MinVer" Version="2.2.0">
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can be simplified to

<PackageReference Include="MinVer" Version="2.2.0" PrivateAssets="All" />

<AssemblyTitle>RabbitMQ Client Library for .NET</AssemblyTitle>
<Description>The RabbitMQ .NET client is the official client library for C# (and, implicitly, other .NET languages)</Description>
<Company>VMware, Inc. or its affiliates.</Company>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
Copy link
Collaborator

@bording bording Mar 26, 2020

Choose a reason for hiding this comment

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

Moving to embedding the license file is good, but this is incomplete. The PackageLicense line above should be removed, and you need to actually include the file in the package.

<ItemGroup>
<Compile Include="..\..\..\gensrc\autogenerated-api-0-9-1.cs" />
</ItemGroup>

<ItemGroup>
<None Remove="icon.png" />
<Content Include="icon.png" PackagePath="" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

Right around here is where you need

<None Include="..\..\..\LICENSE" Pack="true" PackagePath="" />

@@ -57,7 +57,6 @@ class BlockingCell<T>
{
private readonly ManualResetEventSlim _manualResetEventSlim = new ManualResetEventSlim(false);
private T _value = default;
public EventHandler<T> ContinueUsingValue;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not seeing a failure related to this, but if it's not being used, no harm in removing it.

@bording
Copy link
Collaborator

bording commented Mar 26, 2020

Sure, go right ahead. I just invited you as a collaborator, so feel free to push right to this branch.

Just saw this after I submitted my review.

This error showed up in the internal CI when packing the PR build:

```
/usr/share/dotnet/sdk/3.1.102/Sdks/NuGet.Build.Tasks.Pack/buildCrossTargeting/NuGet.Build.Tasks.Pack.targets(198,5): error NU5030: The license file 'LICENSE' does not exist in the package. [/tmp/build/db7f1294/rabbitmq_dotnet_client/projects/client/RabbitMQ.Client/RabbitMQ.Client.csproj]
```
@lukebakken lukebakken requested a review from bording March 26, 2020 17:27
@lukebakken
Copy link
Collaborator Author

lukebakken commented Mar 26, 2020

Thanks @bording

I'm just now addressing this issue - telia-oss/github-pr-resource#136

We use that Concourse resource and it doesn't fetch tags by default 🤦‍♂

...but I think this PR is looking alright, lmk.

<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Unit, PublicKey=00240000048000009400000006020000002400005253413100040000010001008d20ec856aeeb8c3153a77faa2d80e6e43b5db93224a20cc7ae384f65f142e89730e2ff0fcc5d578bbe96fa98a7196c77329efdee4579b3814c0789e5a39b51df6edd75b602a33ceabdfcf19a3feb832f31d8254168cd7ba5700dfbca301fbf8db614ba41ba18474de0a5f4c2d51c995bc3636c641c8cbe76f45717bfcb943b5</_Parameter1>
</AssemblyAttribute>
<None Include="..\..\..\LICENSE">
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can be simplified to

<None Include="..\..\..\LICENSE" Pack="true" PackagePath="" />

I'd also move it up above the AssemblyAttribute entry.

<None Remove="icon.png" />
<Content Include="icon.png" PackagePath="" />
</ItemGroup>

<ItemGroup>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I personally like seeing the package references group separately into their own ItemGroup instead of all being in one, but that's more style / readability than a technical reason.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Feel free to re-org however you'd like! I'll refrain from smashing things all together going forward 😄

Copy link
Collaborator

Choose a reason for hiding this comment

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

Feel free to re-org however you'd like! I'll refrain from smashing things all together going forward 😄

Just wanted to make sure I was pointing out style / preference things as such, and not trying to dictate how to do things!

@bording
Copy link
Collaborator

bording commented Mar 26, 2020

We use that Concourse resource and it doesn't fetch tags by default 🤦‍♂

Ah, yeah you're going to need the tags!

@lukebakken lukebakken merged commit ca93809 into master Mar 26, 2020
@lukebakken lukebakken deleted the rabbitmq-dotnet-client-768 branch March 26, 2020 18:15
@lukebakken
Copy link
Collaborator Author

As always thank you @bording

lukebakken added a commit that referenced this pull request Mar 27, 2020
Generate assembly attributes using MinVer and csproj

(cherry picked from commit ca93809)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AssemblyVersion isn't being updated correctly
2 participants