diff --git a/chopper_generator/CHANGELOG.md b/chopper_generator/CHANGELOG.md index 2c58007d..881ab59e 100644 --- a/chopper_generator/CHANGELOG.md +++ b/chopper_generator/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 6.0.2 + +- Add support for generating files in different directories ([#444](https://github.com/lejard-h/chopper/pull/444)) + ## 6.0.1 - Packages upgrade, constraints upgrade diff --git a/chopper_generator/lib/chopper_generator.dart b/chopper_generator/lib/chopper_generator.dart index 74355389..84099889 100644 --- a/chopper_generator/lib/chopper_generator.dart +++ b/chopper_generator/lib/chopper_generator.dart @@ -5,4 +5,4 @@ import 'package:build/build.dart'; import 'src/generator.dart'; Builder chopperGeneratorFactory(BuilderOptions options) => - chopperGeneratorFactoryBuilder(header: options.config['header']); + chopperGeneratorFactoryBuilder(options); diff --git a/chopper_generator/lib/src/generator.dart b/chopper_generator/lib/src/generator.dart index 72635a75..cb3b4f2f 100644 --- a/chopper_generator/lib/src/generator.dart +++ b/chopper_generator/lib/src/generator.dart @@ -634,10 +634,19 @@ class ChopperGenerator extends GeneratorForAnnotation { } } -Builder chopperGeneratorFactoryBuilder({String? header}) => PartBuilder( +Builder chopperGeneratorFactoryBuilder(BuilderOptions options) => PartBuilder( [ChopperGenerator()], '.chopper.dart', - header: header, + header: options.config['header'], + formatOutput: + PartBuilder([ChopperGenerator()], '.chopper.dart').formatOutput, + options: !options.config.containsKey('build_extensions') + ? options.overrideWith( + BuilderOptions({ + 'build_extensions': {'.dart': '.chopper.dart'}, + }), + ) + : options, ); bool getMethodOptionalBody(ConstantReader method) => diff --git a/chopper_generator/pubspec.yaml b/chopper_generator/pubspec.yaml index 716f5332..ee10e5de 100644 --- a/chopper_generator/pubspec.yaml +++ b/chopper_generator/pubspec.yaml @@ -1,6 +1,6 @@ name: chopper_generator description: Chopper is an http client generator using source_gen, inspired by Retrofit -version: 6.0.1 +version: 6.0.2 documentation: https://hadrien-lejard.gitbook.io/chopper repository: https://github.com/lejard-h/chopper