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

Generator fails without error message #93

Open
puelocesar opened this issue Jul 26, 2023 · 6 comments
Open

Generator fails without error message #93

puelocesar opened this issue Jul 26, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@puelocesar
Copy link

Description of the bug

When running dart run build_runner build --delete-conflicting-outputs -v, it fails with a [SEVERE] message, but no error message:

dart run build_runner build --delete-conflicting-outputs -v
Building package executable... (3.4s)
Built build_runner:build_runner.
[INFO] Entrypoint:Generating build script...
[INFO] Entrypoint:Generating build script completed, took 168ms

[INFO] BuildDefinition:Initializing inputs
[INFO] BuildDefinition:Reading cached asset graph...
[INFO] BuildDefinition:Reading cached asset graph completed, took 64ms

[INFO] BuildDefinition:Checking for updates since last build...
[INFO] BuildDefinition:Checking for updates since last build completed, took 628ms

[INFO] Build:Running build...
[INFO] Build:Running build completed, took 9ms

[INFO] Build:Caching finalized dependency graph...
[INFO] Build:Caching finalized dependency graph completed, took 38ms

[SEVERE] openapi_generator on lib/open_api_config.dart (cached):


[SEVERE] Build:
Failed after 54ms

Steps to reproduce

My configuration looks like this:

@Openapi(
  additionalProperties: AdditionalProperties(
    pubName: 'my_api',
    pubAuthor: 'MyAuthor',
  ),
  inputSpecFile: 'openapi.json',
  generatorName: Generator.dio,
  outputDirectory: 'packages/my_api',
)
class MyApiGeneratorConfig extends OpenapiGeneratorConfig {}

And I'm running it like this:
dart run build_runner build --delete-conflicting-outputs -v

Expected behavior

If there's something wrong with my openapi spec, of something wrong with my configuration, I expect to see error messages telling me why the generation failed.

Logs

No response

Screenshots

No response

Platform

macOS

Library version

4.11.0

Flutter version

3.10.6

Flutter channel

stable

Additional context

No response

@puelocesar puelocesar added the bug Something isn't working label Jul 26, 2023
@puelocesar
Copy link
Author

Update, I deleted my generated folder and run using flutter pub run build_runner build --delete-conflicting-outputs - instead of dart, and now I get this error right after everything was generated correctly:

[SEVERE] Build:
Failed after 27.9s
IO  : Writing 7239 characters to text file /Users/pcferreira/.pub-cache/log/pub_log.txt.
MSG : Logs written to /Users/pcferreira/.pub-cache/log/pub_log.txt.
[+29909 ms] pub failed
                     command: "/Users/pcferreira/dev/flutter/bin/cache/dart-sdk/bin/dart pub --suppress-analytics run build_runner
                     build --delete-conflicting-outputs -v"
                     pub env: {
                       "FLUTTER_ROOT": "/Users/pcferreira/dev/flutter",
                       "PUB_ENVIRONMENT": "flutter_cli:forward",
                     }
                     exit code: 1

[   +5 ms] "flutter run" took 29,989ms.
[   +2 ms]
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      _DefaultPub._runWithStdioInherited (package:flutter_tools/src/dart/pub.dart:447:7)
           <asynchronous suspension>
           #2      _DefaultPub.interactively (package:flutter_tools/src/dart/pub.dart:530:5)
           <asynchronous suspension>
           #3      PackagesForwardCommand.runCommand (package:flutter_tools/src/commands/packages.dart:122:5)
           <asynchronous suspension>
           #4      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1336:27)
           <asynchronous suspension>
           #5      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #6      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command_runner.dart:296:9)
           <asynchronous suspension>
           #8      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #9      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:244:5)
           <asynchronous suspension>
           #10     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:91:9)
           <asynchronous suspension>
           #11     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #12     main (package:flutter_tools/executable.dart:91:3)
           <asynchronous suspension>


[  +79 ms] ensureAnalyticsSent: 75ms
[        ] Running 0 shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 1

@gibahjoe
Copy link
Owner

Hi, can you share your openapi.json. Or try if you can reproduce the error with the example code

@gibahjoe
Copy link
Owner

Hi, upon further investigation, this was a severe log that was erroneously left in the release so everything should still work fine (its just logging error when there is no error). Please confirm that everything still genarates fine (if there are other issues, let me know). I will release a minor update in the next few hours and close this issue.

@thomasgi1
Copy link

At least from my point of view I can confirm that everything still generates fine. However, more annoying than the severe log is the fact that the generator's return value is not 0. That behaviour breaks all automated builds, which rely on a correct return value of the programs called. For now we have to ignore the return value of the dart run build_runner build call in order to complete the automated build. Of course, ignoring the return value will cause more trouble in the future, if there is a real error in our OpenAPI yaml file.

@gibahjoe
Copy link
Owner

@thomasgi1 I don't believe this log should cause what you are experiencing.

I have released the patch to remove the log, please check it out. If it is still happening , please share your logs and a minimal openapi spec that reproduces the issue.

@thomasgi1
Copy link

I tested your patch. It fixes the problem. Thank you for that.

I also double checked the return value behaviour of version 4.11.0. That old version definitely returns an error code != 0. However, in version 4.11.1 the error code is 0 again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants