Add IReporter-over-MSBuild adapter and BuildvanaSdkTask.Reporter - #304
Conversation
TaskLoggingHelperReporter bridges Core services' human-facing output to MSBuild via TaskLoggingHelper, mirroring the existing ILogger bridge: Error/Warning become build errors/warnings, Info/Detail/Trace become messages at High/Normal/Low importance, activity scopes render the same lines as ConsoleReporter at Normal importance, and child-process lines pass through as low-importance messages. Verbosity is derived from EngineServices importance filtering when available. BuildvanaSdkTask exposes a lazily built Reporter property so derived tasks can hand it to Core services. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@claude please review this PR. |
|
Claude finished @rdeago's task in 5m 16s —— View job Review
Overall this is clean, well-scoped work: it mirrors the existing A few notes, nothing blocking: 1. private void LogChildLine(string line, Verbosity? minimumVerbosity)
{
ArgumentNullException.ThrowIfNull(line);
if (minimumVerbosity is { } v && !this.IsVerbosityAtLeast(v))
{
return;
}
_log.LogMessage(MessageImportance.Low, "{0}", line);
}with 2. Slight tension with 3. 4. 5. Minor test-coverage gap: the guard clauses ( No correctness issues found in the level/importance mapping, the activity line formatting (matches |
- Collapse the identical ChildOutput/ChildError bodies into a shared LogChildLine helper. - Soften the IReporter ChildOutput/ChildError doc contract: with a null minimumVerbosity the reporter applies no gate of its own, but an underlying output system may still filter the line. - Cover the constructor and argument guard clauses with tests, adding InternalsVisibleTo for the test project. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Thanks for the review! Addressed in 8d3787a:
@claude please take another look. |
|
Claude finished @rdeago's task in 1m 14s —— View job Follow-up review
All three addressed points check out:
Items 3 ( CI ( |
Report and LogChildLine logged without the lock that BeginActivity and EndActivity take, tripping ReSharper's InconsistentlySynchronizedField at every unsynchronized _log use. Route every _log call through the lock, renamed to _writeLock to mirror ConsoleReporter's model of serializing all output. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Closes #294.
Implements the plumbing for running Core services inside MSBuild tasks (design option (b) of #267): human-facing output flows through
IReporter, bridged to the build's own loggers.Changes
TaskLoggingHelperReporter(internal,Buildvana.Sdk.Tasks) — anIReporterbacked by the task'sTaskLoggingHelper, sibling to the existingTaskLoggingHelperLoggerILoggerbridge:Report:Error→LogError,Warning→LogWarning,Info/Detail/Trace→LogMessageatHigh/Normal/Lowimportance.[depth] title: starting.../done (X.Xs)lines asConsoleReporter(outcome only afterComplete), atNormalimportance so they stay quiet at MSBuild's default (minimal) verbosity.ChildOutput/ChildErrorboth pass through as low-importance messages: MSBuild has no neutral stderr channel, and a build error would fail the task over stderr lines many tools use for progress.Verbosityis derived fromIBuildEngine10.EngineServicesimportance filtering when available (fully permissive fallback), soReporterExtensionsformatting helpers skip messages MSBuild would discard; MSBuild's own verbosity gating governs visibility either way.BuildvanaSdkTaskexposes a lazily builtprotected IReporter Reporter, mirroringLogger, for derived tasks to hand to Core services. No task consumes it yet; existing tasks are unchanged.Buildvana.Sdk.Tasks.Testsproject (TUnit): a recordingIBuildEngine(plus anIBuildEngine10variant with stubbedEngineServices) drives the full mapping through the realReporterproperty of a probe task; 20 tests cover levels, importances, activity lifecycle, child passthrough, and verbosity derivation.No CHANGELOG entry: internal-only, no public-facing change.
Validation
dotnet build: zero warnings/errors; all tests pass.dotnet bv packself-hosts and produces theBuildvana.Sdkandbvpackages.inspectcode(--swea --severity=WARNING): no findings in changed code (one pre-existing false positive inBuildvana.Core.JsonSchema, untouched by this PR).🤖 Generated with Claude Code