dart-lang / dart-lang/source_gen
Unable to generate files in a different folder
- Dominant language
- Dart
- Stars
- 494
- Forks
- 115
- Avg merge
- 12h 13m
- Merged PRs (30d)
- 3
Description
Using PartBuilder
i am not able to generate the files in specific folder.
pubspec.yaml
```
dependencies:
material: 1.0.0+2
meta: 1.10.0
source_gen: ^1.4.0
```
I have tried below in my project build.yaml file
```
auto_models:
options:
build_extensions:
"{{}}.dart": '{{dir}}/generated/{{file}}.mapped.g.dart'
```
full yaml file is
```
targets:
$default:
builders:
#general purpose .g.dart builder
source_gen|combining_builder:
enabled: true
generate_for:
- lib/**.dart
options:
build_extensions:
'^{{path}}/{{file}}.dart': '{{path}}/generated/{{file}}.g.dart'
#chopper
chopper_generator:
options:
# This assumes you want the files to end with `.chopper.g.dart`
# instead of the default `.chopper.dart`.
build_extensions:
"^{{path}}/{{file}}.dart": '{{path}}/generated/{{file}}.chopper.g.dart'
````
My package yaml file
```
targets:
$default:
builders:
auto_models|auto_models:
enabled: true
builders:
auto_models:
import: "package:auto_models/builder.dart"
builder_factories: ["dataModalBuilder"]
build_extensions: { ".dart": [ "generated/.mapped.g.dart" ] }
auto_apply: dependents
build_to: source
runs_before: ["drift_dev|drift_dev"]
applies_builders: ["source_gen|combining_builder"]
```
also tried
``` build_extensions: { ".dart": [ ".mapped.g.dart" ] } ```
but files are always generating inside same folder
Contributor guide
Research direction
Start with the project's build.yaml and package YAML configuration, then trace how PartBuilder and the source_gen|combining_builder interpret build_extensions. Reproduce the configuration with the auto_models and chopper_generator builders and compare the generated paths. Done means the requested generated files are placed in the generated folder without breaking the combining builder.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100