run method

  1. @override
Future<int> run()
override

Runs this command.

The return value is wrapped in a Future if necessary and returned by CommandRunner.runCommand.

Implementation

@override
Future<int> run() async {
  var config = readConfig();
  var isClean = argResults?["clean"] as bool;
  var isServerOnly = argResults?["server"] as bool;
  await runBuildRunner(logger, sharedLibraryDirectory.path, "shared library",
      clean: isClean, throwOnFail: true);
  await runBuildRunner(logger, serverDirectory.path, "server",
      clean: isClean, throwOnFail: true);
  if (!isServerOnly) {
    await buildOpenapiDocumentProgress(logger, CancellationToken());
    await buildGeneratedClient(logger, config,
        clean: isClean, throwOnFail: true);
    await runBuildRunner(logger, applicationDirectory.path, "application",
        clean: isClean, throwOnFail: true);
  }
  return ExitCode.success.code;
}