Skip to content

[Foundation] Introduce DI container in build orchestrator #89

Closed

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 identical — Execute<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 #91 — IFileSystem, 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

Activity

  1. ChrisonSimtian commented on Jun 16, 2026

    @ChrisonSimtian
    CollaboratorAuthor

    Superseded by the [Foundation] FT-* series (epic #315), which re-decomposes this engine-foundation work with file:line findings and an explicitly backwards-compatible, facade-preserving scope (vs. the obsolete v11 "breaking" framing here). Tracked going forward by: #307 (BuildContext) + #308 (facades) — the lightweight ambient-context approach replaces a full DI container. Closing to avoid double-counting milestone #6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions