Skip to content

2.0.0

Choose a tag to compare

@Ethan-IS Ethan-IS released this 23 Feb 10:04
0b9317a

What's Changed

1) Macro architecture was split by responsibility

  • DIContainerMacro was decomposed into parser/validator/codegen/model units:
    • Sources/InnoDIMacros/DIContainerParser.swift
    • Sources/InnoDIMacros/DIContainerValidator.swift
    • Sources/InnoDIMacros/DIContainerCodeGenerator.swift
    • Sources/InnoDIMacros/DIContainerModel.swift
  • Dependency extraction moved to SwiftSyntax AST traversal (ExpressionDependencyExtractor) instead of regex heuristics.
  • Result: easier maintenance, lower parser/validator drift, and more predictable diagnostics.

2) DAG validation became a first-class build-time contract

  • Added core cycle detection in Sources/InnoDICore/DependencyCycleDetector.swift.
  • Added CLI DAG validation mode (--validate-dag) and dedicated exit code:
    • ExitCode.dagValidationFailure = 3
  • Added build tool plugin:
    • Plugins/InnoDIDAGValidationPlugin/plugin.swift
  • @DIContainer(validateDAG: Bool = true) is now supported and defaults to validation-on.
  • In DAG validation mode, validateDAG: false containers are excluded from cycle/ambiguity judgments.
  • Ambiguous container references are promoted to explicit validation failures in DAG mode.

3) Concurrency support expanded in container APIs

  • @DIContainer signature now includes mainActor:
    • @DIContainer(validate:root:validateDAG:mainActor:)
  • @Provide signature now includes asyncFactory:
    • @Provide(..., factory: Any? = nil, asyncFactory: Any? = nil, concrete: Bool = false)
  • Async factory behavior was added for both transient/shared paths, including async task-backed shared storage (_storage_task_*).
  • Throwing behavior for async factories is inferred from closure effects.

4) Validation and parsing correctness hardened

  • Centralized parsing contract in Sources/InnoDICore/Parsing.swift and aligned macro usage.
  • Removed fragile string-based checks (e.g. async/throws detection via description matching) in favor of structured syntax checks.
  • Eliminated false-positive dependency cycles caused by string literals in factory expressions.
  • Strengthened invariant handling in cycle detection to surface impossible states instead of silently skipping.

5) Dependency graph CLI was refactored into modules

  • InnoDI-DependencyGraph moved from monolithic main into focused modules:
    • CLI args/exit codes
    • file discovery
    • container/dependency collectors
    • renderers/output writer
  • Rendering and path handling were stabilized across Mermaid/DOT/ASCII outputs.
  • Graph identity and declaration-path tracking were made deterministic for reproducible output.

6) Test coverage was significantly expanded

  • Added/expanded suites across core, macros, and CLI:
    • Tests/InnoDICoreTests/*
    • Tests/InnoDIDependencyGraphCLITests/DependencyGraphCLITests.swift
    • Tests/InnoDIMacrosTests/ProvideMacroTests.swift
    • Tests/InnoDIMacrosTests/DependencyExtractionPropertyTests.swift
    • Tests/InnoDIMacrosTests/DiagnosticsTests.swift
  • Added seed-based property tests (200 seeds) for parser/dependency/cycle invariants.
  • Added regressions for:
    • validateDAG: false ambiguity exclusion behavior
    • string-literal dependency false positives
    • async factory validation edge-cases

7) Documentation and examples were upgraded

  • Added DocC catalog:
    • Sources/InnoDI/InnoDI.docc/Overview.md
    • Sources/InnoDI/InnoDI.docc/DIContainer.md
    • Sources/InnoDI/InnoDI.docc/Provide.md
    • Sources/InnoDI/InnoDI.docc/Validation.md
  • Added doc generation tooling: Tools/generate-docc.sh
  • Added runnable examples:
    • Examples/SwiftUIExample
    • Examples/TCAIntegrationExample
    • Examples/PreviewInjectionExample
  • Updated README.md, added/expanded README.ko.md, and refreshed Examples/README.md.

8) Benchmarks and CI workflows were modernized

  • Added benchmark harness and scripts:
    • Benchmarks/run-compile-bench.sh
    • Benchmarks/run-runtime-bench.sh
    • Benchmarks/compare.sh
  • Added benchmark result JSON outputs under Benchmarks/results/.
  • CI updates:
    • PR-focused macro test workflow tuning
    • separate docs workflow and benchmark workflow
    • Apple Silicon macos-26 runner alignment and Xcode 26.2 stabilization for consistency
  • TCA example dependency pinned to swift-composable-architecture 1.23.2.

Migration Notes

  • If a dependency is .input, remove factory/asyncFactory usage for that member.
  • If you currently use async construction through factory, migrate to asyncFactory.
  • If strict global DAG validation is not desired for a specific container, set validateDAG: false explicitly.
  • For CI/local parity, use an Xcode 26.2 toolchain where possible.

PRs included in this release

Full Changelog: 1.1.1...2.0.0