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

Fixes for Linux release build #72658

Merged
merged 4 commits into from
Mar 26, 2024
Merged

Fixes for Linux release build #72658

merged 4 commits into from
Mar 26, 2024

Conversation

mmitche
Copy link
Member

@mmitche mmitche commented Mar 21, 2024

Linux release build currently fails due to a couple issues:

  • Path issues - The relative path metadata in the language server eventually makes it way into R2R tasks. The relative path has a backslash on Linux as currently written, so Path.Combine in the R2R tasks retains that backslash, and then we fail to create the subdir where the R2R output goes.
  • Hoist .vsextension exclusion to Imports.targets - These files end up in Content even when not using the VS SDK tooling, so exclude even when not using the VS SDK targets.
  • Exclude VS.ExternalApis.Roslyn.Package on Linux - It packs vs debugger files, which are not available.

Linux release build currently fails due to a couple issues:
- Path issues - The relative path metadata in the language server eventually makes it way into R2R tasks. The relative path has a backslash on Linux as currently written, so Path.Combine in the R2R tasks retains that backslash, and then we fail to create the subdir where the R2R output goes.
- Hoist .vsextension exclusion to Imports.targets - These files end up in Content even when not using the VS SDK tooling, so exclude even when not using the VS SDK targets.
- Exclude VS.ExternalApis.Roslyn.Package on Linux - It packs vs debugger files, which are not available.

Additional fixes
@mmitche mmitche requested review from a team as code owners March 21, 2024 23:36
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Infrastructure untriaged Issues and PRs which have not yet been triaged by a lead labels Mar 21, 2024
@dotnet-policy-service dotnet-policy-service bot added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Mar 21, 2024
@mmitche
Copy link
Member Author

mmitche commented Mar 21, 2024

@jaredpar No VMR specific changes here, but specific to the config/commands that the VMR build runs on Linux (roslyn in release w/ -pack)

<!--
Microsoft.VisualStudio.Extensibility.JsonGenerators.Sdk.props creates content items for all files in .vsextension dir.
NuGet includes content items in package, by default but these items should only be included in the VSIX.
-->
Copy link
Member

Choose a reason for hiding this comment

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

Why did we need to make this change for non-VS targets? My instinct would be that instead of this change we should be including VisualStudio.targets in more places.

@dibarbet

Copy link
Member Author

Choose a reason for hiding this comment

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

The .vsextension files end up in the pack content because of this package ref: https://github.com/dotnet/roslyn/blob/main/src/VisualStudio/CSharp/Impl/Microsoft.VisualStudio.LanguageServices.CSharp.csproj#L46

  <ItemGroup>
    <Reference Include="System.Design" />
    <Reference Include="System.Windows.Forms" />
    <PackageReference Include="Microsoft.VisualStudio.Extensibility" />
    <PackageReference Include="Microsoft.VisualStudio.Extensibility.JsonGenerators.Sdk" PrivateAssets="all" /> <-- THIS
  </ItemGroup>

That ends up importing a props file which creates the content items. I could make this conditional on vssdk usage, but it seems like a better approach to keep this here, and just not conditionalize the .vsextension Pack exclusion on IsUsingToolVsSdk, which was what was implicitly happening due to https://github.com/dotnet/roslyn/blob/main/eng/targets/Imports.targets#L4

  <Import Project="VisualStudio.targets" Condition="'$(UsingToolVSSDK)' == 'true'"/>

Copy link
Member

Choose a reason for hiding this comment

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

Feel like that should be importing the VisualStudio.targets file. @dibarbet will know better though.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not super familiar with this stuff here tbh - I'll delegate to @tmat who added the jsongenerators reference for gladstone.

Copy link
Member

Choose a reason for hiding this comment

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

I've been a bit out of the loop as well - why are we building VS layer projects on linux? Seems like the packages produced for Microsoft.VisualStudio.LanguageServices.CSharp.csproj and others wouldn't be useful without the vssdk?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we generally build everything and it seems to work fine. It's the packing that generally doesn't work, at least in release modes.

TargetPath="%(NetFrameworkBuildHostAssets.ContentFolderName)\%(NetFrameworkBuildHostAssets.TargetPath)"
PackagePath="contentFiles\any\any\%(NetFrameworkBuildHostAssets.ContentFolderName)\%(NetFrameworkBuildHostAssets.TargetPath)"
TargetPath="$([System.IO.Path]::Combine('%(NetFrameworkBuildHostAssets.ContentFolderName)', '%(NetFrameworkBuildHostAssets.TargetPath)'))"
PackagePath="$([System.IO.Path]::Combine('contentFiles', 'any', 'any', '%(NetFrameworkBuildHostAssets.ContentFolderName)', '%(NetFrameworkBuildHostAssets.TargetPath)'))"
Copy link
Member

Choose a reason for hiding this comment

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

@baronfel type of stuff an msbuild analyzer / warning would help with.

Copy link
Member Author

Choose a reason for hiding this comment

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

Seriously.

Copy link
Member

Choose a reason for hiding this comment

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

Interesting - I thought we were more or less slash agnostic in most of MSBuild. Unless you're wanting a stricter rule of 'no direct path creation allowed'?

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 isn't a globbing pattern, it's a relative path. It ends up as metadata and eventually fed into the R2R tasks, which path.combines it with another parameter. On Linux, at that point the task the Path.Combine sees the backslash and does what it should on Linux (not treat it as a directory separator char).

If it was a globbing pattern, then MSBuild would fix it up.

@mmitche
Copy link
Member Author

mmitche commented Mar 22, 2024

@jaredpar Overall the line between "using VS SDK" and not in this repo is pretty messy. It seems like some VS extensibility features are in use even if the VS SDK isn't available. That causes some messiness w.r.t. to building on Linux vs. Windows.

@jaredpar
Copy link
Member

Let's wait for @dibarbet sign off but I'm good when he signs off.

@ViktorHofer
Copy link
Member

ping @dibarbet

Copy link
Member

@dibarbet dibarbet left a comment

Choose a reason for hiding this comment

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

seems fine to me, but as I mentioned in a prior comment, not super familiar with the VSSDK targets.

@mmitche mmitche merged commit 6a21cd0 into dotnet:main Mar 26, 2024
30 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Mar 26, 2024
@dibarbet dibarbet modified the milestones: Next, 17.11 P1 Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Infrastructure Community The pull request was submitted by a contributor who is not a Microsoft employee. untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants