run method
Runs this command.
The return value is wrapped in a Future
if necessary and returned by
CommandRunner.runCommand
.
Implementation
@override
Future<int> run() async {
final root = await rootOf(rootPath);
final generator = switch ((profile, release)) {
(true, _) => ConstructGenerator.profile,
_ => ConstructGenerator.release,
}(
flavor: flavor,
routesHandler: routesHandler,
makers: constructs,
logger: logger,
fs: fs,
rootPath: root.path,
dartDefines: defines,
generateConstructType: type,
);
await generator.clean(type: type);
final progress = logger.progress('Building');
if (await generator.generate(progress.update) case final server
when server == null) {
progress.fail('Build failed');
logger.flush();
return 1;
}
progress.complete('Build succeeded');
return 0;
}