Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix formatting and add default value for version in runDart function #662

Merged
merged 2 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
## 3.0.12
## Unreleased

* Adds skipping version mismatch handling when using force or running with a custom fvm version. [#653](https://github.com/leoafarias/fvm/issues/653)
* Fixes parsing error of vscode settings when there are commas [#656](https://github.com/leoafarias/fvm/issues/656)
* Sets global as first default if Dart SDK is not found in the project.

## 3.0.11

Expand Down
5 changes: 2 additions & 3 deletions lib/src/commands/dart_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ class DartCommand extends BaseCommand {
..detail('');
} else {
logger
..detail('$kPackageName: Running Dart version configured in path.')
..detail('$kPackageName: Running Dart version configured in PATH.')
..detail('');

// Running null will default to dart version on path
}
// Running null will default to dart version on path
final results = await runDart(args, version: cacheVersion);

return results.exitCode;
Expand Down
1 change: 1 addition & 0 deletions lib/src/utils/commands.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Future<ProcessResult> runDart(
bool? echoOutput,
bool? throwOnError,
}) {
version ??= GlobalVersionService.fromContext.getGlobal();
if (version == null) {
return _runCmd(_dartCmd, args: args);
}
Expand Down
16 changes: 12 additions & 4 deletions lib/src/workflows/ensure_cache.workflow.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,17 @@ Future<CacheFlutterVersion> ensureCacheWorkflow(
);
}

if (integrity == CacheIntegrity.versionMismatch && !force && !validVersion.isCustom) {
if (integrity == CacheIntegrity.versionMismatch &&
!force &&
!validVersion.isCustom) {
return await _handleVersionMismatch(cacheVersion);
} else if (force) {
logger.warn('Not checking for version mismatch as --force flag is set.');
logger
.warn('Not checking for version mismatch as --force flag is set.');
} else if (validVersion.isCustom) {
logger.warn('Not checking for version mismatch as custom version is being used.');
logger.warn(
'Not checking for version mismatch as custom version is being used.',
);
}

// If shouldl install notifiy the user that is already installed
Expand Down Expand Up @@ -165,7 +170,10 @@ Future<CacheFlutterVersion> _handleVersionMismatch(
return ensureCacheWorkflow(version.name, shouldInstall: true);
}

Future<FlutterVersion> validateFlutterVersion(String version, {bool force = false}) async {
Future<FlutterVersion> validateFlutterVersion(
String version, {
bool force = false,
}) async {
final flutterVersion = FlutterVersion.parse(version);

if (force) {
Expand Down
Loading