Skip to content

[Foundation] Introduce DI container in build orchestrator #89

Description

@ChrisonSimtian

Part of the v11 internal-foundation workstream. See docs/roadmap.md and milestone #6.

Goal

Introduce Microsoft.Extensions.DependencyInjection inside the build orchestrator. Set up a composition root that registers default implementations of every infrastructure interface (file system, process runner, console host, etc.) and resolves them via constructor injection.

Consumer-facing API stays identicalExecute<T>() is still the static entrypoint; internally it builds the ServiceProvider, registers defaults, runs the orchestrator.

Scope

  • Add Microsoft.Extensions.DependencyInjection to Directory.Packages.props.
  • Create a BuildHostBuilder that produces a configured IServiceProvider per build invocation. Lives in Fallout.Build.
  • Register defaults for the interfaces from [Foundation] Wrap IO/process/console statics behind injectable interfaces #91IFileSystem, IProcessRunner, IConsoleHost, IBuildStatePersistence.
  • Plumb the IServiceProvider through BuildExecutor, ExecutionPlanner, ParameterService. Replace direct static calls with resolved dependencies.
  • Keep static facades (ProcessTasks.StartProcess, AbsolutePath.*) as default wrappers that resolve their dependency from a per-build ambient context (AsyncLocal<IServiceProvider> or similar). Statics on the surface, DI underneath.

Verification

  • BuildExecutor unit tests can now pass a fake IProcessRunner and assert it was invoked as expected. Add at least one as proof.
  • ./build.ps1 still runs end-to-end with no behavioral changes.
  • No IServiceCollection.AddSingleton<T> call reaches into Fallout.Common internals — registration is shaped against the interfaces only.

Out of scope (tracked separately)

Blocks

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions