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

Upstream changes from Vertical Build PoC #71666

Merged
merged 17 commits into from
Jan 25, 2024

Conversation

mmitche
Copy link
Member

@mmitche mmitche commented Jan 17, 2024

This largely enables roslyn to build in the VMR, without much of the source build exclusions. Some current exclusions may also be removed at some point.

  • Backport IsTestUtilityProject arcade features into roslyn's targets. Can be removed when roslyn is on Arcade 9
  • Sprinkle on test utility projects, removing IsShipping where specified.
  • Exclude projects from the vertical build where they were excluded for the PoC work.
  • Tweak eng/build.ps1 to use common tooling to initialize the CLI rather than force installing it under -ci.
  • Remove extra / to roslyn solution in source-build.props

This largely enables roslyn to build in the VMR, without much of the source build exclusions. Some current exclusions may also be removed at some point.
- Backport IsTestUtilityProject arcade features into roslyn's targets. Can be removed when roslyn is on Arcade 9
- Sprinkle on test utility projects, removing IsShipping where specified.
- Exclude projects from the vertical build where they were excluded for the PoC work.
- Tweak eng/build.ps1 to use common tooling to initialize the CLI rather than force installing it under -ci.
- Remove extra / to roslyn solution in source-build.props
@mmitche mmitche requested review from a team as code owners January 17, 2024 00:03
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Infrastructure untriaged Issues and PRs which have not yet been triaged by a lead labels Jan 17, 2024
@ghost ghost added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Jan 17, 2024
@jaredpar jaredpar self-assigned this Jan 17, 2024
@mmitche
Copy link
Member Author

mmitche commented Jan 17, 2024

@ViktorHofer

displayName: Validate Generated Syntax Files
inputs:
filePath: eng/validate-code-formatting.ps1
arguments: -rootDirectory $(Build.SourcesDirectory)\src -includeDirectories Compilers\CSharp\Portable\Generated\, Compilers\VisualBasic\Portable\Generated\, ExpressionEvaluator\VisualBasic\Source\ResultProvider\Generated\
Copy link
Member Author

Choose a reason for hiding this comment

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

@jaredpar I tweaked this so it doesn't assume that the SDK is installed at the root of the repo (instead, uses Ensure-DotNetSDK). I set the validation tooling to diag for this PR iteration to ensure that things are operating as expected.

I'm pretty sure that the current format command is incorrect. It appears that the include directories are expected to be paths relative to the root dir ($(Build.SourcesDirectory)\src) and not absolute paths. When I was testing it locally it was not formatting any files.

Copy link
Member Author

Choose a reason for hiding this comment

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

Looking good now. 11 generated files from those directories checked. I changed the verbosity back down to detailed. It prints some details (number of files) that are useful.

@mmitche mmitche enabled auto-merge (squash) January 24, 2024 00:19
@mmitche
Copy link
Member Author

mmitche commented Jan 24, 2024

Ready to go. Waiting on @dotnet/roslyn-infrastructure to verify.

@@ -403,8 +403,11 @@ stages:
arguments: -test -configuration Release
condition: or(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['compilerChange'], 'true'))

- script: $(Build.SourcesDirectory)\.dotnet\dotnet.exe tool run dotnet-format whitespace $(Build.SourcesDirectory)\src --folder --include-generated --include $(Build.SourcesDirectory)\src\Compilers\CSharp\Portable\Generated\ $(Build.SourcesDirectory)\src\Compilers\VisualBasic\Portable\Generated\ $(Build.SourcesDirectory)\src\ExpressionEvaluator\VisualBasic\Source\ResultProvider\Generated\ --verify-no-changes
- task: PowerShell@2
Copy link
Member

Choose a reason for hiding this comment

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

Curious: why did you pick the PowerShell task here vs using pwsh? That is installed in our repo as a local tool. Generally I try and use that when possible.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do.

@@ -42,6 +42,7 @@ function Run-LanguageCore($language, $languageSuffix, $languageDir, $syntaxProje
function Test-GeneratedContent($generatedDir, $scratchDir) {
$algo = "MD5"
foreach ($fileName in (Get-ChildItem $scratchDir)) {
$fileName = $fileName.Name
Copy link
Member

Choose a reason for hiding this comment

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

Why was this change needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

On my local powershell installation (powershell core 7), Get-ChildItem is returning full file objects. So when you do Join-Path below you actually get:

C:\r\roslyn\src\generatedfoobar\C:\r\roslyn\src\generatedfoobar\Foo.cs

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 can definitely revert this if you want.

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 tweaked this so that it selects Name explicitly.

eng/validate-code-formatting.ps1 Show resolved Hide resolved

<!-- Work around missing project dependencies. VS features not needed at this time:
https://github.com/dotnet/source-build/issues/3981. -->
<ExcludeFromVerticalBuild>true</ExcludeFromVerticalBuild>
Copy link
Member

Choose a reason for hiding this comment

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

Curious: if we set something as excluded from vertical build is it automatically excluded from source build? That would save us a lot of duplicate properties if true.

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 with the new unified build controls. "ExcludeFromVerticalBuild" is the PoC switch. It becomes a general ExcludeFromDotNetBuild switch, while ExcludeFromSourceOnlyBuild becomes the specific switch that says; "When you have access to no outside binaries, exclude this project".

@@ -2,5 +2,8 @@
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
<PropertyGroup>
<ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
<!-- TODO: https://github.com/dotnet/source-build/issues/3981
Remove if necessary. -->
<ExcludeFromVerticalBuild>true</ExcludeFromVerticalBuild>
Copy link
Member

Choose a reason for hiding this comment

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

Having both properties seems unnecessary. What code is excuded from the vertical build but included in source build?

Copy link
Member Author

Choose a reason for hiding this comment

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

Expect this to go away when the new Unified build controls come to this repo. That will happen after the implementation is complete (very soon) and when Roslyn moves to .NET 9 Arcade (late). Whenever you see both of these conditions, they would be replaced by ExcludeFromDotNetBuild

auto-merge was automatically disabled January 24, 2024 17:55

Head branch was pushed to by a user without write access

@mmitche
Copy link
Member Author

mmitche commented Jan 25, 2024

@jaredpar Dealt with feedback.

$dotnet = Ensure-DotnetSdk
Exec-Console $dotnet "tool run dotnet-format -v detailed whitespace $rootDirectory --folder --include-generated --include $includeDirectories --verify-no-changes"

exit 0
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 you use exit here vs. ExitWithCode?

Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -396,14 +396,13 @@ stages:
- script: eng/validate-rules-missing-documentation.cmd -ci
displayName: Validate rules missing documentation

- task: PowerShell@2
- pwsh: |
Copy link
Member

Choose a reason for hiding this comment

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

Does that use a pwsh that is controlled by AzDO or shell out to the pwsh that we installed via local tools?

Copy link
Member Author

Choose a reason for hiding this comment

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

pwsh is the Powershell task with pwsh set to true.

@mmitche mmitche merged commit c31c76c into dotnet:main Jan 25, 2024
31 checks passed
@ghost ghost added this to the Next milestone Jan 25, 2024
@Cosifne Cosifne modified the milestones: Next, 17.10 P1 Jan 30, 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.

4 participants