Commit Graph

245 Commits

Author SHA1 Message Date
Jason Simmons
c9d4c749b5
Disable single character mode in the terminal when exiting flutter_tools (#146534) 2024-04-10 23:54:42 +00:00
Kenzie Davisson
31f4f2b6c0
Add a --print-dtd flag to print the DTD address served by DevTools server (#144272) 2024-03-25 13:04:18 -07:00
Daco Harkes
4e70bfae2b
Reland "Move native assets to isolated/ directory" (#143055)
Reland of https://github.com/flutter/flutter/pull/142709.

The revert of the revert is in the first commit, the fix in the commit on top.

The move of the fakes for packages/flutter_tools/test/general.shard/resident_runner_test.dart was erroneous before, as it was trying to use setters instead of a private field. This PR changes the private `_devFS` field in the fake to be a public `fakeDevFS` in line with other fakes.

## Original PR description

Native assets in other build systems are not built with `package:native_assets_builder` invoking `build.dart` scripts. Instead all packages have their own blaze rules. Therefore we'd like to not depend on `package:native_assets_builder` from flutter tools in g3 at all.

This PR aims to move the imports of `native_assets_builder` and `native_assets_cli` into the `isolated/` directory and into the files with a `main` function that are not used in with other build systems.

In order to be able to remove all imports in files used by other build systems, two new interfaces are added `HotRunnerNativeAssetsBuilder` and `TestCompilerNativeAssetsBuilder`. New parameters are then piped all the way through from the entry points:

* bin/fuchsia_tester.dart
* lib/executable.dart

The build_system/targets dir is already excluded in other build systems.

So, after this PR only the two above files and build_system/targets import from `isolated/native_assets/` and only `isolated/native_assets/` import `package:native_assets_cli` and `package:native_assets_builder`.

Context:

* https://github.com/flutter/flutter/issues/142041
2024-02-08 17:49:48 +00:00
auto-submit[bot]
ceca606662
Reverts "Move native assets to isolated/ directory" (#143027)
Reverts flutter/flutter#142709

Initiated by: vashworth

Reason for reverting: `Mac tool_tests_general` started failing on this commit: https://ci.chromium.org/ui/p/flutter/builders/prod/Mac%20tool_tests_general/15552/overview

Original PR Author: dcharkes

Reviewed By: {christopherfujino, chingjun, reidbaker}

This change reverts the following previous change:
Original Description:
Native assets in other build systems are not built with `package:native_assets_builder` invoking `build.dart` scripts. Instead all packages have their own blaze rules. Therefore we'd like to not depend on `package:native_assets_builder` from flutter tools in g3 at all.

This PR aims to move the imports of `native_assets_builder` and `native_assets_cli` into the `isolated/` directory and into the files with a `main` function that are not used in with other build systems.

In order to be able to remove all imports in files used by other build systems, two new interfaces are added `HotRunnerNativeAssetsBuilder` and `TestCompilerNativeAssetsBuilder`. New parameters are then piped all the way through from the entry points:

* bin/fuchsia_tester.dart
* lib/executable.dart

The build_system/targets dir is already excluded in other build systems.

So, after this PR only the two above files and build_system/targets import from `isolated/native_assets/` and only `isolated/native_assets/` import `package:native_assets_cli` and `package:native_assets_builder`.

Context:

* https://github.com/flutter/flutter/issues/142041
2024-02-07 00:01:18 +00:00
Daco Harkes
a069e62e8a
Move native assets to isolated/ directory (#142709)
Native assets in other build systems are not built with `package:native_assets_builder` invoking `build.dart` scripts. Instead all packages have their own blaze rules. Therefore we'd like to not depend on `package:native_assets_builder` from flutter tools in g3 at all.

This PR aims to move the imports of `native_assets_builder` and `native_assets_cli` into the `isolated/` directory and into the files with a `main` function that are not used in with other build systems.

In order to be able to remove all imports in files used by other build systems, two new interfaces are added `HotRunnerNativeAssetsBuilder` and `TestCompilerNativeAssetsBuilder`. New parameters are then piped all the way through from the entry points:

* bin/fuchsia_tester.dart
* lib/executable.dart

The build_system/targets dir is already excluded in other build systems.

So, after this PR only the two above files and build_system/targets import from `isolated/native_assets/` and only `isolated/native_assets/` import `package:native_assets_cli` and `package:native_assets_builder`.

Context:

* https://github.com/flutter/flutter/issues/142041
2024-02-06 20:59:49 +00:00
Lau Ching Jun
ac7879e2aa
Avoid depending on files from build_system/targets other than from top level entrypoints in flutter_tools. (#142760)
Add a new `BuildTargets` class that provides commonly used build targets. And avoid importing files from `build_system/targets` except from the top level entrypoints or from top level commands.

Also move `scene_importer.dart` and `shader_compiler.dart` into `build_system/tools` because they are not `Target` classes, but wrapper for certain tools.

With this change, we can ignore all files in `build_system/targets` internally and make PR #142709 easier to land internally. See cl/603434066 for the corresponding internal change.

Related to:
https://github.com/flutter/flutter/pull/142709
https://github.com/flutter/flutter/issues/142041

Also note that I have opted to add a new variable in `globals.dart` for `BuildTargets` in this PR, but I know that we are trying to get rid of globals. Several alternatives that I was considering:

1. Add a new field in `BuildSystem` that returns a `BuildTargets` instance. Since `BuildSystem` is already in `globals`, we can access build targets using `globals.buildSystem.buildTargets` without adding a new global variable.
2. Properly inject the `BuildTargetsImpl` instance from the top level `executable.dart` and top level commands.

Let me know if you want me to do one of the above instead. Thanks!
2024-02-02 18:23:08 +00:00
Christopher Fujino
4c978efead
[flutter_tools] Fix bad state future already completed in flutter logs (#138517)
Fixes https://github.com/flutter/flutter/issues/138436
2023-11-23 19:56:14 +00:00
Ian Hickson
4d788b109d
Reduce animations further when --no-cli-animations is set. (#133598) 2023-11-16 21:05:22 +00:00
Christopher Fujino
8a31a3a284
Flutter preview device (#135639)
Fixes https://github.com/flutter/flutter/issues/130277

This PR does two things:

1. introduce a hidden `flutter build _preview` command, that will build a debug windows desktop app and copy it into the SDK's binary cache. This command is only intended to be run during packaging.
2. introduce a new device type, called `PreviewDevice`, which relies on the prebuilt desktop debug app from step 1, copies it into the target app's assets build folder, and then hot reloads their dart code into it.
2023-10-18 00:27:54 +00:00
Ian Hickson
487bd69078
Support disabling animations in the CLI (#132239) 2023-08-23 03:35:22 +00:00
Christopher Fujino
a6118612ac
Fix flutter attach local engine (#131825)
Fixes: https://github.com/flutter/flutter/issues/124970
Part of https://github.com/flutter/flutter/issues/47161

Before this change, there were two places we overrode the `Artifacts` in a Zone:

1. if/when we parse local-engine CLI options: 1cf3907407/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart (L281)
2. an additional override for fuchsia platform dill (no longer used, deleted in this PR): 1cf3907407/packages/flutter_tools/lib/src/commands/attach.dart (L274)

Note 1 above creates a new instance of `Artifacts.getLocalEngine()`. In this flow, there exist two instances of `Artifacts`:

1. The default fallback instance of `CachedArtifacts` (which gets all artifacts from flutter/bin/cache), instantiated in context_runner.dart: 1cf3907407/packages/flutter_tools/lib/src/context_runner.dart (L137)
2. An instance of `CachedLocalEngineArtifacts` created in the command runner once the CLI options have been parsed: 1cf3907407/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart (L281)

The regression happened when we direct injected the Artifacts 1 from above BEFORE we parsed the local-engine flag, and then used this in the second zone override, and then when creating the `FlutterDevice` there are multiple calls to `globals.artifacts` returned it when it should have returned Artifacts 2: 1cf3907407/packages/flutter_tools/lib/src/resident_runner.dart (L80)

Device.artifactOverrides was originally introduced in https://github.com/flutter/flutter/pull/32071, but is no longer used, so I deleted it.

I also removed direct injection of `Artifacts` to the attach sub-command, because that class now no longer references artifacts.

I believe the ideal true fix for this would be to:

1. Migrate all leaf calls to `globals.artifacts` to use direct injection (in this case, the offending invocations were in [`FlutterDevice.create()`](1cf3907407/packages/flutter_tools/lib/src/resident_runner.dart (L80-L218)), but I'm not sure that something else would not have broken later)
2. Ensure we are always direct injecting the desired instance of `Artifacts`--that is, if the user desires local engine artifacts, that we are passing an instance of `CachedLocalEngineArtifacts`.
  a. Alternatively, and probably simpler, teach `CachedArtifacts` to know about the local engine. This would mean parsing the global CLI options BEFORE we ever construct any instance of `Artifacts`.
  
As an overall recommendation for implementing https://github.com/flutter/flutter/issues/47161, in the overall tree of tool function calls, we should probably migrate the leaves first (that is, migrate the sub-commands last). We should also audit and reconsider any usage of `runZoned()` or `context.run()` for the purpose overriding zoneValues.
2023-08-10 17:51:05 +00:00
Christopher Fujino
6f3b07811b
[flutter_tools] delete flutter format command (#129360)
On the current stable branch (3.10.x), `flutter format` no longer works, and gives an error. This change just deletes the code.

Fixes https://github.com/flutter/flutter/issues/115809
2023-06-22 21:28:55 +00:00
Janice Collins
81e9060968
Suppress analytics flag pass through to analysis server (#123235)
Suppress analytics flag pass through to analysis server
2023-03-24 19:59:15 +00:00
Christopher Fujino
3736274a6d
Revert "[flutter_tools] Remove sound null safety flag (#123031)" (#123280)
Revert "[flutter_tools] Remove sound null safety flag (#123031)"
2023-03-22 22:53:49 +00:00
Christopher Fujino
f4c3facfdd
Revert "Revert "[flutter_tools] Remove sound null safety flag (#120936)" (#122909)" (#123031)
[flutter_tools] Remove sound null safety flag #2
2023-03-20 22:32:07 +00:00
Christopher Fujino
f6bc147c91
Revert "[flutter_tools] Remove sound null safety flag (#120936)" (#122909)
This reverts commit 7c3088cf22.
2023-03-17 11:31:48 -07:00
Christopher Fujino
7c3088cf22
[flutter_tools] Remove sound null safety flag (#120936)
[flutter_tools] Remove sound null safety flag
2023-03-17 17:48:35 +00:00
Christopher Fujino
7e151b4641
[flutter_tools] throw tool exit on invocation of flutter format (#121646)
[flutter_tools] throw tool exit on invocation of flutter format
2023-03-16 21:40:26 +00:00
Jackson Gardner
db1c3e208d
Platform binaries reland (#115502)
You can now specify a --local-web-sdk flag to point to a wasm_release folder. This will make it so that only artifacts that pertain to the web sdk are overridden to point to the wasm_release folder. Other artifacts (such as impellerc) will pull from the cache, or from the --local-engine path if that is specified.

This also uses precompiled platform kernel files for both ddc and dart2js
2022-12-02 14:13:40 -08:00
Jesús S Guerrero
530324d232
Build command dependency injection (#114383)
* update flutter build command

* update tests

* fix analyze suggestions
2022-11-08 23:38:10 +00:00
Alex Wallen
7020f59ace
[tool] Support --flavor option for flutter install. (#114048)
* Alphabetize setup calls

* Add --flavor as an option for install

* Add verbose logging in install command

* Test that flavors build succeeds with proper flavor and fails with bogus one.

* Remove unused import

* The import was used...

* SQUASH

* Add flavor install test

* Rename test

* Add flavors install integration tests

* correct error message

* remove unused imports

* Delete copy test

* update test target

* Refactor mechanism to read buildInfo

* Remove unused import

* Set affected test targets to bringup: true

Co-authored-by: a-wallen <stephenwallen@google.com>
2022-11-08 22:53:23 +00:00
Jenn Magder
28ab431096
Make Logger required when injected in flutter_tool (#114111) 2022-10-27 22:40:08 +00:00
Christopher Fujino
d40f6d1e68
[flutter_tools] allow flutter drive to take screenshots when sent a terminating signal (#114118) 2022-10-27 18:51:15 +00:00
Jesús S Guerrero
eea60f86f1
Dependency injection Attach command (#113227) 2022-10-18 17:30:01 +00:00
Gary Qian
21861423f2
[flutter_tools] analyze --suggestions --machine command (#112217) 2022-10-03 17:40:58 +00:00
Elias Yishak
0c829caad8
error handling when path to dir provided instead of file (#109796) 2022-09-14 21:13:13 +00:00
Christopher Fujino
08d5d51a98
[flutter_tools] Instantiate shutdown hooks before localfilesystem (#110693) 2022-09-02 17:38:56 +00:00
Jesús S Guerrero
e271e8428b
add GeneralInfo project validator to analyze --suggestions (#109874) 2022-08-19 21:18:49 +00:00
Tae Hyung Kim
646666f8e7
[gen_l10n] Add option to format generated localizations files (#109171)
* init

* fix

* fix 2

* fix 3

* tests

* fix tests

* clarify help text

* fix all tests

* fix formatting?

* add second test

* unused import

* remove print

* trailing spaces

* artifacts is never null

* fix
2022-08-19 14:03:42 -07:00
jensjoha
981bdf5476
[flutter_tools] Make flutter test -v print timing of different phases (#108864) 2022-08-18 16:26:56 +00:00
Jesús S Guerrero
cdf5b1d40d
Pub dependencies project validator (#106895) 2022-07-15 23:12:05 +00:00
Jesús S Guerrero
ddd493b927
[flutter_tools] migrate project-validate to analyze --suggestions (#106149) 2022-06-24 18:43:07 +00:00
Jonah Williams
92034482f9
[flutter_tool] partial null safety migration of tool source code (#105798) 2022-06-15 20:02:07 +00:00
Jason Simmons
ba4d63a47b
Exit the tool if a DevTools subprocess fails when running on a bot (#97613) 2022-02-02 14:55:18 -08:00
Christopher Fujino
e8ec8a0dfb
[flutter_tools] Catch lack of flutter tools source missing (#93168) 2021-11-12 14:43:52 -08:00
Jenn Magder
9e88fe328e
Remove globals_null_migrated.dart, move into globals.dart (#92861) 2021-11-01 17:18:03 -07:00
Danny Tuppeny
de966d8a49
Add a "flutter debug_adapter" command that runs a DAP server (#91802) 2021-10-27 06:48:06 -07:00
Kenzie (Schmoll) Davisson
5a85c0d81c
Launch DevTools from the 'dart devtools' command instead of pub (#90894) 2021-09-29 15:32:24 -07:00
Sigurd Meldgaard
bce366203a
Stop calling top level pub (#89032)
* Use `dart __deprecated_pub` instead of `pub` to invoke pub from tools

The top level `pub` commmand has been deprecated and will print
a message. It is however implemented via the __deprecated_pub command
that prints no message.
2021-08-30 10:40:10 -07:00
Jonah Williams
63a4013160
Revert "[flutter_tools] let the logger know about machine mode (#86116)" (#86363)
This reverts commit 53d8cba3ec.
2021-07-13 10:39:35 -07:00
Ian Hickson
d3c17acf9d
Run "pub global activate devtools" before overall_experience_test (#85812) 2021-07-12 14:36:05 -07:00
Jonah Williams
53d8cba3ec
[flutter_tools] let the logger know about machine mode (#86116) 2021-07-12 10:41:03 -07:00
Hannes Winkler
a1e9f2057f
[custom-devices] general improvements, add custom-devices subcommand, better error handling (#82043) 2021-07-07 09:16:04 -07:00
Ahmed Ashour
529a599ce6
Fix some indentation (#84967) 2021-07-01 13:41:04 -07:00
Jonah Williams
10840352ce
[flutter_tools] switch flutter sdk to dart format (#84273) 2021-06-10 07:54:03 -07:00
Jenn Magder
19eab105a5
Migrate build_system, exceptions, and source to null safety (#83147) 2021-05-24 10:29:04 -07:00
Jonah Williams
b30d97a64c
[flutter_tools] split host artifacts out of Artifacts (#80876) 2021-04-22 19:29:02 -07:00
Jenn Magder
3463946448
Take screenshot when drive fails (#78822) 2021-03-22 19:06:28 -07:00
Jonah Williams
cf903d7392
[flutter_tools] remove globals from process, filesystem (#78357) 2021-03-22 10:35:40 -07:00
Jonah Williams
666c950989
[flutter_tools] replace most MockBuildSystem instances with TestBuildSystem (#76821) 2021-02-26 08:46:00 -08:00