Skip to content

Commit

Permalink
Format code and log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
HakkyuKim committed Jan 14, 2022
1 parent 968c857 commit 20eba93
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 33 deletions.
42 changes: 30 additions & 12 deletions tools/lib/src/build_examples_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,54 @@ class BuildExamplesCommand extends PackageLoopingCommand {
Future<PackageResult> runForPackage(RepositoryPackage package) async {
final List<String> errors = <String>[];

if (await processRunner.runAndStream(
'flutter-tizen', <String>['pub', 'get'],
workingDir: package.directory) !=
0) {
int exitCode = await processRunner.runAndStream(
'flutter-tizen',
<String>['pub', 'get'],
workingDir: package.directory,
);
if (exitCode != 0) {
errors.add('${package.displayName} (pub get failed)');
return PackageResult.fail(errors);
}

bool builtSomething = false;
for (final RepositoryPackage example in package.getExamples()) {
final String packageName =
getRelativePosixPath(example.directory, from: packagesDir);
final String packageName = getRelativePosixPath(
example.directory,
from: packagesDir,
);

builtSomething = true;
// TODO(HakkyuKim): Support different profiles.
workingDir: example.directory);
final int exitCode = await processRunner.runAndStream(
'flutter-tizen',
<String>[
'build',
'tpk',
'--device-profile',
'wearable',
'-v',
],
workingDir: example.directory,
);
if (exitCode != 0) {
errors.add(packageName);
}
}
if (await processRunner.runAndStream('flutter-tizen', <String>['clean'],
workingDir: package.directory) !=
0) {
logWarning('Failed to clean ${package.displayName} after build.');
}

if (!builtSomething) {
errors.add('No examples found');
}

exitCode = await processRunner.runAndStream(
'flutter-tizen',
<String>['clean'],
workingDir: package.directory,
);
if (exitCode != 0) {
logWarning('Failed to clean ${package.displayName} after build.');
}

return errors.isEmpty
? PackageResult.success()
: PackageResult.fail(errors);
Expand Down
45 changes: 24 additions & 21 deletions tools/lib/src/integration_test_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,35 @@ class IntegrationTestCommand extends PluginCommand {
argParser.addFlag(
_generateEmulatorsArg,
help: 'Create and destroy emulators during test.\n\n'
'Must provide either $_platformsArg or $_recipeArg option to specify\n'
'Must provide either $_platformsArg or $_recipeArg option to specify '
'which platforms to create.',
);
argParser.addOption(
_platformsArg,
help: 'Run integration test on all connected devices that satisfy\n'
'<device_profile>-<platform_version> (ex: wearable-5.5, tv-6.0).\n\n'
'The selected devices will be used to test all plugins,\n'
'if you wish to run different devices for each plugin,\n'
'use the $_recipeArg option instead.',
'Selected devices will be used to test all plugins, if you wish to\n'
'run different devices for each plugin, use $_recipeArg instead.',
valueHelp: '<device_profile>-<platform_version>',
);
argParser.addOption(_recipeArg,
help:
'The recipe file path. A recipe refers to a yaml file that defines\n'
'a list of target platforms to test for each plugin.\n\n'
'Pass this file if you want to select specific target platforms\n'
'for different plugins. Every package listed in the recipe file\n'
'will be recognized by the tool (same as $_packagesArg option)\n'
'and those that specify an empty list will be explicitly excluded\n'
'(same as $_excludeArg option). If $_recipeArg is used,\n'
'$_packagesArg and $_excludeArg options will be ignored.\n\n'
'plugins:\n'
' a: [wearable-5.5, tv-6.0]\n'
' b: [mobile-6.0]\n'
' c: [wearable-4.0]\n'
' d: [] # explicitly excluded\n',
valueHelp: 'recipe.yaml');
argParser.addOption(
_recipeArg,
help:
'The recipe file path. A recipe refers to a yaml file that defines\n'
'a list of target platforms to test for each plugin.\n\n'
'Pass this file if you want to select specific target platforms\n'
'for different plugins. Every package listed in the recipe file\n'
'will be recognized by the tool (same as $_packagesArg option)\n'
'and those that specify an empty list will be explicitly excluded\n'
'(same as $_excludeArg option). If $_recipeArg is used,\n'
'$_packagesArg and $_excludeArg options will be ignored.\n\n'
'plugins:\n'
' a: [wearable-5.5, tv-6.0]\n'
' b: [mobile-6.0]\n'
' c: [wearable-4.0]\n'
' d: [] # explicitly excluded\n',
valueHelp: 'recipe.yaml',
);
argParser.addOption(
_timeoutArg,
help: 'Timeout limit of each integration test in seconds.',
Expand Down Expand Up @@ -83,7 +84,9 @@ class IntegrationTestCommand extends PluginCommand {

// TODO(HakkyuKim): Migrate python tool logic to dart.
final int exitCode = await processRunner.runAndStream(
_pythonTool.path, <String>['test', ...argResults!.arguments]);
_pythonTool.path,
<String>['test', ...argResults!.arguments],
);
if (exitCode != 0) {
throw ToolExit(exitCode);
}
Expand Down

0 comments on commit 20eba93

Please sign in to comment.