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

Enable SourceLink #1435

Merged
merged 1 commit into from
Dec 14, 2018
Merged

Enable SourceLink #1435

merged 1 commit into from
Dec 14, 2018

Conversation

ob-stripe
Copy link
Contributor

r? @remi-stripe
cc @stripe/api-libraries

SourceLink is a cool new feature that provides developers with seamless access to sources of the libraries they're using.

It's still technically in beta, but it was enabled in the latest version of Json.Net. This PR is based on the one for Json.Net (JamesNK/Newtonsoft.Json#1746), as well as this blog post: http://blog.ctaggart.com/2018/06/newtonsoftjson-enabling-source-link.html.

I installed the sourcelink tool locally and checked that things work (I had to disable the net45 target to test the .nupkg build since it's not available on macOS):

❯ dotnet build -c Release src/Stripe.net /p:TargetFramework=netstandard1.2
...
Build succeeded.

❯ ~/.dotnet/tools/sourcelink test src/Stripe.net/bin/Release/netstandard1.2/Stripe.net.pdb
sourcelink test passed: src/Stripe.net/bin/Release/netstandard1.2/Stripe.net.pdb

❯ ~/.dotnet/tools/sourcelink print-json src/Stripe.net/bin/Release/netstandard1.2/Stripe.net.pdb
{"documents":{"/Users/ob/workspace/dotnet/stripe-dotnet/*":"https://raw.githubusercontent.com/stripe/stripe-dotnet/5ea88a73bfa2ddf0527f84bc8785dbebbd4f00ef/*"}}

❯ ~/.dotnet/tools/sourcelink print-urls src/Stripe.net/bin/Release/netstandard1.2/Stripe.net.pdb
14a26cd990d39597d80a4f4d326f4a39e81895dd sha1 csharp /Users/ob/workspace/dotnet/stripe-dotnet/src/Stripe.net/Constants/AccountType.cs
https://raw.githubusercontent.com/stripe/stripe-dotnet/5ea88a73bfa2ddf0527f84bc8785dbebbd4f00ef/src/Stripe.net/Constants/AccountType.cs
...
9a62488763be5efdd8b1efb3a55f723cb858ba1b sha1 csharp /Users/ob/workspace/dotnet/stripe-dotnet/src/Stripe.net/Services/Issuing/Transactions/TransactionUpdateOptions.cs
https://raw.githubusercontent.com/stripe/stripe-dotnet/5ea88a73bfa2ddf0527f84bc8785dbebbd4f00ef/src/Stripe.net/Services/Issuing/Transactions/TransactionUpdateOptions.cs
36ff84774aa05fee5ee89563390f7f18b80df39c sha1 csharp /var/folders/fr/1d9bfhg17x58gdqyvg_ymcm40000gn/T/.NETStandard,Version=v1.2.AssemblyAttributes.cs
embedded

❯ dotnet build -c Release src/Stripe.net /p:TargetFramework=netstandard2.0
...
Build succeeded.

❯ ~/.dotnet/tools/sourcelink test src/Stripe.net/bin/Release/netstandard2.0/Stripe.net.pdb
sourcelink test passed: src/Stripe.net/bin/Release/netstandard2.0/Stripe.net.pdb

❯ ~/.dotnet/tools/sourcelink print-json src/Stripe.net/bin/Release/netstandard2.0/Stripe.net.pdb
{"documents":{"/Users/ob/workspace/dotnet/stripe-dotnet/*":"https://raw.githubusercontent.com/stripe/stripe-dotnet/5ea88a73bfa2ddf0527f84bc8785dbebbd4f00ef/*"}}

❯ ~/.dotnet/tools/sourcelink print-urls src/Stripe.net/bin/Release/netstandard2.0/Stripe.net.pdb
14a26cd990d39597d80a4f4d326f4a39e81895dd sha1 csharp /Users/ob/workspace/dotnet/stripe-dotnet/src/Stripe.net/Constants/AccountType.cs
https://raw.githubusercontent.com/stripe/stripe-dotnet/5ea88a73bfa2ddf0527f84bc8785dbebbd4f00ef/src/Stripe.net/Constants/AccountType.cs
...
9a62488763be5efdd8b1efb3a55f723cb858ba1b sha1 csharp /Users/ob/workspace/dotnet/stripe-dotnet/src/Stripe.net/Services/Issuing/Transactions/TransactionUpdateOptions.cs
https://raw.githubusercontent.com/stripe/stripe-dotnet/5ea88a73bfa2ddf0527f84bc8785dbebbd4f00ef/src/Stripe.net/Services/Issuing/Transactions/TransactionUpdateOptions.cs
78caba916da115f043ae57a8e2c14315a6a56ea2 sha1 csharp /var/folders/fr/1d9bfhg17x58gdqyvg_ymcm40000gn/T/.NETStandard,Version=v2.0.AssemblyAttributes.cs
embedded

❯ dotnet pack -c Release src/Stripe.net
...
  Successfully created package '/Users/ob/workspace/dotnet/stripe-dotnet/src/Stripe.net/bin/Release/Stripe.net.21.7.0.nupkg'.

❯ ~/.dotnet/tools/sourcelink test src/Stripe.net/bin/Release/Stripe.net.21.7.0.nupkg
sourcelink test passed: lib/netstandard1.2/Stripe.net.pdb
sourcelink test passed: lib/netstandard2.0/Stripe.net.pdb

@ob-stripe ob-stripe mentioned this pull request Dec 14, 2018
29 tasks
Copy link
Contributor

@remi-stripe remi-stripe left a comment

Choose a reason for hiding this comment

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

Sounds useful. Have you made sure we have not increased the size of the library because of this?

@ob-stripe
Copy link
Contributor Author

The package is a little larger because the .PDB symbol files are now embedded in the package. On my local machine (without net45) I get 476K with SourceLink and 362K without. I don't think that's significant enough to not pull this in though.

@ob-stripe ob-stripe merged commit 99a38e3 into integration-v23 Dec 14, 2018
@ob-stripe ob-stripe deleted the ob-enable-sourcelink branch December 14, 2018 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants