Skip to content

[cli] Introduce dart cleanΒ #60754

Open
Open
@dcharkes

Description

@dcharkes

We want a way to clean the build hook results in Dart. For Flutter, we can add this to flutter clean (flutter/flutter#151890). Dart doesn't have such command.

dacoharkes-macbookpro2:~ dacoharkes$ flutter clean --help
Delete the build/ and .dart_tool/ directories.

Global options:
-h, --help                  Print this usage information.
-v, --verbose               Noisy logging, including all shell commands executed.
                            If used with "--help", shows hidden options. If used
                            with "flutter doctor", shows additional diagnostic
                            information. (Use "-vv" to force verbose logging in
                            those cases.)
-d, --device-id             Target device id or name (prefixes allowed).
    --version               Reports the version of this tool.
    --enable-analytics      Enable telemetry reporting each time a flutter or dart
                            command runs.
    --disable-analytics     Disable telemetry reporting each time a flutter or
                            dart command runs, until it is re-enabled.
    --suppress-analytics    Suppress analytics reporting for the current CLI
                            invocation.

Usage: flutter clean [arguments]
-h, --help      Print this usage information.
    --scheme    When cleaning Xcode schemes, clean only the specified scheme.

Run "flutter help" to see global options.
dacoharkes-macbookpro2:~ dacoharkes$ dart clean --help
Could not find a command named "clean".

Usage: dart <command|dart-file> [arguments]

Global options:
-v, --verbose               Show additional command output.
    --version               Print the Dart SDK version.
    --enable-analytics      Enable analytics.
    --disable-analytics     Disable analytics.
    --suppress-analytics    Disallow analytics for this `dart *` run without changing the analytics configuration.
-h, --help                  Print this usage information.

Available commands:
  analyze    Analyze Dart code in a directory.
  compile    Compile Dart to various formats.
  create     Create a new Dart project.
  devtools   Open DevTools (optionally connecting to an existing application).
  doc        Generate API documentation for Dart projects.
  fix        Apply automated fixes to Dart source code.
  format     Idiomatically format Dart source code.
  info       Show diagnostic information about the installed tooling.
  pub        Work with packages.
  run        Run a Dart program.
  test       Run tests for a project.

Run "dart help <command>" for more information about a command.
See https://dart.dev/tools/dart-tool for detailed documentation.

In Flutter, it simply deletes the whole .dart_tool/ forcing also a flutter pub get. So if we introduce a command, we might want to also address #50422 to avoid users having to have run dart pub get manually.

cc @bkonyi

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-dart-cliUse area-dart-cli for issues related to the 'dart' command like tool.area-native-interopUsed for native interop related issues, including FFI.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions