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 Vertical build PoC as a more first-class concept #14274

Merged
merged 15 commits into from
Dec 11, 2023

Conversation

mmitche
Copy link
Member

@mmitche mmitche commented Dec 8, 2023

For the vertical builds, we need some of the arcade infra required for source build, but not all. This PR introduces two switches:

  • ArcadeBuildVertical - Enables arcade infra for vertical build. Similar to source build but without some SB customization (e.g. filtering)
  • DotNetBuildVertical - Passed to inner build when ArcadeBuildVertical is enabled.

Note that BOTH switches may be passed if you wanted.

I probably could have introduced a more polished switch structure here. But I don't want to disturb existing SB functionality before a full design and rollout plan is determined.

In addition:

  • Add inner-clone support for Windows.
  • Add ExcludeFromVerticalBuild switch. We could use ExcludeFromBuild for the PoCs but there are other uses of ExcludeFromBuild in the product and I want to avoid confusion.

To double check:

For the vertical builds, we need some of the arcade infra required for source build, but not all. This PR introduces two switches:
- ArcadeBuildVertical - Enables arcade infra for vertical build. Similar to source build but without some SB customization (e.g. filtering)
- DotNetBuildVertical - Passed to inner build when ArcadeBuildVertical is enabled.

Note that BOTH switches may be passed if you wanted.
@steveisok steveisok self-requested a review December 8, 2023 20:21
steveisok
steveisok previously approved these changes Dec 8, 2023
@mmitche
Copy link
Member Author

mmitche commented Dec 8, 2023

@mmitche
Copy link
Member Author

mmitche commented Dec 8, 2023

@ViktorHofer This works now when building arcade with itself with -verticalBuild switch on windows. I think we'll need this infra to get the PoC working.

It should be possible to pull a build of this bootstrap arcade into your branch of the PoC. The PoC should be passing:

  • ArcadeBuildVertical.

This workaround is required for arcade to build itself with this in vb mode, Something odd about the in-tree usage of the built xliff binaries in this specific project. Nothing jumped out and it looks like it's not critical for fact finding, so I moved on. https://github.com/dotnet/arcade/pull/14274/files#diff-8e1f1364a8ce67c9d91692b95b9e2235e4de9b6efe15e2f05b61be99dd04f66cR42-R43

@@ -16,7 +16,7 @@

<EnableDefaultNoneItems>false</EnableDefaultNoneItems>
<_GeneratedVersionFilePath>$(IntermediateOutputPath)DefaultVersions.Generated.props</_GeneratedVersionFilePath>
<NoWarn>$(NoWarn);3021;NU5105;SYSLIB0013</NoWarn>
<NoWarn>$(NoWarn);3021;NU5105;NU5111;SYSLIB0013</NoWarn>
Copy link
Member

Choose a reason for hiding this comment

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

Add a comment above indicating what the individual NoWarns are for. The others were already there but adding a comment for each is a best practice that we follow in other places.

@@ -33,7 +33,7 @@
MSBuild tasks and tools should use this version to target the latest TFM that is supported by tooling.
Identical with NetCurrent when building from source. -->
<NetToolCurrent Condition="'$(DotNetBuildFromSource)' != 'true'">net8.0</NetToolCurrent>
<NetToolCurrent Condition="'$(DotNetBuildFromSource)' == 'true'">$(NetCurrent)</NetToolCurrent>
<NetToolCurrent Condition="'$(DotNetBuildFromSource)' == 'true' or '$(DotNetBuildVertical)' == 'true'">$(NetCurrent)</NetToolCurrent>
Copy link
Member

Choose a reason for hiding this comment

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

That looks wrong. We don't want to change the meaning of TFMs when building from the VMR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, you're probably right on this one.

@@ -58,6 +60,8 @@ function Print-Usage() {
Write-Host " -sign Sign build outputs"
Write-Host " -publish Publish artifacts (e.g. symbols)"
Write-Host " -clean Clean the solution"
Write-Host " -sourceBuild Run in 'source build' infra mode."
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't look right. The same switch exists in the build.sh file for Unix platforms but does something completely different:

echo " --sourceBuild Source-build the solution (short: -sb)"
echo " Will additionally trigger the following actions: --restore, --build, --pack"
echo " If --configuration is not set explicitly, will also set it to 'Release'"

What does "source build" infra mode mean?

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 added this for completeness. It would end up being "windows build without prebuilts". I can remove it.

Copy link
Member

Choose a reason for hiding this comment

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

OK. Let's remove this until there's a need and until it works with the existing infrastructure.

@@ -58,6 +60,8 @@ function Print-Usage() {
Write-Host " -sign Sign build outputs"
Write-Host " -publish Publish artifacts (e.g. symbols)"
Write-Host " -clean Clean the solution"
Write-Host " -sourceBuild Run in 'source build' infra mode."
Write-Host " -verticalBuild Run in 'vertical build' infra mode."
Copy link
Member

@ViktorHofer ViktorHofer Dec 9, 2023

Choose a reason for hiding this comment

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

Why do we need a new switch and not just use the already defined DotNetBuildVertical one? What does "vertical build infra mode" mean?

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 basically is the PoC mode for Windows and potentially other platforms. You need two switches to make thsi work:

  • ArcadeBuildVertical
  • DotNetBuildVertical

ArcadeBuildVertical should be initially passed

Comment on lines 302 to +308
<!--
Publish artifacts.
-->
<MSBuild Projects="Publish.proj"
Properties="@(_PublishProps);_NETCORE_ENGINEERING_TELEMETRY=Publish"
Targets="Publish"
Condition="'$(Publish)' == 'true' and '$(DotNetBuildFromSource)' != 'true'"/>
Condition="'$(Publish)' == 'true' and '$(DotNetBuildFromSource)' != 'true' and '$(DotNetBuildVertical)' != 'true'"/>
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it make more sense to just not pass the -publish argument in when building the repos from the VMR? That's done here: https://github.com/dotnet/dotnet/blob/ab06cf16219bc309a2a725008556abbbdab01007/repo-projects/Directory.Build.props#L152

Copy link
Member Author

Choose a reason for hiding this comment

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

Maaybe? I'm not sure why that was put there in the first place so I'm skeptical of removing it at this point.

@@ -296,14 +297,14 @@
-->
<MSBuild Projects="SourceBuild\AfterSourceBuild.proj"
Properties="@(_CommonProps);_NETCORE_ENGINEERING_TELEMETRY=AfterSourceBuild"
Condition="'$(ArcadeBuildFromSource)' == 'true'"/>
Condition="'$(ArcadeBuildFromSource)' == 'true' or '$(ArcadeBuildVertical)' == 'true'"/>
Copy link
Member

Choose a reason for hiding this comment

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

This confuses me. Why would invoke source build infrastructure when not building from source?

Which infrastructure from AfterSourceBuild.proj would you want a VMR build to execute? We don't create prebuilt usage reports in the VMR today when not building from source and I don't see that in scope for the PoCs. Similarly, I was under the impression that we don't want to create the source built intermediate nuget packages when not building from source.

If there really is some common infrastructure (please explain which part), then we should rename the AfterSourceBuild.proj file or create a new AfterBuildVertical.proj and share the code between both projects, i.e. via a targets file.

Copy link
Member Author

Choose a reason for hiding this comment

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

You need to create the intermediate nupkgs coming out of each repo build for use in downstream builds for the orchestrated build infra to work today.

IMO, we should keep the prebuilt detection in place for VB (but only error in "strict" SB mode).

Yes, we should rename AfterSourceBuild to something else, but I want to do this after .NET 9: Redesign source-build behavior controls is complete. What we want to do with the PoC, IMO, is use the source build infra, while not necessarily using the SB repo behavior.

Copy link
Member

@ViktorHofer ViktorHofer left a comment

Choose a reason for hiding this comment

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

Thank you for working on this. I see a lot of improvements but also a few changes that I don't understand / that don't make sense to me. Marking as "Request changes" to prevent an accidental merge before we resolve the feedback.

…rcadeTools.targets

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
# clone anyway, the difference is probably not significant. (This has not been measured.)
# * '-c protocol.file.allow=alwyas allows cloning from the local filesystem even on newer versions
# of git which have disabled this for security reasons.
git clone -c protocol.file.allow=always --depth=1 --no-local --no-checkout "$Source" "$Dest"
Copy link
Member

Choose a reason for hiding this comment

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

When native executables calls fail, the error is not propagated in PowerShell (unless I'm missing some external setup) and $LASTEXITCODE has to be checked. Do we have a solution for this in arcade (such as a wrapper function for calling native binaries that checks the LASTEXITCODE and throws if non-zero) or that's something that we'd need to do yet?

@mmitche mmitche merged commit 0a0217f into dotnet:main Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants