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

Use arcade power source build infra #58651

Merged
merged 3 commits into from
Sep 14, 2021
Merged

Use arcade power source build infra #58651

merged 3 commits into from
Sep 14, 2021

Conversation

Anipik
Copy link
Contributor

@Anipik Anipik commented Sep 3, 2021

Related to #54573

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@Anipik Anipik changed the title [WIP] Use arcade power source build infra Use arcade power source build infra Sep 3, 2021
@Anipik
Copy link
Contributor Author

Anipik commented Sep 8, 2021

cc @ViktorHofer & @wfurt to look at the change.

@@ -128,7 +128,7 @@
</ItemGroup>

<!-- Support for deploying msquic -->
<ItemGroup Condition="'$(TargetsWindows)' == 'true' and
<ItemGroup Condition="'$(_hostOS)' == 'windows' and
Copy link
Member

Choose a reason for hiding this comment

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

That's an internal property. Don't we have a better one to use? cc @am11

Copy link
Member

Choose a reason for hiding this comment

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

Would also be good to add a comment explaining why TargetsWindows can't be used here. I don't know that either yet.

Copy link
Member

Choose a reason for hiding this comment

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

Note that Targets{OSName} properties in top level Directory.Build.props do not get set for src/libraries, we set them in eng/targetframeworksuffix.props. It would be nice to get rid of whole SkipInferTargetOSName mechanism and just use the top-level Directory.Build.props, unless it is impossible to consolidate (which I don't think is the case).

Copy link
Contributor Author

@Anipik Anipik Sep 9, 2021

Choose a reason for hiding this comment

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

i can add the comment. but the explaination is
The non portable build triggers all config build which build this project for net6.0-windows on linux, hence targetsWIndows is true but the runtime is linux so all the BinPlaceDir are linux directories and thee file gets binplaced with the linux runtime.
i think we want to binplace it in the runtime when we arre building on windows, i added @wfurt to verify that

Copy link
Member

Choose a reason for hiding this comment

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

comment would be always good. We should package this only for Windows runtime - regardless where this is build. if _hostOS is the right variables I'm fine with that.

Copy link
Member

@am11 am11 Sep 9, 2021

Choose a reason for hiding this comment

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

That's an internal property.

Correct, properties with _ indicate "do no use outside of this file" and can break in the future. We have managed to avoid using these internal properties elsewhere. Since this is the first use-case of HostOS outside of Directory.Build.props, we can (unconditionally) define <HostOS>$(_hostOS)</HostOS> between these two lines:

<_hostOS Condition="'$(TargetOS)' == 'Browser'">Browser</_hostOS>
<TargetOS Condition="'$(TargetOS)' == ''">$(_hostOS)</TargetOS>

and then in the following lines of Directory.Build.props and here, use $(HostOS).

Copy link
Member

Choose a reason for hiding this comment

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

Why can't we use TargetOS here instead?

Copy link
Member

Choose a reason for hiding this comment

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

I think it's because of the non-portable build which @Anipik alluded above: #58651 (comment)
But is this the only place in the entire build infra where it is applicable? If not, what is the alternative way of solving it, maybe we should use that approach to keep it consistent?

Copy link
Member

@ViktorHofer ViktorHofer Sep 10, 2021

Choose a reason for hiding this comment

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

But the sourcebuild leg sets the OS to Linux in the yml, why would the TargetOS be "Windows" then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TargetsWindows = true is true in the innerbuilds when we dispatch innerbuild from net6.0-windows.

- template: /eng/common/templates/steps/source-build.yml
parameters:
platform:
buildScript: $(_sclEnableCommand) $(Build.SourcesDirectory)$(dir)build$(scriptExt)
Copy link
Member

Choose a reason for hiding this comment

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

Is that the right command to invoke? cc @MichaelSimons

Copy link
Member

Choose a reason for hiding this comment

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

I think so. This is just the build script, the template defaults to specify all of the correct args.

Copy link
Member

Choose a reason for hiding this comment

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

And is the _sclEnableCommand still needed?

value: scl enable llvm-toolset-7.0 --

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes otherwise we get clang failures.

Copy link
Member

@MichaelSimons MichaelSimons left a comment

Choose a reason for hiding this comment

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

With these changes, will the Microsoft.SourceBuild.Intermediates.* packages get published during internal CI runs?

@Anipik
Copy link
Contributor Author

Anipik commented Sep 9, 2021

With these changes, will the Microsoft.SourceBuild.Intermediates.* packages get published during internal CI runs?

This was the first step, i was thinking of adding it a separate change but i think i can push the change here only

@Anipik
Copy link
Contributor Author

Anipik commented Sep 9, 2021

Copy link
Member

@MichaelSimons MichaelSimons left a comment

Choose a reason for hiding this comment

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

I don't have an in-depth knowledge of the runtime pipelines but the source-build specific parts LGTM.

Directory.Build.props Outdated Show resolved Hide resolved
@@ -128,7 +128,8 @@
</ItemGroup>

<!-- Support for deploying msquic -->
<ItemGroup Condition="'$(TargetsWindows)' == 'true' and
<!-- Native msquic assemblies should only be binplaced while running on windows. -->
<ItemGroup Condition="'$(HostOS)' == 'windows' and
Copy link
Member

@ericstj ericstj Sep 10, 2021

Choose a reason for hiding this comment

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

This is a bit of conflation. Nothing about building on a Windows machine means that these files are present. Targeting is the right concept. Can we instead just exclude this from source build? Since presumably the reason this isn't available is because we aren't building the dependent package as part of source build.

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 actually surprised that the PackageReference worked but this didn't. What failed that led you to add this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm actually surprised that the PackageReference worked but this didn't. What failed that led you to add this?

sourcebuild leg failed.

Copy link
Member

Choose a reason for hiding this comment

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

Of course something failed, how did it fail and why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we instead just exclude this from source build?

SourceBuild leg if run on windows will not contain this file in the targeting pack.

Targeting is the right concept.

why is the targeting the right concept here, we are binplacing the file in the runtime folders, shouldnt we check the runtime we are running on before binplacing ?

Copy link
Contributor Author

@Anipik Anipik Sep 10, 2021

Choose a reason for hiding this comment

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

Of course something failed, how did it fail and why?

the missing fileVersion error.

Copy link
Member

Choose a reason for hiding this comment

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

shouldnt we check the runtime we are running on before binplacing ?

The runtime we're running on has nothing to do with the product we are building, though it is sometimes related. We could technically build all of libraries for Linux from a windows machine (and we used to do so at the start of .NETCore).

BinPlacing is supposed to involve a calculation on "best applicable configuration". Typically we only binplace when the configuration being built is the best for a given target. https://github.com/dotnet/arcade/blob/22d90b34fe210ca9f85ea1896eda29f2de55f826/src/Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk/src/build/BinPlace.targets#L122

It looks like this project is bypassing that by directly defining BinPlaceDir items. In that case, this condition needs to do the work that would have been done by ChooseBestTargetFrameworksTask: the concept shouldn't be "host OS" but should be "target runtime for the vertical". It looks like this should be TargetOS.

I'm still dubious about MSQuic packagereference though. @MichaelSimons does this package even get built in source build repos? Shouldn't we exclude the PackageReference?

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 still dubious about MSQuic packagereference though. @MichaelSimons does this package even get built in source build repos? Shouldn't we exclude the PackageReference?

It does not get produced by source-build today. Additionally system.net.msquic.transport is showing up as a prebuilt. Excluding the PackageReference seems like the good approach for source-build.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The runtime we're running on has nothing to do with the product we are building, though it is sometimes related. We could technically build all of libraries for Linux from a windows machine

i thought this applied to managed assemblies, i thought we cant build the native assemblies cross platform ?

@@ -101,7 +101,8 @@
<PackageReference Include="System.Net.MsQuic.Transport"
Version="$(SystemNetMsQuicTransportVersion)"
PrivateAssets="all"
GeneratePathProperty="true" />
GeneratePathProperty="true"
Condition="'$(DotNetBuildFromSource)' != 'true'" />
Copy link
Member

Choose a reason for hiding this comment

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

Should this same condition be applied to the target which consumes the file from this package?

Copy link
Contributor Author

@Anipik Anipik Sep 12, 2021

Choose a reason for hiding this comment

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

its used for interop calls mostly, no specific target uses this file

Copy link
Member

@ericstj ericstj left a comment

Choose a reason for hiding this comment

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

LGTM modulo the one comment about the target condition

@@ -129,7 +130,7 @@

<!-- Support for deploying msquic -->
<ItemGroup Condition="'$(TargetsWindows)' == 'true' and
('$(TargetArchitecture)' == 'x64' or '$(TargetArchitecture)' == 'x86')">
('$(TargetArchitecture)' == 'x64' or '$(TargetArchitecture)' == 'x86') and '$(DotNetBuildFromSource)' != 'true'">
<BinPlaceDir Include="$(MicrosoftNetCoreAppRuntimePackNativeDir)" ItemName="NativeBinPlaceItem" />
Copy link
Member

Choose a reason for hiding this comment

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

Not for this PR, but something to consider moving forward is that this fails silently if that quic package changes it's shape. It might be good to avoid a wildcard here. We should be explicit about things which we end up shipping in the shared framework.

@Anipik Anipik merged commit 0585160 into dotnet:main Sep 14, 2021
@Anipik
Copy link
Contributor Author

Anipik commented Sep 14, 2021

Failure is a known xunit bug,

@Anipik
Copy link
Contributor Author

Anipik commented Sep 14, 2021

/backport to release/6.0

@github-actions
Copy link
Contributor

Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/1235139018

@ghost ghost locked as resolved and limited conversation to collaborators Nov 3, 2021
@Anipik Anipik deleted the sb branch November 10, 2021 18:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants