62 Commits

Author SHA1 Message Date
Kate Lovett
9d96df2364
Modernize framework lints (#179089)
WIP

Commits separated as follows:
- Update lints in analysis_options files
- Run `dart fix --apply`
- Clean up leftover analysis issues 
- Run `dart format .` in the right places.

Local analysis and testing passes. Checking CI now.

Part of https://github.com/flutter/flutter/issues/178827
- Adoption of flutter_lints in examples/api coming in a separate change
(cc @loic-sharma)

## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-11-26 01:10:39 +00:00
Ryan Macnak
00590369f7
Engine build setup for Android RISCV64. (#173672)
Bug: https://github.com/flutter/flutter/issues/117973
2025-08-20 21:50:51 +00:00
Jamil Saadeh
6feaa2c632
[engine] Null aware elements clean-ups (#173075)
<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->

Converted more null checks to null aware elements.

Part of #172188 

*If you had to change anything in the [flutter/tests] repo, include a
link to the migration guide as per the [breaking change policy].*

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-08-01 16:19:22 +00:00
Kate Lovett
a04fb324be
Bump Dart to 3.8 and reformat (#171703)
Bumps the Dart version to 3.8 across the repo (excluding
engine/src/flutter/third_party) and applies formatting updates from Dart
3.8.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-07-07 17:58:32 +00:00
John "codefu" McDole
123e969efa
feat: add "stamp" to et and create build-time engine_stamp.json (#171310)
Writes a stamp file, engine_stamp.json, containing interesting
information about this build:

```json
{
  "build_date": "2025-06-27T16:35:13.279188",
  "build_time_ms": 1751067313279,
  "git_revision": "e68e105667e9e5cace56b0431781062b773e4831",
  "git_revision_date": "2025-06-27 15:51:55 -0700",
  "content_hash": "23542e452fc55890626fd1c5eb77c4788c19f983"
}
```

Later; I'll update to the flutter tool to download this artifact to
bin/cache so it can be used instead of git commands.
2025-06-30 17:55:27 +00:00
Jason Simmons
b4d05f4867
Manual roll of Dart SDK from 023ac80cef14 to 2cecb16348e4 (#163621) 2025-02-19 20:37:35 +00:00
Yegor
1f5cb0d665
support running et fetch from anywhere (#162712)
Support running `et fetch` from any directory.
2025-02-06 04:59:24 +00:00
Matan Lurey
9e273d5e6e
Remove scenario_app/android and rename to ios_scenario_app. (#160992)
🚫 **BLOCKED** : Do not merge until
https://github.com/flutter/flutter/issues/161261 (additional test
coverage).

---

This PR eliminates (1) `scenario_app/android`, and all references to an
Android `scenario_app`, including documentation, CI configuration, build
rules, test runner, Android-side test application, and (2), to verify
and disambiguate the remains, renames the folder `ios_scenario_app`,
which is now accurate.

It also eliminates elements that were _only_ used in the Android-side
scenario_app, such as Firebase Test Lab uploading.

I would be open to doing this in phases if we thought it was better to
do so, but given its mostly a mechanical change (and by renaming the
directory, references can be checked merely by looking for
`/\bscenario_app/`, I believe this is safe to iterate on and eventually
merge after the holidays.

## Background

As of the merged mono-repo, there is no longer a requirement for the
engine to be testable as a standalone unit.

As an example,
[`%ENGINE%/testing/scenario_app`](3762f2e973/engine/src/flutter/testing/scenario_app),
which was intended to _emulate_ the Flutter framework (and some of
`flutter_tools` tooling), load the iOS and Android embedder, and run
various "scenarios" (which ran a combination of `dart:ui` code and
Android Java/iOS Obj-C) verifying golden-file screenshots.

Instead, it is now possible to write and run _real_ (full) Flutter apps
the same way that an end-user (or our own tests) would. One such example
is
[`dev/native_driver_test`](https://github.com/flutter/flutter/tree/master/dev/integration_tests/native_driver_test),
which is a full-fledged Flutter app, which uses standard tooling (i.e.
`flutter`), to test most of the same elements that previously were only
tested in the Android version of `scenario_app`.
2025-01-28 03:43:46 +00:00
Michael Goderbauer
8e0993eda8
Auto-format Dart code in engine (#160576)
This auto-formats all *.dart files in the `engine` subdirectory and
enforces that these files stay formatted with a presubmit check.
2024-12-19 17:13:07 +00:00
Matan Lurey
8bd297a4be Add and document et cleanup. (flutter/engine#56327)
Closes https://github.com/flutter/flutter/issues/157945.

```sh
% et cleanup --dry-run
Checking /Users/matanl/Developer/engine/src/out...
The following directories were accessed later than 2024-10-02:
  android_debug
  android_debug_arm64
  android_debug_unopt
  android_debug_unopt_arm64_ide
  host_debug_unopt_arm64_ide
  ios_debug
  ios_debug_sim_unopt_arm64
  ios_debug_unopt
  ios_debug_unopt_arm64
  license_script_output
  wasm_release
  web_tests
Run without --dry-run to reclaim 2.79gb.
```

```sh
flutter % et cleanup          
Checking /Users/matanl/Developer/engine/src/out...
Deleted 12 output directories and reclaimed 2.79gb.
```
2024-11-04 15:19:51 -08:00
Matan Lurey
6066418415 Refactor BuildPlan, better document and explain --config. (flutter/engine#56324)
Closes https://github.com/flutter/flutter/issues/156591.
Closes https://github.com/flutter/flutter/issues/156355.

I also moved some functions only used as implementation details :)
2024-11-02 00:10:06 +00:00
Matan Lurey
018d53a74f Vastly rewrite and expand et/README.md (flutter/engine#56250)
Closes https://github.com/flutter/flutter/issues/157876.

/cc @dcharkes @jensjoha as well (documented `--gn-args`)
2024-10-31 21:27:54 +00:00
Matan Lurey
eb42dc7b9d Add and use mergeGnArgs with --gn-args from et. (flutter/engine#56228)
Closes https://github.com/flutter/flutter/issues/156909.

This PR adds (and implements) the `--gn-args` (extra command-line GN args) functionality by generalizing on the concept of "merged" GN args that @zanderso had special-cased for `--lto` and `--rbe`, and further testing it.

There is also a logical place for us to expand support of merged arguments at a future point in time.
2024-10-30 21:44:35 +00:00
Matan Lurey
ecb7c78604 Recognizegroup, and warn when we silently discard targets. (flutter/engine#55791)
Closes https://github.com/flutter/flutter/issues/156260.

Fixes the degenerate case where you specify an unrecognized target, and it falls back to rebuilding the entire engine as if you specified nothing. In addition, added recognition of `group`.
2024-10-10 18:45:49 +00:00
Matan Lurey
173af3d95f Refactor multi-file build parsing into a single BuildPlan class. (flutter/engine#55720)
Closes https://github.com/flutter/flutter/issues/148444 (code de-duplicated).
Closes https://github.com/flutter/flutter/issues/150877 (`--build-strategy=local`).
Closes https://github.com/flutter/flutter/issues/150884 (`--build-strategy=remote`).

Replaces duplicate code across ~3 commands (query, test, build) with a class called `BuildPlan`, which encapsulates (a) concurrency, (b) build configuration, (c) RBE, (d) LTO, and (e) build strategy. I also moved all of the validation of the build plan into `build_plan_test`, which gives us better coverage at a lower cost (less things to think about in that suite of tests).

I know the diff looks scary, but 1K of the 1.4K is tests.

/cc @gaaclarke @flar
2024-10-08 23:45:20 +00:00
John McCutchan
1e3d251560 Add --rbe-force-local flag to force rbe task execution to happen on the local machine (flutter/engine#55635)
`build`, `test`, and `run` commands all support the `--exec-strategy`
flag ('auto', 'local', 'remote').

This flag controls the RBE task execution strategy (when RBE is
enabled).

Closes #150877
2024-10-04 14:59:37 -07:00
Matan Lurey
9f49c8f4e3 Add support for et test //flutter/path/to/dart_test (flutter/engine#55638)
Closes https://github.com/flutter/flutter/issues/147013.
Closes https://github.com/flutter/flutter/issues/147071.

/cc @reidbaker who I know wants to do this for the Java rules soon TM.
/cc @jtmcdole, @zanderso for visibility.
2024-10-04 13:55:27 -07:00
Matan Lurey
92c9c99411 Add missing license headers to engine_tool. (flutter/engine#55636)
Address post-submit feedback on https://github.com/flutter/engine/pull/55537#pullrequestreview-2346684376.
2024-10-04 00:24:20 +00:00
Matan Lurey
6c9af1435d Refactor et run (and friends). (flutter/engine#55537)
Does a few things:

- Refactors `run_command_test` significantly to reduce global fixtures
- Replaced stringly-typed things with enum-like objects
- Adds a lot stronger coverage for `run_command` to make future refactors safer
- Takes advantage of `package:test` having a workable matchers system and uses it
- Changes `return 1` into `throw FatalError(...)` where it makes sense in `run_command`

As a result of the refactoring work, I also fixed a bug: Closes https://github.com/flutter/flutter/issues/147646.
2024-10-03 19:32:08 +00:00
Matan Lurey
7a1d324299 Remove all use of gn desc global test fixtures. (flutter/engine#55592)
Closes https://github.com/flutter/flutter/issues/148420.
2024-10-02 21:55:05 +00:00
Matan Lurey
a38103ac0e Remove the need to use runZoned by replacing print statements (flutter/engine#55530) 2024-09-30 21:33:21 +00:00
Matan Lurey
87727168e8 Remove --disable-dart-dev across flutter/engine. (flutter/engine#54845)
As per the Dart CLI team and @bkonyi, this is no longer providing value and we shouldn't cargo-cult it.

Work towards https://github.com/flutter/flutter/issues/154268.
2024-08-29 00:12:32 +00:00
Zachary Anderson
63d8e2bbe6 [et] Plumb -j to ninja (flutter/engine#54005)
Also computes a better `-j` when RBE is enabled.

Fixes https://github.com/flutter/flutter/issues/147667
2024-07-19 20:28:47 +00:00
Matan Lurey
767eb5b265 Gracefully fail when gn desc returns no targets. (flutter/engine#53999)
Closes https://github.com/flutter/flutter/issues/151990.

This is just a nice QOL change, since the `//` format we're using is not "native" to GN or Ninja.
2024-07-18 21:44:06 +00:00
Reid Baker
02d2b7c8e1 Google java format relocation and formatting update (flutter/engine#53118)
Fixes https://github.com/flutter/flutter/issues/149319
Caused by https://github.com/flutter/engine/pull/52582

Follow up required to add a flag that fails on missing jar files instead of skipping missing jar files.
2024-05-31 18:09:23 +00:00
John McCutchan
88b596ca64 Reduce rebuild times when invoking 'et run' (flutter/engine#52883)
Android only for now but this avoids rebuilding a bunch of test targets that aren't necessary to do a `flutter run` with a custom engine.

I need to fill in some blanks for other platforms before landing.
2024-05-22 17:49:05 +00:00
Matan Lurey
b0e791fce3 et generates {out}/{buildName} if missing on et {build|test|query} (flutter/engine#52866)
Closes https://github.com/flutter/flutter/issues/148442.

This restores functionality that existed prior in https://github.com/flutter/engine/pull/52832:

- Splits `runGn` to `ensureBuildDir`, which is in practice what it does.
2024-05-16 04:03:21 +00:00
Matan Lurey
eafc52c37d Include stdout on a failed gn desc call, and test for it. (flutter/engine#52863)
Fixes https://github.com/flutter/flutter/issues/148431, in that full error output is now shown.

I also filed an additional issue for how we could do better: https://github.com/flutter/flutter/issues/148442.
2024-05-16 01:09:13 +00:00
Matan Lurey
cb19eac08e Short-circuit crawling all targets in et {build|test|query} (flutter/engine#52832)
Closes https://github.com/flutter/flutter/issues/147666.

This is a large change, I'd be happy to either review synchronously or
change commands one at a time, but I think this is overall the right
approach. I also didn't see any reason to reuse the `BuildRunner` code
for these commands, the flow is basically:

```mermaid
graph LR
    A[et targetsOrPatterns] --> B[gn desc --format=json]
    B --> C[existing code that runs ninja/workers]
```

Quick summary of changes:
- Introduced a [`Label` and `TargetPattern`][1] type to avoid awkward
string parsing/manipulation all over
- Replaced `gn_utils` (i.e. `targetsFromCommandLine` and friends) with
[an invocation of `gn desc`][2]
- Some tests were brittle in terms of expected output, I mostly left
them alone and wrote TODOs where applicable

Here is the fun part, results (and some manual integration tests):
```sh
# build, previously was 10-15s, is now ~3s
flutter % time et build -c host_debug_unopt_arm64 //flutter/impeller:impeller_unittests
[2024-05-14T19:05:55.163][macos/host_debug_unopt_arm64: GN]: OK
[2024-05-14T19:05:56.119][macos/host_debug_unopt_arm64: RBE startup]: Proxy started successfully.
[macos/host_debug_unopt_arm64: ninja] 0.0% (0/1) Regenerating ninja files[2024-05-14T19:05:57.309][macos/host_debug_unopt_arm64: ninja]: OK
[2024-05-14T19:05:57.573][macos/host_debug_unopt_arm64: RBE shutdown]: Actions completed: 0
$ENGINE/flutter/bin/et build -c host_debug_unopt_arm64   3.20s user 0.87s system 107% cpu 3.776 total

# test, also benefits from speedup, but I didn't time it
flutter % et test -c host_debug_unopt_arm64 //flutter/fml:fml_unittests
[2024-05-14T19:07:01.843][macos/host_debug_unopt_arm64: GN]: OK
[2024-05-14T19:07:02.707][macos/host_debug_unopt_arm64: RBE startup]: Proxy started successfully.
[2024-05-14T19:07:07.400][macos/host_debug_unopt_arm64: ninja]: 100.0% (3/3) LINK ./fml_unittests
[2024-05-14T19:07:07.404][macos/host_debug_unopt_arm64: ninja]: OK
[2024-05-14T19:07:07.748][macos/host_debug_unopt_arm64: RBE shutdown]: Actions completed: 1 (1 racing local)
OKAY:         7s.95ms //flutter/fml:fml_unittests

# query, also benefits from speedup
flutter % time et query targets -c host_debug_unopt_arm64
//flutter/display_list:display_list_benchmarks
//flutter/display_list:display_list_builder_benchmarks
# ... many targets omitted ...
$ENGINE/flutter/bin/et query targets -c host_debug_unopt_arm64  1.27s user 0.18s system 147% cpu 0.978 total
```

In other words, ~5x improvement on `et build` and `et query` is _much_
faster as well.

[1]:
https://github.com/flutter/engine/compare/main...matanlurey:engine:gn-label?expand=1#diff-ac008475ce9e209f4ecf6594b0cd48d12d86a1ffa0aa7d555375ff43b983eb2b
[2]:
https://github.com/flutter/engine/compare/main...matanlurey:engine:gn-label?expand=1#diff-ad116b8504dd0a500bf758a327c7052e5733a2b465d3295e35b74458d483276f
2024-05-15 12:57:02 -07:00
Matan Lurey
d89f54dd65 Replace json_utils with a modern extension type, add tests. (flutter/engine#52769)
I started on a refactoring of
https://github.com/flutter/flutter/issues/147666, and was frustrated
with the JSON decoding of `gn desc --format=json`, so I used a similar
pattern from my micro-json library (https://pub.dev/packages/jsonut) and
encapsulated it as an extension type.

My favorite is the `JsonObject.map` function which replaces:

```dart
/// Construct a RunTarget from a JSON map.
factory RunTarget.fromJson(Map<String, Object> map) {
  final List<String> errors = <String>[];
  final String name = stringOfJson(map, _nameKey, errors)!;
  final String id = stringOfJson(map, _idKey, errors)!;
  final String targetPlatform =
      stringOfJson(map, _targetPlatformKey, errors)!;

  if (errors.isNotEmpty) {
    throw FormatException('Failed to parse RunTarget: ${errors.join('\n')}');
  }
  return RunTarget._(name, id, targetPlatform);
}
```

... with:

```dart
/// Construct a RunTarget from a JSON map.
factory RunTarget.fromJson(Map<String, Object> map) {
  return JsonObject(map).map((JsonObject json) => RunTarget._(
    json.string(_nameKey),
    json.string(_idKey),
    json.string(_targetPlatformKey),
  ));
}
```
2024-05-13 20:03:43 -07:00
Matan Lurey
0a503306d4 Infer --rbe based on the existence of //flutter/build/rbe (flutter/engine#52700)
Closes https://github.com/flutter/flutter/issues/148006.
2024-05-10 11:49:44 -07:00
Matan Lurey
8ce9cf6200 When et is not attached to a terminal, still split lines for status updates. (flutter/engine#52681)
For illustrative purposes:

```sh
$ et build | grep '.*'
```

... should still get line-per-line status updates, but it does not without this patch.

It's hard to write tests because of global state, so I've declined to do so at the moment.

Closes https://github.com/flutter/flutter/issues/147903.
2024-05-09 18:09:05 +00:00
Matan Lurey
05ff169def Move Logger.test to an injected log output versus leaky abstraction. (flutter/engine#52639)
Previously, `Logger.test` was a leaky abstraction that stored a `@visibleForTesting` variable that was sometimes unused. It saved a few lines of code for tests, but doesn't seem necessary, so I swapped it out for a callback.
2024-05-07 22:56:17 +00:00
Matan Lurey
ea78cc7551 Move setting the logging level into the Logger constructor, refactor. (flutter/engine#52624)
Based on @zanderso's feedback here: https://github.com/flutter/engine/pull/52619#discussion_r1592868979.

I think this is the most succinct way to setup logging, it also doesn't seem to make sense to allow the level to be configured at runtime, so boom.
2024-05-07 21:00:54 +00:00
Matan Lurey
8618834019 Move verbose to environment.verbose, pass to ninja --verbose if provided. (flutter/engine#52619)
Closes https://github.com/flutter/flutter/issues/147894.

While doing this PR I realized we were basically passing `(bool verbose, Envrionment)` as a tuple around, so I just moved the concept _into_ `Environment` directly, and made the necessary code changes across the tool and tests.

To clarify, this does _not_ mimic the output of `ninja --verbose` _today_, because we also don't stream the output directly, and instead do terminal magic. Combined with a hypothetical fix for https://github.com/flutter/flutter/issues/147903, this would work exactly the same as before.

/cc @loic-sharma @johnmccutchan
2024-05-07 19:07:31 +00:00
Brandon DeRosier
dfed7164a1 et phone home (flutter/engine#52506)
<img width="684" alt="image" src="https://github.com/flutter/engine/assets/919017/2dcdc7e9-b0e1-434d-9078-1de6a3d57d35">
2024-05-02 01:36:30 +00:00
John McCutchan
1c441f353d Fix et run (flutter/engine#52477)
et run was broken in https://github.com/flutter/engine/pull/51803

this PR adds the missing calls to mangledConfigName before invoking flutter run
2024-05-01 14:20:04 +00:00
Zachary Anderson
f1ac2c5650 [et] Don't require the --verbose flag when requesting a ci/ build (flutter/engine#52339)
https://github.com/flutter/engine/pull/52021 introduced a bug where `ci`
build could only be specified when also passing the `--verbose` flag.
This PR fixes the issue so that by default the `help` message will only
show `ci` builds when `--verbose` is passed to `help`, but the `ci`
builds can be specified even without the `--verbose` flag.
2024-04-23 16:46:11 -07:00
Chris Bracken
0ce6126c47 [et] Lookup output filesystem path, not label (flutter/engine#52248)
Sets BuildTarget.executable to the `root_out_dir`-relative path of the
executable (e.g. `displaylist_unittests`) instead of its label (e.g.
`//out/host_debug/displaylist_unittests`). This is required since, in
the lines following the output lookup, we assume it to be a path
relative to the build output directory.

Also breaks out functions for:
* `_runGnDesc`: returns the JSON output of `gn desc buildDir target`
* `_runGnOutputs`: returns the output files listed by `gn outputs
buildDir target`

Noticed while working on:
https://github.com/flutter/flutter/issues/147071

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2024-04-22 11:13:16 -07:00
Chris Bracken
c9f3a89bf4 [et] Fix concurrent modification exception (flutter/engine#52247)
We cannot modify the list of build targets as we're iterating over it. Instead of removing non-test/non-executable elements, instead we add executable test targets to a separate testTargets list and use that.

Noticed while working on: https://github.com/flutter/flutter/issues/147071

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-04-20 03:40:59 +00:00
Zachary Anderson
0b6ce345a3 [et] Correctly plumb usage line length limit (flutter/engine#52039)
The `Command`s added to a `CommandRunner` don't automatically inherit
the `CommandRunner`'s usage line length limit. This PR does the
necessary plumbing. Help messages look nicer now.
2024-04-11 08:39:05 -07:00
Zachary Anderson
2163fc1bc9 [et] Adds --lto flag to build. Plumbs verbose flag differently. (flutter/engine#52021)
This PR does two things. First, in many of the `ci` builds, LTO is
enabled by default. This is usually not what we want when doing local
builds, so this PR adds an `--lto` flag to the `build` command which is
disabled by default, causing `--no-lto` to be passed to GN. When `--lto`
is passed to the `build` command, `--lto` is passed to GN, which results
in the build using LTO.

Second, this PR eagerly parses the `--verbose` flag out of the command
line so that help messages can optionally show less information. In
particular, in this PR, `ci` and `web_test` builds are only displayed by
`help build` when `--verbose` is passed to the `help` command. There's
some extra text in the help message as well indicating that passing
`--verbose` to `help` will show more builds.
2024-04-10 11:09:14 -07:00
Zachary Anderson
785386dc2f [et] Run GN before looking for targets. Default to build config targets (flutter/engine#51956)
Addresses the notes I left on
https://github.com/flutter/engine/pull/51868. Mainly fixes an issue in
which the `build`, `query`, and `test` commands would fail if GN had not
yet been run for the requested configuration. Instead, in this PR, if
the build output directory doesn't exist yet, then it will run GN before
querying the targets.

Additionally, for the `build` command, if no targets are specified on
the command line, the PR uses the targets in the build config as the
default rather than all targets. `query` and `test` keep the same
behavior.
2024-04-08 13:26:57 -07:00
Zachary Anderson
a7eaa48c9a Adds human readable descriptions to build configs (flutter/engine#51929)
Step 4 of https://github.com/flutter/flutter/issues/145263

Hopefully these descriptions will be more useful than the list of GN
args.
2024-04-05 13:43:04 -07:00
Zachary Anderson
72ea5c99e3 [et] Fixup help text a bit (flutter/engine#51930)
The multiline string literal retains the newlines.
2024-04-05 09:23:12 -07:00
John McCutchan
6b4db1f60a Expand understanding of build targets in et (flutter/engine#51868)
- s/TestTarget/BuildTarget.
- Use a more informative way of querying for build targets from gn
- Port existing code to use new interfaces
- Replace 'query tests' with 'query targets' and a --testonly flag
- Extend 'et build' with support for build target selectors.
- Extend 'et query targets' with support for build target selectors.
2024-04-04 11:28:04 -07:00
Zachary Anderson
87162bdc8a [et] Prepare local_engine.json for CI, teach et to understand local build names (flutter/engine#51803)
This is steps (2) and (3) of
https://github.com/flutter/flutter/issues/145263.

The next steps after this are to:
1. Fix any issues that come up when running `local_engine.json` in CI.
1. Step (4) of https://github.com/flutter/flutter/issues/145263
1. Fill in some missing builds in `local_engine.json`.
2024-04-02 19:21:15 -07:00
John McCutchan
7245fef9ad Add et query tests and et test commands (flutter/engine#51605)
- `et query tests` enumerates all test binaries encoded in BUILD.gn
files.
- `et test` builds, then, runs a set of tests in parallel
- Tests
2024-03-28 16:11:24 -07:00
Zachary Anderson
66fa3dd66c Pass some missing --disable-dart-dev and --suppress-analytics to dart (flutter/engine#51473) 2024-03-17 08:46:11 -07:00
Zachary Anderson
da1a3b464c [et] build and run commands disable RBE with a flag or when not available (flutter/engine#51404) 2024-03-14 14:30:41 -07:00