# Short description for each builder

#  - preparing_builder: Infers the type of inline Dart expressions in drift files.
#    We create a `input.temp.dart` file containing the expressions so that they
#    can be resolved.
#  - drift_dev: The regular SharedPartBuilder for @DriftDatabase and @DriftAccessor
#    annotations
#  - not_shared: Like drift_dev, but as a PartBuilder instead of
#    a SharedPartBuilder. This builder is disabled by default, but users may choose
#    to use it so that generated classes can be used by other builders.
#  - cleanup: Deletes the `.temp.dart` files generated by the `preparing_builder`.

builders:
  preparing_builder:
    import: "package:drift_dev/integrations/build.dart"
    builder_factories: ["preparingBuilder"]
    build_extensions:
      ".moor": [".drift_prep.json"]
      ".drift": [".drift_prep.json"]
    build_to: cache
    applies_builders: ["drift_dev:cleanup"]

  # Regular build flow, emitting a shared part file for source_gen to pick up
  drift_dev:
    import: "package:drift_dev/integrations/build.dart"
    builder_factories: ["discover", "analyzer", "driftBuilder"]
    build_extensions:
      ".dart": [".drift.g.part", ".dart.drift_module.json"]
      ".drift": [".drift.drift_module.json"]
    auto_apply: dependents
    build_to: cache
    required_inputs: [".drift_prep.json"]
    applies_builders: ["source_gen:combining_builder", ":preparing_builder"]

  # Similar to the regular builder, but emitting a direct part file instead of a
  # shared part file.
  not_shared:
    import: "package:drift_dev/integrations/build.dart"
    builder_factories: ["driftBuilderNotShared"]
    build_extensions: {".dart": [".drift.dart"]}
    build_to: source
    auto_apply: none
    required_inputs: [".drift_prep.json"]

  # A work-in-progress builder that emits standalone Dart libraries for each
  # .drift file.
  modular:
    import: "package:drift_dev/integrations/build.dart"
    builder_factories: ["modular"]
    build_extensions: {".dart": [".drift.dart"]}
    build_to: source
    auto_apply: none
    required_inputs: [".drift.drift_module.json"]
    applies_builders: [":analyzer"]
  analyzer:
    import: "package:drift_dev/integrations/build.dart"
    builder_factories: ["discover", "analyzer"]
    build_extensions:
      ".dart": [".dart.drift_module.json"]
      ".drift": [".drift.drift_module.json"]
    build_to: cache
    auto_apply: none
    required_inputs: [".drift_prep.json"]
    applies_builders: [":preparing_builder"]

post_process_builders:
  cleanup:
    import: "package:drift_dev/integrations/build.dart"
    builder_factory: "driftCleanup"
