From 869f21acb76b0f2f1c4ca87999492290149ec082 Mon Sep 17 00:00:00 2001 From: Maikel Rehl Date: Fri, 14 Jun 2024 12:08:26 +0200 Subject: [PATCH 01/14] Migrate to dcli 4.0.1 --- sidekick/pubspec.lock | 193 +++++++++++------- sidekick/pubspec.yaml | 7 +- sidekick/sidekick-cli.iml | 15 ++ sidekick_core/lib/sidekick_core.dart | 1 + .../plugins/install_plugin_command.dart | 2 +- sidekick_core/lib/src/dart.dart | 3 +- sidekick_core/lib/src/flutter.dart | 24 ++- sidekick_core/pubspec.yaml | 3 +- sidekick_core/test/flutter_command_test.dart | 14 +- sidekick_plugin_installer/pubspec.yaml | 4 +- sidekick_test/lib/src/local_testing.dart | 10 +- sidekick_test/pubspec.yaml | 3 +- sidekick_vault/pubspec.yaml | 7 +- sidekick_vault/test/vault_command_test.dart | 6 +- .../commands/lock_dependencies_command.dart | 2 +- sk_sidekick/pubspec.lock | 193 +++++++++++------- sk_sidekick/pubspec.yaml | 4 +- 17 files changed, 297 insertions(+), 194 deletions(-) diff --git a/sidekick/pubspec.lock b/sidekick/pubspec.lock index 9ba98646..f5d6cb51 100644 --- a/sidekick/pubspec.lock +++ b/sidekick/pubspec.lock @@ -49,14 +49,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.11.0" - basic_utils: - dependency: transitive - description: - name: basic_utils - sha256: "8815477fcf58499e42326bd858e391442425fa57db9a45e48e15224c62049262" - url: "https://pub.dev" - source: hosted - version: "5.5.4" boolean_selector: dependency: transitive description: @@ -73,14 +65,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.0" - charcode: - dependency: transitive - description: - name: charcode - sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306 - url: "https://pub.dev" - source: hosted - version: "1.3.1" checked_yaml: dependency: transitive description: @@ -113,14 +97,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.3.0" - cli_util: - dependency: transitive - description: - name: cli_util - sha256: b8db3080e59b2503ca9e7922c3df2072cf13992354d5e944074ffa836fba43b7 - url: "https://pub.dev" - source: hosted - version: "0.4.0" clock: dependency: transitive description: @@ -165,10 +141,18 @@ packages: dependency: transitive description: name: csv - sha256: "016b31a51a913744a0a1655c74ff13c9379e1200e246a03d96c81c5d9ed297b5" + sha256: c6aa2679b2a18cb57652920f674488d89712efaf4d3fdf2e537215b35fc19d6c url: "https://pub.dev" source: hosted - version: "5.0.2" + version: "6.0.0" + dart_console: + dependency: transitive + description: + name: dart_console + sha256: eae9ddd7bb69477a6e9821c75d575874e290887da09292732a35ab510d1de713 + url: "https://pub.dev" + source: hosted + version: "4.1.0" dart_console2: dependency: transitive description: @@ -189,18 +173,34 @@ packages: dependency: "direct main" description: name: dcli - sha256: "1b4a960f39e60d177dadbfc57059e391b69ac914c76dc6b91e5ba76b0f92d294" + sha256: "12ef06b5b99d092eb37d9598dbc0a49807abac40390085afd2be11f604607705" url: "https://pub.dev" source: hosted - version: "2.2.3" - dcli_core: + version: "4.0.1" + dcli_common: dependency: transitive + description: + name: dcli_common + sha256: aa61137f0e60817a6bc67f9ca0c709da222f9cef5bbfffb598051ac7c543557d + url: "https://pub.dev" + source: hosted + version: "4.0.0" + dcli_core: + dependency: "direct dev" description: name: dcli_core - sha256: "2d5281792dd2a4bf8b612335fd530e91d14f3829debde841720ed9a7552b3a27" + sha256: d922658829d15a5c5726480b9848fa2916267148f4db6098597ca086e1dabe8a url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "4.0.0" + dcli_terminal: + dependency: transitive + description: + name: dcli_terminal + sha256: c738b3449bf72f4fc42eb746702546a3d321ec5d03be64ca975d2407ed35e59f + url: "https://pub.dev" + source: hosted + version: "4.0.0" equatable: dependency: transitive description: @@ -213,18 +213,26 @@ packages: dependency: transitive description: name: ffi - sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" + sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" file: dependency: transitive description: name: file - sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" url: "https://pub.dev" source: hosted - version: "6.1.4" + version: "1.1.0" frontend_server_client: dependency: transitive description: @@ -337,6 +345,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" + lists: + dependency: transitive + description: + name: lists + sha256: "4ca5c19ae4350de036a7e996cdd1ee39c93ac0a2b840f4915459b7d0a7d4ab27" + url: "https://pub.dev" + source: hosted + version: "1.0.1" logging: dependency: transitive description: @@ -365,10 +381,10 @@ packages: dependency: "direct main" description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.15.0" mime: dependency: transitive description: @@ -385,6 +401,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.3.0" + native_synchronization: + dependency: transitive + description: + name: native_synchronization + sha256: ff200fe0a64d733ff7d4dde2005271c297db81007604c8cd21037959858133ab + url: "https://pub.dev" + source: hosted + version: "0.2.0" node_preamble: dependency: transitive description: @@ -405,10 +429,10 @@ packages: dependency: "direct main" description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" platform: dependency: transitive description: @@ -437,18 +461,18 @@ packages: dependency: transitive description: name: posix - sha256: "3ad26924254fd2354b0e2b95fc8b45ac392ad87434f8e64807b3a1ac077f2256" + sha256: a0117dc2167805aa9125b82eee515cc891819bac2f538c83646d355b16f58b9a url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "6.0.1" process: dependency: "direct main" description: name: process - sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" + sha256: "21e54fd2faf1b5bdd5102afd25012184a6793927648ea81eea80552ac9405b32" url: "https://pub.dev" source: hosted - version: "4.2.4" + version: "5.0.2" pub_semver: dependency: transitive description: @@ -473,6 +497,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.2" + pubspec_manager: + dependency: transitive + description: + name: pubspec_manager + sha256: b2674161f3f69ed07bc164dc4172afc190d56f060a293a8eb6fa691e5ddf9b5c + url: "https://pub.dev" + source: hosted + version: "1.0.0" pubspec_parse: dependency: transitive description: @@ -481,46 +513,46 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.3" - quiver: - dependency: transitive + recase: + dependency: "direct main" description: - name: quiver - sha256: b1c1ac5ce6688d77f65f3375a9abb9319b3cb32486bdc7a1e0fdf004d7ba4e47 + name: recase + sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213 url: "https://pub.dev" source: hosted - version: "3.2.1" - random_string: + version: "4.1.0" + runtime_named_locks: dependency: transitive description: - name: random_string - sha256: "03b52435aae8cbdd1056cf91bfc5bf845e9706724dd35ae2e99fa14a1ef79d02" + name: runtime_named_locks + sha256: "5fe859c1ddeeb595f6528596157191b628d85ba3137f0da327d92153604f2f6b" url: "https://pub.dev" source: hosted - version: "2.3.1" - recase: - dependency: "direct main" + version: "1.0.0-beta.6" + runtime_native_semaphores: + dependency: transitive description: - name: recase - sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213 + name: runtime_native_semaphores + sha256: bd5895d87f97543be6c9a5199b8a10483b9d6871327fe508ec89dbc2437c9220 url: "https://pub.dev" source: hosted - version: "4.1.0" + version: "1.0.0-beta.6" scope: dependency: transitive description: name: scope - sha256: e0c880d8f0db2ffd2accd63eeb02396748f3b8a2f71bce4b7d3f8dab75fc8a74 + sha256: "80cf1cb727791fdaaa4131817974a6084815ed59b9ab02ef352c3a1badea488b" url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "4.1.0" settings_yaml: dependency: transitive description: name: settings_yaml - sha256: "7b24fabf8595da060cb98d72541d594c3d3c706272b4d7bec70b251473257909" + sha256: "415bc91cbcfe8b66b0945fdad8823b439ec9bd31591db6c1a4d2d07cab97899d" url: "https://pub.dev" source: hosted - version: "6.0.0" + version: "8.1.0" shelf: dependency: transitive description: @@ -556,11 +588,10 @@ packages: sidekick_core: dependency: "direct main" description: - name: sidekick_core - sha256: "323611a8527b7094ffc4691d6a288de1d187dd017e18e62db7a6165fcc36db77" - url: "https://pub.dev" - source: hosted - version: "2.1.0" + path: "../sidekick_core" + relative: true + source: path + version: "2.1.2" sidekick_test: dependency: "direct dev" description: @@ -592,6 +623,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.0" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" + source: hosted + version: "7.0.0" stack_trace: dependency: transitive description: @@ -616,6 +655,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + strings: + dependency: transitive + description: + name: strings + sha256: b33f40c4dd3e597bf6d9e7f4f4dc282dad0f19b07d9f320cb5c2183859cbccf5 + url: "https://pub.dev" + source: hosted + version: "3.1.1" sum_types: dependency: transitive description: @@ -688,22 +735,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.2" - uri: + unicode: dependency: transitive description: - name: uri - sha256: "889eea21e953187c6099802b7b4cf5219ba8f3518f604a1033064d45b1b8268a" + name: unicode + sha256: "0f69e46593d65245774d4f17125c6084d2c20b4e473a983f6e21b7d7762218f1" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "0.3.1" uuid: dependency: transitive description: name: uuid - sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" + sha256: "814e9e88f21a176ae1359149021870e87f7cddaf633ab678a5d2b0bff7fd1ba8" url: "https://pub.dev" source: hosted - version: "3.0.7" + version: "4.4.0" validators2: dependency: transitive description: @@ -769,4 +816,4 @@ packages: source: hosted version: "2.1.1" sdks: - dart: ">=3.0.0 <3.999.0" + dart: ">=3.3.0 <3.999.0" diff --git a/sidekick/pubspec.yaml b/sidekick/pubspec.yaml index 68656e0f..b3001f7f 100644 --- a/sidekick/pubspec.yaml +++ b/sidekick/pubspec.yaml @@ -8,22 +8,23 @@ topics: - cli environment: - sdk: '>=2.19.0 <3.999.0' + sdk: '>=3.3.0 <3.999.0' dependencies: acronym: ^0.5.1 args: ^2.3.2 cli_completion: ^0.3.0 dartx: ^1.0.0 - dcli: '>=2.2.0 <=2.2.3' + dcli: '>=4.0.0 <=4.1.0' http: '>=0.13.3 <=2.0.0' meta: ^1.5.0 path: ^1.8.0 - process: ^4.2.4 + process: ^5.0.2 recase: ^4.0.0 sidekick_core: ^2.1.0 dev_dependencies: + dcli_core: ^4.0.0 lint: ^2.0.0 sidekick_test: path: ../sidekick_test diff --git a/sidekick/sidekick-cli.iml b/sidekick/sidekick-cli.iml index 38717d06..60f576f8 100644 --- a/sidekick/sidekick-cli.iml +++ b/sidekick/sidekick-cli.iml @@ -9,6 +9,21 @@ + + + + + + + + + + + + + + + diff --git a/sidekick_core/lib/sidekick_core.dart b/sidekick_core/lib/sidekick_core.dart index 224d1e39..f54715b2 100644 --- a/sidekick_core/lib/sidekick_core.dart +++ b/sidekick_core/lib/sidekick_core.dart @@ -14,6 +14,7 @@ export 'package:args/command_runner.dart'; export 'package:dartx/dartx.dart'; export 'package:dartx/dartx_io.dart'; export 'package:dcli/dcli.dart' hide run, start, startFromArgs; +export 'package:dcli_core/dcli_core.dart' show withEnvironment; export 'package:path/path.dart' hide absolute; export 'package:pub_semver/pub_semver.dart' show Version; export 'package:sidekick_core/src/cli_util.dart'; diff --git a/sidekick_core/lib/src/commands/plugins/install_plugin_command.dart b/sidekick_core/lib/src/commands/plugins/install_plugin_command.dart index a7d84baa..98c3dd50 100644 --- a/sidekick_core/lib/src/commands/plugins/install_plugin_command.dart +++ b/sidekick_core/lib/src/commands/plugins/install_plugin_command.dart @@ -254,7 +254,7 @@ Directory _getPackageRootDirForHostedOrGitSource(ArgResults args) { final progress = dcli.Progress( dcli.devNull, // this parameter has a typo in dcli and actually is captureStdOut - captureStdin: true, + captureStdout: true, captureStderr: true, ); try { diff --git a/sidekick_core/lib/src/dart.dart b/sidekick_core/lib/src/dart.dart index 2497ef81..4a62799f 100644 --- a/sidekick_core/lib/src/dart.dart +++ b/sidekick_core/lib/src/dart.dart @@ -112,7 +112,8 @@ String? systemDartExecutable() => // /opt/homebrew/bin/dart dcli .start('which dart', progress: Progress.capture(), nothrow: true) - .firstLine; + .lines + .firstOrNull; /// Returns the Dart SDK of the `dart` executable on `PATH` Directory? systemDartSdk() { diff --git a/sidekick_core/lib/src/flutter.dart b/sidekick_core/lib/src/flutter.dart index e78f1580..3d87e2b5 100644 --- a/sidekick_core/lib/src/flutter.dart +++ b/sidekick_core/lib/src/flutter.dart @@ -1,5 +1,3 @@ -import 'dart:async'; - import 'package:dcli/dcli.dart' as dcli; import 'package:sidekick_core/sidekick_core.dart'; @@ -24,10 +22,8 @@ int flutter( } for (final initializer in _sdkInitializers) { - final future = initializer(sdk); - if (future is Future) { - dcli.waitForEx(future); - } + initializer( + FlutterInitializerConfig(sdk: sdk, packagePath: workingDirectory)); } final process = dcli.startFromArgs( @@ -64,7 +60,8 @@ Directory? systemFlutterSdk() { // /opt/homebrew/bin/flutter final path = dcli .start('which flutter', progress: Progress.capture(), nothrow: true) - .firstLine ?? + .lines + .firstOrNull ?? env['FLUTTER_ROOT']; if (path == null) { // flutter not on path or env.FLUTTER_ROOT @@ -97,7 +94,18 @@ Removable addFlutterSdkInitializer(FlutterInitializer initializer) { typedef Removable = void Function(); /// Called by [flutter] before executing the flutter executable -typedef FlutterInitializer = FutureOr Function(Directory sdkDir); +typedef FlutterInitializer = Function(FlutterInitializerConfig config); /// Initializers that have to be executed before executing the flutter command List _sdkInitializers = []; + +/// Called by [flutter] before executing the flutter executable +class FlutterInitializerConfig { + FlutterInitializerConfig({ + this.sdk, + this.packagePath, + }); + + final Directory? sdk; + final Directory? packagePath; +} diff --git a/sidekick_core/pubspec.yaml b/sidekick_core/pubspec.yaml index 752fcb0c..c48620a9 100644 --- a/sidekick_core/pubspec.yaml +++ b/sidekick_core/pubspec.yaml @@ -15,7 +15,8 @@ dependencies: cli_completion: ^0.3.0 dart_console2: '>=3.0.0 <3.1.0' dartx: ^1.1.0 - dcli: '>=2.2.0 <=2.2.3' + dcli: '>=4.0.0 <=4.1.0' + dcli_core: ^4.0.0 glob: ^2.0.2 http: '>=0.13.5 <2.0.0' meta: ^1.5.0 diff --git a/sidekick_core/test/flutter_command_test.dart b/sidekick_core/test/flutter_command_test.dart index ad3d36da..44690d06 100644 --- a/sidekick_core/test/flutter_command_test.dart +++ b/sidekick_core/test/flutter_command_test.dart @@ -41,11 +41,9 @@ void main() { runner.addCommand(FlutterCommand()); bool called = false; - addFlutterSdkInitializer((sdkDir) { + addFlutterSdkInitializer((conf) { fakeFlutterSdk(directory: tempDir); - return Future.sync(() { - called = true; - }); + called = true; }); await runner.run(['flutter']); expect(called, isTrue); @@ -67,9 +65,7 @@ void main() { addFlutterSdkInitializer((sdkDir) { // async fakeFlutterSdk(directory: tempDir); - return Future.sync(() { - called1 = true; - }); + called1 = true; }); bool called2 = false; @@ -94,7 +90,7 @@ void main() { runner.addCommand(FlutterCommand()); int called = 0; - void initializer(Directory path) { + void initializer(FlutterInitializerConfig config) { called++; } @@ -118,7 +114,7 @@ void main() { runner.addCommand(FlutterCommand()); int called = 0; - void initializer(Directory path) { + void initializer(FlutterInitializerConfig config) { called++; } diff --git a/sidekick_plugin_installer/pubspec.yaml b/sidekick_plugin_installer/pubspec.yaml index 2baa936c..7e0151ee 100644 --- a/sidekick_plugin_installer/pubspec.yaml +++ b/sidekick_plugin_installer/pubspec.yaml @@ -8,11 +8,11 @@ topics: - cli environment: - sdk: '>=3.0.0 <4.0.0' + sdk: '>=3.3.0 <4.0.0' dependencies: analyzer: '>=4.0.0 <6.0.0' - dcli: ^2.2.0 + dcli: ^4.0.1 sidekick_core: ^2.0.0 dev_dependencies: diff --git a/sidekick_test/lib/src/local_testing.dart b/sidekick_test/lib/src/local_testing.dart index 06c9d75c..6d1776fc 100644 --- a/sidekick_test/lib/src/local_testing.dart +++ b/sidekick_test/lib/src/local_testing.dart @@ -5,6 +5,7 @@ import 'package:dartx/dartx_io.dart'; import 'package:dcli/dcli.dart'; import 'package:dcli/posix.dart'; import 'package:path/path.dart'; +import 'package:pubspec_manager/pubspec_manager.dart'; import 'package:sidekick_test/src/download_dart.sh.template.dart'; import 'package:sidekick_test/src/sidekick_config.sh.template.dart'; import 'package:test/test.dart'; @@ -215,12 +216,9 @@ void _overrideDependency({ required String path, }) { final pubspecPath = package.file('pubspec.yaml').path; - final pubspec = PubSpec.fromFile(pubspecPath); - pubspec.dependencyOverrides = { - ...pubspec.dependencyOverrides, - dependency: Dependency.fromPath(dependency, path), - }; - pubspec.save(pubspecPath); + final pubspec = PubSpec.loadFromPath(pubspecPath); + pubspec.dependencyOverrides + .add(DependencyBuilderPath(name: dependency, path: path)); } /// Returns the Dart SDK of the `dart` executable on `PATH` diff --git a/sidekick_test/pubspec.yaml b/sidekick_test/pubspec.yaml index 186e152f..3e34becf 100644 --- a/sidekick_test/pubspec.yaml +++ b/sidekick_test/pubspec.yaml @@ -9,9 +9,10 @@ environment: dependencies: args: ^2.1.0 dartx: ^1.0.0 - dcli: ^2.2.0 + dcli: ^4.0.1 mocktail: ^0.3.0 path: ^1.8.1 + pubspec_manager: ^1.0.0 test: ^1.17.0 dev_dependencies: diff --git a/sidekick_vault/pubspec.yaml b/sidekick_vault/pubspec.yaml index f6860d35..517e32db 100644 --- a/sidekick_vault/pubspec.yaml +++ b/sidekick_vault/pubspec.yaml @@ -9,16 +9,15 @@ topics: - sidekick-plugin environment: - sdk: '>=3.0.0 <4.0.0' + sdk: '>=3.3.0 <4.0.0' dependencies: actions_toolkit_dart: ^0.5.0 - dcli: ^2.2.0 + dcli: ^4.0.1 sidekick_core: ^2.0.0 dev_dependencies: - dcli_core: ^2.2.0 lint: '>=1.5.0 <3.0.0' prompts: ^2.0.0 - sidekick_plugin_installer: ^1.0.0 + sidekick_plugin_installer: ^1.1.0 test: ^1.20.0 diff --git a/sidekick_vault/test/vault_command_test.dart b/sidekick_vault/test/vault_command_test.dart index 90c3769b..8710e792 100644 --- a/sidekick_vault/test/vault_command_test.dart +++ b/sidekick_vault/test/vault_command_test.dart @@ -1,11 +1,7 @@ -import 'package:sidekick_core/sidekick_core.dart' hide withEnvironment; +import 'package:sidekick_core/sidekick_core.dart'; import 'package:sidekick_vault/sidekick_vault.dart'; import 'package:test/test.dart'; -// withEnvironment doesn't support async callbacks. core does. Fixed in dcli:2.0.0-beta.14 -// ignore: directives_ordering, depend_on_referenced_packages -import 'package:dcli_core/dcli_core.dart' show withEnvironment; - void main() { late CommandRunner runner; late SidekickVault vault; diff --git a/sk_sidekick/lib/src/commands/lock_dependencies_command.dart b/sk_sidekick/lib/src/commands/lock_dependencies_command.dart index 910035ef..21dfd722 100644 --- a/sk_sidekick/lib/src/commands/lock_dependencies_command.dart +++ b/sk_sidekick/lib/src/commands/lock_dependencies_command.dart @@ -1,5 +1,5 @@ import 'package:pub_semver/pub_semver.dart'; -import 'package:sidekick_core/sidekick_core.dart' hide PubSpec, version; +import 'package:sidekick_core/sidekick_core.dart' hide version; // ignore: implementation_imports, sk_sidekick is not a published package and already depends on sidekick_core from path import 'package:sidekick_core/src/version_checker.dart'; diff --git a/sk_sidekick/pubspec.lock b/sk_sidekick/pubspec.lock index bc1596ea..3e00e41b 100644 --- a/sk_sidekick/pubspec.lock +++ b/sk_sidekick/pubspec.lock @@ -21,10 +21,10 @@ packages: dependency: transitive description: name: archive - sha256: "0c8368c9b3f0abbc193b9d6133649a614204b528982bebc7026372d61677ce3a" + sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d url: "https://pub.dev" source: hosted - version: "3.3.7" + version: "3.6.1" args: dependency: transitive description: @@ -41,14 +41,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.11.0" - basic_utils: - dependency: transitive - description: - name: basic_utils - sha256: "8815477fcf58499e42326bd858e391442425fa57db9a45e48e15224c62049262" - url: "https://pub.dev" - source: hosted - version: "5.5.4" boolean_selector: dependency: transitive description: @@ -65,14 +57,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.0" - charcode: - dependency: transitive - description: - name: charcode - sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306 - url: "https://pub.dev" - source: hosted - version: "1.3.1" checked_yaml: dependency: transitive description: @@ -105,14 +89,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.3.0" - cli_util: - dependency: transitive - description: - name: cli_util - sha256: b8db3080e59b2503ca9e7922c3df2072cf13992354d5e944074ffa836fba43b7 - url: "https://pub.dev" - source: hosted - version: "0.4.0" clock: dependency: transitive description: @@ -157,10 +133,18 @@ packages: dependency: transitive description: name: csv - sha256: "016b31a51a913744a0a1655c74ff13c9379e1200e246a03d96c81c5d9ed297b5" + sha256: c6aa2679b2a18cb57652920f674488d89712efaf4d3fdf2e537215b35fc19d6c + url: "https://pub.dev" + source: hosted + version: "6.0.0" + dart_console: + dependency: transitive + description: + name: dart_console + sha256: eae9ddd7bb69477a6e9821c75d575874e290887da09292732a35ab510d1de713 url: "https://pub.dev" source: hosted - version: "5.0.2" + version: "4.1.0" dart_console2: dependency: transitive description: @@ -181,18 +165,34 @@ packages: dependency: "direct main" description: name: dcli - sha256: "1b4a960f39e60d177dadbfc57059e391b69ac914c76dc6b91e5ba76b0f92d294" + sha256: "12ef06b5b99d092eb37d9598dbc0a49807abac40390085afd2be11f604607705" + url: "https://pub.dev" + source: hosted + version: "4.0.1" + dcli_common: + dependency: transitive + description: + name: dcli_common + sha256: aa61137f0e60817a6bc67f9ca0c709da222f9cef5bbfffb598051ac7c543557d url: "https://pub.dev" source: hosted - version: "2.2.3" + version: "4.0.0" dcli_core: dependency: transitive description: name: dcli_core - sha256: "2d5281792dd2a4bf8b612335fd530e91d14f3829debde841720ed9a7552b3a27" + sha256: d922658829d15a5c5726480b9848fa2916267148f4db6098597ca086e1dabe8a + url: "https://pub.dev" + source: hosted + version: "4.0.0" + dcli_terminal: + dependency: transitive + description: + name: dcli_terminal + sha256: c738b3449bf72f4fc42eb746702546a3d321ec5d03be64ca975d2407ed35e59f url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "4.0.0" equatable: dependency: transitive description: @@ -205,18 +205,26 @@ packages: dependency: transitive description: name: ffi - sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" + sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" file: dependency: transitive description: name: file - sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" url: "https://pub.dev" source: hosted - version: "6.1.4" + version: "1.1.0" frontend_server_client: dependency: transitive description: @@ -329,6 +337,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" + lists: + dependency: transitive + description: + name: lists + sha256: "4ca5c19ae4350de036a7e996cdd1ee39c93ac0a2b840f4915459b7d0a7d4ab27" + url: "https://pub.dev" + source: hosted + version: "1.0.1" logging: dependency: transitive description: @@ -357,10 +373,10 @@ packages: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.15.0" mime: dependency: transitive description: @@ -377,6 +393,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.3.0" + native_synchronization: + dependency: transitive + description: + name: native_synchronization + sha256: ff200fe0a64d733ff7d4dde2005271c297db81007604c8cd21037959858133ab + url: "https://pub.dev" + source: hosted + version: "0.2.0" node_preamble: dependency: transitive description: @@ -397,18 +421,10 @@ packages: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" - url: "https://pub.dev" - source: hosted - version: "1.8.3" - pointycastle: - dependency: transitive - description: - name: pointycastle - sha256: "7c1e5f0d23c9016c5bbd8b1473d0d3fb3fc851b876046039509e18e0c7485f2c" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "3.7.3" + version: "1.9.0" pool: dependency: transitive description: @@ -421,10 +437,10 @@ packages: dependency: transitive description: name: posix - sha256: "3ad26924254fd2354b0e2b95fc8b45ac392ad87434f8e64807b3a1ac077f2256" + sha256: a0117dc2167805aa9125b82eee515cc891819bac2f538c83646d355b16f58b9a url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "6.0.1" pub_semver: dependency: "direct main" description: @@ -449,6 +465,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.2" + pubspec_manager: + dependency: transitive + description: + name: pubspec_manager + sha256: b2674161f3f69ed07bc164dc4172afc190d56f060a293a8eb6fa691e5ddf9b5c + url: "https://pub.dev" + source: hosted + version: "1.0.0" pubspec_parse: dependency: "direct main" description: @@ -457,46 +481,46 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.3" - quiver: + recase: dependency: transitive description: - name: quiver - sha256: b1c1ac5ce6688d77f65f3375a9abb9319b3cb32486bdc7a1e0fdf004d7ba4e47 + name: recase + sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213 url: "https://pub.dev" source: hosted - version: "3.2.1" - random_string: + version: "4.1.0" + runtime_named_locks: dependency: transitive description: - name: random_string - sha256: "03b52435aae8cbdd1056cf91bfc5bf845e9706724dd35ae2e99fa14a1ef79d02" + name: runtime_named_locks + sha256: "5fe859c1ddeeb595f6528596157191b628d85ba3137f0da327d92153604f2f6b" url: "https://pub.dev" source: hosted - version: "2.3.1" - recase: + version: "1.0.0-beta.6" + runtime_native_semaphores: dependency: transitive description: - name: recase - sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213 + name: runtime_native_semaphores + sha256: bd5895d87f97543be6c9a5199b8a10483b9d6871327fe508ec89dbc2437c9220 url: "https://pub.dev" source: hosted - version: "4.1.0" + version: "1.0.0-beta.6" scope: dependency: transitive description: name: scope - sha256: e0c880d8f0db2ffd2accd63eeb02396748f3b8a2f71bce4b7d3f8dab75fc8a74 + sha256: "80cf1cb727791fdaaa4131817974a6084815ed59b9ab02ef352c3a1badea488b" url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "4.1.0" settings_yaml: dependency: transitive description: name: settings_yaml - sha256: "7b24fabf8595da060cb98d72541d594c3d3c706272b4d7bec70b251473257909" + sha256: "415bc91cbcfe8b66b0945fdad8823b439ec9bd31591db6c1a4d2d07cab97899d" url: "https://pub.dev" source: hosted - version: "6.0.0" + version: "8.1.0" shelf: dependency: transitive description: @@ -532,10 +556,9 @@ packages: sidekick_core: dependency: "direct main" description: - name: sidekick_core - sha256: "23a62a757d8afa0f5384d2867e6b8e966fc2d9ace1a5b99c48fc0da14bb44d91" - url: "https://pub.dev" - source: hosted + path: "../sidekick_core" + relative: true + source: path version: "2.1.2" sidekick_test: dependency: "direct dev" @@ -568,6 +591,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.0" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" + source: hosted + version: "7.0.0" stack_trace: dependency: transitive description: @@ -592,6 +623,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" + strings: + dependency: transitive + description: + name: strings + sha256: b33f40c4dd3e597bf6d9e7f4f4dc282dad0f19b07d9f320cb5c2183859cbccf5 + url: "https://pub.dev" + source: hosted + version: "3.1.1" sum_types: dependency: transitive description: @@ -656,22 +695,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.2" - uri: + unicode: dependency: transitive description: - name: uri - sha256: "889eea21e953187c6099802b7b4cf5219ba8f3518f604a1033064d45b1b8268a" + name: unicode + sha256: "0f69e46593d65245774d4f17125c6084d2c20b4e473a983f6e21b7d7762218f1" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "0.3.1" uuid: dependency: transitive description: name: uuid - sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" + sha256: "814e9e88f21a176ae1359149021870e87f7cddaf633ab678a5d2b0bff7fd1ba8" url: "https://pub.dev" source: hosted - version: "3.0.7" + version: "4.4.0" validators2: dependency: transitive description: @@ -737,4 +776,4 @@ packages: source: hosted version: "2.1.1" sdks: - dart: ">=3.2.6 <3.999.0" + dart: ">=3.3.0 <3.999.0" diff --git a/sk_sidekick/pubspec.yaml b/sk_sidekick/pubspec.yaml index c28085fd..0b5a305c 100644 --- a/sk_sidekick/pubspec.yaml +++ b/sk_sidekick/pubspec.yaml @@ -4,13 +4,13 @@ version: 0.0.1 publish_to: none environment: - sdk: ">=3.2.6 <4.0.0" + sdk: ">=3.3.0 <4.0.0" executables: main: dependencies: - dcli: ^2.2.2 + dcli: ^4.0.1 pub_semver: ^2.1.1 pubspec_parse: ^1.2.0 sidekick_core: ^2.1.2 From 79d99a5cd1104729d56cd399a3a54f4f309b0ff9 Mon Sep 17 00:00:00 2001 From: Maikel Rehl Date: Mon, 17 Jun 2024 16:36:20 +0200 Subject: [PATCH 02/14] Update to Dart 3.3.0 --- sidekick/pubspec.yaml | 7 ++-- sidekick/test/init_test.dart | 22 ++++++------- .../minimal_sidekick_plugin/pubspec.yaml | 2 +- sidekick/test/update_test.dart | 21 +++++------- sidekick/test/util/cli_runner.dart | 15 +++++---- .../create_templates/install_only.dart | 2 +- .../plugins/create_templates/shared_code.dart | 2 +- .../create_templates/shared_command.dart | 2 +- .../lib/src/commands/update_command.dart | 6 ---- .../template/sidekick_package.template.dart | 2 +- sidekick_core/lib/src/update/migration.dart | 4 +-- sidekick_core/pubspec.yaml | 7 ++-- sidekick_core/test/update_command_test.dart | 4 +-- sidekick_plugin_installer/pubspec.yaml | 4 +-- .../test/register_plugin_test.dart | 16 +++++----- sidekick_test/lib/src/local_testing.dart | 8 +++++ sidekick_test/pubspec.yaml | 4 +-- sidekick_vault/pubspec.yaml | 4 +-- sk_sidekick/pubspec.lock | 32 +++++-------------- sk_sidekick/pubspec.yaml | 2 +- 20 files changed, 77 insertions(+), 89 deletions(-) diff --git a/sidekick/pubspec.yaml b/sidekick/pubspec.yaml index b3001f7f..bd2b8224 100644 --- a/sidekick/pubspec.yaml +++ b/sidekick/pubspec.yaml @@ -15,13 +15,13 @@ dependencies: args: ^2.3.2 cli_completion: ^0.3.0 dartx: ^1.0.0 - dcli: '>=4.0.0 <=4.1.0' + dcli: ^4.0.1-beta.4 http: '>=0.13.3 <=2.0.0' meta: ^1.5.0 path: ^1.8.0 process: ^5.0.2 recase: ^4.0.0 - sidekick_core: ^2.1.0 + sidekick_core: ^2.1.2 dev_dependencies: dcli_core: ^4.0.0 @@ -33,3 +33,6 @@ dev_dependencies: executables: sidekick: + +dependency_overrides: + dcli: 4.0.1-beta.4 diff --git a/sidekick/test/init_test.dart b/sidekick/test/init_test.dart index 054eb68c..9d179335 100644 --- a/sidekick/test/init_test.dart +++ b/sidekick/test/init_test.dart @@ -32,7 +32,7 @@ void main() { final sidekickCoreVersion = versionRegExp .firstMatch(sidekickCoreFile.readAsStringSync())! .group(1)!; - final process = await cachedGlobalSidekickCli + final process = await (await cachedGlobalSidekickCli) .run(['--version'], workingDirectory: Directory.current); final output = await process.stdoutStream().join('\n'); expect(output, 'sidekick: $version\nsidekick_core: $sidekickCoreVersion'); @@ -49,7 +49,7 @@ void main() { final projectRoot = setupTemplateProject('test/templates/minimal_dart_package'); - final process = await cachedGlobalSidekickCli.run( + final process = await (await cachedGlobalSidekickCli).run( [ 'init', '-n', @@ -79,7 +79,7 @@ void main() { final projectRoot = setupTemplateProject('test/templates/minimal_dart_package'); - final process = await cachedGlobalSidekickCli.run( + final process = await (await cachedGlobalSidekickCli).run( [ 'init', '-n', @@ -118,7 +118,7 @@ void main() { final projectRoot = setupTemplateProject('test/templates/minimal_dart_package'); - final process = await cachedGlobalSidekickCli.run( + final process = await (await cachedGlobalSidekickCli).run( [ 'init', '-n', @@ -156,7 +156,7 @@ void main() { final projectRoot = setupTemplateProject('test/templates/minimal_dart_package'); - final process = await cachedGlobalSidekickCli.run( + final process = await (await cachedGlobalSidekickCli).run( [ 'init', '-n', @@ -189,7 +189,7 @@ void main() { test( 'throws error when cli name is invalid', () async { - final process = await cachedGlobalSidekickCli.run( + final process = await (await cachedGlobalSidekickCli).run( ['init', '-n', '-42invalidName'], workingDirectory: Directory.systemTemp.createTempSync(), ); @@ -211,7 +211,7 @@ void main() { test( 'throws error when cli name collides with an system executable', () async { - final process = await cachedGlobalSidekickCli.run( + final process = await (await cachedGlobalSidekickCli).run( ['init', '-n', 'rm'], workingDirectory: Directory.systemTemp.createTempSync(), ); @@ -248,7 +248,7 @@ void main() { () async { final projectRoot = setupTemplateProject('test/templates/minimal_flutter_package'); - final process = await cachedGlobalSidekickCli.run( + final process = await (await cachedGlobalSidekickCli).run( ['init', '-n', 'dashi'], workingDirectory: projectRoot, ); @@ -309,7 +309,7 @@ void main() { addTearDown(() => cliDir.deleteSync(recursive: true)); final entrypointDir = cliDir.directory('foo/custom/projectRoot') ..createSync(recursive: true); - final process = await cachedGlobalSidekickCli.run( + final process = await (await cachedGlobalSidekickCli).run( [ 'init', '-n', @@ -383,7 +383,7 @@ void main() { () async { final project = setupTemplateProject('test/templates/root_with_packages'); - final process = await cachedGlobalSidekickCli.run( + final process = await (await cachedGlobalSidekickCli).run( ['init', '-n', 'dashi'], workingDirectory: project, ); @@ -445,7 +445,7 @@ void main() { () async { final projectRoot = setupTemplateProject('test/templates/minimal_flutter_package'); - final process = await cachedGlobalSidekickCli.run( + final process = await (await cachedGlobalSidekickCli).run( [ 'init', '-n', diff --git a/sidekick/test/templates/minimal_sidekick_plugin/pubspec.yaml b/sidekick/test/templates/minimal_sidekick_plugin/pubspec.yaml index ca38159b..6c665a91 100644 --- a/sidekick/test/templates/minimal_sidekick_plugin/pubspec.yaml +++ b/sidekick/test/templates/minimal_sidekick_plugin/pubspec.yaml @@ -1,7 +1,7 @@ name: minimal_sidekick_plugin environment: - sdk: '>=3.0.0 <4.0.0' + sdk: '>=3.3.0 <4.0.0' dev_dependencies: sidekick_plugin_installer: ^1.1.0 \ No newline at end of file diff --git a/sidekick/test/update_test.dart b/sidekick/test/update_test.dart index 4dd6a435..5ad20d5b 100644 --- a/sidekick/test/update_test.dart +++ b/sidekick/test/update_test.dart @@ -49,7 +49,7 @@ void main() { Future code() async { when(() => mockProcessManager.runSync(any())) - .thenAnswer((_) => FakeProcessResult()); + .thenAnswer((_) => fakeProcessResult()); const latest = '13.12.1989'; fakeGetLatestDependencyVersion({'sidekick': Version.parse(latest)}); final runner = @@ -86,7 +86,7 @@ void main() { Future code() async { when(() => mockProcessManager.runSync(any())) - .thenAnswer((_) => FakeProcessResult(exitCode: 1, stderr: 'foo')); + .thenAnswer((_) => fakeProcessResult(exitCode: 1, stderr: 'foo')); const latest = '13.12.1989'; fakeGetLatestDependencyVersion({'sidekick': Version.parse(latest)}); @@ -127,17 +127,12 @@ void main() { class MockProcessManager extends Mock implements ProcessManager {} -class FakeProcessResult extends Fake implements ProcessResult { - FakeProcessResult({ - this.exitCode = 0, - this.stderr, - }); - - @override - final int exitCode; - - @override - final String? stderr; +ProcessResult fakeProcessResult({ + int exitCode = 0, + String stdout = '', + String stderr = '', +}) { + return ProcessResult(0, exitCode, stdout, stderr); } void fakeGetLatestDependencyVersion(Map latestVersions) { diff --git a/sidekick/test/util/cli_runner.dart b/sidekick/test/util/cli_runner.dart index 4d4b71ce..8169381f 100644 --- a/sidekick/test/util/cli_runner.dart +++ b/sidekick/test/util/cli_runner.dart @@ -19,19 +19,20 @@ void tearDownSidekickCache() { /// Executes [callback] with copy of cached sidekick CLI to speed up CI tests /// /// sidekick_core dependency is linked to the local version -R withSidekickCli(R Function(SidekickCli cli) callback) { +Future withSidekickCli( + Future Function(SidekickCli cli) callback) async { final copy = Directory.systemTemp.createTempSync(); addTearDown(() => copy.deleteSync(recursive: true)); - waitForEx(_cachedSidekickCli.root.copyRecursively(copy)); + await (await _cachedSidekickCli).root.copyRecursively(copy); final cli = SidekickCli._(copy, 'dashi'); return callback(cli); } /// Cached sidekick CLI. Don't use directly, use [withSidekickCli] instead. -final _cachedSidekickCli = waitForEx(() async { +final _cachedSidekickCli = () async { _cachedSidekickCliDir = Directory.systemTemp.createTempSync(); - final process = await cachedGlobalSidekickCli.run( + final process = await (await cachedGlobalSidekickCli).run( ['init', '-n', 'dashi'], workingDirectory: _cachedSidekickCliDir!, ); @@ -51,13 +52,13 @@ final _cachedSidekickCli = waitForEx(() async { await cli.run([]); return cli; -}()); +}(); Directory? _cachedSidekickCliDir; /// Cached global sidekick CLI to speed up tests on CI -final cachedGlobalSidekickCli = - waitForEx(_buildGlobalSidekickCli()); +final Future cachedGlobalSidekickCli = + _buildGlobalSidekickCli(); Directory? _cachedGlobalSidekickCliDir; diff --git a/sidekick_core/lib/src/commands/plugins/create_templates/install_only.dart b/sidekick_core/lib/src/commands/plugins/create_templates/install_only.dart index c3148ae4..b0f17ab0 100644 --- a/sidekick_core/lib/src/commands/plugins/create_templates/install_only.dart +++ b/sidekick_core/lib/src/commands/plugins/create_templates/install_only.dart @@ -35,7 +35,7 @@ topics: - sidekick-plugin environment: - sdk: '>=3.0.0 <4.0.0' + sdk: '>=3.3.0 <4.0.0' dependencies: sidekick_core: ^2.0.0 diff --git a/sidekick_core/lib/src/commands/plugins/create_templates/shared_code.dart b/sidekick_core/lib/src/commands/plugins/create_templates/shared_code.dart index 65af70a1..52aaef6b 100644 --- a/sidekick_core/lib/src/commands/plugins/create_templates/shared_code.dart +++ b/sidekick_core/lib/src/commands/plugins/create_templates/shared_code.dart @@ -49,7 +49,7 @@ topics: - sidekick-plugin environment: - sdk: '>=3.0.0 <4.0.0' + sdk: '>=3.3.0 <4.0.0' dependencies: sidekick_core: ^2.0.0 diff --git a/sidekick_core/lib/src/commands/plugins/create_templates/shared_command.dart b/sidekick_core/lib/src/commands/plugins/create_templates/shared_command.dart index 5ee4f9ed..a0751907 100644 --- a/sidekick_core/lib/src/commands/plugins/create_templates/shared_command.dart +++ b/sidekick_core/lib/src/commands/plugins/create_templates/shared_command.dart @@ -49,7 +49,7 @@ topics: - sidekick-plugin environment: - sdk: '>=3.0.0 <4.0.0' + sdk: '>=3.3.0 <4.0.0' dependencies: sidekick_core: ^2.0.0 diff --git a/sidekick_core/lib/src/commands/update_command.dart b/sidekick_core/lib/src/commands/update_command.dart index 0c7ecdd4..740c2526 100644 --- a/sidekick_core/lib/src/commands/update_command.dart +++ b/sidekick_core/lib/src/commands/update_command.dart @@ -43,12 +43,6 @@ class UpdateCommand extends Command { .toList(); final futureDartSdkVersionWithLatestPatch = futureDartSdkVersions - // Make the maximum compatible Dart SDK 3.2.x, because dcli is not - // compatible with Dart SDK 3.3.0 anymore - // Dart 3.3.0 waitFor requires --enable_deprecated_wait_for in the VM - // Dart 3.4.0 waitFor was removed - // Waiting for dcli 4.0.0 to be released https://github.com/onepub-dev/dcli/issues/229 - .filter((version) => version < Version(3, 3, 0)) .groupBy((v) => Version(v.major, v.minor, 0)) .mapEntries((versionGroup) => versionGroup.value.maxBy((v) => v.patch)!) .toList(); diff --git a/sidekick_core/lib/src/template/sidekick_package.template.dart b/sidekick_core/lib/src/template/sidekick_package.template.dart index e83968ab..b0291d39 100644 --- a/sidekick_core/lib/src/template/sidekick_package.template.dart +++ b/sidekick_core/lib/src/template/sidekick_package.template.dart @@ -188,7 +188,7 @@ version: 0.0.1 publish_to: none environment: - sdk: '>=3.0.0 <4.0.0' + sdk: '>=3.3.0 <4.0.0' executables: main: diff --git a/sidekick_core/lib/src/update/migration.dart b/sidekick_core/lib/src/update/migration.dart index 3126f8cc..7a590bde 100644 --- a/sidekick_core/lib/src/update/migration.dart +++ b/sidekick_core/lib/src/update/migration.dart @@ -192,8 +192,8 @@ Future migrate({ printerr(e.toString()); printerr(s.toString()); } - final handling = - onMigrationStepError?.call(context) ?? MigrationErrorHandling.skip; + final handling = await onMigrationStepError?.call(context) ?? + MigrationErrorHandling.skip; switch (handling) { case MigrationErrorHandling.skip: continue; diff --git a/sidekick_core/pubspec.yaml b/sidekick_core/pubspec.yaml index c48620a9..a179b256 100644 --- a/sidekick_core/pubspec.yaml +++ b/sidekick_core/pubspec.yaml @@ -8,14 +8,14 @@ topics: - cli environment: - sdk: '>=2.19.0 <3.999.0' + sdk: '>=3.3.0 <3.999.0' dependencies: args: ^2.1.0 cli_completion: ^0.3.0 dart_console2: '>=3.0.0 <3.1.0' dartx: ^1.1.0 - dcli: '>=4.0.0 <=4.1.0' + dcli: ^4.0.1-beta.4 dcli_core: ^4.0.0 glob: ^2.0.2 http: '>=0.13.5 <2.0.0' @@ -36,3 +36,6 @@ dev_dependencies: sidekick_test: path: ../sidekick_test test: ^1.20.0 + +dependency_overrides: + dcli: 4.0.1-beta.4 \ No newline at end of file diff --git a/sidekick_core/test/update_command_test.dart b/sidekick_core/test/update_command_test.dart index 17c708ca..a3555de9 100644 --- a/sidekick_core/test/update_command_test.dart +++ b/sidekick_core/test/update_command_test.dart @@ -15,7 +15,7 @@ void main() { initialSidekickCliVersion: Version.parse('1.1.0'), initialSidekickCoreVersion: Version.parse('1.1.0'), sidekickCoreReleases: [ - _sidekick_core('1.2.0', sdk: '>=2.12.0 <3.0.0'), + _sidekick_core('2.0.0', sdk: '>=3.3.0 <4.0.0'), ], ); await testCase.execute((command) async { @@ -199,7 +199,7 @@ class _UpdateCommandTestCase { required this.sidekickCoreReleases, List? dartSdks, this.dartSdkVersion, - }) : dartSdks = dartSdks ?? [Version.parse('2.19.6')]; + }) : dartSdks = dartSdks ?? [Version.parse('3.3.0')]; final printLog = []; final command = UpdateCommand(); diff --git a/sidekick_plugin_installer/pubspec.yaml b/sidekick_plugin_installer/pubspec.yaml index 7e0151ee..6453fb08 100644 --- a/sidekick_plugin_installer/pubspec.yaml +++ b/sidekick_plugin_installer/pubspec.yaml @@ -12,8 +12,8 @@ environment: dependencies: analyzer: '>=4.0.0 <6.0.0' - dcli: ^4.0.1 - sidekick_core: ^2.0.0 + dcli: 4.0.1-beta.4 + sidekick_core: ^2.1.2 dev_dependencies: lint: ^2.0.0 diff --git a/sidekick_plugin_installer/test/register_plugin_test.dart b/sidekick_plugin_installer/test/register_plugin_test.dart index 2ea5bca3..24692e1d 100644 --- a/sidekick_plugin_installer/test/register_plugin_test.dart +++ b/sidekick_plugin_installer/test/register_plugin_test.dart @@ -5,8 +5,8 @@ import 'package:test/test.dart'; void main() { group('Register plugin', () { - test('A command gets added', () { - insideFakeProjectWithSidekick((dir) async { + test('A command gets added', () async { + await insideFakeProjectWithSidekick((dir) async { dir.file('packages/dash/lib/dash.dart').writeAsStringSync( initialCliFileContentWithoutImportAndCommand, ); @@ -24,8 +24,8 @@ void main() { test( 'A command does not get double added if the command is already present', - () { - insideFakeProjectWithSidekick((dir) async { + () async { + await insideFakeProjectWithSidekick((dir) async { dir.file('packages/dash/lib/dash.dart').writeAsStringSync( initialCliFileContentWithMyCommand, ); @@ -41,8 +41,8 @@ void main() { }); }); - test('A import gets added', () { - insideFakeProjectWithSidekick((dir) async { + test('A import gets added', () async { + await insideFakeProjectWithSidekick((dir) async { dir.file('packages/dash/lib/dash.dart').writeAsStringSync( initialCliFileContentWithoutImportAndCommand, ); @@ -59,8 +59,8 @@ void main() { }); }); test('A import does not get double added if the command is already present', - () { - insideFakeProjectWithSidekick((dir) async { + () async { + await insideFakeProjectWithSidekick((dir) async { dir.file('packages/dash/lib/dash.dart').writeAsStringSync( initialCliFileContentWithMyImport, ); diff --git a/sidekick_test/lib/src/local_testing.dart b/sidekick_test/lib/src/local_testing.dart index 6d1776fc..6fab7c93 100644 --- a/sidekick_test/lib/src/local_testing.dart +++ b/sidekick_test/lib/src/local_testing.dart @@ -217,8 +217,16 @@ void _overrideDependency({ }) { final pubspecPath = package.file('pubspec.yaml').path; final pubspec = PubSpec.loadFromPath(pubspecPath); + + if (pubspec.dependencyOverrides.list + .firstOrNullWhere((dep) => dep.name == dependency) != + null) { + pubspec.dependencyOverrides.remove(dependency); + } + pubspec.dependencyOverrides .add(DependencyBuilderPath(name: dependency, path: path)); + pubspec.save(); } /// Returns the Dart SDK of the `dart` executable on `PATH` diff --git a/sidekick_test/pubspec.yaml b/sidekick_test/pubspec.yaml index 3e34becf..94155065 100644 --- a/sidekick_test/pubspec.yaml +++ b/sidekick_test/pubspec.yaml @@ -4,12 +4,12 @@ version: 2.0.0 publish_to: none environment: - sdk: '>=2.19.0 <3.999.0' + sdk: '>=3.3.0 <3.999.0' dependencies: args: ^2.1.0 dartx: ^1.0.0 - dcli: ^4.0.1 + dcli: 4.0.1-beta.4 mocktail: ^0.3.0 path: ^1.8.1 pubspec_manager: ^1.0.0 diff --git a/sidekick_vault/pubspec.yaml b/sidekick_vault/pubspec.yaml index 517e32db..c17de300 100644 --- a/sidekick_vault/pubspec.yaml +++ b/sidekick_vault/pubspec.yaml @@ -13,8 +13,8 @@ environment: dependencies: actions_toolkit_dart: ^0.5.0 - dcli: ^4.0.1 - sidekick_core: ^2.0.0 + dcli: 4.0.1-beta.4 + sidekick_core: ^2.1.2 dev_dependencies: lint: '>=1.5.0 <3.0.0' diff --git a/sk_sidekick/pubspec.lock b/sk_sidekick/pubspec.lock index 3e00e41b..46f653de 100644 --- a/sk_sidekick/pubspec.lock +++ b/sk_sidekick/pubspec.lock @@ -165,34 +165,34 @@ packages: dependency: "direct main" description: name: dcli - sha256: "12ef06b5b99d092eb37d9598dbc0a49807abac40390085afd2be11f604607705" + sha256: c076448cee6fe563e1964ade9d4653d855e69d204547791fff0d0fe96c7bd75a url: "https://pub.dev" source: hosted - version: "4.0.1" + version: "4.0.1-beta.4" dcli_common: dependency: transitive description: name: dcli_common - sha256: aa61137f0e60817a6bc67f9ca0c709da222f9cef5bbfffb598051ac7c543557d + sha256: c8af0ed248e67b7293cc7ca24a11cc6f3762009ce2a4d0d03c1368e6b0f15fb9 url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "4.0.1-beta.4" dcli_core: dependency: transitive description: name: dcli_core - sha256: d922658829d15a5c5726480b9848fa2916267148f4db6098597ca086e1dabe8a + sha256: "915b6d7aa9cc039de4be263ecbdac0d372286059f5dba02a8b171748afb4883c" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "4.0.1-beta.4" dcli_terminal: dependency: transitive description: name: dcli_terminal - sha256: c738b3449bf72f4fc42eb746702546a3d321ec5d03be64ca975d2407ed35e59f + sha256: "5449d06b49966796237c5953abc8763dfbc3c29d180ba41f8e182d76c8379840" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "4.0.1-beta.4" equatable: dependency: transitive description: @@ -489,22 +489,6 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.0" - runtime_named_locks: - dependency: transitive - description: - name: runtime_named_locks - sha256: "5fe859c1ddeeb595f6528596157191b628d85ba3137f0da327d92153604f2f6b" - url: "https://pub.dev" - source: hosted - version: "1.0.0-beta.6" - runtime_native_semaphores: - dependency: transitive - description: - name: runtime_native_semaphores - sha256: bd5895d87f97543be6c9a5199b8a10483b9d6871327fe508ec89dbc2437c9220 - url: "https://pub.dev" - source: hosted - version: "1.0.0-beta.6" scope: dependency: transitive description: diff --git a/sk_sidekick/pubspec.yaml b/sk_sidekick/pubspec.yaml index 0b5a305c..c40318ca 100644 --- a/sk_sidekick/pubspec.yaml +++ b/sk_sidekick/pubspec.yaml @@ -10,7 +10,7 @@ executables: main: dependencies: - dcli: ^4.0.1 + dcli: 4.0.1-beta.4 pub_semver: ^2.1.1 pubspec_parse: ^1.2.0 sidekick_core: ^2.1.2 From c359e6064ab7d0a8dc0e15bb33b5ec0a7b25f3e7 Mon Sep 17 00:00:00 2001 From: Maikel Rehl Date: Mon, 17 Jun 2024 16:46:06 +0200 Subject: [PATCH 03/14] Revert sk_sidekick --- sk_sidekick/pubspec.lock | 227 ++++++++++++++++++--------------------- sk_sidekick/pubspec.yaml | 9 +- 2 files changed, 113 insertions(+), 123 deletions(-) diff --git a/sk_sidekick/pubspec.lock b/sk_sidekick/pubspec.lock index 46f653de..525b705f 100644 --- a/sk_sidekick/pubspec.lock +++ b/sk_sidekick/pubspec.lock @@ -29,10 +29,10 @@ packages: dependency: transitive description: name: args - sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.5.0" async: dependency: transitive description: @@ -41,6 +41,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.11.0" + basic_utils: + dependency: transitive + description: + name: basic_utils + sha256: "8815477fcf58499e42326bd858e391442425fa57db9a45e48e15224c62049262" + url: "https://pub.dev" + source: hosted + version: "5.5.4" boolean_selector: dependency: transitive description: @@ -57,6 +65,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.0" + charcode: + dependency: transitive + description: + name: charcode + sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306 + url: "https://pub.dev" + source: hosted + version: "1.3.1" checked_yaml: dependency: transitive description: @@ -89,6 +105,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.3.0" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19 + url: "https://pub.dev" + source: hosted + version: "0.4.1" clock: dependency: transitive description: @@ -101,10 +125,10 @@ packages: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.19.0" convert: dependency: transitive description: @@ -117,10 +141,10 @@ packages: dependency: transitive description: name: coverage - sha256: "2fb815080e44a09b85e0f2ca8a820b15053982b2e714b59267719e8a9ff17097" + sha256: "595a29b55ce82d53398e1bcc2cba525d7bd7c59faeb2d2540e9d42c390cfeeeb" url: "https://pub.dev" source: hosted - version: "1.6.3" + version: "1.6.4" crypto: dependency: transitive description: @@ -133,18 +157,10 @@ packages: dependency: transitive description: name: csv - sha256: c6aa2679b2a18cb57652920f674488d89712efaf4d3fdf2e537215b35fc19d6c - url: "https://pub.dev" - source: hosted - version: "6.0.0" - dart_console: - dependency: transitive - description: - name: dart_console - sha256: eae9ddd7bb69477a6e9821c75d575874e290887da09292732a35ab510d1de713 + sha256: "63ed2871dd6471193dffc52c0e6c76fb86269c00244d244297abbb355c84a86e" url: "https://pub.dev" source: hosted - version: "4.1.0" + version: "5.1.1" dart_console2: dependency: transitive description: @@ -165,34 +181,18 @@ packages: dependency: "direct main" description: name: dcli - sha256: c076448cee6fe563e1964ade9d4653d855e69d204547791fff0d0fe96c7bd75a - url: "https://pub.dev" - source: hosted - version: "4.0.1-beta.4" - dcli_common: - dependency: transitive - description: - name: dcli_common - sha256: c8af0ed248e67b7293cc7ca24a11cc6f3762009ce2a4d0d03c1368e6b0f15fb9 + sha256: "1b4a960f39e60d177dadbfc57059e391b69ac914c76dc6b91e5ba76b0f92d294" url: "https://pub.dev" source: hosted - version: "4.0.1-beta.4" + version: "2.2.3" dcli_core: dependency: transitive description: name: dcli_core - sha256: "915b6d7aa9cc039de4be263ecbdac0d372286059f5dba02a8b171748afb4883c" - url: "https://pub.dev" - source: hosted - version: "4.0.1-beta.4" - dcli_terminal: - dependency: transitive - description: - name: dcli_terminal - sha256: "5449d06b49966796237c5953abc8763dfbc3c29d180ba41f8e182d76c8379840" + sha256: "2d5281792dd2a4bf8b612335fd530e91d14f3829debde841720ed9a7552b3a27" url: "https://pub.dev" source: hosted - version: "4.0.1-beta.4" + version: "2.3.0" equatable: dependency: transitive description: @@ -213,18 +213,10 @@ packages: dependency: transitive description: name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" url: "https://pub.dev" source: hosted - version: "7.0.0" - fixnum: - dependency: transitive - description: - name: fixnum - sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" - url: "https://pub.dev" - source: hosted - version: "1.1.0" + version: "6.1.4" frontend_server_client: dependency: transitive description: @@ -325,26 +317,18 @@ packages: dependency: transitive description: name: json_annotation - sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" url: "https://pub.dev" source: hosted - version: "4.8.1" + version: "4.9.0" lint: dependency: "direct dev" description: name: lint - sha256: f4bd4dbaa39f4ae8836f2d1275f2f32bc68b3a8cce0a0735dd1f7a601f06682a + sha256: d758a5211fce7fd3f5e316f804daefecdc34c7e53559716125e6da7388ae8565 url: "https://pub.dev" source: hosted - version: "2.1.2" - lists: - dependency: transitive - description: - name: lists - sha256: "4ca5c19ae4350de036a7e996cdd1ee39c93ac0a2b840f4915459b7d0a7d4ab27" - url: "https://pub.dev" - source: hosted - version: "1.0.1" + version: "2.3.0" logging: dependency: transitive description: @@ -381,10 +365,10 @@ packages: dependency: transitive description: name: mime - sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e + sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "1.0.5" mocktail: dependency: transitive description: @@ -393,14 +377,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.3.0" - native_synchronization: - dependency: transitive - description: - name: native_synchronization - sha256: ff200fe0a64d733ff7d4dde2005271c297db81007604c8cd21037959858133ab - url: "https://pub.dev" - source: hosted - version: "0.2.0" node_preamble: dependency: transitive description: @@ -425,6 +401,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.9.0" + pointycastle: + dependency: transitive + description: + name: pointycastle + sha256: "4be0097fcf3fd3e8449e53730c631200ebc7b88016acecab2b0da2f0149222fe" + url: "https://pub.dev" + source: hosted + version: "3.9.1" pool: dependency: transitive description: @@ -437,10 +421,10 @@ packages: dependency: transitive description: name: posix - sha256: a0117dc2167805aa9125b82eee515cc891819bac2f538c83646d355b16f58b9a + sha256: "3ad26924254fd2354b0e2b95fc8b45ac392ad87434f8e64807b3a1ac077f2256" url: "https://pub.dev" source: hosted - version: "6.0.1" + version: "5.0.0" pub_semver: dependency: "direct main" description: @@ -465,22 +449,30 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.2" - pubspec_manager: + pubspec_parse: + dependency: "direct main" + description: + name: pubspec_parse + sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + quiver: dependency: transitive description: - name: pubspec_manager - sha256: b2674161f3f69ed07bc164dc4172afc190d56f060a293a8eb6fa691e5ddf9b5c + name: quiver + sha256: b1c1ac5ce6688d77f65f3375a9abb9319b3cb32486bdc7a1e0fdf004d7ba4e47 url: "https://pub.dev" source: hosted - version: "1.0.0" - pubspec_parse: - dependency: "direct main" + version: "3.2.1" + random_string: + dependency: transitive description: - name: pubspec_parse - sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367 + name: random_string + sha256: "03b52435aae8cbdd1056cf91bfc5bf845e9706724dd35ae2e99fa14a1ef79d02" url: "https://pub.dev" source: hosted - version: "1.2.3" + version: "2.3.1" recase: dependency: transitive description: @@ -493,18 +485,18 @@ packages: dependency: transitive description: name: scope - sha256: "80cf1cb727791fdaaa4131817974a6084815ed59b9ab02ef352c3a1badea488b" + sha256: e0c880d8f0db2ffd2accd63eeb02396748f3b8a2f71bce4b7d3f8dab75fc8a74 url: "https://pub.dev" source: hosted - version: "4.1.0" + version: "3.0.0" settings_yaml: dependency: transitive description: name: settings_yaml - sha256: "415bc91cbcfe8b66b0945fdad8823b439ec9bd31591db6c1a4d2d07cab97899d" + sha256: "7b24fabf8595da060cb98d72541d594c3d3c706272b4d7bec70b251473257909" url: "https://pub.dev" source: hosted - version: "8.1.0" + version: "6.0.0" shelf: dependency: transitive description: @@ -540,16 +532,19 @@ packages: sidekick_core: dependency: "direct main" description: - path: "../sidekick_core" - relative: true - source: path + name: sidekick_core + sha256: "23a62a757d8afa0f5384d2867e6b8e966fc2d9ace1a5b99c48fc0da14bb44d91" + url: "https://pub.dev" + source: hosted version: "2.1.2" sidekick_test: dependency: "direct dev" description: - path: "../sidekick_test" - relative: true - source: path + path: sidekick_test + ref: "sidekick_core-v2.1.2" + resolved-ref: "9f16b58c618d31c21b8050c5f16545c96feda5f3" + url: "https://github.com/phntmxyz/sidekick.git" + source: git version: "2.0.0" source_map_stack_trace: dependency: transitive @@ -575,14 +570,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.0" - sprintf: - dependency: transitive - description: - name: sprintf - sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" - url: "https://pub.dev" - source: hosted - version: "7.0.0" stack_trace: dependency: transitive description: @@ -607,14 +594,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" - strings: - dependency: transitive - description: - name: strings - sha256: b33f40c4dd3e597bf6d9e7f4f4dc282dad0f19b07d9f320cb5c2183859cbccf5 - url: "https://pub.dev" - source: hosted - version: "3.1.1" sum_types: dependency: transitive description: @@ -667,10 +646,10 @@ packages: dependency: transitive description: name: time - sha256: "83427e11d9072e038364a5e4da559e85869b227cf699a541be0da74f14140124" + sha256: ad8e018a6c9db36cb917a031853a1aae49467a93e0d464683e029537d848c221 url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.4" typed_data: dependency: transitive description: @@ -679,22 +658,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.2" - unicode: + uri: dependency: transitive description: - name: unicode - sha256: "0f69e46593d65245774d4f17125c6084d2c20b4e473a983f6e21b7d7762218f1" + name: uri + sha256: "889eea21e953187c6099802b7b4cf5219ba8f3518f604a1033064d45b1b8268a" url: "https://pub.dev" source: hosted - version: "0.3.1" + version: "1.0.0" uuid: dependency: transitive description: name: uuid - sha256: "814e9e88f21a176ae1359149021870e87f7cddaf633ab678a5d2b0bff7fd1ba8" + sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" url: "https://pub.dev" source: hosted - version: "4.4.0" + version: "3.0.7" validators2: dependency: transitive description: @@ -719,22 +698,30 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" + web: + dependency: transitive + description: + name: web + sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" + url: "https://pub.dev" + source: hosted + version: "0.5.1" web_socket_channel: dependency: transitive description: name: web_socket_channel - sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + sha256: "58c6666b342a38816b2e7e50ed0f1e261959630becd4c879c4f26bfa14aa5a42" url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.4.5" webkit_inspection_protocol: dependency: transitive description: name: webkit_inspection_protocol - sha256: "67d3a8b6c79e1987d19d848b0892e582dbb0c66c57cc1fef58a177dd2aa2823d" + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" win32: dependency: transitive description: @@ -755,9 +742,9 @@ packages: dependency: transitive description: name: yaml_edit - sha256: "1579d4a0340a83cf9e4d580ea51a16329c916973bffd5bd4b45e911b25d46bfd" + sha256: e9c1a3543d2da0db3e90270dbb1e4eebc985ee5e3ffe468d83224472b2194a5f url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.2.1" sdks: - dart: ">=3.3.0 <3.999.0" + dart: ">=3.4.0 <3.999.0" diff --git a/sk_sidekick/pubspec.yaml b/sk_sidekick/pubspec.yaml index c40318ca..4784eaa6 100644 --- a/sk_sidekick/pubspec.yaml +++ b/sk_sidekick/pubspec.yaml @@ -4,13 +4,13 @@ version: 0.0.1 publish_to: none environment: - sdk: ">=3.3.0 <4.0.0" + sdk: ">=3.2.6 <4.0.0" executables: main: dependencies: - dcli: 4.0.1-beta.4 + dcli: ^2.2.2 pub_semver: ^2.1.1 pubspec_parse: ^1.2.0 sidekick_core: ^2.1.2 @@ -19,7 +19,10 @@ dependencies: dev_dependencies: lint: ^2.0.0 sidekick_test: - path: ../sidekick_test + git: + url: https://github.com/phntmxyz/sidekick.git + ref: sidekick_core-v2.1.2 + path: sidekick_test test: ^1.20.0 sidekick: From fd55130f4fa80bfe7772040e885f34643f38fce0 Mon Sep 17 00:00:00 2001 From: Maikel Rehl Date: Mon, 17 Jun 2024 16:46:32 +0200 Subject: [PATCH 04/14] Update workflow --- .github/workflows/format.yaml | 2 +- .github/workflows/lint.yaml | 2 +- .github/workflows/unit_tests.yaml | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml index 39dd8fbf..986fbc7f 100644 --- a/.github/workflows/format.yaml +++ b/.github/workflows/format.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest container: - image: dart:3.0.0 + image: dart:3.3.0 steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 14e12131..53d31eff 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest container: - image: dart:3.0.0 + image: dart:3.3.0 steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index 31ef6887..4591e826 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -11,20 +11,20 @@ jobs: runs-on: ubuntu-latest container: - image: dart:3.0.0 + image: dart:3.3.0 steps: - uses: actions/checkout@v1 - name: Install dependencies sidekick_core run: cd sidekick_core && dart pub get --no-precompile - name: Run tests sidekick_core - run: cd sidekick_core && dart test + run: cd sidekick_core && dart test >> /test.txt vault_test: runs-on: ubuntu-latest container: - image: dart:3.0.0 + image: dart:3.3.0 steps: - uses: actions/checkout@v1 @@ -39,7 +39,7 @@ jobs: runs-on: ubuntu-latest container: - image: dart:3.0.0 + image: dart:3.3.0 steps: - uses: actions/checkout@v1 From e0179a393ab2fa4be33f75d9f113358ee68ee952 Mon Sep 17 00:00:00 2001 From: Maikel Rehl Date: Mon, 17 Jun 2024 21:52:28 +0200 Subject: [PATCH 05/14] Get exit code from RunException --- .github/workflows/unit_tests.yaml | 2 +- .../lib/src/commands/bash_command.dart | 9 +++++- sidekick_core/lib/src/dart.dart | 31 ++++++++++++------- sidekick_core/lib/src/flutter.dart | 31 ++++++++++++------- sidekick_core/test/bash_command_test.dart | 4 ++- 5 files changed, 52 insertions(+), 25 deletions(-) diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml index 4591e826..cdfb062b 100644 --- a/.github/workflows/unit_tests.yaml +++ b/.github/workflows/unit_tests.yaml @@ -18,7 +18,7 @@ jobs: - name: Install dependencies sidekick_core run: cd sidekick_core && dart pub get --no-precompile - name: Run tests sidekick_core - run: cd sidekick_core && dart test >> /test.txt + run: cd sidekick_core && dart test vault_test: runs-on: ubuntu-latest diff --git a/sidekick_core/lib/src/commands/bash_command.dart b/sidekick_core/lib/src/commands/bash_command.dart index a8905ef8..15023bed 100644 --- a/sidekick_core/lib/src/commands/bash_command.dart +++ b/sidekick_core/lib/src/commands/bash_command.dart @@ -88,11 +88,18 @@ class BashCommand extends ForwardCommand { terminal: withStdIn, ); } catch (e, stack) { + final int exitCode; + if (e is dcli.RunException) { + exitCode = e.exitCode ?? 1; + } else { + exitCode = progress.exitCode ?? 1; + } + throw BashCommandException( script: bashScript, commandName: name, arguments: argResults!.arguments, - exitCode: progress.exitCode!, + exitCode: exitCode, cause: e, stack: stack, ); diff --git a/sidekick_core/lib/src/dart.dart b/sidekick_core/lib/src/dart.dart index 4a62799f..932e7124 100644 --- a/sidekick_core/lib/src/dart.dart +++ b/sidekick_core/lib/src/dart.dart @@ -90,17 +90,26 @@ int systemDart( throw "Couldn't find dart executable on PATH."; } - final process = dcli.startFromArgs( - systemDartExecutablePath, - args, - workingDirectory: workingDirectory?.path, - progress: progress, - terminal: progress == null, - nothrow: nothrow || throwOnError != null, - ); - - final exitCode = process.exitCode ?? -1; - + int exitCode = -1; + try { + final process = dcli.startFromArgs( + systemDartExecutablePath, + args, + workingDirectory: workingDirectory?.path, + progress: progress, + terminal: progress == null, + nothrow: nothrow || throwOnError != null, + ); + + exitCode = process.exitCode ?? -1; + } catch (e) { + if (e is dcli.RunException) { + exitCode = e.exitCode ?? 1; + } + if (throwOnError == null) { + rethrow; + } + } if (exitCode != 0 && throwOnError != null) { throw throwOnError(); } diff --git a/sidekick_core/lib/src/flutter.dart b/sidekick_core/lib/src/flutter.dart index 3d87e2b5..a043cfe8 100644 --- a/sidekick_core/lib/src/flutter.dart +++ b/sidekick_core/lib/src/flutter.dart @@ -26,17 +26,26 @@ int flutter( FlutterInitializerConfig(sdk: sdk, packagePath: workingDirectory)); } - final process = dcli.startFromArgs( - Platform.isWindows ? 'bash' : sdk.file('bin/flutter').path, - [if (Platform.isWindows) sdk.file('bin/flutter.exe').path, ...args], - workingDirectory: workingDirectory?.absolute.path, - nothrow: nothrow || throwOnError != null, - progress: progress, - terminal: progress == null, - ); - - final exitCode = process.exitCode ?? -1; - + int exitCode = -1; + try { + final process = dcli.startFromArgs( + Platform.isWindows ? 'bash' : sdk.file('bin/flutter').path, + [if (Platform.isWindows) sdk.file('bin/flutter.exe').path, ...args], + workingDirectory: workingDirectory?.absolute.path, + nothrow: nothrow || throwOnError != null, + progress: progress, + terminal: progress == null, + ); + + exitCode = process.exitCode ?? -1; + } catch (e) { + if (e is dcli.RunException) { + exitCode = e.exitCode ?? 1; + } + if (throwOnError == null) { + rethrow; + } + } if (exitCode != 0 && throwOnError != null) { throw throwOnError(); } diff --git a/sidekick_core/test/bash_command_test.dart b/sidekick_core/test/bash_command_test.dart index 0348023e..68ca4178 100644 --- a/sidekick_core/test/bash_command_test.dart +++ b/sidekick_core/test/bash_command_test.dart @@ -87,7 +87,9 @@ void main() { try { await runner.run(['script']); fail('should throw'); - } catch (e) { + } catch (e, stack) { + printOnFailure(e.toString()); + printOnFailure(stack.toString()); expect( e, isA() From bd7e9940aeaa4733d3f4ef9c78853ff6d47df347 Mon Sep 17 00:00:00 2001 From: Maikel Rehl Date: Wed, 19 Jun 2024 17:04:29 +0200 Subject: [PATCH 06/14] Use caret range for dcli --- sidekick/pubspec.lock | 39 ++++++++------------------ sidekick/pubspec.yaml | 2 +- sidekick_core/pubspec.yaml | 2 +- sidekick_plugin_installer/pubspec.yaml | 2 +- sidekick_test/pubspec.yaml | 2 +- sidekick_vault/pubspec.yaml | 2 +- sk_sidekick/pubspec.lock | 18 ++++++------ 7 files changed, 26 insertions(+), 41 deletions(-) diff --git a/sidekick/pubspec.lock b/sidekick/pubspec.lock index f5d6cb51..f2e5a9ec 100644 --- a/sidekick/pubspec.lock +++ b/sidekick/pubspec.lock @@ -173,34 +173,34 @@ packages: dependency: "direct main" description: name: dcli - sha256: "12ef06b5b99d092eb37d9598dbc0a49807abac40390085afd2be11f604607705" + sha256: c076448cee6fe563e1964ade9d4653d855e69d204547791fff0d0fe96c7bd75a url: "https://pub.dev" source: hosted - version: "4.0.1" + version: "4.0.1-beta.4" dcli_common: dependency: transitive description: name: dcli_common - sha256: aa61137f0e60817a6bc67f9ca0c709da222f9cef5bbfffb598051ac7c543557d + sha256: c8af0ed248e67b7293cc7ca24a11cc6f3762009ce2a4d0d03c1368e6b0f15fb9 url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "4.0.1-beta.4" dcli_core: dependency: "direct dev" description: name: dcli_core - sha256: d922658829d15a5c5726480b9848fa2916267148f4db6098597ca086e1dabe8a + sha256: "915b6d7aa9cc039de4be263ecbdac0d372286059f5dba02a8b171748afb4883c" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "4.0.1-beta.4" dcli_terminal: dependency: transitive description: name: dcli_terminal - sha256: c738b3449bf72f4fc42eb746702546a3d321ec5d03be64ca975d2407ed35e59f + sha256: "5449d06b49966796237c5953abc8763dfbc3c29d180ba41f8e182d76c8379840" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "4.0.1-beta.4" equatable: dependency: transitive description: @@ -521,22 +521,6 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.0" - runtime_named_locks: - dependency: transitive - description: - name: runtime_named_locks - sha256: "5fe859c1ddeeb595f6528596157191b628d85ba3137f0da327d92153604f2f6b" - url: "https://pub.dev" - source: hosted - version: "1.0.0-beta.6" - runtime_native_semaphores: - dependency: transitive - description: - name: runtime_native_semaphores - sha256: bd5895d87f97543be6c9a5199b8a10483b9d6871327fe508ec89dbc2437c9220 - url: "https://pub.dev" - source: hosted - version: "1.0.0-beta.6" scope: dependency: transitive description: @@ -588,9 +572,10 @@ packages: sidekick_core: dependency: "direct main" description: - path: "../sidekick_core" - relative: true - source: path + name: sidekick_core + sha256: "23a62a757d8afa0f5384d2867e6b8e966fc2d9ace1a5b99c48fc0da14bb44d91" + url: "https://pub.dev" + source: hosted version: "2.1.2" sidekick_test: dependency: "direct dev" diff --git a/sidekick/pubspec.yaml b/sidekick/pubspec.yaml index bd2b8224..4b9aaa55 100644 --- a/sidekick/pubspec.yaml +++ b/sidekick/pubspec.yaml @@ -35,4 +35,4 @@ executables: sidekick: dependency_overrides: - dcli: 4.0.1-beta.4 + dcli: ^4.0.1-beta.4 diff --git a/sidekick_core/pubspec.yaml b/sidekick_core/pubspec.yaml index a179b256..81b19cf3 100644 --- a/sidekick_core/pubspec.yaml +++ b/sidekick_core/pubspec.yaml @@ -38,4 +38,4 @@ dev_dependencies: test: ^1.20.0 dependency_overrides: - dcli: 4.0.1-beta.4 \ No newline at end of file + dcli: ^4.0.1-beta.4 \ No newline at end of file diff --git a/sidekick_plugin_installer/pubspec.yaml b/sidekick_plugin_installer/pubspec.yaml index 6453fb08..fcf8239f 100644 --- a/sidekick_plugin_installer/pubspec.yaml +++ b/sidekick_plugin_installer/pubspec.yaml @@ -12,7 +12,7 @@ environment: dependencies: analyzer: '>=4.0.0 <6.0.0' - dcli: 4.0.1-beta.4 + dcli: ^4.0.1-beta.4 sidekick_core: ^2.1.2 dev_dependencies: diff --git a/sidekick_test/pubspec.yaml b/sidekick_test/pubspec.yaml index 94155065..907eedc6 100644 --- a/sidekick_test/pubspec.yaml +++ b/sidekick_test/pubspec.yaml @@ -9,7 +9,7 @@ environment: dependencies: args: ^2.1.0 dartx: ^1.0.0 - dcli: 4.0.1-beta.4 + dcli: ^4.0.1-beta.4 mocktail: ^0.3.0 path: ^1.8.1 pubspec_manager: ^1.0.0 diff --git a/sidekick_vault/pubspec.yaml b/sidekick_vault/pubspec.yaml index c17de300..e2246b14 100644 --- a/sidekick_vault/pubspec.yaml +++ b/sidekick_vault/pubspec.yaml @@ -13,7 +13,7 @@ environment: dependencies: actions_toolkit_dart: ^0.5.0 - dcli: 4.0.1-beta.4 + dcli: ^4.0.1-beta.4 sidekick_core: ^2.1.2 dev_dependencies: diff --git a/sk_sidekick/pubspec.lock b/sk_sidekick/pubspec.lock index 525b705f..b5cceae3 100644 --- a/sk_sidekick/pubspec.lock +++ b/sk_sidekick/pubspec.lock @@ -125,10 +125,10 @@ packages: dependency: transitive description: name: collection - sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.19.0" + version: "1.18.0" convert: dependency: transitive description: @@ -205,10 +205,10 @@ packages: dependency: transitive description: name: ffi - sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.0" file: dependency: transitive description: @@ -702,18 +702,18 @@ packages: dependency: transitive description: name: web - sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" + sha256: "4188706108906f002b3a293509234588823c8c979dc83304e229ff400c996b05" url: "https://pub.dev" source: hosted - version: "0.5.1" + version: "0.4.2" web_socket_channel: dependency: transitive description: name: web_socket_channel - sha256: "58c6666b342a38816b2e7e50ed0f1e261959630becd4c879c4f26bfa14aa5a42" + sha256: "939ab60734a4f8fa95feacb55804fa278de28bdeef38e616dc08e44a84adea23" url: "https://pub.dev" source: hosted - version: "2.4.5" + version: "2.4.3" webkit_inspection_protocol: dependency: transitive description: @@ -747,4 +747,4 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=3.4.0 <3.999.0" + dart: ">=3.2.6 <3.999.0" From 8e54d9dd6340ee96711e119de19a6667c15679c4 Mon Sep 17 00:00:00 2001 From: Maikel Rehl Date: Wed, 19 Jun 2024 17:06:02 +0200 Subject: [PATCH 07/14] Add dependency --- sidekick/test/plugins_test.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/sidekick/test/plugins_test.dart b/sidekick/test/plugins_test.dart index 400b2819..5717c509 100644 --- a/sidekick/test/plugins_test.dart +++ b/sidekick/test/plugins_test.dart @@ -1,4 +1,5 @@ import 'package:dcli/dcli.dart'; +import 'package:dcli_core/dcli_core.dart'; import 'package:recase/recase.dart'; import 'package:sidekick_core/sidekick_core.dart'; import 'package:sidekick_core/src/commands/plugins/create_plugin_command.dart'; From 8a96ea13f39df888ffed2b95f35cb7a0be352c6b Mon Sep 17 00:00:00 2001 From: Pascal Welsch Date: Wed, 19 Jun 2024 17:52:54 +0200 Subject: [PATCH 08/14] Fix path flakieness --- sidekick_core/test/flutter_test.dart | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/sidekick_core/test/flutter_test.dart b/sidekick_core/test/flutter_test.dart index c43bcb03..ed4b08f8 100644 --- a/sidekick_core/test/flutter_test.dart +++ b/sidekick_core/test/flutter_test.dart @@ -5,6 +5,8 @@ import 'package:sidekick_test/sidekick_test.dart'; import 'package:test/test.dart'; void main() { + final originalPATH = List.unmodifiable(PATH); + group('systemFlutterSdkPath', () { final tempDir = Directory.systemTemp.createTempSync(); final fakeFlutter = tempDir.file('fake_flutter/bin/flutter') @@ -15,15 +17,20 @@ void main() { tempDir.deleteSync(recursive: true); }); - final originalPATH = [...PATH]; setUp(() { + PATH.forEach(env.removeFromPATH); + originalPATH.forEach(env.appendToPATH); final whichPath = start('which which', progress: Progress.capture()).firstLine!; PATH.where((p) => !whichPath.startsWith(p)).forEach(env.removeFromPATH); - addTearDown(() { - PATH.forEach(env.removeFromPATH); - originalPATH.forEach(env.appendToPATH); - }); + env['FLUTTER_ROOT'] = null; + env.removeFromPATH('FLUTTER_ROOT'); + }); + tearDown(() { + PATH.forEach(env.removeFromPATH); + originalPATH.forEach(env.appendToPATH); + env.removeFromPATH('FLUTTER_ROOT'); + env['FLUTTER_ROOT'] = null; }); test('returns null when flutter is not on path or env.FLUTTER_ROOT', () { From cfffb36ee8f12a90e6e6cca2a1e81fb2e84232ad Mon Sep 17 00:00:00 2001 From: Pascal Welsch Date: Wed, 19 Jun 2024 17:53:15 +0200 Subject: [PATCH 09/14] Always reset exit code --- sidekick_core/test/analyzer_command_test.dart | 1 + sidekick_core/test/bash_command_test.dart | 1 + sidekick_core/test/dart_command_test.dart | 1 + sidekick_core/test/deps_command_test.dart | 2 ++ sidekick_core/test/flutter_command_test.dart | 1 + sidekick_core/test/format_command_test.dart | 2 ++ 6 files changed, 8 insertions(+) diff --git a/sidekick_core/test/analyzer_command_test.dart b/sidekick_core/test/analyzer_command_test.dart index 1910d932..59f99a2e 100644 --- a/sidekick_core/test/analyzer_command_test.dart +++ b/sidekick_core/test/analyzer_command_test.dart @@ -3,6 +3,7 @@ import 'package:sidekick_test/sidekick_test.dart'; import 'package:test/test.dart'; void main() { + tearDown(() => exitCode = 0); test('analyze command sets exitCode 1 when command fails', () async { await insideFakeProjectWithSidekick((dir) async { dir.file('dash_sidekick.dart').writeAsStringSync(''' diff --git a/sidekick_core/test/bash_command_test.dart b/sidekick_core/test/bash_command_test.dart index 68ca4178..0611935f 100644 --- a/sidekick_core/test/bash_command_test.dart +++ b/sidekick_core/test/bash_command_test.dart @@ -4,6 +4,7 @@ import 'package:sidekick_test/sidekick_test.dart'; import 'package:test/test.dart'; void main() { + tearDown(() => exitCode = 0); test('bash command receives arguments', () async { await insideFakeProjectWithSidekick((dir) async { final runner = initializeSidekick( diff --git a/sidekick_core/test/dart_command_test.dart b/sidekick_core/test/dart_command_test.dart index eb5e9e11..b6637f12 100644 --- a/sidekick_core/test/dart_command_test.dart +++ b/sidekick_core/test/dart_command_test.dart @@ -3,6 +3,7 @@ import 'package:sidekick_test/sidekick_test.dart'; import 'package:test/test.dart'; void main() { + tearDown(() => exitCode = 0); test('dart command works when dartSdkPath is set', () async { await insideFakeProjectWithSidekick((dir) async { final runner = initializeSidekick( diff --git a/sidekick_core/test/deps_command_test.dart b/sidekick_core/test/deps_command_test.dart index f0e6045c..f5f7bbe5 100644 --- a/sidekick_core/test/deps_command_test.dart +++ b/sidekick_core/test/deps_command_test.dart @@ -5,6 +5,8 @@ import 'package:sidekick_test/sidekick_test.dart'; import 'package:test/test.dart'; void main() { + tearDown(() => exitCode = 0); + void setUpPackages(Directory tempDir) { final packages = [ 'foo/a', diff --git a/sidekick_core/test/flutter_command_test.dart b/sidekick_core/test/flutter_command_test.dart index 44690d06..7b4b59f8 100644 --- a/sidekick_core/test/flutter_command_test.dart +++ b/sidekick_core/test/flutter_command_test.dart @@ -3,6 +3,7 @@ import 'package:sidekick_test/sidekick_test.dart'; import 'package:test/test.dart'; void main() { + tearDown(() => exitCode = 0); test('flutter command works when flutterSdkPath is set', () async { await insideFakeProjectWithSidekick((dir) async { final runner = initializeSidekick( diff --git a/sidekick_core/test/format_command_test.dart b/sidekick_core/test/format_command_test.dart index 83ecb423..1e0a9c57 100644 --- a/sidekick_core/test/format_command_test.dart +++ b/sidekick_core/test/format_command_test.dart @@ -18,6 +18,8 @@ void main() { mainFile.writeAsStringSync(mainContent); } + tearDown(() => exitCode = 0); + group('getLineLength', () { late File pubspecYamlFile; late DartPackage package; From cfdbfd392493604fa1b07b6f68495d4aaed4ca81 Mon Sep 17 00:00:00 2001 From: Maikel Rehl Date: Fri, 21 Jun 2024 13:32:04 +0200 Subject: [PATCH 10/14] Bump version to 3.0.0-preview.0 and add migration --- sidekick_core/lib/sidekick_core.dart | 2 +- .../src/update/patches/255_dcli_4.patch.dart | 21 +++++++++++++++++++ .../src/update/patches/patch_migrations.dart | 2 ++ sidekick_core/pubspec.yaml | 2 +- 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 sidekick_core/lib/src/update/patches/255_dcli_4.patch.dart diff --git a/sidekick_core/lib/sidekick_core.dart b/sidekick_core/lib/sidekick_core.dart index f54715b2..20aeb330 100644 --- a/sidekick_core/lib/sidekick_core.dart +++ b/sidekick_core/lib/sidekick_core.dart @@ -46,7 +46,7 @@ export 'package:sidekick_core/src/template/sidekick_package.template.dart'; /// This is used by the update command to determine if your sidekick cli /// requires an update // DO NOT MANUALLY EDIT THIS VERSION, instead run `sk bump-version sidekick_core` -final Version version = Version.parse('2.1.2'); +final Version version = Version.parse('3.0.0-preview.0'); /// Initializes sidekick, call this at the very start of your CLI program /// diff --git a/sidekick_core/lib/src/update/patches/255_dcli_4.patch.dart b/sidekick_core/lib/src/update/patches/255_dcli_4.patch.dart new file mode 100644 index 00000000..6e7904d3 --- /dev/null +++ b/sidekick_core/lib/src/update/patches/255_dcli_4.patch.dart @@ -0,0 +1,21 @@ +import 'package:pub_semver/pub_semver.dart'; +import 'package:pubspec_parse/pubspec_parse.dart'; +import 'package:sidekick_core/sidekick_core.dart'; +import 'package:sidekick_core/src/update/migration.dart'; + +final migrateDcli4_255 = MigrationStep.inline( + (context) { + final pubspecFile = SidekickContext.sidekickPackage.pubspec; + final content = pubspecFile.readAsStringSync(); + + final pubspec = Pubspec.parse(content); + + pubspec.dependencies.remove('dcli'); + pubspec.dependencies['dcli'] = HostedDependency( + version: VersionConstraint.parse('^4.0.1-beta.4'), + ); + }, + name: 'Do not ignore sidekick pubspec.lock file', + pullRequestLink: 'https://github.com/phntmxyz/sidekick/pull/253', + targetVersion: Version(3, 0, 0, pre: 'preview.0'), +); diff --git a/sidekick_core/lib/src/update/patches/patch_migrations.dart b/sidekick_core/lib/src/update/patches/patch_migrations.dart index c2d3c0e9..d98dc27c 100644 --- a/sidekick_core/lib/src/update/patches/patch_migrations.dart +++ b/sidekick_core/lib/src/update/patches/patch_migrations.dart @@ -3,6 +3,7 @@ import 'package:sidekick_core/src/update/patches/157_fix_usage_message.patch.dar import 'package:sidekick_core/src/update/patches/192_add_format_command.patch.dart'; import 'package:sidekick_core/src/update/patches/208_remove_cli_name.patch.dart'; import 'package:sidekick_core/src/update/patches/253_add_lock_file.patch.dart'; +import 'package:sidekick_core/src/update/patches/255_dcli_4.patch.dart'; /// Migration steps from git patches List patchMigrations = [ @@ -10,4 +11,5 @@ List patchMigrations = [ fixUsageMessage208, addFormatCommand192, forceAddPubspecLock253, + migrateDcli4_255, ]; diff --git a/sidekick_core/pubspec.yaml b/sidekick_core/pubspec.yaml index 81b19cf3..c45fed73 100644 --- a/sidekick_core/pubspec.yaml +++ b/sidekick_core/pubspec.yaml @@ -1,6 +1,6 @@ name: sidekick_core description: Shared sidekick commands, plugin engine, migrations, templates and utilities for sidekick CLIs -version: 2.1.2 +version: 3.0.0-preview.0 repository: https://github.com/phntmxyz/sidekick/tree/main/sidekick_core issue_tracker: https://github.com/phntmxyz/sidekick/labels/sidekick_core topics: From d4b04e23960aa3675180b1f04bbc85c831f31785 Mon Sep 17 00:00:00 2001 From: Maikel Rehl Date: Fri, 21 Jun 2024 13:56:21 +0200 Subject: [PATCH 11/14] Add dcli_core.dart to dev dependency --- sidekick_core/lib/sidekick_core.dart | 47 +++++++-------------- sidekick_core/pubspec.yaml | 4 -- sidekick_test/pubspec.yaml | 1 + sidekick_vault/pubspec.yaml | 1 + sidekick_vault/test/delete_test.dart | 1 + sidekick_vault/test/unlock_test.dart | 1 + sidekick_vault/test/vault_command_test.dart | 10 ++--- 7 files changed, 23 insertions(+), 42 deletions(-) diff --git a/sidekick_core/lib/sidekick_core.dart b/sidekick_core/lib/sidekick_core.dart index 20aeb330..11e0d184 100644 --- a/sidekick_core/lib/sidekick_core.dart +++ b/sidekick_core/lib/sidekick_core.dart @@ -14,7 +14,6 @@ export 'package:args/command_runner.dart'; export 'package:dartx/dartx.dart'; export 'package:dartx/dartx_io.dart'; export 'package:dcli/dcli.dart' hide run, start, startFromArgs; -export 'package:dcli_core/dcli_core.dart' show withEnvironment; export 'package:path/path.dart' hide absolute; export 'package:pub_semver/pub_semver.dart' show Version; export 'package:sidekick_core/src/cli_util.dart'; @@ -23,8 +22,7 @@ export 'package:sidekick_core/src/commands/bash_command.dart'; export 'package:sidekick_core/src/commands/dart_command.dart'; export 'package:sidekick_core/src/commands/deps_command.dart'; export 'package:sidekick_core/src/commands/flutter_command.dart'; -export 'package:sidekick_core/src/commands/format_command.dart' - show FormatCommand; +export 'package:sidekick_core/src/commands/format_command.dart' show FormatCommand; export 'package:sidekick_core/src/commands/install_global_command.dart'; export 'package:sidekick_core/src/commands/plugins/plugins_command.dart'; export 'package:sidekick_core/src/commands/recompile_command.dart'; @@ -93,8 +91,7 @@ SidekickCommandRunner initializeSidekick({ String? path, ) { if (path == null) return null; - final fromRepoRoot = - repoRoot == null ? null : _resolveSdkPath(path, repoRoot); + final fromRepoRoot = repoRoot == null ? null : _resolveSdkPath(path, repoRoot); final fromProjectRoot = _resolveSdkPath(path, projectRoot); if (fromRepoRoot == null && fromProjectRoot == null) { @@ -149,16 +146,14 @@ SidekickCommandRunner initializeSidekick({ // Not in a git repo. This is not a breaking change. Sidekick did not // support project without a git repo, before the migration if (mainProjectPath != null) { - mainProject = - DartPackage.fromDirectory(projectRoot.directory(mainProjectPath)); + mainProject = DartPackage.fromDirectory(projectRoot.directory(mainProjectPath)); } flutterSdk = _resolveSdkPath(flutterSdkPath, projectRoot); dartSdk = _resolveSdkPath(dartSdkPath, projectRoot); } else if (canonicalize(repoRoot.path) == canonicalize(projectRoot.path)) { // EntryPoint is in root of repository, we can safely migrate if (mainProjectPath != null) { - mainProject = - DartPackage.fromDirectory(projectRoot.directory(mainProjectPath)); + mainProject = DartPackage.fromDirectory(projectRoot.directory(mainProjectPath)); } flutterSdk = _resolveSdkPath(flutterSdkPath, projectRoot); dartSdk = _resolveSdkPath(dartSdkPath, projectRoot); @@ -168,8 +163,7 @@ SidekickCommandRunner initializeSidekick({ // relative to repo-root to relative to project-root try { - flutterSdk = - resolveDirectoryBackwardsCompatible('flutterSdkPath', flutterSdkPath); + flutterSdk = resolveDirectoryBackwardsCompatible('flutterSdkPath', flutterSdkPath); } catch (e, stack) { throw SdkNotFoundException( flutterSdkPath!, @@ -189,8 +183,7 @@ SidekickCommandRunner initializeSidekick({ ); } - final mainProjectDir = - resolveDirectoryBackwardsCompatible('mainProjectPath', mainProjectPath); + final mainProjectDir = resolveDirectoryBackwardsCompatible('mainProjectPath', mainProjectPath); if (mainProjectDir != null) { mainProject = DartPackage.fromDirectory(mainProjectDir); } @@ -213,8 +206,7 @@ SidekickCommandRunner initializeSidekick({ } final runner = SidekickCommandRunner._( - description: description ?? - 'A sidekick CLI to equip Dart/Flutter projects with custom tasks', + description: description ?? 'A sidekick CLI to equip Dart/Flutter projects with custom tasks', mainProject: mainProject, flutterSdk: flutterSdk, dartSdk: dartSdk, @@ -307,23 +299,17 @@ class SidekickCommandRunner extends CompletionCommandRunner { // don't show the install-global suggesting when running the install-global command bool isInstallGlobalCommand() => - parsedArgs?.command?.name == 'sidekick' && - parsedArgs!.arguments.contains('install-global'); - - if (!enableAutoInstall && - !isRunningTabCompletionCommand() && - !isInstallGlobalCommand()) { - final command = - yellow('./${SidekickContext.cliName} sidekick install-global'); + parsedArgs?.command?.name == 'sidekick' && parsedArgs!.arguments.contains('install-global'); + + if (!enableAutoInstall && !isRunningTabCompletionCommand() && !isInstallGlobalCommand()) { + final command = yellow('./${SidekickContext.cliName} sidekick install-global'); printerr( '${cyan('💡Tip: Run')} $command ${cyan('to enable tab completion.')}', ); } try { - if (_isUpdateCheckEnabled && - !_isSidekickCliUpdateCommand(parsedArgs) && - !isRunningTabCompletionCommand()) { + if (_isUpdateCheckEnabled && !_isSidekickCliUpdateCommand(parsedArgs) && !isRunningTabCompletionCommand()) { // print warning if the user didn't fully update their CLI _checkCliVersionIntegrity(); // print warning if CLI update is available @@ -434,8 +420,7 @@ class SidekickCommandRunner extends CompletionCommandRunner { /// Enables checking for `sidekick` updates in [SidekickCommandRunner] /// /// Defaults to true, unless `export SIDEKICK_ENABLE_UPDATE_CHECK=false` is set -bool get _isUpdateCheckEnabled => - env['SIDEKICK_ENABLE_UPDATE_CHECK'] != 'false'; +bool get _isUpdateCheckEnabled => env['SIDEKICK_ENABLE_UPDATE_CHECK'] != 'false'; typedef Unmount = void Function(); @@ -448,8 +433,7 @@ SidekickCommandRunner? _activeRunner; /// and the initial working directory is needed /// /// Nested calls to the cli run method may return different directories -Directory get entryWorkingDirectory => - _entryWorkingDirectory ?? Directory.current; +Directory get entryWorkingDirectory => _entryWorkingDirectory ?? Directory.current; Directory? _entryWorkingDirectory; /// Name of the cli program @@ -521,8 +505,7 @@ class SdkNotFoundException implements Exception { final Object? cause; final StackTrace? causeStackTrace; - late final String message = - "Dart or Flutter SDK set to '$sdkPath', but that directory doesn't exist. " + late final String message = "Dart or Flutter SDK set to '$sdkPath', but that directory doesn't exist. " "Please fix the path in `initializeSidekick` (dartSdkPath/flutterSdkPath). " "Note that relative sdk paths are resolved relative to the project root, " "which in this case is '${repoRoot.path}'."; diff --git a/sidekick_core/pubspec.yaml b/sidekick_core/pubspec.yaml index c45fed73..6b45b329 100644 --- a/sidekick_core/pubspec.yaml +++ b/sidekick_core/pubspec.yaml @@ -16,7 +16,6 @@ dependencies: dart_console2: '>=3.0.0 <3.1.0' dartx: ^1.1.0 dcli: ^4.0.1-beta.4 - dcli_core: ^4.0.0 glob: ^2.0.2 http: '>=0.13.5 <2.0.0' meta: ^1.5.0 @@ -36,6 +35,3 @@ dev_dependencies: sidekick_test: path: ../sidekick_test test: ^1.20.0 - -dependency_overrides: - dcli: ^4.0.1-beta.4 \ No newline at end of file diff --git a/sidekick_test/pubspec.yaml b/sidekick_test/pubspec.yaml index 907eedc6..ecfc274f 100644 --- a/sidekick_test/pubspec.yaml +++ b/sidekick_test/pubspec.yaml @@ -16,4 +16,5 @@ dependencies: test: ^1.17.0 dev_dependencies: + dcli_core: ^4.0.0 lint: ^2.0.0 diff --git a/sidekick_vault/pubspec.yaml b/sidekick_vault/pubspec.yaml index e2246b14..09c5e72c 100644 --- a/sidekick_vault/pubspec.yaml +++ b/sidekick_vault/pubspec.yaml @@ -17,6 +17,7 @@ dependencies: sidekick_core: ^2.1.2 dev_dependencies: + dcli_core: ^4.0.0 lint: '>=1.5.0 <3.0.0' prompts: ^2.0.0 sidekick_plugin_installer: ^1.1.0 diff --git a/sidekick_vault/test/delete_test.dart b/sidekick_vault/test/delete_test.dart index 59ac6524..cf72aed0 100644 --- a/sidekick_vault/test/delete_test.dart +++ b/sidekick_vault/test/delete_test.dart @@ -1,3 +1,4 @@ +import 'package:dcli_core/dcli_core.dart'; import 'package:sidekick_core/sidekick_core.dart'; import 'package:sidekick_vault/sidekick_vault.dart'; import 'package:test/test.dart'; diff --git a/sidekick_vault/test/unlock_test.dart b/sidekick_vault/test/unlock_test.dart index 3fabf5db..92ac6ea2 100644 --- a/sidekick_vault/test/unlock_test.dart +++ b/sidekick_vault/test/unlock_test.dart @@ -1,3 +1,4 @@ +import 'package:dcli_core/dcli_core.dart'; import 'package:sidekick_core/sidekick_core.dart'; import 'package:sidekick_vault/sidekick_vault.dart'; import 'package:test/test.dart'; diff --git a/sidekick_vault/test/vault_command_test.dart b/sidekick_vault/test/vault_command_test.dart index 8710e792..920b588b 100644 --- a/sidekick_vault/test/vault_command_test.dart +++ b/sidekick_vault/test/vault_command_test.dart @@ -1,3 +1,4 @@ +import 'package:dcli_core/dcli_core.dart'; import 'package:sidekick_core/sidekick_core.dart'; import 'package:sidekick_vault/sidekick_vault.dart'; import 'package:test/test.dart'; @@ -22,8 +23,7 @@ void main() { final secretFile = File('test/vault/secret.txt.gpg'); final tempDir = Directory.systemTemp.createTempSync(); - final clearTextFile = tempDir.file('cleartext.txt') - ..writeAsStringSync('Dash is cool'); + final clearTextFile = tempDir.file('cleartext.txt')..writeAsStringSync('Dash is cool'); addTearDown(() { if (secretFile.existsSync()) { secretFile.deleteSync(); @@ -233,8 +233,7 @@ void main() { test('encrypt overwrites existing files', () async { final tempDir = Directory.systemTemp.createTempSync(); - final clearTextFile = tempDir.file('cleartext.txt') - ..writeAsStringSync('Dash is cool'); + final clearTextFile = tempDir.file('cleartext.txt')..writeAsStringSync('Dash is cool'); addTearDown(() { tempDir.deleteSync(recursive: true); }); @@ -305,8 +304,7 @@ environment: '''); projectRoot.file('dash').createSync(); - final fakeSidekickDir = projectRoot.directory('packages/dash') - ..createSync(recursive: true); + final fakeSidekickDir = projectRoot.directory('packages/dash')..createSync(recursive: true); fakeSidekickDir.file('pubspec.yaml') ..createSync() From aa97dc0fdd278d68126ed692977980721774449c Mon Sep 17 00:00:00 2001 From: Maikel Rehl Date: Fri, 21 Jun 2024 14:00:33 +0200 Subject: [PATCH 12/14] Run dart format --- sidekick/test/util/cli_runner.dart | 3 +- sidekick_core/lib/sidekick_core.dart | 46 ++++++++++++++------- sidekick_core/lib/src/flutter.dart | 6 ++- sidekick_vault/test/vault_command_test.dart | 9 ++-- 4 files changed, 44 insertions(+), 20 deletions(-) diff --git a/sidekick/test/util/cli_runner.dart b/sidekick/test/util/cli_runner.dart index 8169381f..f1b04333 100644 --- a/sidekick/test/util/cli_runner.dart +++ b/sidekick/test/util/cli_runner.dart @@ -20,7 +20,8 @@ void tearDownSidekickCache() { /// /// sidekick_core dependency is linked to the local version Future withSidekickCli( - Future Function(SidekickCli cli) callback) async { + Future Function(SidekickCli cli) callback, +) async { final copy = Directory.systemTemp.createTempSync(); addTearDown(() => copy.deleteSync(recursive: true)); await (await _cachedSidekickCli).root.copyRecursively(copy); diff --git a/sidekick_core/lib/sidekick_core.dart b/sidekick_core/lib/sidekick_core.dart index 11e0d184..3694a5fa 100644 --- a/sidekick_core/lib/sidekick_core.dart +++ b/sidekick_core/lib/sidekick_core.dart @@ -22,7 +22,8 @@ export 'package:sidekick_core/src/commands/bash_command.dart'; export 'package:sidekick_core/src/commands/dart_command.dart'; export 'package:sidekick_core/src/commands/deps_command.dart'; export 'package:sidekick_core/src/commands/flutter_command.dart'; -export 'package:sidekick_core/src/commands/format_command.dart' show FormatCommand; +export 'package:sidekick_core/src/commands/format_command.dart' + show FormatCommand; export 'package:sidekick_core/src/commands/install_global_command.dart'; export 'package:sidekick_core/src/commands/plugins/plugins_command.dart'; export 'package:sidekick_core/src/commands/recompile_command.dart'; @@ -91,7 +92,8 @@ SidekickCommandRunner initializeSidekick({ String? path, ) { if (path == null) return null; - final fromRepoRoot = repoRoot == null ? null : _resolveSdkPath(path, repoRoot); + final fromRepoRoot = + repoRoot == null ? null : _resolveSdkPath(path, repoRoot); final fromProjectRoot = _resolveSdkPath(path, projectRoot); if (fromRepoRoot == null && fromProjectRoot == null) { @@ -146,14 +148,16 @@ SidekickCommandRunner initializeSidekick({ // Not in a git repo. This is not a breaking change. Sidekick did not // support project without a git repo, before the migration if (mainProjectPath != null) { - mainProject = DartPackage.fromDirectory(projectRoot.directory(mainProjectPath)); + mainProject = + DartPackage.fromDirectory(projectRoot.directory(mainProjectPath)); } flutterSdk = _resolveSdkPath(flutterSdkPath, projectRoot); dartSdk = _resolveSdkPath(dartSdkPath, projectRoot); } else if (canonicalize(repoRoot.path) == canonicalize(projectRoot.path)) { // EntryPoint is in root of repository, we can safely migrate if (mainProjectPath != null) { - mainProject = DartPackage.fromDirectory(projectRoot.directory(mainProjectPath)); + mainProject = + DartPackage.fromDirectory(projectRoot.directory(mainProjectPath)); } flutterSdk = _resolveSdkPath(flutterSdkPath, projectRoot); dartSdk = _resolveSdkPath(dartSdkPath, projectRoot); @@ -163,7 +167,8 @@ SidekickCommandRunner initializeSidekick({ // relative to repo-root to relative to project-root try { - flutterSdk = resolveDirectoryBackwardsCompatible('flutterSdkPath', flutterSdkPath); + flutterSdk = + resolveDirectoryBackwardsCompatible('flutterSdkPath', flutterSdkPath); } catch (e, stack) { throw SdkNotFoundException( flutterSdkPath!, @@ -183,7 +188,8 @@ SidekickCommandRunner initializeSidekick({ ); } - final mainProjectDir = resolveDirectoryBackwardsCompatible('mainProjectPath', mainProjectPath); + final mainProjectDir = + resolveDirectoryBackwardsCompatible('mainProjectPath', mainProjectPath); if (mainProjectDir != null) { mainProject = DartPackage.fromDirectory(mainProjectDir); } @@ -206,7 +212,8 @@ SidekickCommandRunner initializeSidekick({ } final runner = SidekickCommandRunner._( - description: description ?? 'A sidekick CLI to equip Dart/Flutter projects with custom tasks', + description: description ?? + 'A sidekick CLI to equip Dart/Flutter projects with custom tasks', mainProject: mainProject, flutterSdk: flutterSdk, dartSdk: dartSdk, @@ -299,17 +306,23 @@ class SidekickCommandRunner extends CompletionCommandRunner { // don't show the install-global suggesting when running the install-global command bool isInstallGlobalCommand() => - parsedArgs?.command?.name == 'sidekick' && parsedArgs!.arguments.contains('install-global'); - - if (!enableAutoInstall && !isRunningTabCompletionCommand() && !isInstallGlobalCommand()) { - final command = yellow('./${SidekickContext.cliName} sidekick install-global'); + parsedArgs?.command?.name == 'sidekick' && + parsedArgs!.arguments.contains('install-global'); + + if (!enableAutoInstall && + !isRunningTabCompletionCommand() && + !isInstallGlobalCommand()) { + final command = + yellow('./${SidekickContext.cliName} sidekick install-global'); printerr( '${cyan('💡Tip: Run')} $command ${cyan('to enable tab completion.')}', ); } try { - if (_isUpdateCheckEnabled && !_isSidekickCliUpdateCommand(parsedArgs) && !isRunningTabCompletionCommand()) { + if (_isUpdateCheckEnabled && + !_isSidekickCliUpdateCommand(parsedArgs) && + !isRunningTabCompletionCommand()) { // print warning if the user didn't fully update their CLI _checkCliVersionIntegrity(); // print warning if CLI update is available @@ -420,7 +433,8 @@ class SidekickCommandRunner extends CompletionCommandRunner { /// Enables checking for `sidekick` updates in [SidekickCommandRunner] /// /// Defaults to true, unless `export SIDEKICK_ENABLE_UPDATE_CHECK=false` is set -bool get _isUpdateCheckEnabled => env['SIDEKICK_ENABLE_UPDATE_CHECK'] != 'false'; +bool get _isUpdateCheckEnabled => + env['SIDEKICK_ENABLE_UPDATE_CHECK'] != 'false'; typedef Unmount = void Function(); @@ -433,7 +447,8 @@ SidekickCommandRunner? _activeRunner; /// and the initial working directory is needed /// /// Nested calls to the cli run method may return different directories -Directory get entryWorkingDirectory => _entryWorkingDirectory ?? Directory.current; +Directory get entryWorkingDirectory => + _entryWorkingDirectory ?? Directory.current; Directory? _entryWorkingDirectory; /// Name of the cli program @@ -505,7 +520,8 @@ class SdkNotFoundException implements Exception { final Object? cause; final StackTrace? causeStackTrace; - late final String message = "Dart or Flutter SDK set to '$sdkPath', but that directory doesn't exist. " + late final String message = + "Dart or Flutter SDK set to '$sdkPath', but that directory doesn't exist. " "Please fix the path in `initializeSidekick` (dartSdkPath/flutterSdkPath). " "Note that relative sdk paths are resolved relative to the project root, " "which in this case is '${repoRoot.path}'."; diff --git a/sidekick_core/lib/src/flutter.dart b/sidekick_core/lib/src/flutter.dart index a043cfe8..a422523a 100644 --- a/sidekick_core/lib/src/flutter.dart +++ b/sidekick_core/lib/src/flutter.dart @@ -23,7 +23,11 @@ int flutter( for (final initializer in _sdkInitializers) { initializer( - FlutterInitializerConfig(sdk: sdk, packagePath: workingDirectory)); + FlutterInitializerConfig( + sdk: sdk, + packagePath: workingDirectory, + ), + ); } int exitCode = -1; diff --git a/sidekick_vault/test/vault_command_test.dart b/sidekick_vault/test/vault_command_test.dart index 920b588b..5f5e90a9 100644 --- a/sidekick_vault/test/vault_command_test.dart +++ b/sidekick_vault/test/vault_command_test.dart @@ -23,7 +23,8 @@ void main() { final secretFile = File('test/vault/secret.txt.gpg'); final tempDir = Directory.systemTemp.createTempSync(); - final clearTextFile = tempDir.file('cleartext.txt')..writeAsStringSync('Dash is cool'); + final clearTextFile = tempDir.file('cleartext.txt') + ..writeAsStringSync('Dash is cool'); addTearDown(() { if (secretFile.existsSync()) { secretFile.deleteSync(); @@ -233,7 +234,8 @@ void main() { test('encrypt overwrites existing files', () async { final tempDir = Directory.systemTemp.createTempSync(); - final clearTextFile = tempDir.file('cleartext.txt')..writeAsStringSync('Dash is cool'); + final clearTextFile = tempDir.file('cleartext.txt') + ..writeAsStringSync('Dash is cool'); addTearDown(() { tempDir.deleteSync(recursive: true); }); @@ -304,7 +306,8 @@ environment: '''); projectRoot.file('dash').createSync(); - final fakeSidekickDir = projectRoot.directory('packages/dash')..createSync(recursive: true); + final fakeSidekickDir = projectRoot.directory('packages/dash') + ..createSync(recursive: true); fakeSidekickDir.file('pubspec.yaml') ..createSync() From 85c9bf0073ac2709c5ba543130fdcd95df0b43f7 Mon Sep 17 00:00:00 2001 From: Maikel Rehl Date: Fri, 21 Jun 2024 16:01:55 +0200 Subject: [PATCH 13/14] Rename FlutterInitializerContext --- sidekick_core/lib/src/flutter.dart | 15 ++++++++++----- sidekick_core/test/flutter_command_test.dart | 4 ++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/sidekick_core/lib/src/flutter.dart b/sidekick_core/lib/src/flutter.dart index a422523a..8a61e399 100644 --- a/sidekick_core/lib/src/flutter.dart +++ b/sidekick_core/lib/src/flutter.dart @@ -23,7 +23,7 @@ int flutter( for (final initializer in _sdkInitializers) { initializer( - FlutterInitializerConfig( + FlutterInitializerContext( sdk: sdk, packagePath: workingDirectory, ), @@ -95,7 +95,7 @@ String? systemFlutterSdkPath() => systemFlutterSdk()?.path; /// Registers an initializer function that is called before executing the flutter command /// to prepare the SDK, such as downloading it. /// -/// This is a global function, +/// Also this function will be called multiple times, once for each usage of the [flutter] method Removable addFlutterSdkInitializer(FlutterInitializer initializer) { if (!_sdkInitializers.contains(initializer)) { _sdkInitializers.add(initializer); @@ -107,18 +107,23 @@ Removable addFlutterSdkInitializer(FlutterInitializer initializer) { typedef Removable = void Function(); /// Called by [flutter] before executing the flutter executable -typedef FlutterInitializer = Function(FlutterInitializerConfig config); +typedef FlutterInitializer = Function(FlutterInitializerContext context); /// Initializers that have to be executed before executing the flutter command List _sdkInitializers = []; /// Called by [flutter] before executing the flutter executable -class FlutterInitializerConfig { - FlutterInitializerConfig({ +class FlutterInitializerContext { + FlutterInitializerContext({ this.sdk, this.packagePath, }); + /// The Flutter SDK directory, this directory is set by flutterSdkPath in [initializeSidekick] + /// Make sure the SDK will be initialized in this directory + /// You may want to use a symlink to the actual SDK directory final Directory? sdk; + + /// The package directory where the [flutter] and [dart] command is executed final Directory? packagePath; } diff --git a/sidekick_core/test/flutter_command_test.dart b/sidekick_core/test/flutter_command_test.dart index 7b4b59f8..7d281ad2 100644 --- a/sidekick_core/test/flutter_command_test.dart +++ b/sidekick_core/test/flutter_command_test.dart @@ -91,7 +91,7 @@ void main() { runner.addCommand(FlutterCommand()); int called = 0; - void initializer(FlutterInitializerConfig config) { + void initializer(FlutterInitializerContext context) { called++; } @@ -115,7 +115,7 @@ void main() { runner.addCommand(FlutterCommand()); int called = 0; - void initializer(FlutterInitializerConfig config) { + void initializer(FlutterInitializerContext context) { called++; } From 09290f53dd3528c760cf251cb25b05bae243d45d Mon Sep 17 00:00:00 2001 From: Maikel Rehl Date: Fri, 21 Jun 2024 16:02:37 +0200 Subject: [PATCH 14/14] Remove dependency_overrides --- sidekick/pubspec.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/sidekick/pubspec.yaml b/sidekick/pubspec.yaml index 4b9aaa55..273c5d0d 100644 --- a/sidekick/pubspec.yaml +++ b/sidekick/pubspec.yaml @@ -33,6 +33,3 @@ dev_dependencies: executables: sidekick: - -dependency_overrides: - dcli: ^4.0.1-beta.4