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

Allow overriding task parameter logging options in task classes #5236

Conversation

KirillOsenkov
Copy link
Member

This is an alternative approach to #5235.

Instead of specifying the task parameter logging options in UsingTask XML, we introduce an internal virtual method on TaskExtension to let implementations override the defaults.

A new internal interface has to be added to Framework to connect the task implementations to the TaskLoggingHelper that needs to consume the new method.

This is a new virtual method on Task that allows task implementations to customize how and whether to log its parameters. The default implementation preserves existing behavior, which is, log everything if LogTaskInputs is true. Overrides on specific tasks customize this behavior to avoid logging item metadata where not relevant, or not log some parameters at all.

For example since the Hash task only looks at the ItemSpec, there's no point to log metadata for the input items.

The tasks were chosen by the most output. These cause the majoriy of logging for task inputs and outputs.

This does not touch tasks important for build investigations such as Rar and Csc and NuGet-related tasks. Tasks modified were carefully chosen to ensure we don't lose useful information from the logs.
Tasks can customize the parameter logging behavior. All new API is internal.
@cdmihai
Copy link
Contributor

cdmihai commented Apr 10, 2020

How about keeping both mechanisms? Tasks that know for sure it some of its items or metadata do not add any logging value can remove them via this PR. For tasks that cannot be changed, there's #5235

@KirillOsenkov
Copy link
Member Author

I don't mind ;) Will fix conflicts shortly.

Was curious what the team thinks since I'm not 100% on either approach.

@KirillOsenkov
Copy link
Member Author

I'm thinking I like the UsingTask approach much better as it's more extensible and doesn't require to change the task classes.

#5235

Let's keep this PR around for a bit but if all goes well I'll just abandon it.

@cdmihai
Copy link
Contributor

cdmihai commented Apr 10, 2020

We discussed it a bit in the PR review today. Using task is seen as not that great, because it's hard for the user to override UsingTask elements. Unfortunately first one wins, not last one wins. This assumes the scenario where the user wants to tone down a task and has to add using task to do so. He has to make sure his using task element is the first.

Regarding the TaskExtension approach, I don't remember any points against it, other than it should be in Task, not TaskExtension.

I'll invite you to the next PR review so we can brain storm.

@KirillOsenkov
Copy link
Member Author

I think there was a reason it is on TaskExtension, not Task. Task is in Microsoft.Build.Utilities.Core and TaskExtension is in Microsoft.Build.Tasks.Core. I think it was IVT related...

Assemblies

@KirillOsenkov
Copy link
Member Author

Also I honestly don't foresee users needing to change that all that often - the mechanism is predominantly for us, and I don't even think we'll need to extend it in the future, maybe just for NuGet tasks. And for that we can just do that at the original UsingTask.

@KirillOsenkov
Copy link
Member Author

Here's another approach, via simple properties:
#5268

@rainersigwald
Copy link
Member

Team triage: closing in favor of #5268.

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.

3 participants