Build runner generation on Flutter 2.10.3 for schema.graphql failed!!
I can not generate code from schema.graphql file because flutter pub run build_runner build --delete-conflicting-outputs
failed.
build_runner result: `[INFO] Generating build script... [INFO] Generating build script completed, took 378ms
[INFO] Precompiling build script...... [WARNING] /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/gql_code_builder-0.2.0/lib/src/ast.dart:618:12: Error: A non-null value must be returned since th e return type 'Expression' doesn't allow null.
- 'Expression' is from 'package:code_builder/src/specs/expression.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/code_builder-4.1.0/lib/src/specs /expression.dart'). Expression _directiveLocation(DirectiveLocation location) { ^ [INFO] Precompiling build script... completed, took 5.5s
[SEVERE] Failed to precompile build script .dart_tool/build/entrypoint/build.dart. This is likely caused by a misconfigured builder definition.
pub finished with exit code 78 `
build.yaml : `targets: $default: builders: gql_build|schema_builder: enabled: true gql_build|ast_builder: enabled: true gql_build|data_builder: enabled: true options: schema: untitled|lib/schema.graphql gql_build|var_builder: enabled: true options: schema: untitled|lib/schema.graphql gql_build|serializer_builder: enabled: true options: schema: untitled|lib/schema.graphql
ferry_generator|req_builder:
enabled: true
options:
schema: untitled|lib/schema.graphql`
pubspec.yaml: `dependencies: flutter: sdk: flutter cupertino_icons: ^1.0.2 ferry: ^0.10.4 gql_http_link: ^0.4.0 gql_code_builder:
dev_dependencies: flutter_test: sdk: flutter build_runner: ^2.1.4 ferry_generator: ^0.4.4`
Are you able to resolve it?
This is only temporary solution.
- Switching Ferry to its dev verion in pubspec.yaml:
ferry: ^0.10.5-dev.3 - Switching Ferry_generator in your dev_dependencies:
ferry_generator: git: url: https://github.com/axrs/ferry.git path: packages/ferry_generator
- My build.yaml with some Custome Serializer:
targets: $default: builders: ferry_generator|graphql_builder: generate_for: - lib/graphql/news/** enabled: true options: schema: flutter_base|lib/graphql/news/schema.graphql type_overrides: DateTime: name: DateTime Upload: name: MultipartFile import: 'package:http/http.dart' ferry_generator|serializer_builder: enabled: true options: schema: flutter_base|lib/graphql/news/schema.graphql custom_serializers: - import: 'package:flutter_base/graphql/serializers/date_serializer.dart' name: DateSerializer - import: 'package:flutter_base/graphql/serializers/upload_serializer.dart' name: UploadSerializer built_value_generator:built_value: generate_for: - lib/graphql/news/** source_gen:combining_builder: generate_for: - lib/graphql/news/**
@minhhoangtn
[WARNING] Configuring gql_build:schema_builder in target app:app but this is not a known Builder
Are you familiar of this error?
@minhhoangtn
[WARNING] Configuring
gql_build:schema_builderin targetapp:appbut this is not a known BuilderAre you familiar of this error?
Maybe you are missing ferry_generator in your dev_dependencie
This is mine
s
When using the ferry_generator fork, nothing gets generated, and everything that was there, gets deleted:
[WARNING] Configuring `gql_build:schema_builder` in target `my_app:my_app` but this is not a known Builder
[WARNING] Configuring `gql_build:ast_builder` in target `my_app:my_app` but this is not a known Builder
[WARNING] Configuring `gql_build:data_builder` in target `my_app:my_app` but this is not a known Builder
[WARNING] Configuring `gql_build:var_builder` in target `my_app:my_app` but this is not a known Builder
[WARNING] Configuring `gql_build:serializer_builder` in target `my_app:my_app` but this is not a known Builder
[WARNING] Configuring `ferry_generator:req_builder` in target `my_app:my_app` but this is not a known Builder
So I can finaly confirm that the isue is gone with using all stable versions and pinning the versions:
ependency_overrides:
analyzer: ^3.3.0
gql: 0.13.0
At least as long I do NOT use --delete-conflicting-outputs
I'm having the same issue. With the stable versions of ferry and ferry_generator, I'm getting
[WARNING] ../../../../../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/gql_code_builder-0.2.0/lib/src/ast.dart:618:12: Error: A non-null value must be returned since the return type 'Expression' doesn't allow null.
- 'Expression' is from 'package:code_builder/src/specs/expression.dart' ('../../../../../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/code_builder-4.1.0/lib/src/specs/expression.dart').
Expression _directiveLocation(DirectiveLocation location) {
^
[INFO] Precompiling build script... completed, took 5.9s
[SEVERE] Failed to precompile build script .dart_tool/build/entrypoint/build.dart.
This is likely caused by a misconfigured builder definition.
After upgrading both packages to dev, I'm getting this:
[WARNING] Configuring `gql_build:schema_builder` in target `shsdk:shsdk` but this is not a known Builder
[WARNING] Configuring `gql_build:ast_builder` in target `shsdk:shsdk` but this is not a known Builder
[WARNING] Configuring `gql_build:data_builder` in target `shsdk:shsdk` but this is not a known Builder
[WARNING] Configuring `gql_build:var_builder` in target `shsdk:shsdk` but this is not a known Builder
[WARNING] Configuring `gql_build:serializer_builder` in target `shsdk:shsdk` but this is not a known Builder
[WARNING] Configuring `ferry_generator:req_builder` in target `shsdk:shsdk` but this is not a known Builder
[SEVERE] Nothing can be built, yet a build was requested.
It doesn't matter whether or not I use the --delete-conflicting-outputs flag.
@sunderee did you add gql_build as a package?
@appinteractive correct, I did. To no avail. I've dropped working with the library and I've instead reverted to manually deserializing all models.
@appinteractive correct, I did. To no avail. I've dropped working with the library and I've instead reverted to manually deserializing all models.
@appinteractive @sunderee if you are working with dev version check this
Thanks @chungonion, I did the switch already to the graphql package.
Fixed with the latest stable