Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jun 9, 2025

Implements Source Link support to enable debugging into the library source code from NuGet packages.

Changes Made

  1. Added Microsoft.SourceLink.GitHub package reference (v8.0.0) to the main library project with PrivateAssets="All" to avoid exposing it as a dependency

  2. Configured Source Link MSBuild properties in Directory.Build.props:

    • PublishRepositoryUrl=true - Enables repository URL publishing in packages
    • EmbedUntrackedSources=true - Embeds source files not tracked by source control
    • Deterministic=true - Enables deterministic builds for reproducibility
    • ContinuousIntegrationBuild=true - Enabled when running in GitHub Actions
  3. Removed duplicate PublishRepositoryUrl property from the project file since it's now defined globally

Benefits

  • Developers can now step through the actual source code when debugging applications that reference this NuGet package
  • Improved debugging experience for consumers of the library
  • Follows Microsoft's recommended practices for .NET library packages

Verification

  • All existing tests continue to pass ✅
  • Package generation works correctly ✅
  • Source Link validation passes using sourcelink test
  • Repository URL mapping verified: /_/*https://raw.githubusercontent.com/SIkebe/ShukujitsuSharp/{commit}/*

This implementation follows the Microsoft Source Link documentation and enables a better debugging experience for library consumers.

Fixes #9.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Source Link Add Source Link support for GitHub repository Jun 9, 2025
Copilot AI requested a review from SIkebe June 9, 2025 17:00
Copilot finished work on behalf of SIkebe June 9, 2025 17:01
@SIkebe SIkebe requested a review from Copilot June 9, 2025 23:53

This comment was marked as outdated.

Comment on lines 10 to 17

<!-- Source Link Configuration -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>

<!-- Deterministic builds help ensure reproducible builds -->
<Deterministic>true</Deterministic>
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
Copy link
Owner

Choose a reason for hiding this comment

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

@copilot src/ShukujitsuSharp/ShukujitsuSharp.csproj ではなく Directory.Build.props に追加した理由は?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right to question this. I've moved the Source Link properties from Directory.Build.props to the specific ShukujitsuSharp.csproj project file where they're actually needed. Source Link is only relevant for NuGet packages that get published, and only the main library project has IsPackable=true. The test project and generator don't need these properties. This makes the configuration more targeted and precise. Commit: 5a0ef13

@SIkebe SIkebe requested a review from Copilot June 10, 2025 00:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds Source Link support to the GitHub repository, enabling developers to step into the library source code during debugging sessions.

  • Added the Microsoft.SourceLink.GitHub package reference to the main project.
  • Configured Source Link properties (PublishRepositoryUrl, EmbedUntrackedSources, Deterministic, ContinuousIntegrationBuild) globally in Directory.Build.props.
  • Removed the duplicate PublishRepositoryUrl property from the project file.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/ShukujitsuSharp/ShukujitsuSharp.csproj Removed duplicate PublishRepositoryUrl and added Microsoft.SourceLink.GitHub package.
Directory.Build.props Added Source Link configuration properties for reproducible builds and CI integration.

@SIkebe
Copy link
Owner

SIkebe commented Jun 10, 2025

Configured Source Link properties (PublishRepositoryUrl, EmbedUntrackedSources, Deterministic, ContinuousIntegrationBuild) globally in Directory.Build.props.

Why globally?

Copy link
Contributor Author

Copilot AI commented Jun 10, 2025

Configured Source Link properties (PublishRepositoryUrl, EmbedUntrackedSources, Deterministic, ContinuousIntegrationBuild) globally in Directory.Build.props.

Why globally?

Good point. I initially configured them globally but realized that Source Link properties are only meaningful for projects that get published as NuGet packages. I've moved them to the specific ShukujitsuSharp.csproj file since only that project has IsPackable=true - the test project and generator don't need Source Link. This is more precise and follows the principle of configuring features only where they're needed. Commit: 5a0ef13

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.

Source Link

2 participants