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 in source-build #76685

Merged
merged 4 commits into from
Oct 7, 2022

Conversation

NikolaMilosavljevic
Copy link
Member

Fixes: dotnet/source-build#2883

This is one part of the fix, the other parts are in Arcade and Installer repo. Runtime change is independent and should be merged before the Installer change.

@ghost
Copy link

ghost commented Oct 5, 2022

Tagging subscribers to this area: @hoyosjs
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes: dotnet/source-build#2883

This is one part of the fix, the other parts are in Arcade and Installer repo. Runtime change is independent and should be merged before the Installer change.

Author: NikolaMilosavljevic
Assignees: -
Labels:

area-Infrastructure-coreclr

Milestone: -

@carlossanlop
Copy link
Member

Infra change only, so this is tell mode. @crummel @MichaelSimons @lbussell can you please provide a code review sign-off?

@@ -247,6 +247,7 @@
<!-- Disable source link when building locally. -->
<DisableSourceLink Condition="'$(DisableSourceLink)' == '' and
'$(ContinuousIntegrationBuild)' != 'true' and
'$(DotNetBuildFromSource)' != 'true' and
Copy link
Member

Choose a reason for hiding this comment

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

Would it be better to explicitly specify this property in the source-build configuration vs a sourcebuild condition here?

Copy link
Member

Choose a reason for hiding this comment

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

The benefit is it utilizes the existing mechanism for source-build and reduces the source-build specific checks throughout the code.

Copy link
Member Author

Choose a reason for hiding this comment

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

Would it be better to explicitly specify this property in the source-build configuration vs a sourcebuild condition here?

Makes sense - moving it there.

@@ -6,7 +6,7 @@
<RuntimeVersionFile>$(ArtifactsObjDir)runtime_version.h</RuntimeVersionFile>
<NativeSourceLinkFile>$(ArtifactsObjDir)native.sourcelink.json</NativeSourceLinkFile>
<VerifySourceLinkFileExists>false</VerifySourceLinkFileExists>
<VerifySourceLinkFileExists Condition="'$(ContinuousIntegrationBuild)' == 'true' and '$(DotNetBuildFromSource)' != 'true'">true</VerifySourceLinkFileExists>
<VerifySourceLinkFileExists Condition="'$(ContinuousIntegrationBuild)' == 'true'">true</VerifySourceLinkFileExists>
Copy link
Member

Choose a reason for hiding this comment

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

Just for mitigating risk, I'd remove changes here. It only applies to windows (native sourcelink).

Copy link
Member Author

Choose a reason for hiding this comment

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

This is applicable to Linux as well - NativeSourceLinkFile points to a file that exists in Linux build, so we should check for file existence.

Copy link
Member

Choose a reason for hiding this comment

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

It will never use it though. It's only passed to MSVC here

if(EXISTS ${CLR_SOURCELINK_FILE_PATH})

Copy link
Member Author

Choose a reason for hiding this comment

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

It will never use it though. It's only passed to MSVC here

if(EXISTS ${CLR_SOURCELINK_FILE_PATH})

Interesting. I might be missing when the file gets generated, but it did get created on Linux and had the following content. Should the file even be created on Linux?

{"documents":{"/src/source.online/src/runtime/artifacts/source-build/self/src/*":"https://raw.githubusercontent.com/nikolamilosavljevic/runtime/056cf9bd4c52f7bb8fff74bc47d9c6d2562c3e9c/*"}}

Copy link
Member

Choose a reason for hiding this comment

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

yeah, the file gets created always. It's used by native only on Windows. It gets used for managed projects mostly.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! Since this is useful for Windows only, it makes sense to remove it on source-build and revert the change I proposed.

Copy link
Member

Choose a reason for hiding this comment

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

Based on this discussion wouldn't it be better to change this to be a windows specific check? e.g. only enabled for windows CI? The point is this really shouldn't be a source-build specific check. I understand however if the desire is to limit changes this late in the release cycle.

@hoyosjs
Copy link
Member

hoyosjs commented Oct 5, 2022

This change also has an implication: sourcelink will work as long as there is no patch applied to cs files. Otherwise, those files wll be seen as non-matching and won't get loaded. Not a huge thing, but mostly an FYI that I expect to be a rare narrow scenario.

@MichaelSimons
Copy link
Member

This change also has an implication: sourcelink will work as long as there is no patch applied to cs files. Otherwise, those files wll be seen as non-matching and won't get loaded. Not a huge thing, but mostly an FYI that I expect to be a rare narrow scenario.

Yep we are aware of that. We are pushing to eliminate all patches for the 7.0 release.

@NikolaMilosavljevic NikolaMilosavljevic merged commit c6473a4 into dotnet:release/7.0 Oct 7, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Nov 6, 2022
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