Skip to content
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

Move Grpc.Core.Api nuget from grpc/grpc #1651

Merged
merged 31 commits into from
Apr 28, 2022

Conversation

jtattermusch
Copy link
Contributor

@jtattermusch jtattermusch commented Mar 29, 2022

Add Grpc.Core.Api and relevant tests from grpc/grpc to grpc-dotnet.

  • copy the src/csharp/Grpc.Core.Api subtree from grpc/grpc
  • add the tests relevant to Grpc.Core.Api from src/csharp/Grpc.Core.Tests as Grpc.Core.Api.Tests
  • make necessary adjustments to fit the csproj layout in grpc-dotnet repo
  • fix analyzer warnings.
  • makes Grpc.Core.Api target net462 instead of net45 (net45 is past end of life). Based on my experiments, this still allows to reference newer Grpc.Core.Api versions from projects that use older versions of Grpc.Core (for which there will likely be no more major version releases). (the net462 version of Grpc.core.Api.dll assembly can still be used by an older Grpc.Core.dll assembly that targets net45 - as long as the project including both Grpc.Core.Api and Grpc.Core uses net462+, which is a fair limitation, since net45 is past end of support so there in practice there should really be no systems that don't support at least .NET Framework 4.6.2)
  • best reviewed commit-by-commit

/// </summary>
public static class VersionInfo
{
// TODO(jtattermusch): how to propagate versions from https://github.com/grpc/grpc-dotnet/blob/f238855fcb77cec01e87eb9cc08680c3420c132f/Directory.Build.props#L8-L10version into
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Still need to figure out how to turn .csproj properties into string constants.
(in grpc/grpc we simply used codegen to generate contents of VersionInfo.cs)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JamesNK any ideas how to do this?

Copy link
Member

Choose a reason for hiding this comment

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

No. I know how to easily embed properties as assembly attributes, which can then be fetched at runtime. But these are const values so that won't work.

Copy link
Member

Choose a reason for hiding this comment

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

src/Grpc.Core.Api/.gitignore Outdated Show resolved Hide resolved
/// </summary>
public class AuthInterceptorContext
{
readonly string serviceUrl;
Copy link
Member

@JamesNK JamesNK Mar 30, 2022

Choose a reason for hiding this comment

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

What do you think of eventually following grpc-dotnet standards? e.g. underscore on private variables, no this, var, etc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is something we can consider, but I think it's low priority. I understand that we'd want all the code to follow the same code-style, but I'd like us to refrain from making unnecessary changes / refactorings until the point when things settle down a bit (e.g. once we've done one or two successful releases of the new location and we have some verification that there aren't any unexpected problems).

src/Grpc.Core.Api/ContextPropagationToken.cs Show resolved Hide resolved
Comment on lines +22 to +46
[assembly: InternalsVisibleTo("Grpc.Core,PublicKey=" +
"00240000048000009400000006020000002400005253413100040000010001002f5797a92c6fcde81bd4098f43" +
"0442bb8e12768722de0b0cb1b15e955b32a11352740ee59f2c94c48edc8e177d1052536b8ac651bce11ce5da3a" +
"27fc95aff3dc604a6971417453f9483c7b5e836756d5b271bf8f2403fe186e31956148c03d804487cf642f8cc0" +
"71394ee9672dfe5b55ea0f95dfd5a7f77d22c962ccf51320d3")]
[assembly: InternalsVisibleTo("Grpc.Core.Tests,PublicKey=" +
"00240000048000009400000006020000002400005253413100040000010001002f5797a92c6fcde81bd4098f43" +
"0442bb8e12768722de0b0cb1b15e955b32a11352740ee59f2c94c48edc8e177d1052536b8ac651bce11ce5da3a" +
"27fc95aff3dc604a6971417453f9483c7b5e836756d5b271bf8f2403fe186e31956148c03d804487cf642f8cc0" +
"71394ee9672dfe5b55ea0f95dfd5a7f77d22c962ccf51320d3")]
[assembly: InternalsVisibleTo("Grpc.Core.Testing,PublicKey=" +
"00240000048000009400000006020000002400005253413100040000010001002f5797a92c6fcde81bd4098f43" +
"0442bb8e12768722de0b0cb1b15e955b32a11352740ee59f2c94c48edc8e177d1052536b8ac651bce11ce5da3a" +
"27fc95aff3dc604a6971417453f9483c7b5e836756d5b271bf8f2403fe186e31956148c03d804487cf642f8cc0" +
"71394ee9672dfe5b55ea0f95dfd5a7f77d22c962ccf51320d3")]
[assembly: InternalsVisibleTo("Grpc.IntegrationTesting,PublicKey=" +
"00240000048000009400000006020000002400005253413100040000010001002f5797a92c6fcde81bd4098f43" +
"0442bb8e12768722de0b0cb1b15e955b32a11352740ee59f2c94c48edc8e177d1052536b8ac651bce11ce5da3a" +
"27fc95aff3dc604a6971417453f9483c7b5e836756d5b271bf8f2403fe186e31956148c03d804487cf642f8cc0" +
"71394ee9672dfe5b55ea0f95dfd5a7f77d22c962ccf51320d3")]
[assembly: InternalsVisibleTo("Grpc.Microbenchmarks,PublicKey=" +
"00240000048000009400000006020000002400005253413100040000010001002f5797a92c6fcde81bd4098f43" +
"0442bb8e12768722de0b0cb1b15e955b32a11352740ee59f2c94c48edc8e177d1052536b8ac651bce11ce5da3a" +
"27fc95aff3dc604a6971417453f9483c7b5e836756d5b271bf8f2403fe186e31956148c03d804487cf642f8cc0" +
"71394ee9672dfe5b55ea0f95dfd5a7f77d22c962ccf51320d3")]
Copy link
Member

Choose a reason for hiding this comment

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

Can be removed/replaced

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can only remove once we verify that Grpc.Core.Api assembly built using the grpc-dotnet repo still works with the tests from the grpc/grpc (since those tests aren't going to be deleted, we still need to be able to run them, even though they'd live on a "frozen" branch.)

src/Grpc.Core.Api/README.md Show resolved Hide resolved
src/Grpc.Core.Api/Status.cs Show resolved Hide resolved
src/Grpc.Core.Api/Utils/EncodingExtensions.cs Show resolved Hide resolved
@JamesNK
Copy link
Member

JamesNK commented Mar 30, 2022

There are tests in Grpc.Core.Tests that relate to Grpc.Core.Api functionality. They should be extracted to a new test project.

@jtattermusch
Copy link
Contributor Author

There are tests in Grpc.Core.Tests that relate to Grpc.Core.Api functionality. They should be extracted to a new test project.

Added Grpc.Core.Api.Tests with the tests from Grpc.Core.Tests that seemed relevant.

public class VersionInfoTest
{
[Test]
public void VersionInfoMatchesAssemblyProperties()
Copy link
Contributor Author

@jtattermusch jtattermusch Mar 31, 2022

Choose a reason for hiding this comment

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

FYI I added this test to make sure that VersionInfo.cs' constants alway stay in sync with the .csproj settings regardless of what approach we choose for keeping the VersionInfo up to date.

@jtattermusch
Copy link
Contributor Author

One more question: It seems feasible to add the original src/csharp/Grpc.Core.Api git subtree along with filtered commit history by using the git subtree split command. Do you think it would be worthwhile to import the code along with change history (the commit messages would have a --annotate prefix that would make it clear the the history is from a different repo) or is simply pointing to the original codebase somewhere in a readme good enough?

@jtattermusch
Copy link
Contributor Author

One more question: It seems feasible to add the original src/csharp/Grpc.Core.Api git subtree along with filtered commit history by using the git subtree split command. Do you think it would be worthwhile to import the code along with change history (the commit messages would have a --annotate prefix that would make it clear the the history is from a different repo) or is simply pointing to the original codebase somewhere in a readme good enough?

Discussed and we decided to simply do a codedump and link to the original codebase (at a clearly documented revision) for simplicity.

@jtattermusch
Copy link
Contributor Author

@JamesNK can you please do another pass and let me know if there's any other major concerns (besides the question of regenerating the constants in VersionInfo.cs) that would prevent this PR from accepting?
We still won't merge this, but I'd like to make sure that with some clean up this will be mergeable once we need it to.

@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net45;netcoreapp3.1</TargetFrameworks>
Copy link
Member

Choose a reason for hiding this comment

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

net45 -> net462

I think eventually these new projects should test with the same frameworks as existing test projects (e.g. + net5.0 and net6.0) but can leave it unchanged for now.


<IsGrpcPublishedPackage>true</IsGrpcPublishedPackage>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TargetFrameworks>net45;netstandard1.5;netstandard2.0;netstandard2.1</TargetFrameworks>
Copy link
Member

Choose a reason for hiding this comment

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

net45 isn't supported anymore. See https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-framework

Should change net45 to net462 for various Grpc.Core projects.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, that seems doable. But there should also be a some follow-up cleanup after switching to net462 (#if defs and also there is some compatibility code that is no longer needed on net462)

@jtattermusch jtattermusch marked this pull request as ready for review April 26, 2022 07:55
@jtattermusch
Copy link
Contributor Author

@JamesNK this is ready for final pass of review (even when approved, I still won't merge just yet, I'd like to synchronize removing stuff from grpc/grpc with adding the corresponding stuff to grpc-dotnet).

@jtattermusch
Copy link
Contributor Author

I'm going to merge this to allow for easier review of #1652 and #1708.

  • the 2.47.x branch has already been cut on master, and the version 2.47 and above of Grpc.Core.Api will be released as part of the grpc-dotnet release. v2.46.x will be the last version that's going to be released from the grpc/grpc repository.

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.

2 participants