Skip to content

Switch "pub run" for "dart run" in tasks#5882

Merged
DanTup merged 2 commits intomasterfrom
always-use-dart-run-buildrunner
Jan 20, 2026
Merged

Switch "pub run" for "dart run" in tasks#5882
DanTup merged 2 commits intomasterfrom
always-use-dart-run-buildrunner

Conversation

@DanTup
Copy link
Member

@DanTup DanTup commented Jan 20, 2026

Fixes #5874

@DanTup DanTup added this to the v3.128.0 milestone Jan 20, 2026
@DanTup DanTup added is enhancement An enhancement or improvement that should be listed in release notes but is not a bug fix. in tasks Relates to VS Code tasks, such as those provided by Task Providers labels Jan 20, 2026
@DanTup DanTup requested a review from Copilot January 20, 2026 11:46
@DanTup
Copy link
Member Author

DanTup commented Jan 20, 2026

@codex review
/gemini review

@gemini-code-assist
Copy link

Hello @DanTup,

Thank you for invoking a code review! I've thoroughly examined your pull request titled "Switch "pub run" for "dart run" in tasks".

Overall Impression:

This is a well-executed and important change that aligns with the evolution of the Dart SDK's command-line tools. The refactoring to explicitly use dart run for build_runner tasks and to streamline the createPubTask method is clean and improves clarity. The addition of comprehensive tests for both Dart and Flutter projects, including the verification of FLUTTER_ROOT for Flutter tasks, is excellent and ensures the robustness of this change.

Detailed Review:

  • src/extension/dart/dart_task_provider.ts

    • The removal of "pub" from the taskOptions array for build_runner tasks (Diff 1) correctly reflects the shift to dart run.
    • The direct calls to this.createTask(workspaceFolder, projectFolder, "dart", [...]) for build_runner tasks (Diff 2) are the core of this change and are implemented correctly.
    • The simplification of createPubTask (Diff 3) to always prepend "pub" is a good refactoring. It clarifies the purpose of createPubTask as being specifically for pub commands, while build_runner tasks now correctly bypass it to use dart run directly.
  • src/test/dart/commands/dart_tasks.test.ts

    • The new test case it("includes build_runner tasks that use 'dart run'", ...) (Diff 2) is crucial for verifying the intended behavior. It correctly asserts the executable and arguments for the build_runner task.
  • src/test/flutter/commands/flutter_tasks.test.ts

    • The addition of this new test file and the corresponding test case it("includes build_runner tasks that use 'dart run' and have FLUTTER_ROOT", ...) (Diff 1) is highly valuable. It ensures that the changes are also correctly applied to Flutter projects and, importantly, verifies that the FLUTTER_ROOT environment variable is set, which is essential for Flutter tool execution.

Conclusion:

All changes are correct, well-tested, and improve the maintainability of the codebase by aligning with current best practices for Dart/Flutter command execution. I recommend approving this pull request.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request updates the Dart-Code extension to use "dart run" instead of "pub run" for build_runner tasks, aligning with modern Dart CLI conventions where "dart run" is the recommended approach.

Changes:

  • Updated task provider to generate build_runner tasks using "dart run" instead of "pub run"
  • Added comprehensive test coverage for both Dart and Flutter projects to verify the new task format

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/extension/dart/dart_task_provider.ts Modified taskOptions patterns to use "run" instead of "pub run", updated build_runner task creation to use createTask directly with "dart" command, and simplified createPubTask method
src/test/dart/commands/dart_tasks.test.ts Added test to verify build_runner tasks use "dart run" in Dart projects
src/test/flutter/commands/flutter_tasks.test.ts Added new test file to verify build_runner tasks use "dart run" in Flutter projects and that FLUTTER_ROOT is set correctly

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1f7b296627

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@codecov
Copy link

codecov bot commented Jan 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.27%. Comparing base (1a85e1e) to head (1e5ceda).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5882      +/-   ##
==========================================
- Coverage   67.32%   67.27%   -0.05%     
==========================================
  Files         168      168              
  Lines       12894    12894              
  Branches     2554     2554              
==========================================
- Hits         8681     8675       -6     
- Misses       3762     3765       +3     
- Partials      451      454       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@DanTup DanTup merged commit e044b09 into master Jan 20, 2026
21 checks passed
@DanTup DanTup deleted the always-use-dart-run-buildrunner branch January 20, 2026 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in tasks Relates to VS Code tasks, such as those provided by Task Providers is enhancement An enhancement or improvement that should be listed in release notes but is not a bug fix.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Switch tasks from "dart pub run" and "flutter pub run" to "dart run", setting FLUTTER_ROOT if appropriate

2 participants