schultek / dart_mappable

Improved json serialization and data classes with full support for generics, inheritance, customization and more.
https://pub.dev/packages/dart_mappable
MIT License
145 stars 22 forks source link

change output folder #138

Closed hatch01 closed 10 months ago

hatch01 commented 10 months ago

I'm really interested in this package, with seems incredible. However, in my projects, I have folders with many models in it. So generating.mapper.g in the same folder makes it unreadable. When I user for example copywith of freezed or json_serialize, I written in my build.yaml :

targets:
  $default:
    builders:
      source_gen|combining_builder:
        generate_for:
          - lib/**.dart
        options:
          build_extensions:
            'lib/{{path}}/{{file}}.dart': 'lib/{{path}}/generated/{{file}}.g.dart'

I tried to replace source_gen|combining_builder with dart_mappable_builder, but it didn't work. I do not really understand what I'm doing with the build.yaml, but I think that having a different output dir is just not yet planned. If anyone has an idea, without modifier dart_mappable, it's perfect. Otherwise, I can make the modification if someone gives me some indication of the process to follow.

schultek commented 10 months ago

This package does not use the source_gen builders, therefore the config has no effect.

For this to work the dart_mappable_builder package would need some modification, similar to how the combining_builder accepts the build_extensions here: https://github.com/dart-lang/source_gen/blob/master/source_gen/lib/builder.dart

hatch01 commented 10 months ago

done in #140