Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to generate files in different directories #54

Closed
andrew-tpz opened this issue Jun 2, 2022 · 3 comments
Closed

Unable to generate files in different directories #54

andrew-tpz opened this issue Jun 2, 2022 · 3 comments

Comments

@andrew-tpz
Copy link

Maybe this can help:
https://github.com/dart-lang/source_gen/tree/master/source_gen#generating-files-in-different-directories

@smotastic
Copy link
Owner

Hi andrew,

so the idea is to make it configurable (via environments?) where the generated files will be placed?
If the yaml is also able to read environments, this should be fairly easy to implement by adding the location in the generator/build.yaml

@andrew-tpz
Copy link
Author

Hi,
I can set output folder for json_serializable and freezed by adding build.yaml to my project:

targets:
  $default:
    builders:
      source_gen|combining_builder:
        options:
          build_extensions:
            '^lib/{{}}.dart': 'lib/gen/{{}}.g.dart'
      freezed:
        options:
          build_extensions:
            '^lib/{{}}.dart': 'lib/gen/{{}}.freezed.dart'

After that all *.g.dart and *.freezed.dart files are saved into "/lib/gen/..." root folder. I want to place all *.mapper.g.dart files there too.

@smotastic
Copy link
Owner

Fixed with #60

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants