# We run drift's builder in two different configurations on this package. The
# default configuration (in the `$default`) package applies a range of
# recommended builder options that are unlikely to cause problems.
# For additional testing, the version of drift_dev generating the custom tables
# file has `store_date_time_values_as_text` build option enabled.
# This way, we get to write integration tests for both date time modes.

targets:
  drift_regular:
    auto_apply_builders: false
    sources:
      exclude:
        # Exlude sources used for the drift-file based generation source
        - "test/generated/custom_tables.dart"
        - "test/generated/data_classes.dart"
        - "test/generated/tables.drift*"
    builders:
      drift_dev:
        enabled: true
        generate_for:
          exclude:
            # Exlude sources used for the drift-file based generation source
            - "test/generated/custom_tables.dart"
            - "test/generated/data_classes.dart"
            - "test/generated/tables.drift*"
        options:
          override_hash_and_equals_in_result_sets: true
          use_column_name_as_json_key_when_defined_in_moor_file: true
          write_from_json_string_constructor: true
          raw_result_set_data: true
          named_parameters: true
          fatal_warnings: true
          sql:
            dialects: [sqlite, postgres]
            options:
              version: "3.37"
              modules:
                - json1
                - fts5
                - geopoly
  drift_custom:
    auto_apply_builders: false
    sources:
     - "test/generated/custom_tables.dart"
     - "test/generated/data_classes.dart"
     - "test/generated/tables.drift*"
    builders:
      drift_dev:
        options:
          fatal_warnings: true
          store_date_time_values_as_text: true
          # Dart doesn't support YAML merge tags yet, https://github.com/dart-lang/yaml/issues/121
          override_hash_and_equals_in_result_sets: true
          use_column_name_as_json_key_when_defined_in_moor_file: true
          write_from_json_string_constructor: true
          raw_result_set_data: true
          named_parameters: true
          sql:
            dialect: sqlite
            options:
              version: "3.37"
              modules:
                - json1
                - fts5
                - geopoly

  web_worker:
    auto_apply_builders: false
    builders:
      build_web_compilers:entrypoint:
        enabled: true
        generate_for:
          - "web/drift_worker.dart"
        options:
          compiler: dart2js

  $default:
    dependencies: [:drift_regular, :drift_custom, :web_worker]
    builders:
      build_test:test_bootstrap:
        enabled: false
      drift_dev:
        enabled: false
      build_web_compilers:entrypoint:
        enabled: true
        generate_for:
          - "test/**.browser_test.dart"
        options:
          compiler: dartdevc
