onepub-dev / dcli

An extensive library and tooling for building console/cli applications and scripts using the Dart programming language.
245 stars 28 forks source link

Error: Type 'DependencyGitBuilder' not found. #238

Closed myThorsten closed 6 months ago

myThorsten commented 6 months ago

I am hopeful that you can tell me what I am doing wrong.

Describe the bug Unable to run script.

To Reproduce Create a minimal script based on documentation, but replace dcli: ^1.34.0 with [^3.3.6](dcli: ^3.3.6)

name: hello_world
description: My first app that does bugger all.

environment:
  sdk: '^3.3.0'

dependencies:
  dcli: ^3.3.6

Logs

/D:/pub_cache/hosted/pub.dev/dcli-3.3.6/lib/src/commands/lock.dart:106:3: Error: Type 'DependencyGitBuilder' not found.
  DependencyGitBuilder buildGit(GitPackageDependency git) =>
  ^^^^^^^^^^^^^^^^^^^^
/D:/pub_cache/hosted/pub.dev/dcli-3.3.6/lib/src/script/dart_project.dart:190:38: Error: The type 'Dependencies' used in the 'for' loop must implement 'Iterable<dynamic>'.
 - 'Dependencies' is from 'package:pubspec_manager/src/pubspec/internal_parts.dart' ('/D:/pub_cache/hosted/pub.dev/pubspec_manager-1.0.0/lib/src/pubspec/internal_parts.dart').
 - 'Iterable' is from 'dart:core'.
    for (final dependency in pubSpec.dependencies) {
                                     ^
/D:/pub_cache/hosted/pub.dev/dcli-3.3.6/lib/src/script/dart_project_creator.dart:99:38: Error: The setter 'version' isn't defined for the class 'DependencyVersioned'.
 - 'DependencyVersioned' is from 'package:pubspec_manager/src/pubspec/dependency_versioned.dart' ('/D:/pub_cache/hosted/pub.dev/pubspec_manager-1.0.0/lib/src/pubspec/dependency_versioned.dart').
Try correcting the name to the name of an existing setter, or defining a setter or field named 'version'.
      (dcli! as DependencyVersioned).version = packageVersion;
                                     ^^^^^^^
/D:/pub_cache/hosted/pub.dev/dcli-3.3.6/lib/src/script/dart_project_creator.dart:107:42: Error: The setter 'version' isn't defined for the class 'DependencyVersioned'.
 - 'DependencyVersioned' is from 'package:pubspec_manager/src/pubspec/dependency_versioned.dart' ('/D:/pub_cache/hosted/pub.dev/pubspec_manager-1.0.0/lib/src/pubspec/dependency_versioned.dart').
Try correcting the name to the name of an existing setter, or defining a setter or field named 'version'.
      (dcliCore! as DependencyVersioned).version = packageVersion;
                                         ^^^^^^^
/D:/pub_cache/hosted/pub.dev/dcli-3.3.6/lib/src/script/dart_project_creator.dart:112:12: Error: The setter 'value' isn't defined for the class 'Name'.
 - 'Name' is from 'package:pubspec_manager/src/pubspec/internal_parts.dart' ('/D:/pub_cache/hosted/pub.dev/pubspec_manager-1.0.0/lib/src/pubspec/internal_parts.dart').
Try correcting the name to the name of an existing setter, or defining a setter or field named 'value'.
    ..name.value = _replaceInvalidCharactersForName(projectName)
           ^^^^^
/D:/pub_cache/hosted/pub.dev/dcli-3.3.6/lib/src/commands/compile.dart:256:33: Error: The type 'Executables' used in the 'for' loop must implement 'Iterable<dynamic>'.
 - 'Executables' is from 'package:pubspec_manager/src/pubspec/internal_parts.dart' ('/D:/pub_cache/hosted/pub.dev/pubspec_manager-1.0.0/lib/src/pubspec/internal_parts.dart').
 - 'Iterable' is from 'dart:core'.
      for (final exe in pubspec.executables) {
                                ^
/D:/pub_cache/hosted/pub.dev/dcli-3.3.6/lib/src/commands/lock.dart:79:30: Error: The method 'append' isn't defined for the class 'Dependencies'.
 - 'Dependencies' is from 'package:pubspec_manager/src/pubspec/internal_parts.dart' ('/D:/pub_cache/hosted/pub.dev/pubspec_manager-1.0.0/lib/src/pubspec/internal_parts.dart').
Try correcting the name to the name of an existing method, or defining a method named 'append'.
        pubspec.dependencies.append(package.iswitch(
                             ^^^^^^
/D:/pub_cache/hosted/pub.dev/dcli-3.3.6/lib/src/commands/lock.dart:107:7: Error: The method 'DependencyGitBuilder' isn't defined for the class 'LockCommand'.
 - 'LockCommand' is from 'package:dcli/src/commands/lock.dart' ('/D:/pub_cache/hosted/pub.dev/dcli-3.3.6/lib/src/commands/lock.dart').
Try correcting the name to the name of an existing method, or defining a method named 'DependencyGitBuilder'.
      DependencyGitBuilder(
      ^^^^^^^^^^^^^^^^^^^^
/D:/pub_cache/hosted/pub.dev/dcli-3.3.6/lib/src/commands/lock.dart:117:14: Error: The method 'DependencyPubHostedBuilder' isn't defined for the class 'LockCommand'.
 - 'LockCommand' is from 'package:dcli/src/commands/lock.dart' ('/D:/pub_cache/hosted/pub.dev/dcli-3.3.6/lib/src/commands/lock.dart').
Try correcting the name to the name of an existing method, or defining a method named 'DependencyPubHostedBuilder'.
      return DependencyPubHostedBuilder(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
/D:/pub_cache/hosted/pub.dev/dcli-3.3.6/lib/src/commands/lock.dart:120:14: Error: The method 'DependencyAltHostedBuilder' isn't defined for the class 'LockCommand'.
 - 'LockCommand' is from 'package:dcli/src/commands/lock.dart' ('/D:/pub_cache/hosted/pub.dev/dcli-3.3.6/lib/src/commands/lock.dart').
Try correcting the name to the name of an existing method, or defining a method named 'DependencyAltHostedBuilder'.
      return DependencyAltHostedBuilder(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^

Run dcli doctor:

Der Befehl "dcli" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.

flutter doctor: If that helps:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.19.4, on Microsoft Windows [Version 10.0.22631.3296], locale de-DE)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[!] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.5)
    X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:
        MSVC v142 - VS 2019 C++ x64/x86 build tools
         - If there are multiple build tool versions available, install the latest
        C++ CMake tools for Windows
        Windows 10 SDK
[√] Android Studio (version 2023.1)
[√] VS Code, 64-bit edition (version 1.87.2)
[√] Connected device (3 available)
[√] Network resources

! Doctor found issues in 1 category.

Meaning: command not found

bsutton commented 6 months ago

I've released 3.4.0 which resolves the issue.

bsutton commented 6 months ago

for dcli doctor to work you need to install the dcli sdk tooling via:

dart pub global activate dcli
bsutton commented 6 months ago

finally to use a version of dart after 3.2.0 you will need to use the dcli 4.x alpha.

dcli 3.x only works with dart 3.2 and earlier.

myThorsten commented 6 months ago

Thank you for your fast response 😄

Here is some feedback:

Since I am on Dart SDK version: 3.3.2 (stable) (Tue Mar 19 20:44:48 2024 +0000) on "windows_x64" I tried using dcli: ^4.0.1-alpha.13, this was the result:

dart pub get --no-example
Resolving dependencies...
Note: meta is pinned to version 1.11.0 by flutter_localizations from the flutter SDK.
See https://dart.dev/go/sdk-version-pinning for details.

...
And because dcli >=4.0.1-alpha.11 depends on dcli_common ^4.0.1-alpha.11 which depends on meta ^1.12.0, ... is incompatible with dcli >=4.0.1-alpha.11.
...

You can try the following suggestion to make the pubspec resolve:
* Consider downgrading your constraint on dcli: dart pub add dcli:^3.3.6
exit code 1

Then I tried using dcli: ^3.4.0 which works when I use dart --enable_deprecated_wait_for.