Files
sdk/pkg/analysis_server/CONTRIBUTING.md
T
Kenzie Davisson d9bb808663 Add a tools script to build a local Dart SDK and copy the output to a local Flutter SDK.
This script is helpful for testing local Dart SDK changes against a
Flutter project. This CL also adds instructions to the analysis_server
CONTRIBUTING guide.

The help output of the script looks like this:

> dart tools/copy_dart_to_flutter.dart -h
-a, --arch Specify your machine's architecture.
                                                     [ARM64 (default), X64]
    --[no-]build-sdk                                 Whether to build the Dart SDK as part of running this script. Negate with --no-build-sdk if you have already built the Dart SDK locally and want to skip this step.
                                                     (defaults to on)
-d, --local-dart=</Users/me/path/to/dart-sdk/sdk> Path to your local
Dart SDK directory. If unspecified, this value will default to the value
of the LOCAL_DART_SDK environment variable.
-f, --local-flutter=</Users/me/path/to/flutter> Path to your local Flutter
SDK directory. If unspecified, this value will default to the value of
the LOCAL_FLUTTER_SDK environment variable. -v, --verbose Run the script
with verbose output, which will forward the stdout and stderr of all
sub-processes. -h, --help Show the program usage.

Additional commands
    --reset                                          Reset your local Flutter SDK cache to undo the effects of running this script.

Change-Id: Ie34bf169838c3b0ac366cd02817324352b9234be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408481
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
2025-03-10 15:32:29 -07:00

1.9 KiB

Contributing

Contributions welcome! Please follow the guide in Contributing.

Building

If you want to build Dart yourself, here is a guide to getting the source, preparing your machine to build the SDK, and building.

There are more documents on our wiki. Once set up to build the SDK, run:

./tools/build.py -mrelease create_sdk

Testing your changes against a local Flutter project

There may be times where you want to test your SDK changes locally against a Flutter project. To do this, you can use the copy_dart_to_flutter.dart script in the sdk/tools/ directory.

To see usage information for this script, run:

dart ./tools/copy_dart_to_flutter.dart -h

For ease of use, consider setting the LOCAL_DART_SDK and LOCAL_FLUTTER_SDK environment variables. Otherwise, you will need to specify these paths via the -d and -f options when running the script. You can add the following to your .bash_profile or .zshrc file to set the environment variables:

export LOCAL_DART_SDK='/Users/me/path/to/dart-sdk/sdk'
export LOCAL_FLUTTER_SDK='/Users/me/path/to/flutter'

Instructions for testing your local changes against a Flutter project:

  1. Run the copy_dart_to_flutter.dart script.
    dart ./tools/copy_dart_to_flutter.dart
    
  2. Open a Flutter project in your IDE and restart the Analysis Server to test your changes.

Running tests

To run analyzer tests:

./tools/test.py -mrelease pkg/analyzer/test/

To run all analysis server tests:

./tools/test.py -mrelease pkg/analysis_server/test/

To run just the analysis server integration tests:

./tools/test.py -mrelease pkg/analysis_server/test/integration/