-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Apply source-build patches #58727
Apply source-build patches #58727
Conversation
Why is this needed? We already set |
This was a red flag to me as well. We should ideally use one approach or the other. I have no issue with either approach, as long as we either drop the other approach or include a new build validation step that verifies the two are consistent (i.e. the set of projects marked If we use a solution filter, it should be relocated to the eng subdirectory. |
eng/SourceBuild.props
Outdated
<InnerBuildArgs Condition="'$(DotNetBuildFromSource)' != 'true'">$(InnerBuildArgs) /p:Projects="$(InnerSourceBuildRepoRoot)\Roslyn.sln"</InnerBuildArgs> | ||
<InnerBuildArgs Condition="'$(DotNetBuildFromSource)' == 'true'">$(InnerBuildArgs) /p:Projects="$(InnerSourceBuildRepoRoot)\Roslyn.SourceBuild.slnf"</InnerBuildArgs> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😕 Why would SourceBuild.props be included in non-sourcebuild builds? Can we just make the <Target>
element itself conditional?
@@ -1,6 +1,6 @@ | |||
<Project> | |||
|
|||
<ItemGroup> | |||
<ItemGroup Condition="'$(DotNetBuildFromSource)' != 'true'"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ Why is Tools.props being included in sourcebuild? Can we exclude the file through some other means?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like it is included by Arcade: https://github.com/dotnet/arcade/blob/aa647dcfc48bd3a644625e549ff71b7d06ed0958/src/Microsoft.DotNet.Arcade.Sdk/tools/Tools.proj#L53
@@ -28,4 +28,10 @@ | |||
|
|||
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="$(SourceGeneratorMicrosoftCodeAnalysisVersion)" PrivateAssets="all" Condition="'$(TargetFramework)' == 'netstandard2.0'" /> | |||
</ItemGroup> | |||
<ItemGroup Condition="'$(DotNetBuildFromSource)' == 'true'"> | |||
<PackageReference Include="System.Collections.Immutable" Version="$(RefOnlySystemCollectionsImmutableVersion)" PrivateAssets="all" Condition="'$(TargetFramework)' == 'netstandard2.0'" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ Why isn't this implicit via the Microsoft.CodeAnalysis.Common reference above?
@@ -28,4 +28,10 @@ | |||
|
|||
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="$(SourceGeneratorMicrosoftCodeAnalysisVersion)" PrivateAssets="all" Condition="'$(TargetFramework)' == 'netstandard2.0'" /> | |||
</ItemGroup> | |||
<ItemGroup Condition="'$(DotNetBuildFromSource)' == 'true'"> | |||
<PackageReference Include="System.Collections.Immutable" Version="$(RefOnlySystemCollectionsImmutableVersion)" PrivateAssets="all" Condition="'$(TargetFramework)' == 'netstandard2.0'" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Consider restructuring this as a <Choose>
element to avoid needing the same condition on each <PackageReference>
See #57342 for a better description of why I can look into getting rid of the |
Would it be possible for source build to create an empty WindowsDesktop SDK package and build against that? |
0226d2d
to
d188c8d
Compare
This was mentioned in dotnet/installer#12500 (comment). Using a solution filter is a maintainability concern so avoiding them is preferable. On the other hand, avoiding the SDK reference in the first place is preferable if possible IMO as it is more obvious to what the behavior is instead of injecting an empty SDK during source-build. |
I don't see a problem with injecting SDK that itself can specify ExcludeFromSourceBulid = true. |
I'm a bit concerned that a fake WindowsDesktop SDK could escape to the final source-built SDK output and cause problems for users trying to create a project with it. I think this would be worth following up on but the solution filter seems like the most straightforward way to avoid any potential issues for a fix right now. |
Sure, but it adds debt. I'd prefer solution that does not add debt. |
db30781
to
47ee45b
Compare
Looks like BuildBoss will need to be updated: https://github.com/dotnet/roslyn/blob/main/src/Tools/BuildBoss/ProjectCheckerUtil.cs#L144 |
Is this something I need to do? |
Yes, or the correctness build leg will not pass. |
…sly source built versions
Pull request for applying this patch: dotnet#57159
Creating an apphost for a netcoreapp3.1 project uses the apphost pack as a prebuilt. Stopping these projects from creating the apphost removes the prebuilt for source-build. See: dotnet#57233 PR: dotnet#57306
Some projects use Microsoft.NET.Sdk.WindowsDesktop sdk which cannot be built using a boostrapped source-build sdk, since WindowsDesktop is not supported. These cannot be ignored using ExcludeFromSourceBuild because the project still needs to be loaded and the sdk cannot be found. See dotnet#57342
eng/Versions.props
Outdated
<!-- | ||
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. | ||
--> | ||
<RefOnlyMicrosoftBuildVersion>$(RefOnlyMicrosoftBuildPackagesVersion)</RefOnlyMicrosoftBuildVersion> | ||
<RefOnlyMicrosoftBuildFrameworkVersion>$(RefOnlyMicrosoftBuildPackagesVersion)</RefOnlyMicrosoftBuildFrameworkVersion> | ||
<RefOnlyMicrosoftBuildRuntimeVersion>$(RefOnlyMicrosoftBuildPackagesVersion)</RefOnlyMicrosoftBuildRuntimeVersion> | ||
<RefOnlyMicrosoftBuildTasksCoreVersion>$(RefOnlyMicrosoftBuildPackagesVersion)</RefOnlyMicrosoftBuildTasksCoreVersion> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❔ Is there a reason this needs to move to the bottom of the file?
eng/Versions.props
Outdated
<SourceBuildLiftedSystemCollectionsImmutableVersion Condition="'$(SourceBuildLiftedSystemCollectionsImmutableVersion)' == ''">$(SystemCollectionsImmutableVersion)</SourceBuildLiftedSystemCollectionsImmutableVersion> | ||
<SourceBuildLiftedSystemReflectionMetadataVersion Condition="'$(SourceBuildLiftedSystemReflectionMetadataVersion)' == ''">$(SystemReflectionMetadataVersion)</SourceBuildLiftedSystemReflectionMetadataVersion> | ||
<SourceBuildLiftedSystemRuntimeCompilerServicesUnsafeVersion Condition="'$(SourceBuildLiftedSystemRuntimeCompilerServicesUnsafeVersion)' == ''">$(SystemRuntimeCompilerServicesUnsafeVersion)</SourceBuildLiftedSystemRuntimeCompilerServicesUnsafeVersion> | ||
<SourceBuildLiftedSystemTextEncodingCodePagesVersion Condition="'$(SourceBuildLiftedSystemTextEncodingCodePagesVersion)' == ''">$(SystemTextEncodingCodePagesVersion)</SourceBuildLiftedSystemTextEncodingCodePagesVersion> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ What is SourceBuildLifted
prefix? Why do none of the existing naming approaches work? A comment should be added for future readers.
<ItemGroup Condition="'$(DotNetBuildFromSource)' == 'true'"> | ||
<PackageReference Include="System.Collections.Immutable" Version="$(SourceBuildLiftedSystemCollectionsImmutableVersion)" PrivateAssets="all" /> | ||
<PackageReference Include="System.Reflection.Metadata" Version="$(SourceBuildLiftedSystemReflectionMetadataVersion)" PrivateAssets="all" /> | ||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="$(SourceBuildLiftedSystemRuntimeCompilerServicesUnsafeVersion)" PrivateAssets="all" /> | ||
<PackageReference Include="System.Text.Encoding.CodePages" Version="$(SourceBuildLiftedSystemTextEncodingCodePagesVersion)" PrivateAssets="all" /> | ||
</ItemGroup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❔ Why do these need to be explicit? Aren't they inherited from Microsoft.CodeAnalysis.Common?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The packages are inherited from Microsoft.CodeAnalysis.Common. However, roslyn builds before runtime in the source-build tarball, so we don't have access to the "current" versions of the packages to build against. The SourceBuildLifted-
versions point to the previously source-built versions of the packages (i.e. the last build's output) so that we don't try to restore versions of these packages we don't have. That is also why the RefOnly-
prefix is not applicable here.
I have just realized that a better solution for this might be to add the packages to SBRP, so I will get working on that and hopefully this change won't be necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added the necessary packages to SBRP and verified that the changes to CSharpSyntaxGenerator.csproj
will no longer be necessary in the context of a full source-build tarball build and bootstrap. I also reverted those changes in this PR.
/azp run roslyn-integration-ci |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run roslyn-integration-corehost |
Azure Pipelines successfully started running 1 pipeline(s). |
@sharwell I'm going ahead and overriding the one failing integration test. |
See dotnet/source-build#2708. The source-build team is making an effort to upstream all of our patches.
Summary of changes: