gibahjoe / openapi-generator-dart

Openapi Generator for Dart/Flutter
BSD 3-Clause "New" or "Revised" License
128 stars 34 forks source link

Flutter pub get after generation on widows fail #17

Closed robertcsakany closed 4 years ago

robertcsakany commented 4 years ago

We have a project where 2 YAML file used for generation inside a project lib directory. We would like to use the generated files only not as a whole project - so we have all of required DIO/Dart-generator definition in our root pubspec. The generation is fine and in mac/linux everything is fine.

The problem is with this code block:

    print(
        'OpenapiGenerator :: Codegen ${pr.exitCode != 0 ? 'Failed' : 'completed successfully'}');
    exitCode = pr.exitCode;

    if (exitCode == 0) {
      var installOutput = await Process.run('flutter', ['pub', 'get'],
          workingDirectory: '$outputDirectory');

      print(installOutput.stderr);
      print(
          'OpenapiGenerator :: Install exited with code ${installOutput.exitCode}');
      exitCode = installOutput.exitCode;
    }

I'm not sure what is the root, the flutter is installed system wide, I tried with normal command and power shell, same result.

I think it's can be a good idea if the run of the pub get can be set in annotation (maybe I will create and issue and pull request for that part) - for example in our case it's not required at all, but the original problem is stays, flutter pub get does not work some reason.

The log is:

[FINE] openapi_generator:openapi_generator on lib/external_ap/rest/external_ap.dart:Running OpenapiGenerator
[WARNING] openapi_generator:openapi_generator on lib/external_ap/rest/external_ap.dart:
OpenapiGenerator :: [generate -i lib/external_ap/rest/external_ap.yaml -g dart2-api -o lib/external_ap/rest --additional-properties=pubAuthor=Judo Generator,pubName=externalAP]
[WARNING] openapi_generator:openapi_generator on lib/external_ap/rest/external_ap.dart:
------------------------------------------------------
|                                                     |
|             Openapi generator for dart              |
|                                                     |
|                                                     |
------------------------------------------------------
[WARNING] openapi_generator:openapi_generator on lib/external_ap/rest/external_ap.dart:
Executing command [generate -i lib/external_ap/rest/external_ap.yaml -g dart2-api -o lib/external_ap/rest --additional-properties=pubAuthor=Judo Generator,pubName=externalAP]
[FINE] openapi_generator:openapi_generator on lib/external_ap/rest/lib/api.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on test/widget_test.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/external_ap/store/package.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/external_ap/ui/drawer_items.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/external_ap/ui/navigation_state.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/external_ap/ui/pages/package.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/external_ap/ui/pages/tables/package.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/external_ap/ui/routes/router.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/external_ap/ui/routes/transition.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/external_ap/ui/scaffold.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/external_ap/ui/settings.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/external_ap/utilities/package.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/generated_plugin_registrant.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/internal_ap/components/package.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/internal_ap/injector/injector.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/internal_ap/main.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/internal_ap/main_release.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/internal_ap/repository/package.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/internal_ap/rest/internal_ap.dart:Running OpenapiGenerator
[WARNING] openapi_generator:openapi_generator on lib/internal_ap/rest/internal_ap.dart:
OpenapiGenerator :: [generate -i lib/internal_ap/rest/internal_ap.yaml -g dart2-api -o lib/internal_ap/rest --additional-properties=pubAuthor=Judo Generator,pubName=internalAP]
[WARNING] openapi_generator:openapi_generator on lib/internal_ap/rest/internal_ap.dart:
------------------------------------------------------
|                                                     |
|             Openapi generator for dart              |
|                                                     |
|                                                     |
------------------------------------------------------
[WARNING] openapi_generator:openapi_generator on lib/internal_ap/rest/internal_ap.dart:
Executing command [generate -i lib/internal_ap/rest/internal_ap.yaml -g dart2-api -o lib/internal_ap/rest --additional-properties=pubAuthor=Judo Generator,pubName=internalAP]
[FINE] openapi_generator:openapi_generator on lib/internal_ap/rest/lib/api.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/internal_ap/store/package.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/internal_ap/ui/drawer_items.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/internal_ap/ui/navigation_state.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/internal_ap/ui/pages/package.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/internal_ap/ui/pages/tables/package.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/internal_ap/ui/routes/router.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/internal_ap/ui/routes/transition.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/internal_ap/ui/scaffold.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/internal_ap/ui/settings.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/internal_ap/utilities/package.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/main.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/external_ap/ui/routes/router.gr.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/internal_ap/ui/routes/router.gr.dart:Running OpenapiGenerator
[FINE] openapi_generator:openapi_generator on lib/external_ap/injector/injector.config.dart:Running OpenapiGenerator
[INFO] Heartbeat:1m 24s elapsed, 1265/1267 actions completed.
[INFO] Heartbeat:1m 25s elapsed, 1265/1267 actions completed.
[INFO] Heartbeat:1m 26s elapsed, 1265/1267 actions completed.
[INFO] Heartbeat:1m 27s elapsed, 1265/1267 actions completed.
[INFO] Heartbeat:1m 28s elapsed, 1265/1267 actions completed.
[WARNING] openapi_generator:openapi_generator on lib/external_ap/rest/external_ap.dart:

[WARNING] openapi_generator:openapi_generator on lib/external_ap/rest/external_ap.dart:
OpenapiGenerator :: Codegen completed successfully
[SEVERE] openapi_generator:openapi_generator on lib/external_ap/rest/external_ap.dart:

ProcessException: The system cannot find the file specified.

  Command: flutter pub get

CreateProcessW failed 2
[INFO] Heartbeat:1m 30s elapsed, 1266/1267 actions completed.
[INFO] Heartbeat:1m 31s elapsed, 1266/1267 actions completed.
[INFO] Heartbeat:1m 32s elapsed, 1266/1267 actions completed.
[INFO] Heartbeat:1m 33s elapsed, 1266/1267 actions completed.
[INFO] Heartbeat:1m 34s elapsed, 1266/1267 actions completed.
[WARNING] openapi_generator:openapi_generator on lib/internal_ap/rest/internal_ap.dart:

[WARNING] openapi_generator:openapi_generator on lib/internal_ap/rest/internal_ap.dart:
OpenapiGenerator :: Codegen completed successfully
[SEVERE] openapi_generator:openapi_generator on lib/internal_ap/rest/internal_ap.dart:

ProcessException: The system cannot find the file specified.

  Command: flutter pub get

CreateProcessW failed 2
[INFO] Heartbeat:1m 36s elapsed, 1286/1286 actions completed.
[INFO] Heartbeat:1m 37s elapsed, 1320/1320 actions completed.
[INFO] Heartbeat:1m 38s elapsed, 1353/1354 actions completed.
[INFO] Heartbeat:1m 40s elapsed, 1399/1402 actions completed.
[INFO] Heartbeat:1m 41s elapsed, 1429/1432 actions completed.
[INFO] Heartbeat:1m 42s elapsed, 1475/1477 actions completed.
[INFO] Heartbeat:1m 43s elapsed, 1515/1520 actions completed.
[INFO] Build:Running build completed, took 1m 43s

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

[SEVERE] Build:
Failed after 1m 44s
[+136684 ms] "flutter run" took 123,288ms.
[  +20 ms] pub finished with exit code 1
[  +14 ms]
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
           #1      _DefaultPub.interactively (package:flutter_tools/src/dart/pub.dart:375:7)
           <asynchronous suspension>
           #2      PackagesForwardCommand.runCommand (package:flutter_tools/src/commands/packages.dart:260:15)
           #3      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:972:18)
           #4      _rootRunUnary (dart:async/zone.dart:1198:47)
           #5      _CustomZone.runUnary (dart:async/zone.dart:1100:19)
           #6      _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
           #7      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
           #8      Future._propagateToListeners (dart:async/future_impl.dart:725:32)
           #9      Future._completeWithValue (dart:async/future_impl.dart:529:5)
           #10     Future._asyncCompleteWithValue.<anonymous closure> (dart:async/future_impl.dart:567:7)
           #11     _rootRun (dart:async/zone.dart:1190:13)
           #12     _CustomZone.run (dart:async/zone.dart:1093:19)
           #13     _CustomZone.runGuarded (dart:async/zone.dart:997:7)
           #14     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1037:23)
           #15     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
           #16     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
           #17     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
           #18     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)

[ +103 ms] ensureAnalyticsSent: 67ms
[   +6 ms] Running shutdown hooks
[   +1 ms] Shutdown hooks complete
[   +1 ms] exiting with code 1
gibahjoe commented 4 years ago

fixed with #21