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

Add Features projects to SourceBuild #57277

Merged

Conversation

JoeRobich
Copy link
Member

Resolves #57270

@JoeRobich JoeRobich requested a review from a team as a code owner October 20, 2021 20:41
@JoeRobich JoeRobich changed the base branch from main to release/dev17.0 October 20, 2021 20:41
@davidwengier
Copy link
Contributor

davidwengier commented Oct 20, 2021

This would have made my last week easier 😛

EDIT: No it wouldn't, nevermind 😔

Compilers.sln Outdated Show resolved Hide resolved
Copy link
Contributor

@jmarolf jmarolf left a comment

Choose a reason for hiding this comment

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

General approach looks fine, but I agree that we want to change source build to build Roslyn.sln instead of Compilers.sln

@333fred 333fred added the Source-Build Tracking dotnet/source-build related tasks. label Oct 20, 2021
dagood and others added 4 commits October 20, 2021 15:31
Use Roslyn.sln, not Compilers.sln, to build more projects during
source-build. Update ExcludeFromSourceBuild properties to include more
projects and exclude a few projects that shouldn't be in source-build.

The newly included projects are used by downstream repos.
This makes source-build stop producing the Microsoft.CodeAnalysis.Collections package. Downstream repos (MSBuild) can't safely use a source-built version.
By default, the projects reference Microsoft.Build 16.5.0, which has netcoreapp2.1 and net472 support. The new 17.0.0-...
version built during source-build only has net6.0. This causes Microsoft.CodeAnalysis.Workspaces.MSBuild.csproj to fail.
Adding 16.5.0 to SBRP and dodging the override by renaming each package version property is the safe way to fix it.
@JoeRobich JoeRobich requested review from a team as code owners October 20, 2021 23:10
@JoeRobich
Copy link
Member Author

Updated with @dagood's change to build Roslyn.sln and to use RefOnly Microsoft.Build dependencies.

@jasonmalinowski @tmat @jmarolf This is ready for another review

@JoeRobich
Copy link
Member Author

@dagood How does this work, will these changes flowing into dev17.0-vs-deps be enough to satisfy source build requirements or will we need an additional insertion into the SDK?

@JoeRobich
Copy link
Member Author

Integration build failures are expected and should be resolved separately by #57281

Copy link
Contributor

@jmarolf jmarolf left a comment

Choose a reason for hiding this comment

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

:shipit:

@dagood
Copy link
Member

dagood commented Oct 21, 2021

How does this work, will these changes flowing into dev17.0-vs-deps be enough to satisfy source build requirements or will we need an additional insertion into the SDK?

I believe an SDK insertion would be needed to make the commit flow into this dependency:
https://github.com/dotnet/installer/blob/931367000f6efd1bc1650c4bcb5ab5dacbc51e10/eng/Version.Details.xml#L144-L148

However, source-build will work fine if we take this PR and include it as a patch file in the dotnet/installer release/6.0.1xx branch--no builds or dependency flow strictly required. So if the gates are very restrictive right now for rebuilds, this doesn't need to trigger one.

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

Thanks for getting to this so quick @JoeRobich!

Just one small suggestion for easier reading.

Comment on lines +30 to +32
<PackageReference Include="Microsoft.Build" Version="$(RefOnlyMicrosoftBuildVersion)" />
<PackageReference Include="Microsoft.Build.Framework" Version="$(RefOnlyMicrosoftBuildFrameworkVersion)" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(RefOnlyMicrosoftBuildTasksCoreVersion)" />
Copy link
Member

@sharwell sharwell Oct 21, 2021

Choose a reason for hiding this comment

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

❓ Should all uses of RefOnly*Version versions have the ExcludeAssets="Runtime" attribute?

Copy link
Member

Choose a reason for hiding this comment

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

We should update BuildBoss to require the attribute if a RefOnly package is used.

Copy link
Member

@dagood dagood Oct 21, 2021

Choose a reason for hiding this comment

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

Would ExcludeAssets="Runtime" cause the unit tests to fail in the Microsoft build? I assume the tests actually find and execute the MSBuild code when they run. (In source-build, unit tests don't build or run, so this isn't a concern there.) (But... it's very possible I don't understand the effect of ExcludeAssets="Runtime" here.)

The name of these properties is misleading in this context for someone working on the Microsoft build. Really, any name that indicates these versions are "pinned" would do fine, if this is a concern.

In non-unit-test projects, ExcludeAssets="Runtime" sounds like an interesting idea to me to exercise how ref-only they really are, in a Microsoft build.

@JoeRobich
Copy link
Member Author

@jasonmalinowski @tmat Any additional concerns before this is merged?

Copy link
Member

@jasonmalinowski jasonmalinowski 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 I'm admittedly not the expert here!

Comment on lines +65 to +69
SourceBuild will requires that all dependencies also be source buildable. We are referencing a
version of MSBuild that is not SourceBuild compatible, which makes our build incompatible. Since we only
use these dependencies as reference assemblies, we can opt them out of this behavior by having their
version variable be prefixed with `RefOnly`. This will allow us to reference these libraries and remain
Source Build compatible.
Copy link
Member

Choose a reason for hiding this comment

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

Is there a version of MSBuild we can be referencing that doesn't have this caveat?

Copy link
Member Author

Choose a reason for hiding this comment

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

@dagood is MSBuild 16.11 compatible?

Copy link
Member

Choose a reason for hiding this comment

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

I thought Davis did a good job of explaining the situation here: #57277 (comment). If you haven't read that, check it out.

If you name this property MicrosoftBuildVersion, when building for source-build that property will automatically get overriden to point to the currently built version of Microsoft.Build.nupkg that was being built during source-build. This means this property would point to version 17.0-previewXXX.

However, Roslyn's build doesn't succeed when trying to build against the current source-built MSBuild nuget packages (probably because your tasks projects are building for net472 and the source-build MSBuild packages didn't at the time - that was fixed yesterday dotnet/installer#12472).

Copy link
Member

@dagood dagood Oct 22, 2021

Choose a reason for hiding this comment

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

You'd have to use 17.0.0 (current latest that is being included in 6.0.100 SDK) and set up a eng/Version.Details.xml dependency and subscription on MSBuild to make sure it's always up to date. Any version other than the one being shipped in the SDK needs this kind of ref-only handling.

My understanding is that this dependency is most likely stuck on an old version because it needs to be compatible with old VS toolsets, anyway--so moving to a non-16.5.0 & non-17.0.0 version wouldn't work from an MSBuild perspective, let alone source-build's.

Copy link
Member Author

Choose a reason for hiding this comment

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

If MSBuild 16.11 is source build compatible, I will update our dependency and revert the 'RefOnly' changes in a follow up.

Copy link
Member

Choose a reason for hiding this comment

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

If MSBuild 16.11 is source build compatible

It's not, only an actively updated 17.0.0[-*] would be.

Copy link
Member

@dagood dagood Oct 22, 2021

Choose a reason for hiding this comment

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

Maybe "caveat" is just too strong. Ref-only usage is everywhere, and it would be nice for source-build to get rid of it and have current references everywhere, but we expect old-ref-usage to stay in a lot of places because of the requirements the Microsoft build needs to fulfill. (E.g. NuGet packages need to be usable by people who are using old framework versions; VS has some complex compat requirements with the toolset it ships with.)

To me, this code comment is just a description of a normal process that is fine to have here. I filed dotnet/source-build#2546 so it can be hopefully be replaced with a link to a doc that describes this in more detail and with more context.

Copy link
Member

Choose a reason for hiding this comment

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

My understanding is that this dependency is most likely stuck on an old version because it needs to be compatible with old VS toolsets

@dagood @JoeRobich I'm not sure how well we support this library being used downlevel in that way -- it's not something we have automated test coverage for in any case. I'm not sure if this breaks folks that might have depended on our package and were also relying on us to have the dependency of some version if they didn't have another VS version on the box.

@JoeRobich JoeRobich merged commit 92a5218 into dotnet:release/dev17.0 Oct 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Infrastructure Source-Build Tracking dotnet/source-build related tasks.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Microsoft.CodeAnalysis.Features dependency is not source-buildable