Skip to content

Refactoring workload build tasks#8645

Merged
mmitche merged 11 commits intodotnet:release/6.0from
joeloff:refactor-workloads
Mar 28, 2022
Merged

Refactoring workload build tasks#8645
mmitche merged 11 commits intodotnet:release/6.0from
joeloff:refactor-workloads

Conversation

@joeloff
Copy link
Member

@joeloff joeloff commented Mar 18, 2022

Refactoring workload build tasks

  • Cleaning up duplicate templates for generating .csproj files to package workload MSIs
  • Adding support for building multiple manifests and feature bands
  • Support for publishing SWIX manifests for feature bands and avoid including unreferenced packages.
  • Better support for building MSIs in parallel to reduce build times.

@joeloff joeloff marked this pull request as draft March 18, 2022 06:46
@joeloff
Copy link
Member Author

joeloff commented Mar 18, 2022

@rainersigwald tagged you because of the MSBUILD shenanigans in case you have time to take a peek.

I still have to make fixes for the tests, clean up some doc comments and fix some files for source build.

dsplaisted
dsplaisted previously approved these changes Mar 18, 2022
Comment on lines +65 to +67
MsiVersion = !string.IsNullOrWhiteSpace(package.GetMetadata(Metadata.MsiVersion)) ? new Version(package.GetMetadata(Metadata.MsiVersion))
: msiVersion != null ? msiVersion : throw new Exception(string.Format(Strings.NoManifestInstallerVersion, nameof(CreateVisualStudioWorkload),
nameof(CreateVisualStudioWorkload.ManifestMsiVersion), nameof(CreateVisualStudioWorkload.WorkloadManifestPackageFiles), Metadata.MsiVersion));
Copy link
Member

Choose a reason for hiding this comment

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

I find multiple ternary operators strung together hard to parse. If/else statements or maybe something with matching would be more readable for me.

: msiVersion != null ? msiVersion : throw new Exception(string.Format(Strings.NoManifestInstallerVersion, nameof(CreateVisualStudioWorkload),
nameof(CreateVisualStudioWorkload.ManifestMsiVersion), nameof(CreateVisualStudioWorkload.WorkloadManifestPackageFiles), Metadata.MsiVersion));

SdkFeatureBand = GetSdkFeatureBandVersion(GetSdkVersion(Id));
Copy link
Member

Choose a reason for hiding this comment

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

I may be confused here, but isn't the version that's part of the package ID already the SDK feature band version? For example, for Microsoft.NET.Sdk.Maui.Manifest-6.0.200, the version number returned from GetSdkVersion would already be 6.0.200, and so there's no need for a separate call to GetSdkFeatureBandVersion.

{
foreach (WorkloadPackId packId in wd.Packs)
{
WorkloadPack pack = manifest.Packs[packId];
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this would break if a workload pack was referenced from one manifest but defined in another. This is supposed to be valid, although I don't think we ever do so in the current manifests. Instead, we have manifests that extend other ones.

Copy link
Member Author

Choose a reason for hiding this comment

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

We previously maintained a list of packs that were absent (technically external). I'll return that logic

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 went through the old code again. The problem with external packs is that their IDs can be shortened to meet the limits imposed by the VS package cache. The replacement values used to shorten the value reside with the repo building the packs, so we have no way to know which packages will be shortened or how they will be shortened.

Comment on lines +76 to +78
default:
// Unsupported RID.
continue;
Copy link
Member

Choose a reason for hiding this comment

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

What happens if there's a rid such as "win7-x64" which isn't hard-coded here? How would we catch that?

Ideally maybe we should be walking the RID graph here. However, a much simpler solution would be to simply list all the RIDs we expect, including non-Windows ones, and throw an error if an unexpected one is encountered.

/// <summary>
/// The set of feature bands that include contain a reference to this pack.
/// </summary>
public Dictionary<string, HashSet<ReleaseVersion>> FeatureBands = new();
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this should be called PlatformFeatureBands to make clearer that the key is a platform?

Copy link
Member Author

Choose a reason for hiding this comment

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

Definitely, thank you. I couldn't come up with a decent name.

{
if (!File.Exists(sourcePackage))
{
throw new FileNotFoundException(message: null, fileName: sourcePackage);
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 seem to account for how we'll need to build manifests in the 7.0 branch that reference packs produced out of 6.0. We won't want to re-package the 6.0 workload packs into MSIs. I think probably we should be able to build and package the manifest without even needing access to the packs it refers to.

Comment on lines +304 to +306
// Generate SWIX projects for the Visual Studio components. These are driven by the manifests, so
// they need to be ordered based on feature bands to avoid pulling in unnecessary packs into the drop
// artifacts.
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 not following this comment. I don't see where the swixs are being ordered, or how that relates to what packages are included.

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'll clarify the comment. At the end of the build you'll get a set of SWIX projects that generate the individual packages wrapping the MSIs, components. The item contains two things: the path to the swixproj and the feature band. The idea being that you can the build these projects, e.g. dotnet build %(SwixProject.Identity) /p:ManifestPath=bin\workloads\%(SdkFeatureBand) ManifestPath in this case refers to the setup manifests, not workloads, but it will help to create artifacts that are grouped by the feature bands since later, all the individual manifests are merged into a .vsman file and that whole folder gets pushed into blob storage. Since one pack can ship in different VS versions, this helps to avoid creating drops containing items that should not be included for a specific VS version. There is a trimming step that removes orphaned packages, but I don't want to rely on something that is outside our control and just make sure the drops have the correct set of files.

@joeloff joeloff marked this pull request as ready for review March 24, 2022 00:02
@mmitche mmitche merged commit f8c0d51 into dotnet:release/6.0 Mar 28, 2022
@pjcollins
Copy link
Member

@joeloff @mmitche I think we'll want to apply this to the main branch as well? I'm not sure if there is a specific process for that but want to make sure it's not forgotten.

@joeloff
Copy link
Member Author

joeloff commented Mar 31, 2022

Yes, Them moment I port this to main though, it's going to set of automatic code flows into emsdk/runtime. I'll send mail about this to the owners so they can be ready to address the breaking changes.

@pjcollins
Copy link
Member

There is no rush from our side, we can consume the 6.0.0 packages for the time being.

joeloff added a commit to joeloff/arcade that referenced this pull request Aug 12, 2022
* Refactoring workload build tasks

* Fix source build and some random cleanup

* Updating tests, code cleanup

* Minor fixes, unit test conversion

* Mark tests as Windows only, fix missing content for Helix

* Hide WiX and test packages from Solution Explorer

* Fix duplicate publish items

* Fix link target for helix

* Fix link metadata for WiX

* Pass ICE suppressions to Light, more cleanup

* Fix file extraction for packs, add unit test for template pack MSI
mmitche pushed a commit that referenced this pull request Aug 15, 2022
* Refactoring workload build tasks (#8645)

* Refactoring workload build tasks

* Fix source build and some random cleanup

* Updating tests, code cleanup

* Minor fixes, unit test conversion

* Mark tests as Windows only, fix missing content for Helix

* Hide WiX and test packages from Solution Explorer

* Fix duplicate publish items

* Fix link target for helix

* Fix link metadata for WiX

* Pass ICE suppressions to Light, more cleanup

* Fix file extraction for packs, add unit test for template pack MSI

* Pass ICE suppressions to Light (#9061)

* Create workload pack group installers (#9514)

* Remove duplicate PackageReference

* Create MSIs for workoad pack groups

* Build NuGet wrapper packages for workload pack group MSIs

* Generate WorkloadPackGroups.json in manifest MSIs

* Add swix authoring for workload pack groups

* De-duplicate workload pack group creation

* Put braces around ProductCode and UpgradeCode registry values

* Write registry keys for pack groups

* Fix swix dependencies for pack groups

* Use correct GUID format when setting candle variables

* Add test for creating pack group dependency in SWR file

* Support building with missing workload packs (#9628)

* Support building with missing workload packs

* Include extracted manifest files in manifest MSI payload nupkg

* Fix versioning errors in workloads (#10363)

* Fix versioning errors in workloads

* Disable TRX tests while reporting to AZDO is broken (#10358) (#10380)

Co-authored-by: Matt Galbraith <MattGal@users.noreply.github.com>

* clean up, api changes

Co-authored-by: Daniel Plaisted <dsplaisted@gmail.com>
Co-authored-by: Matt Galbraith <MattGal@users.noreply.github.com>
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