run method
Executes the build command to build and optionally distribute the app.
Implementation
@override
/// Executes the `build` command to build and optionally distribute the app.
Future run() async {
environment = Environment.fromArgResults(globalResults);
publisher = Publisher.fromArgResults(globalResults);
logger = ColorizeLogger(environment);
final customBuildArgs = _parseCustomArgs();
if (!await environment.initialized) {
logger.logError("Please run distribute init first");
exit(1);
}
return _executeBuild(customBuildArgs).then((value) {
if (value != 0) {
logger.logError('Build failed.');
exit(1);
} else {
logger.logSuccess('Build completed successfully.');
}
}).catchError((e) {
logger.logError('An error occurred: $e');
exit(1);
}).whenComplete(() {
logger.logSuccess('Process completed.');
});
}