Sub-issue of #267. Independent of Phase 4 (#293); prerequisite for Phase 7 (the NBGV swap), where the build-time version task runs VersioningService in-process. This implements the plumbing for design option (b) — run Core services inside tasks via constructor injection, bridging human-facing output through IReporter — rather than shelling to bv (a) or standing up a dedicated MSBuild DI library (c).
Scope
- New
IReporter implementation in Buildvana.Sdk.Tasks (it needs Microsoft.Build.*, so it cannot live in a host-agnostic Core library) backed by the task's TaskLoggingHelper (Log) and IBuildEngine — a sibling to the existing TaskLoggingHelperLogger ILogger bridge. Mapping:
Report(Error, …) → Log.LogError; Report(Warning, …) → Log.LogWarning; Report(Info|Detail|Trace, …) → Log.LogMessage at MessageImportance.High|Normal|Low.
BeginActivity(title) → emit a start message and return an IActivityScope that emits the outcome/elapsed line on dispose (or a lightweight scope — MSBuild already timestamps; decide during implementation).
ChildOutput / ChildError → low-importance message / error passthrough.
Verbosity: set permissive (Trace) and let MSBuild's own verbosity/importance filtering gate visibility (the build's -v already governs this); document the rationale.
- Wire it into
BuildvanaSdkTask: expose an IReporter Reporter property (mirroring the existing Logger), lazily constructed from Log/BuildEngine, so derived tasks can hand it to Core services. Keep the existing ILogger bridge.
- Tests: drive the adapter through a recording
IBuildEngine and assert each IReporter call maps to the expected MSBuild event/severity (error, warning, the three message importances, activity start/outcome, child output/error). A capture IReporter for Core-service tests, if one is needed, belongs in Buildvana.Core.Testing, not here.
- Nothing else changes: no task consumes the reporter for real work yet; existing tasks are unaffected; the build self-hosts.
Acceptance criteria
BuildvanaSdkTask exposes an engine-backed IReporter; the adapter maps every IReporter member to IBuildEngine/TaskLoggingHelper with correct severities and importances.
- Unit tests pass in CI covering the full mapping via a recording build engine.
- Existing tasks are unchanged in behavior;
dotnet bv build self-hosts.
- CHANGELOG: internal-only; no public entry.
Sub-issue of #267. Independent of Phase 4 (#293); prerequisite for Phase 7 (the NBGV swap), where the build-time version task runs
VersioningServicein-process. This implements the plumbing for design option (b) — run Core services inside tasks via constructor injection, bridging human-facing output throughIReporter— rather than shelling tobv(a) or standing up a dedicated MSBuild DI library (c).Scope
IReporterimplementation inBuildvana.Sdk.Tasks(it needsMicrosoft.Build.*, so it cannot live in a host-agnostic Core library) backed by the task'sTaskLoggingHelper(Log) andIBuildEngine— a sibling to the existingTaskLoggingHelperLoggerILoggerbridge. Mapping:Report(Error, …)→Log.LogError;Report(Warning, …)→Log.LogWarning;Report(Info|Detail|Trace, …)→Log.LogMessageatMessageImportance.High|Normal|Low.BeginActivity(title)→ emit a start message and return anIActivityScopethat emits the outcome/elapsed line on dispose (or a lightweight scope — MSBuild already timestamps; decide during implementation).ChildOutput/ChildError→ low-importance message / error passthrough.Verbosity: set permissive (Trace) and let MSBuild's own verbosity/importance filtering gate visibility (the build's-valready governs this); document the rationale.BuildvanaSdkTask: expose anIReporter Reporterproperty (mirroring the existingLogger), lazily constructed fromLog/BuildEngine, so derived tasks can hand it to Core services. Keep the existingILoggerbridge.IBuildEngineand assert eachIReportercall maps to the expected MSBuild event/severity (error, warning, the three message importances, activity start/outcome, child output/error). A captureIReporterfor Core-service tests, if one is needed, belongs inBuildvana.Core.Testing, not here.Acceptance criteria
BuildvanaSdkTaskexposes an engine-backedIReporter; the adapter maps everyIReportermember toIBuildEngine/TaskLoggingHelperwith correct severities and importances.dotnet bv buildself-hosts.