Skip to content

Commit

Permalink
Replace devtools_tool exe with shorthand dt (#8403)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenzieschmoll authored Oct 4, 2024
1 parent c8f8f75 commit 8f116c5
Show file tree
Hide file tree
Showing 30 changed files with 114 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ jobs:
env:
WORKFLOW_ID: ${{ github.run_id }}
run: |
echo "::notice title=To Quickly Fix Goldens:: Run \`devtools_tool fix-goldens --run-id=$WORKFLOW_ID\` on your local branch."
echo "::notice title=To Quickly Fix Goldens:: Run \`dt fix-goldens --run-id=$WORKFLOW_ID\` on your local branch."
devtools-app-integration-test:
name: devtools_app integration-test ${{ matrix.bot }} - ${{ matrix.device }} - shard ${{ matrix.shard }}
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/daily-dev-bump.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ jobs:
dart pub get
popd
# Ensure the devtools_tool command is available
# Ensure the dt command is available
export PATH="$PATH":`pwd`/tool/bin
ORIGINAL_VERSION=$(devtools_tool update-version current-version | tail -1)
ORIGINAL_VERSION=$(dt update-version current-version | tail -1)
if [ -z "$UPDATE_TYPE" ]; then
# If $UPDATE_TYPE is not set, then assume it is dev
Expand All @@ -76,14 +76,14 @@ jobs:
# If there is a major, minor, or patch bump, do it.
if [ "$UPDATE_TYPE" == "patch+dev" ]; then
devtools_tool update-version auto --type patch
devtools_tool update-version auto --type dev
dt update-version auto --type patch
dt update-version auto --type dev
elif [ "$UPDATE_TYPE" == "minor+dev" ]; then
devtools_tool update-version auto --type minor
devtools_tool update-version auto --type dev
dt update-version auto --type minor
dt update-version auto --type dev
elif [ "$UPDATE_TYPE" == "major+dev" ]; then
devtools_tool update-version auto --type major
devtools_tool update-version auto --type dev
dt update-version auto --type major
dt update-version auto --type dev
elif [ "$UPDATE_TYPE" == "dev" ]; then
if ! echo "$ORIGINAL_VERSION" | grep -Eq "\-dev\.[0-9]+" ; then
ERROR_DESCRIPTION="Doing \
Expand All @@ -94,13 +94,13 @@ jobs:
echo "::error ,title=Cannot do a dev bump on a Release Version ($ORIGINAL_VERSION)::$ERROR_DESCRIPTION"
exit 1;
fi
devtools_tool update-version auto --type dev
dt update-version auto --type dev
else
echo "ERROR: UNEXPECTED UPDATE TYPE: $UPDATE_TYPE"
exit 1
fi
NEW_VERSION=$(devtools_tool update-version current-version | tail -1)
NEW_VERSION=$(dt update-version current-version | tail -1)
echo "COMMIT_MESSAGE=Updating from $ORIGINAL_VERSION to $NEW_VERSION" >> $GITHUB_OUTPUT
env:
Expand Down
8 changes: 4 additions & 4 deletions BETA_TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ to the project.
- Make sure to [configure Git to keep your fork in sync](https://docs.github.com/en/get-started/quickstart/fork-a-repo#configuring-git-to-sync-your-fork-with-the-upstream-repository)
with the upstream DevTools repo.

2. Ensure that you have access to the `devtools_tool` executable by:
2. Ensure that you have access to the `dt` executable by:
- Running `flutter pub get` on the `devtools/tool` directory
- Adding the `devtools/tool/bin` folder to your `PATH` environment variable:
- **MacOS Users**
Expand All @@ -63,7 +63,7 @@ to the project.
- Click the **New** button and paste in `<DEVTOOLS_DIR>/tool/bin`, replacing `<DEVTOOLS_DIR>`
with the local path to your DevTools repo.

Explore the commands and helpers that the `devtools_tool` provides by running `devtools_tool -h`.
Explore the commands and helpers that the `dt` provides by running `dt -h`.

## Prepare to build DevTools

Expand All @@ -73,8 +73,8 @@ To ensure your DevTools repository is up to date and ready to build, run the fol
git checkout master
git reset --hard origin/master

devtools_tool update-flutter-sdk
devtools_tool pub-get --only-main --upgrade
dt update-flutter-sdk
dt pub-get --only-main --upgrade
```

## Start DevTools and connect to an app
Expand Down
18 changes: 9 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ own Github account, and then clone it using SSH. If you haven't already, you may
to connect to Github with SSH.
2. Make sure to [configure Git to keep your fork in sync](https://docs.github.com/en/get-started/quickstart/fork-a-repo#configuring-git-to-sync-your-fork-with-the-upstream-repository)
with the upstream DevTools repo.
3. Ensure that you have access to the `devtools_tool` executable by:
3. Ensure that you have access to the DevTools repo management tool exectuable, `dt`:
- Running `flutter pub get` on the `devtools/tool` directory
- Adding the `devtools/tool/bin` folder to your `PATH` environment variable:
- **MacOS Users**
Expand All @@ -74,7 +74,7 @@ with the upstream DevTools repo.
- Click the **New** button and paste in `<DEVTOOLS_DIR>/tool/bin`, replacing `<DEVTOOLS_DIR>`
with the local path to your DevTools repo.

Explore the commands and helpers that `devtools_tool` provides by running `devtools_tool -h`.
Explore the commands and helpers that `dt` provides by running `dt -h`.
4. **Optional:** enable and activate DCM (Dart Code Metrics) - see the [DCM section below](#enable-and-activate-dcm-dart-code-metrics)

#### Set up your IDE
Expand All @@ -88,13 +88,13 @@ of launch configurations for running and debugging DevTools:

### Workflow for making changes

1. Change your local Flutter SDK to the latest flutter candidate branch: `devtools_tool update-flutter-sdk --from-path`
1. Change your local Flutter SDK to the latest flutter candidate branch: `dt update-flutter-sdk --from-path`

> Note: Until https://github.com/flutter/devtools/issues/7939 is fixed, run
`devtools_tool update-flutter-sdk --use-cache` instead.
`dt update-flutter-sdk --use-cache` instead.

2. Create a branch from your cloned DevTools repo: `git checkout -b myBranch`
3. Ensure your branch, dependencies, and generated code are up-to-date: `devtools_tool sync`
3. Ensure your branch, dependencies, and generated code are up-to-date: `dt sync`
4. Implement your changes, and commit to your branch: `git commit -m “description”`
- If your improvement is user-facing, [document it](packages/devtools_app/release_notes/README.md) in the same PR.
5. Push to your branch to GitHub: `git push origin myBranch`
Expand All @@ -112,13 +112,13 @@ request from the branch in your cloned repo to the DevTools master branch. Creat

- If at any time you need to re-sync your branch, run:
```
devtools_tool sync
dt sync
```
This will pull the latest code from the upstream DevTools, upgrade dependencies, and perform code generation.

- If you want to upgrade dependencies and re-generate code (like mocks), but do not want to merge `upstream/master`, instead run
```
devtools_tool generate-code --upgrade
dt generate-code --upgrade
```

- To update DCM to the same version as on GitHub bots with apt-get or brew:
Expand Down Expand Up @@ -171,7 +171,7 @@ dependency_overrides:
Then you can run DevTools with the server by running the following from the top-level `devtools` directory:
```
devtools_tool serve
dt serve
```
### DevTools + VS Code integration (IDE-embedded DevTools experience)
Expand All @@ -195,7 +195,7 @@ command palette (`F1`)) and add the following to your settings:
},
```

This instructs VS Code to run the `devtools_tool serve` command instead of running `dart devtools`.
This instructs VS Code to run the `dt serve` command instead of running `dart devtools`.
You must set the `LOCAL_DART_SDK` and `FLUTTER_ROOT` env variables correctly for the script to work.

Next, restart VS Code (or run the **Developer: Reload Window** command from the command palette (`F1`))
Expand Down
8 changes: 4 additions & 4 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ Before running tests, make sure your Flutter SDK matches the version that will b
the CI. To update your local flutter version, run:

```shell
devtools_tool update-flutter-sdk --update-on-path
dt update-flutter-sdk --update-on-path
```

> Note: Running this command requires that you have followed the [set up instructions](CONTRIBUTING.md#set-up-your-devtools-environment) in the DevTools contributing guide regarding cloning the Flutter SDK from GitHub, adding the `devtools_tool` executable to your PATH, and running `dart pub get` in the `tool` directory.
> Note: Running this command requires that you have followed the [set up instructions](CONTRIBUTING.md#set-up-your-devtools-environment) in the DevTools contributing guide regarding cloning the Flutter SDK from GitHub, adding the `dt` executable to your PATH, and running `dart pub get` in the `tool` directory.
You may need to re-generate the testing mocks before running the tests:

```shell
devtools_tool generate-code --upgrade
dt generate-code --upgrade
```

Now you can proceed with running DevTools tests:
Expand Down Expand Up @@ -71,7 +71,7 @@ be done in one of two ways:
on the CI. To update your local flutter version, run:

```shell
devtools_tool update-flutter-sdk --update-on-path
dt update-flutter-sdk --update-on-path
```

- Then proceed with updating the goldens:
Expand Down
4 changes: 2 additions & 2 deletions packages/devtools_app/lib/src/shared/development_helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ final _log = Logger('dev_helpers');
/// the Dart Tooling Daemon.
///
/// Without using this flag, you would need to run DevTools with the DevTools
/// server (devtools_tool serve) in order to pass a DTD URI to the DevTools
/// server (dt serve) in order to pass a DTD URI to the DevTools
/// server, which is not convenient for development.
///
/// If you do need the DevTools server, then you should run
/// `devtools_tool serve --dtd-uri=<uri>` instead of setting this debug flag.
/// `dt serve --dtd-uri=<uri>` instead of setting this debug flag.
///
/// You can use a real DTD URI from an IDE (VS Code or IntelliJ / Android
/// Studio) using the "Copy DTD URI" action, or you can run a Dart or Flutter
Expand Down
2 changes: 1 addition & 1 deletion packages/devtools_app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ flutter:
- packages/perfetto_ui_compiled/dist/devtools/devtools_shared.css
- packages/perfetto_ui_compiled/dist/devtools/devtools_theme_handler.js
# The version number for all the Perfetto asset paths below is updated by running
# `devtools_tool update-perfetto`.
# `dt update-perfetto`.
- packages/perfetto_ui_compiled/dist/v34.0-16f63abe3/engine_bundle.js
- packages/perfetto_ui_compiled/dist/v34.0-16f63abe3/frontend_bundle.js
- packages/perfetto_ui_compiled/dist/v34.0-16f63abe3/manifest.json
Expand Down
2 changes: 1 addition & 1 deletion packages/devtools_app/release_notes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Before continuing, ensure you have your local environment set up for

Draft release notes on a local `flutter/website` branch using the following command:
```console
devtools_tool release-notes -w /Users/me/absolute/path/to/flutter/website
dt release-notes -w /Users/me/absolute/path/to/flutter/website
```

Clean up the drafted notes on your local `flutter/website` branch and open a PR.
Expand Down
2 changes: 1 addition & 1 deletion packages/devtools_test/lib/src/mocks/generated.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:mockito/annotations.dart';
import 'package:vm_service/vm_service.dart';

// See https://github.com/dart-lang/mockito/blob/master/NULL_SAFETY_README.md
// Run `devtools_tool generate-code` to regenerate mocks.
// Run `dt generate-code` to regenerate mocks.
@GenerateNiceMocks([
MockSpec<ConnectedApp>(),
MockSpec<DebuggerController>(),
Expand Down
18 changes: 9 additions & 9 deletions tool/RELEASE_INSTRUCTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ bash for quality assurance and to prevent regressions from slipping into the rel

# Pre-requisites

1. Ensure that you have access to `devtools_tool` by adding the `tool/bin` folder to your
1. Ensure that you have access to `dt` by adding the `tool/bin` folder to your
`PATH` environment variable
- **MacOS Users**
- add the following to your `~/.bashrc` file.
Expand Down Expand Up @@ -73,7 +73,7 @@ Make sure:

2. Your Flutter SDK in `devtools/tool/flutter-sdk` and the one on PATH are updated to the latest candidate release branch:
```shell
devtools_tool update-flutter-sdk --update-on-path
dt update-flutter-sdk --update-on-path
```

### Prepare the release
Expand All @@ -86,7 +86,7 @@ can run: `brew install gh`

From the `devtools/tool` directory, run the following:
```shell
devtools_tool release-helper
dt release-helper
```
This command will automatically:
- create a new branch using the tip of master and check out locally
Expand All @@ -99,7 +99,7 @@ This command will automatically:

2. Update your Flutter SDK in `devtools/tool/flutter-sdk` and the one on PATH to the latest Flutter candidate:
```shell
devtools_tool update-flutter-sdk --update-on-path --use-cache
dt update-flutter-sdk --update-on-path --use-cache
```

#### Verify the version changes for the Release PR
Expand All @@ -119,7 +119,7 @@ version bumps.
1. Build DevTools in release mode and serve it from a locally running DevTools
server instance:
```shell
devtools_tool serve
dt serve
```

2. Launch DevTools and verify that everything generally works.
Expand Down Expand Up @@ -162,7 +162,7 @@ Within minutes, a build should be uploaded for the commit you just merged and ta

Run the tool script with the commit hash you just merged and tagged:
```shell
devtools_tool update-sdk-deps -c <commit-hash>
dt update-sdk-deps -c <commit-hash>
```

This automatically creates a Gerrit CL with the DEPS update for DevTools.
Expand Down Expand Up @@ -200,7 +200,7 @@ just released into the Dart SDK (the hash you updated the DEPS file with):
2. Then, tag the release:
```shell
devtools_tool tag-version
dt tag-version
```
This command creates a tag on the `flutter/devtools` repo for this release. The
version for the tag is automatically determined from `packages/devtools/pubspec.yaml`
Expand Down Expand Up @@ -266,7 +266,7 @@ example, we'll use `v2.29.0` as the base branch and `2.29.1` as the cherry-pick
DevTools version number:
```
git cherry-pick <commit>
devtools_tool update-version auto -t patch
dt update-version auto -t patch
```
5. Commit your changes and push to the `upstream` remote.
Expand Down Expand Up @@ -352,7 +352,7 @@ create another DevTools cherry-pick release from the tip of the one we just crea
Check out the cherry-pick branch you created earlier, and create a git tag:
```sh
git checkout upstream/2.29.1
devtools_tool tag-version
dt tag-version
```
### Create the merge commit in the `flutter/devtools` repo
Expand Down
21 changes: 5 additions & 16 deletions tool/bin/devtools_tool
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
#!/bin/bash -e

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
# This file serves as an alias for the 'dt' executable so that
# the legacy `dt` can be used.
# TODO(kenz): remove this file in ~6 months (April 2025).

if [ ! -z "$DEVTOOLS_TOOL_FLUTTER_FROM_PATH" ]
then
echo Running devtools_tool using Dart/Flutter from PATH because DEVTOOLS_TOOL_FLUTTER_FROM_PATH is set
dart run "$SCRIPT_DIR/devtools_tool.dart" "$@"
else
if [ ! -d $SCRIPT_DIR/../flutter-sdk ]
then
# If the `devtools/tool/flutter-sdk` directory does not exist yet, use whatever Dart
# is on the user's path to update it before proceeding.
echo "Running devtools_tool using the Dart SDK from `which dart` to create the Flutter SDK in tool/flutter-sdk."
dart run "$SCRIPT_DIR/devtools_tool.dart" update-flutter-sdk
fi

"$SCRIPT_DIR/../flutter-sdk/bin/dart" run "$SCRIPT_DIR/devtools_tool.dart" "$@"
fi
echo Warning: devtools_tool has been replaced by dt. Please use dt instead.
dt
18 changes: 0 additions & 18 deletions tool/bin/devtools_tool.bat

This file was deleted.

19 changes: 19 additions & 0 deletions tool/bin/dt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash -e

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

if [ ! -z "$DEVTOOLS_TOOL_FLUTTER_FROM_PATH" ]
then
echo Running dt using Dart/Flutter from PATH because DEVTOOLS_TOOL_FLUTTER_FROM_PATH is set
dart run "$SCRIPT_DIR/dt.dart" "$@"
else
if [ ! -d $SCRIPT_DIR/../flutter-sdk ]
then
# If the `devtools/tool/flutter-sdk` directory does not exist yet, use whatever Dart
# is on the user's path to update it before proceeding.
echo "Running dt using the Dart SDK from `which dart` to create the Flutter SDK in tool/flutter-sdk."
dart run "$SCRIPT_DIR/dt.dart" update-flutter-sdk
fi

"$SCRIPT_DIR/../flutter-sdk/bin/dart" run "$SCRIPT_DIR/dt.dart" "$@"
fi
18 changes: 18 additions & 0 deletions tool/bin/dt.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@echo off

IF DEFINED DEVTOOLS_TOOL_FLUTTER_FROM_PATH (
echo Running dt using Dart/Flutter from PATH because DEVTOOLS_TOOL_FLUTTER_FROM_PATH is set
dart run %~dp0/dt.dart %*
) ELSE (

rem If the `devtools/tool/flutter-sdk` directory does not exist yet, use whatever Dart
rem is on the user's path to update it before proceeding.
IF NOT EXIST "%~dp0/../flutter-sdk/" (
echo Running dt using the Dart SDK from `where.exe dart` to create the Flutter SDK in tool/flutter-sdk.
dart run %~dp0/dt.dart update-flutter-sdk
)

%~dp0/../flutter-sdk/bin/dart run %~dp0/dt.dart %*
)

EXIT /B %errorlevel%
File renamed without changes.
Loading

0 comments on commit 8f116c5

Please sign in to comment.