mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
2.4 KiB
2.4 KiB
Repository Guidelines
Project Structure & Module Organization
packages/: Flutter framework and core Dart packages (flutter,flutter_test,flutter_tools, etc.).engine/: C++/Skia-based engine sources and build files (seeengine/README.mdfor engine build steps).bin/: Flutter CLI entrypoints (bin/flutter) and cached tooling.dev/: Internal tooling, CI scripts, and large test suites (e.g.,dev/bots,dev/devicelab).examples/: Sample apps and integration examples.docs/: Project documentation and contributing references.
Build, Test, and Development Commands
./bin/flutter --version: Bootstraps the repo toolchain (downloads the Dart SDK if needed)../bin/flutter test: Run tests for a package (run from the package directory, e.g.,packages/flutter).bin/cache/dart-sdk/bin/dart dev/bots/test.dart: CI-style test runner; use shards likeSHARD=framework_tests.bin/cache/dart-sdk/bin/dart --enable-asserts dev/bots/analyze.dart: Repository-wide analysis and lint checks../dev/tools/format.sh: Applies Dart formatting used by CI.
Coding Style & Naming Conventions
- Dart uses 2-space indentation; rely on the formatter (
./dev/tools/format.sh) instead of manual alignment. - Follow
analysis_options.yamlat the repo root (and indev/) for lints and analyzer settings. - File names are lower_snake_case; test files must end with
_test.dart.
Testing Guidelines
- Unit/widget tests live in
*/test/and are run withflutter test. - CI uses
dev/bots/test.dart; prefer shards when validating a focused area. - New features or bug fixes should include tests near the affected package or tool.
Commit & Pull Request Guidelines
- Recent commits use a concise summary with a PR number suffix, e.g.
Roll Skia … (#181780). - Keep commit subjects imperative and scoped to the change.
- PRs should include: a clear description, linked issue (if any), and the tests run.
- Follow
CONTRIBUTING.mdandCODE_OF_CONDUCT.mdfor process and community rules.
Agent Notes (GTK4 Porting)
- Engine deps are synced from the repo root using
.gclientcopied fromengine/scripts/standard.gclient; do not use the archivedhttps://github.com/flutter/engine.gitmirror. - Run
gclient syncat the repo root; it may take a long time and needs network access. - GN/Ninja builds can take >10 minutes; use longer timeouts (e.g., 600s) when running
ninja -C engine/src/out/host_debug_unoptvia automation.