Skip to content

Commit

Permalink
Run setup on install
Browse files Browse the repository at this point in the history
  • Loading branch information
leoafarias committed Feb 15, 2024
1 parent c8370d2 commit 3cdd202
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion lib/src/commands/install_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import '../services/project_service.dart';
import '../utils/exceptions.dart';
import '../workflows/ensure_cache.workflow.dart';
import '../workflows/setup_flutter.workflow.dart';
import '../workflows/use_version.workflow.dart';
import 'base_command.dart';

/// Installs Flutter SDK
Expand Down Expand Up @@ -34,7 +35,9 @@ class InstallCommand extends BaseCommand {

// If no version was passed as argument check project config.
if (argResults!.rest.isEmpty) {
version = ProjectService.fromContext.findVersion();
final project = ProjectService.fromContext.findAncestor();

final version = project.pinnedVersion;

// If no config found is version throw error
if (version == null) {
Expand All @@ -43,6 +46,19 @@ class InstallCommand extends BaseCommand {
' this command in a Flutter project that has FVM configured.',
);
}

final cacheVersion = await ensureCacheWorkflow(
version.name,
shouldInstall: true,
);

await useVersionWorkflow(
version: cacheVersion,
project: project,
skipSetup: false,
);

return ExitCode.success.code;
}
version ??= argResults!.rest[0];

Expand Down

0 comments on commit 3cdd202

Please sign in to comment.