Repository navigation
[release/11.0.1xx] Remove redundant output logging - #13684
Conversation
Backport #13129 while preserving release task logic, output properties, diagnostics, and protected virtual hooks. Adapt logging assertions for the release-only outputs. (cherry picked from commit dc740e8) Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the backport reducing redundant build-task logging and allocations.
No open issues 🎉
What changed in this PR
Backports #13129 to release/11.0.1xx, reducing redundant logging and allocations in .NET for Android build tasks without changing task outputs or release-specific behavior. MSBuild continues recording bound outputs; unbound outputs are no longer explicitly dumped.
Changes:
- Removes output-only messages from 29 build, debugging, and preparation task files.
- Preserves useful diagnostics, output computations, and the protected
LogOutputsextension hook. - Updates six test files to verify output values and the absence of removed messages.
| File | Description |
|---|---|
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/ValidateJavaVersionTests.cs | Checks version outputs and removed logging. |
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/ResolveSdksTaskTests.cs | Checks SDK and tooling output dumps are absent. |
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/RemoveDirTests.cs | Verifies removed-directory output without logging. |
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/CopyIfChangedTests.cs | Verifies copy outputs and retained skip diagnostics. |
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/DebuggingTasksTests.cs | Tests architecture shortcut outputs and logging. |
| src/Xamarin.Android.Build.Tasks/Tasks/ValidateJavaVersion.cs | Removes Java version output messages. |
| src/Xamarin.Android.Build.Tasks/Tasks/ResolveSdksTask.cs | Removes resolved SDK path dumps. |
| src/Xamarin.Android.Build.Tasks/Tasks/ResolveLibraryProjectImports.cs | Removes resolved library item dumps. |
| src/Xamarin.Android.Build.Tasks/Tasks/ResolveAndroidTooling.cs | Removes output dumps while retaining the virtual hook. |
| src/Xamarin.Android.Build.Tasks/Tasks/RemoveUnknownFiles.cs | Removes deleted-file and directory output dumps. |
| src/Xamarin.Android.Build.Tasks/Tasks/RemoveDirFixed.cs | Removes deleted-directory output logging. |
| src/Xamarin.Android.Build.Tasks/Tasks/ReadLibraryProjectImportsCache.cs | Removes cached library import dumps. |
| src/Xamarin.Android.Build.Tasks/Tasks/ReadImportedLibrariesCache.cs | Removes cached library output dumps. |
| src/Xamarin.Android.Build.Tasks/Tasks/Legacy/ResolveAndroidTooling.cs | Removes framework-version logging; preserves override. |
| src/Xamarin.Android.Build.Tasks/Tasks/GetImportedLibraries.cs | Removes imported library output dumps. |
| src/Xamarin.Android.Build.Tasks/Tasks/GetFilesThatExist.cs | Removes existing-file output logging. |
| src/Xamarin.Android.Build.Tasks/Tasks/GetExtraPackages.cs | Removes extra-package output logging. |
| src/Xamarin.Android.Build.Tasks/Tasks/GenerateLayoutBindings.cs | Removes generated-file dumps; retains warning. |
| src/Xamarin.Android.Build.Tasks/Tasks/FindLayoutsToBind.cs | Removes layout dumps; retains no-layout diagnostic. |
| src/Xamarin.Android.Build.Tasks/Tasks/DetermineJavaLibrariesToCompile.cs | Removes Java library output dumps. |
| src/Xamarin.Android.Build.Tasks/Tasks/CreateTemporaryDirectory.cs | Removes temporary-directory output logging. |
| src/Xamarin.Android.Build.Tasks/Tasks/CopyIfChanged.cs | Removes modified-file output dump. |
| src/Xamarin.Android.Build.Tasks/Tasks/CopyGeneratedJavaResourceClasses.cs | Removes primary resource-file output logging. |
| src/Xamarin.Android.Build.Tasks/Tasks/ConvertCustomView.cs | Removes hash and stamp metadata logging. |
| src/Xamarin.Android.Build.Tasks/Tasks/ComputeHash.cs | Removes hashed-item output dump. |
| src/Xamarin.Android.Build.Tasks/Tasks/CalculateLayoutCodeBehind.cs | Removes generated binding and partial-class dumps. |
| src/Xamarin.Android.Build.Debugging.Tasks/Tasks/GetPrimaryCpuAbi.cs | Removes output dumps from shortcut, cache, and device paths. |
| src/Microsoft.Android.Build.Tasks/Tests/Microsoft.Android.Build.Tasks.Tests/GetAndroidPackageNameTests.cs | Verifies package-name output without logging. |
| src/Microsoft.Android.Build.Tasks/Tasks/GetAndroidPackageName.cs | Removes package-name output logging. |
| build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/Which.cs | Removes executable-location output logging. |
| build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/GitCommitsInRange.cs | Removes commit-count output logging. |
| build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/GitCommitHash.cs | Removes abbreviated-hash output logging. |
| build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/GitBranch.cs | Removes branch output logging. |
| build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/GitBlame.cs | Removes commit and line metadata dumps. |
| build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/Git.cs | Removes captured-output dumps. |
Review effort: Balanced
|
@dalexsoto review |
dalexsoto
left a comment
There was a problem hiding this comment.
Reviewed 486f8625 against release/11.0.1xx at 5a1fc50b (merge base 93e2c07d). This is a static review; I didn't run any builds or tests.
I compared this against #13129 (dc740e88). It changes the same 35 files, and the hunks are identical apart from the release-only bits: the ToolsAbi line in GetPrimaryCpuAbi, AndroidSequencePointsMode in ResolveAndroidTooling and AndroidBinUtilsPath in ResolveSdks are removed along with the rest of the output dumps. Task outputs, the cache/device logic, coded diagnostics (XA4221, XA4258) and the protected LogOutputs hook (plus the Legacy override) are unchanged.
The new GetPrimaryCpuAbiHonorsAdbTargetArchitecture test is a clean port, and the "not logged" checks in ResolveSdksTaskTests cover the release-only properties. I didn't find any targets or tests on the release branch that rely on the removed log lines. The 7 commits that landed on the branch since this PR's base don't touch any of these files, and CI is green.
LGTM 👍
Backport of #13129.
Remove duplicate task output messages to reduce logging work and allocations. Task outputs and useful diagnostics remain unchanged. MSBuild still records bound outputs; unbound outputs are no longer dumped to the log.
The conflicts were resolved as follows:
GetPrimaryCpuAbi.cs: Keep the release device, cache, runtime identifier, andToolsAbilogic; remove only the output dump.ResolveAndroidTooling.cs: KeepAndroidSequencePointsModeand the protectedLogOutputshook and legacy override; remove the output dump.ResolveSdksTask.cs: Keep release SDK discovery andAndroidBinUtilsPath; remove the output dump.DebuggingTasksTests.cs: Keep the release FastDeploy2 tests and add the architecture shortcut logging assertions without importing unrelated main-branch tests.Validation
Windows, local .NET SDK 11.0.100. Builds used
MSBUILDDISABLENODEREUSE=1.dotnet msbuild Microsoft.Android.slnx -t:Prepare -nodeReuse:false -v:minimal -bl:C:\Users\jopepper\.copilot\session-state\7b5071c4-9a5a-4267-b7c6-152e2fcfc4af\files\prepare-retry.binlog— passed. The initialbuild.cmd Prepareattempt failed on a Java.Interop file lock; the retry with node reuse disabled passed..\dotnet-local.cmd build Microsoft.Android.slnx -c Debug -nodeReuse:false -v:minimal -bl:C:\Users\jopepper\.copilot\session-state\7b5071c4-9a5a-4267-b7c6-152e2fcfc4af\files\build.binlog— passed, 136 warnings, 0 errors..\dotnet-local.cmd build src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\Xamarin.Android.Build.Tests.csproj -c Debug -nodeReuse:false -v:minimal -bl:C:\Users\jopepper\.copilot\session-state\7b5071c4-9a5a-4267-b7c6-152e2fcfc4af\files\host-tests-build.binlog— passed, 28 warnings, 0 errors..\dotnet-local.cmd build build-tools\xa-prep-tasks\xa-prep-tasks.csproj -c Debug -nodeReuse:false -v:minimal -bl:C:\Users\jopepper\.copilot\session-state\7b5071c4-9a5a-4267-b7c6-152e2fcfc4af\files\prep-tasks-build.binlog— passed, 0 warnings, 0 errors.dotnet-local.cmd test bin\TestDebug\net10.0\Xamarin.Android.Build.Tests.dll --filter "FullyQualifiedName~CopyIfChangedTests|FullyQualifiedName~RemoveDirTests|FullyQualifiedName~ResolveSdksTaskTests|FullyQualifiedName~ValidateJavaVersionTests|Name~GetPrimaryCpuAbiHonorsAdbTargetArchitecture" --logger "trx;LogFileName=host-tests.trx" --results-directory C:\Users\jopepper\.copilot\session-state\7b5071c4-9a5a-4267-b7c6-152e2fcfc4af\files\test-results— 37 passed, 0 failed or skipped.dotnet-local.cmd test bin\TestDebug\net11.0\Microsoft.Android.Build.Tasks.Tests.dll --filter "FullyQualifiedName~GetAndroidPackageNameTests" --logger "trx;LogFileName=package-tests.trx" --results-directory C:\Users\jopepper\.copilot\session-state\7b5071c4-9a5a-4267-b7c6-152e2fcfc4af\files\test-results— 4 passed, 0 failed or skipped.No linked issue.
Pull Request
title and
description
should follow the
commit-messages.mdworkflow documentation, and in particular should include: