Expose public API for TaskEnvironment construction#13383
Open
AR-May wants to merge 4 commits intodotnet:mainfrom
Open
Expose public API for TaskEnvironment construction#13383AR-May wants to merge 4 commits intodotnet:mainfrom
AR-May wants to merge 4 commits intodotnet:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to make Microsoft.Build.Framework.TaskEnvironment directly instantiable by task authors by adding a public parameterless constructor that selects a default environment driver.
Changes:
- Add a public
TaskEnvironment()constructor intended to default to the multi-process driver.
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
With the discovery of the "direct instantiation of the task" use case, tasks must explicitly set a default task environment in order to work correctly. Task authors may encounter the same issue, without having benefit of having framework internals visible to them and thus without ability to create one without re-implementing the driver themselves. So, we need to provide a public API for
TaskEnvironmentconstruction to enable setting the default task environment. Would be helpful for sdk as well.Changes Made
Adds two public API members to
TaskEnvironmentso that task authors usingIMultiThreadableTaskcan obtain or create aTaskEnvironmentwithout depending on internal types:TaskEnvironment.Default: static singleton that delegates to the process-level environment (multi-process mode).TaskEnvironment.CreateMultithreaded(projectDirectory, environmentVariables?): factory method that creates an isolated environment for multithreaded execution mode.Testing
Unit tests
Note
Depends on #13380