Skip to content

use SourceLink.Create.CommandLine instead of Embed#14231

Merged
jtattermusch merged 1 commit intogrpc:v1.9.xfrom
ctaggart:sourcelink-create
Feb 2, 2018
Merged

use SourceLink.Create.CommandLine instead of Embed#14231
jtattermusch merged 1 commit intogrpc:v1.9.xfrom
ctaggart:sourcelink-create

Conversation

@ctaggart
Copy link
Copy Markdown
Contributor

You should use source linking instead of embedding the source files. This saves 275 KB for the nupkg. It goes from 12317 KB to 12042 KB.

@thelinuxfoundation
Copy link
Copy Markdown

Thank you for your pull request. Before we can look at your contribution, we need to ensure all contributors are covered by a Contributor License Agreement.

After the following items are addressed, please respond with a new comment here, and the automated system will re-verify.

Regards,
CLA GitHub bot

@ctaggart
Copy link
Copy Markdown
Contributor Author

Signed the form.

@ctaggart
Copy link
Copy Markdown
Contributor Author

Why aren't the internal CIs running? I'll try reopening this to see if that helps.

@jtattermusch
Copy link
Copy Markdown
Contributor

@ctaggart the CI only runs automatically if you're a member of grpc org (we can't just run external code without first taking a look).

@jtattermusch
Copy link
Copy Markdown
Contributor

I'm not sure if source linking is better for us

  • embedding the sources seems more selfcontained
  • the 2% increase in size doesn't really seem to be that compelling reason

I initially added source embedding, because with sourcelink one needs to be sure to make the git line ending setting right (CF LF vs LF), otherwise the checksum of the source files might not match with git and they would be broken.
Changing the git attributes in our setup that builds the C# nugets might be nontrivial, which is also one of the reasons why I decided to use the embedded sources instead.

@jtattermusch jtattermusch self-assigned this Jan 31, 2018
@jtattermusch jtattermusch self-requested a review January 31, 2018 18:36
@ctaggart
Copy link
Copy Markdown
Contributor Author

@jtattermusch
Copy link
Copy Markdown
Contributor

@ctaggart, ok, thanks for the update, that's good news. I still need to do some manual testing that the newly created package works well when debugging in Visual Studio.
I'd still be interested what are the advantages of sourceLink over embedding the sources (I think the nuget size impact is negligible)? - Pragmatically, changes are always risky so I want to make sure we'll gain something my making this change.

@ctaggart
Copy link
Copy Markdown
Contributor Author

ctaggart commented Feb 1, 2018

I think some end users, Microsoft, and NuGet.org would prefer the smaller size. Another advantages is traceability to the source code repository. It would be nice to be consistent with what everyone else is doing including protocolbuffers/protobuf#4179.

@jtattermusch
Copy link
Copy Markdown
Contributor

Sounds fair, thanks for the explanation. I'll do the manual testing and once that's done I'll approve.

@jtattermusch
Copy link
Copy Markdown
Contributor

@ctaggart
Copy link
Copy Markdown
Contributor Author

ctaggart commented Feb 1, 2018

They look good. The error about 5 files did not pass may be ignored. The tool does not work with the native dll's in the nupkg. Extracting and testing the portable pdb files works just fine.

C:\Users\camer\cs\SourceLink\build [master ≡]> dotnet sourcelink test C:\Users\camer\Downloads\Grpc.Core.1.9.0-pre3.nupkg
sourcelink test passed: lib/net45/Grpc.Core.pdb
sourcelink test passed: lib/netstandard1.5/Grpc.Core.pdb
unable to read debug info: C:\Users\camer\Downloads\Grpc.Core.1.9.0-pre3.nupkg
5 files did not pass in C:\Users\camer\Downloads\Grpc.Core.1.9.0-pre3.nupkg
C:\Users\camer\cs\SourceLink\build [master ≡]> dotnet sourcelink test "C:\Users\camer\Downloads\Grpc.Core.1.9.0-pre3\lib\netstandard1.5\Grpc.Core.pdb"
sourcelink test passed: C:\Users\camer\Downloads\Grpc.Core.1.9.0-pre3\lib\netstandard1.5\Grpc.Core.pdb
C:\Users\camer\cs\SourceLink\build [master ≡]> dotnet sourcelink print-json "C:\Users\camer\Downloads\Grpc.Core.1.9.0-pre3\lib\netstandard1.5\Grpc.Core.pdb"
{"documents":{"c:\\jenkins\\workspace\\gRPC_build_packages\\platform\\windows\\*":"https://raw.githubusercontent.com/ctaggart/grpc/b6f737ee7d9236511ed0f738fa7b6e7e2778b651/*"}}
C:\Users\camer\cs\SourceLink\build [master ≡]> dotnet sourcelink test "C:\Users\camer\Downloads\Grpc.Core.1.9.0-pre3\lib\net45\Grpc.Core.pdb"
sourcelink test passed: C:\Users\camer\Downloads\Grpc.Core.1.9.0-pre3\lib\net45\Grpc.Core.pdb
C:\Users\camer\cs\SourceLink\build [master ≡]> dotnet sourcelink print-json "C:\Users\camer\Downloads\Grpc.Core.1.9.0-pre3\lib\net45\Grpc.Core.pdb"
{"documents":{"c:\\jenkins\\workspace\\gRPC_build_packages\\platform\\windows\\*":"https://raw.githubusercontent.com/ctaggart/grpc/b6f737ee7d9236511ed0f738fa7b6e7e2778b651/*"}}

@jtattermusch
Copy link
Copy Markdown
Contributor

I've tested the packages manually and I was able to step into the code (after VS requested permission to download the sources from github) - so everything seems to work fine.

v1.9.0 was released yesterday, so we didn't make it in time, so the change will be in v1.9.1 later and will be upmerged to upstream/master.

Thanks for the contribution!

A question:
Is there a way in VS to show me the original file in browser on github while debugging ("Open this file on Github") - that would be very useful feature to have.

Copy link
Copy Markdown
Contributor

@jtattermusch jtattermusch left a comment

Choose a reason for hiding this comment

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

LGTM.

@jtattermusch jtattermusch merged commit 4c92ab2 into grpc:v1.9.x Feb 2, 2018
@ctaggart ctaggart deleted the sourcelink-create branch February 2, 2018 21:11
@lock lock bot locked as resolved and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants