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

_WalkEachTargetPerFramework (Pack) should list inner builds the same way as during the build step #10556

Open
xen2 opened this issue Feb 8, 2021 · 1 comment
Labels
Functionality:Pack Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Type:Feature

Comments

@xen2
Copy link

xen2 commented Feb 8, 2021

Issue
_WalkEachTargetPerFramework (used to list files for each TFM during Pack) is currently enumerating builds to pack with only the hardcoded case of TargetFrameworks in mind (Projects="$(MSBuildProjectFullPath)" and TargetFramework=%(_TargetFrameworks.Identity)).
This makes it quite difficult to extend, and is separate from the build dispatch (done by _ComputeTargetFrameworkItems).

Example use case

  • MSBuild.Sdk.Extras for building one library per RID
  • Stride Game Engine (my project) for building one library per graphics API

Proposal:
Unify the build dispatch and packing by reusing the same list, @(_InnerBuildProjects) instead.
It is computed during Build in _ComputeTargetFrameworkItems.

On top of keeping build and pack in sync, it allows for much easier extensibility (current workaround is to do a full copy & paste of _WalkEachTargetPerFramework and all its sub targets).

Excerpt of _WalkEachTargetPerFramework before the change:

<MSBuild
      Condition="'$(IncludeBuildOutput)' == 'true'"
      Projects="$(MSBuildProjectFullPath)"
      Targets="_GetBuildOutputFilesWithTfm"
      Properties="TargetFramework=%(_TargetFrameworks.Identity);">

After:

<MSBuild
      Condition="'$(IncludeBuildOutput)' == 'true'"
      Projects="@(_InnerBuildProjects)"
      Targets="_GetBuildOutputFilesWithTfm">

(_InnerBuildProjects already contains the AdditionalProperties with TargetFramework properly set. The cool thing is that we can easily add custom ones such as RuntimeIdentifier=win-x64, this will affect both Build and Pack)

Do you think of any case where this wouldn't work?
If everybody agrees, I am happy to submit a PR for that.

Note: this is just the first step. About the use case described earlier (multiple DLL per RID or graphics API rather than only by TFM), there's still a bunch of other tedious changes & target overrides to do.
I plan to submit other PRs later to improve on that (if they are welcome, I am not sure it's a priority).

@nkolev92
Copy link
Member

Related to #5154.

I think the linked issue captures the general scenario of building for a target framework more than once.
At this point we'd prefer not to take a dependency on _InnerBuildProjects (it's _ for a reason, internal and not suggested to be used outside of the defining targets), and rather listen for more feedback first.

@nkolev92 nkolev92 added Functionality:Pack Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Type:Feature labels Feb 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Functionality:Pack Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Type:Feature
Projects
None yet
Development

No branches or pull requests

4 participants