Commit Graph

74 Commits

Author SHA1 Message Date
Andrew Kolos
295a9a2031
provide command to FakeCommand::onRun (#142206)
Part of work on [#101077](https://github.com/flutter/flutter/pull/141194). This is done as a separate PR to avoid a massive diff.

## Context
1. The `FakeCommand` class accepts a list of patterns that's used to match a command given to its `FakeProcessManager`. Since `FakeCommand` can match a list of patterns, not just specifically strings, it can be used to match commands where the exact value of some arguments can't (easily) known ahead of time. For example, a part of the tool may invoke a command with an argument that is the path of a temporarily file that has a randomly-generated basename.
2. The `FakeCommand` class provides on `onRun` parameter, which is a callback that is run when the `FakeProcessManager` runs a command that matches the `FakeCommand` in question.

## Issue
In the event that a `FakeCommand` is constructed using patterns, the test code can't know the exact values used for arguments in the command. This PR proposes changing the type of `onRun` from `VoidCallback?` to `void Function(List<String>)?`. When run, the value `List<String>` parameter will be the full command that the `FakeCommand` matched.

Example:
```dart
FakeCommand(
  command: <Pattern>[
    artifacts.getArtifactPath(Artifact.engineDartBinary),
    'run',
    'vector_graphics_compiler',
    RegExp(r'--input=/.*\.temp'),
    RegExp(r'--output=/.*\.temp'),
  ],
  onRun: (List<String> command) {
    final outputPath = (() { 
      // code to parse `--output` from `command`
    })();
    testFileSystem.file(outputPath).createSync(recursive: true);
  },
)
```
2024-01-25 07:51:25 +00:00
Christopher Fujino
4cd0a3252d
[flutter_tools] Fix analyze size on arm64 (#141317)
Fixes https://github.com/flutter/flutter/issues/140659
2024-01-17 00:15:28 +00:00
Elias Yishak
2d60241d61
[Reland] Migration for the sendTiming events for package:unified_analytics (#139299)
Relanding based on this comment:
- https://github.com/flutter/flutter/pull/139278#issuecomment-1832951108

Related to tracker issue:
- https://github.com/flutter/flutter/issues/128251

<img width="278" alt="image" src="https://github.com/flutter/flutter/assets/42216813/cee7b9be-48d6-48e5-8c39-de28d0a1f0de">

The image above shows all of the instances where we have `sendTiming`. All of the call sites have been updated to use the new `Event.timing` event from `package:unified_analytics`.
2023-12-04 21:39:18 +00:00
auto-submit[bot]
6c4475e72d
Reverts "Migration for the sendTiming events for package:unified_analytics" (#139278)
Reverts flutter/flutter#138896
Initiated by: CaseyHillers
This change reverts the following previous change:
Original Description:
Related to tracker issue:
- https://github.com/flutter/flutter/issues/128251

<img width="278" alt="image" src="https://github.com/flutter/flutter/assets/42216813/cee7b9be-48d6-48e5-8c39-de28d0a1f0de">

The image above shows all of the instances where we have `sendTiming`. All of the call sites have been updated to use the new `Event.timing` event from `package:unified_analytics`.
2023-11-30 01:16:19 +00:00
Elias Yishak
60d5c8abc5
Migration for the sendTiming events for package:unified_analytics (#138896)
Related to tracker issue:
- https://github.com/flutter/flutter/issues/128251

<img width="278" alt="image" src="https://github.com/flutter/flutter/assets/42216813/cee7b9be-48d6-48e5-8c39-de28d0a1f0de">

The image above shows all of the instances where we have `sendTiming`. All of the call sites have been updated to use the new `Event.timing` event from `package:unified_analytics`.
2023-11-29 17:42:52 +00:00
Chris Bracken
d71fe92ec4
[macOS] Suppress Xcode 15 createItemModels warning (#138243)
As of Xcode 15 on macOS Sonoma, the following message is (repeatedly)
output to stderr during builds (repros on non-Flutter apps). It is
supppressed in xcode itself, but not when run from the command-line.

```
2023-11-10 10:44:58.031 xcodebuild[61115:1017566] [MT] DVTAssertions: Warning in /System/Volumes/Data/SWE/Apps/DT/BuildRoots/BuildRoot11/ActiveBuildRoot/Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-22267/IDEFoundation/Provisioning/Capabilities Infrastructure/IDECapabilityQuerySelection.swift:103
Details:  createItemModels creation requirements should not create capability item model for a capability item model that already exists.
Function: createItemModels(for:itemModelSource:)
Thread:   <_NSMainThread: 0x6000027c0280>{number = 1, name = main}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
```

This suppresses this message from stderr in our macOS build logs.

Issue: https://github.com/flutter/flutter/issues/135277

## 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] 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
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#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/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2023-11-10 14:14:32 -08: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
LouiseHsu
c9b132d079
Allow .xcworkspace and .xcodeproj to be renamed from default name 'Runner' (#124533)
Adds the ability to rename Runner.xcodeproj and Runner.xcworkspace - fixes https://github.com/flutter/flutter/issues/9767.

To rename a project:
1. Open Runner.xcodeproj in Xcode
2. In the left panel, left click "Show File Inspector" 
<img width="441" alt="Screenshot 2023-04-17 at 11 41 07 PM" src="https://user-images.githubusercontent.com/36148254/232692957-8743742d-c3ef-42e5-833f-dff31aeb2b6a.png">
3. In the right panel, the name of the project, "Runner", should be visible under "Identity and Type". Change the name and press enter.
<img width="299" alt="Screenshot 2023-04-17 at 11 40 43 PM" src="https://user-images.githubusercontent.com/36148254/232693315-b6a71165-f5e3-4a0f-8954-2f3eee5b67cf.png">
4. A wizard should pop up. Click Rename.
<img width="573" alt="Screenshot 2023-04-17 at 11 44 01 PM" src="https://user-images.githubusercontent.com/36148254/232693381-bb9cf026-2a75-4844-b42d-ae0036ae9fdd.png">
To rename the workspace:

1. Make sure Xcode is closed.
2. Rename the .xcworkspace to your new name.

If you also renamed the project

&nbsp; 3. Reopen the .xcworkspace in Xcode. If the selected project is the old name and in red, update it to match the new project name.

Tests for schemeFor were changed as with Xcode 14, in some cases the scheme will be renamed along with the project. Thus we will get the best match scheme for either the project name, or the default name Runner. However if a flavor is present, the scheme should always match the flavor.
2023-05-03 05:52:58 +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
Tim Maffett
2e8c3468e7
fix devtool instructional messages after flutter build ... --analyze-size . Fixes #122229 (#122230)
fix devtool instructional messages after `flutter build ... --analyze-size `.  Fixes #122229
2023-03-09 22:29:50 +00: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
Victoria Ashworth
378387b139
when getting xcworkspace, exclude hidden files (#114099)
* exclude xcworkspace that begins with a period

* fix if spacing, add comment

* add unit test for when no xcworkspace found

* update to use xcodeWorkspace, make it nullable and refactor

* check if hostAppRoot exists before trying to get xcworkspace

* use local variables to take advantage of type promotion

* only check if not null, don't need to check if exists

* readd exist check for migrate

* readd missing line at end of file
2022-11-07 18:48:52 +00:00
Liam Appelbe
8da0432094
Null safety migration of packages/flutter_tools/test/commands.shard/hermetic, part 1/3 (#110707)
* Migrate packages/flutter_tools/test/commands.shard/hermetic, part 1/3

* Fix tests

* Fix analysis

* Fix analyze_test

* Make AnalysisServer a local variable

* Chris's comments
2022-09-06 11:21:23 -07:00
Jenn Magder
7c7ae991e5
Use hasNoRemainingExpectations matcher for fake process manager in tool tests (#108649) 2022-07-30 02:02:05 +00:00
Alexandre Ardhuin
07f1c20474
add missing trailing commas in list/set/map literals (#102585) 2022-04-27 09:15:35 +02:00
Jenn Magder
12da4a2aff
Filter out some stray Xcode logging during macOS builds (#100707) 2022-03-25 16:35:11 -07:00
Dan Field
ff74557c3a
Specify destination when building for macOS (#100315)
Fixes #86590
2022-03-17 16:39:05 -07:00
Chris Bracken
a618ca27a7
[macOS] Enable universal binary builds by default (#100271)
This changes the default build architectures for Flutter macOS apps to
x86_64 and arm64. Previously, we manually excluded arm64 builds via the
EXCLUDE_ARCHS Xcode setting in Flutter's generated xcconfig file. This
eliminates setting EXCLUDE_ARCHS during the build and updates the
default architectures in the tool and in the macos_assemble.sh wrapper.

Issue: https://github.com/flutter/flutter/issues/97681
Umbrella issue: https://github.com/flutter/flutter/issues/60113
2022-03-17 12:28:39 -07:00
Chris Bracken
20ff180ae8
Update Flutter desktop doc URL in error message (#96559)
When desktop support is not present in an existing project, certain
flutter tool commands raise an error that direct the user to
documentation on how to add desktop support to an existing Flutter
project. In a recent revamp of the webside, the URL was very slightly
changed (flutter.dev -> docs.flutter.dev).

This updates the error message to output the new URL.

Issue: https://github.com/flutter/flutter/issues/94398
2022-01-12 18:21:05 -08:00
Ian Hickson
61a0add286
Enable avoid_redundant_argument_values lint (#91409) (#91462) 2021-10-08 09:25:14 -07:00
Zachary Anderson
b9d2177da0
Revert "Enable avoid_redundant_argument_values lint (#91409)" (#91461)
This reverts commit 5fd259be24.
2021-10-07 21:11:07 -07:00
Ian Hickson
5fd259be24
Enable avoid_redundant_argument_values lint (#91409) 2021-10-07 20:13:02 -07:00
Ahmed Ashour
9492e13c45
Reland [flutter_tools] show only supported sub commands (#86153) 2021-07-22 13:41:03 -07:00
Zachary Anderson
c589a0c322
Revert "[flutter_tools] show only supported sub commands (#85125)" (#86131)
This reverts commit 84e576786c.
2021-07-08 15:58:05 -07:00
Ahmed Ashour
84e576786c
[flutter_tools] show only supported sub commands (#85125) 2021-07-08 14:56:06 -07:00
Renan
293756455c
Re-land: Allow users to pass in Xcode build settings as env variables to flutter build macos FLUTTER_XCODE_ (#82298) 2021-05-11 17:09:09 -07:00
Zachary Anderson
04bb954a7d
Revert "Allow users to pass in Xcode build settings as env variables to flutter build macos FLUTTER_XCODE_ (#81384)" (#82004)
This reverts commit 0bba935b76.
2021-05-06 19:04:23 -07:00
Renan
0bba935b76
Allow users to pass in Xcode build settings as env variables to flutter build macos FLUTTER_XCODE_ (#81384) 2021-05-06 16:29:04 -07:00
Jenn Magder
1a36c18497
Tell user how to enable available but disabled features (#79977) 2021-04-08 23:33:00 -07:00
Jenn Magder
a2f67720ef
Migrate test/src/common to null safety (#79907) 2021-04-06 22:55:03 -07:00
Sam Rawlins
3e4320847a
Remove "unnecessary" imports in test/commands.shard. (#78665) 2021-04-06 11:14:01 -07:00
Jenn Magder
2a54bb02aa
Opt into CocoaPods parallel codesigning (#76833) 2021-02-26 13:16:03 -08:00
Jonah Williams
2951363dc8
[flutter_tools] switch FakeCache to cache.test and NoopUsage to TestUsage (#76802) 2021-02-26 11:13:32 -08:00
stuartmorgan
13d051f2f4
Update link for missing desktop projects (#76123) 2021-02-16 09:51:03 -08:00
Jonah Williams
021311ed8a
Revert "[flutter_tools] move process manager into tool (#75350)" (#75639)
This reverts commit 8b6baae44c.
2021-02-08 09:21:46 -08:00
Jonah Williams
8b6baae44c
[flutter_tools] move process manager into tool (#75350)
Our current top crasher is an unclear error when ProcessManager fails to resolve an executable path. To fix this, we'd like to being adjusting the process resolution logic and adding more instrumentation to track failures. In order to begin the process, the ProcessManager has been folded back into the flutter tool
2021-02-04 13:19:11 -08:00
Jonah Williams
44d5950d27
[flutter_tools] switch dart defines to base64 to avoid windows control characters (#75027)
= gets escaped into %3D which seems to be tripping up cmake on windows since % is a control character. Switch to base64 encoding, since this does not have % nor , in the output character set.

This change is not trivially cherry pickable, and isn't tested on windows aside from my local, manual tests due to the planned CI work not being complete yet.

Fixes #75017
Fixes #74705
2021-02-02 09:10:48 -08:00
Jonah Williams
b926c7b696
[flutter_tools] rewrite Usage.test to capture objects instead of print logs (#74829) 2021-01-28 12:41:14 -08:00
Jonah Williams
74bd7b6f6d
[flutter_tools] opt all flutter tool libraries and tests out of null safety. (#74832)
* opt out the flutter tool

* oops EOF

* fix import

* Update tool_backend.dart

* Update daemon_client.dart

* fix more
2021-01-27 15:17:53 -08:00
Jenn Magder
bf37a3964b
Rename setUpMockXcodeBuildHandler -> setUpFakeXcodeBuildHandler in tests (#74778) 2021-01-26 21:19:02 -08:00
Jenn Magder
7aacff2216
Exclude ARM from macOS builds (#72748) 2020-12-21 16:05:24 -08:00
Jenn Magder
1c18cf3da8
Move macOS Podfile logic into the tool (#72020) 2020-12-17 11:48:16 -08:00
Kenzie Schmoll
94a30ddcbb
Add text to --analyze-size command output to launch DevTools with size data (#72295)
* Add text to --analyze-size command output to launch DevTools with size data.
2020-12-15 11:06:10 -08:00
Jonah Williams
81e1f7d1ed
[flutter_tools] mode code size output to ~/.flutter-devtools (#71601) 2020-12-02 17:19:57 -08:00
Jenn Magder
e26c7f98ff
Force regeneration of old Podfile (#70735) 2020-11-18 13:33:04 -08:00
Jenn Magder
148ae7bf71
Always build x86 mac apps (#70649) 2020-11-16 14:53:04 -08:00
Alexandre Ardhuin
73301a35a2
Sync lints (#68136) 2020-10-15 15:37:04 -07:00