Commit Graph

65 Commits

Author SHA1 Message Date
Victoria Ashworth
425d1bd258
Update tests to use Xcode 16.2 and iOS 18.2 Simulator (#165318)
Runs tests on Xcode 16.2 and iOS 18.2. Also updates engine scenario
golden files to iOS 18.2 and removes non-impeller (Skia) test files that
we no longer use.

All framework tests passing:
https://github.com/flutter/flutter/issues/148899#issuecomment-2701465612
All engine tests passing:
https://github.com/flutter/flutter/issues/148906#issuecomment-2702112378

Fixes https://github.com/flutter/flutter/issues/148907 and
https://github.com/flutter/flutter/issues/148957.

## 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].

<!-- 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-03-18 14:13:26 +00:00
Victoria Ashworth
8d100a6416
Get flavor/scheme in assemble command from the build configuration (#162907)
This moves the logic for `FLUTTER_APP_FLAVOR` into `flutter assemble`,
so that it also works when ran through Xcode and not just through the
Flutter CLI.

However, there's no definitive way to get the the flavor/scheme in
`flutter assemble`, so this makes a best effort to get it by parsing it
out of the `CONFIGURATION`. `CONFIGURATION` should have the name of the
scheme in it, although, this is only
[semi-enforced](1d85de0fc8/packages/flutter_tools/lib/src/ios/mac.dart (L201-L203)),
so may not always work. If it's unable to get the scheme name from the
`CONFIGURATION`, it falls back to using the `FLAVOR` environment
variable, which is set by the Flutter CLI and used currently.

Verified `Mac_ios flavors_test_ios` passes:
https://ci.chromium.org/ui/p/flutter/builders/prod.shadow/Mac_ios%20flavors_test_ios/7/overview

Verified `Mac flavors_test_macos` passes:
https://ci.chromium.org/ui/p/flutter/builders/try.shadow/Mac%20flavors_test_macos/2/overview

Fixes https://github.com/flutter/flutter/issues/155951.

## 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].

<!-- 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-02-19 20:37:35 +00:00
Michael Goderbauer
5491c8c146
Auto-format Framework (#160545)
This auto-formats all *.dart files in the repository outside of the
`engine` subdirectory and enforces that these files stay formatted with
a presubmit check.

**Reviewers:** Please carefully review all the commits except for the
one titled "formatted". The "formatted" commit was auto-generated by
running `dev/tools/format.sh -a -f`. The other commits were hand-crafted
to prepare the repo for the formatting change. I recommend reviewing the
commits one-by-one via the "Commits" tab and avoiding Github's "Files
changed" tab as it will likely slow down your browser because of the
size of this PR.

---------

Co-authored-by: Kate Lovett <katelovett@google.com>
Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
2024-12-19 20:06:21 +00:00
Nate Wilson
5ecf10052f
pattern-matching refactor (#154753)
This pull request aims to improve code readability, based on feedback gathered in a recent design doc.

<br>

There are two factors that hugely impact how easy it is to understand a piece of code: **verbosity** and **complexity**.

Reducing **verbosity** is important, because boilerplate makes a project more difficult to navigate. It also has a tendency to make one's eyes gloss over, and subtle typos/bugs become more likely to slip through.

Reducing **complexity** makes the code more accessible to more people. This is especially important for open-source projects like Flutter, where the code is read by those who make contributions, as well as others who read through source code as they debug their own projects.

<hr>

<br>

The following examples show how pattern-matching might affect these two factors:

<details> <summary><h3>Example 1 (GOOD)</h3> [click to expand]</summary>

```dart
if (ancestor case InheritedElement(:final InheritedTheme widget)) {
  themes.add(widget);
}
```

Without using patterns, this might expand to

```dart
if (ancestor is InheritedElement) {
  final InheritedWidget widget = ancestor.widget;
  if (widget is InheritedTheme) {
    themes.add(widget);
  }
}
```

Had `ancestor` been a non-local variable, it would need to be "converted" as well:

```dart
final Element ancestor = this.ancestor;
if (ancestor is InheritedElement) {
  final InheritedWidget inheritedWidget = ancestor.widget;
  if (widget is InheritedTheme) {
    themes.add(theme);
  }
}
```

</details>

<details> <summary><h3>Example 2 (BAD) </h3> [click to expand]</summary>

```dart
if (widget case PreferredSizeWidget(preferredSize: Size(:final double height))) {
  return height;
}
```

Assuming `widget` is a non-local variable, this would expand to:

```dart
final Widget widget = this.widget;
if (widget is PreferredSizeWidget) {
  return widget.preferredSize.height;
}
```

<br>

</details>

In both of the examples above, an `if-case` statement simultaneously verifies that an object meets the specified criteria and performs a variable assignment accordingly.

But there are some differences: Example 2 uses a more deeply-nested pattern than Example 1 but makes fewer useful checks.

**Example 1:**
- checks that `ancestor` is an `InheritedElement`
- checks that the inherited element's `widget` is an `InheritedTheme`

**Example 2:**
- checks that `widget` is a `PreferredSizeWidget`
(every `PreferredSizeWidget` has a `size` field, and every `Size` has a `height` field)

<br>

<hr>

I feel hesitant to try presenting a set of cut-and-dry rules as to which scenarios should/shouldn't use pattern-matching, since there are an abundance of different types of patterns, and an abundance of different places where they might be used.

But hopefully the conversations we've had recently will help us converge toward a common intuition of how pattern-matching can best be utilized for improved readability.

<br><br>

- resolves https://github.com/flutter/flutter/issues/152313
- Design Doc: [flutter.dev/go/dart-patterns](https://flutter.dev/go/dart-patterns)
2024-10-03 18:21:04 +00:00
Loïc Sharma
f2b182f54e
Fix some tests that fail with Swift Package Manager enabled (#152267)
https://github.com/flutter/flutter/pull/152049 was reverted as it broke several post-submit tests. This relands the test fixes in https://github.com/flutter/flutter/pull/152049 without enabling Swift Package Manager on the master channel. 

This change is split into two commits:

1. dd1762abb9 - The changes in https://github.com/flutter/flutter/pull/152049
1. 00fdcfb7bb - Undoes the changes that enabled Swift Package Manager on the master channel

Part of https://github.com/flutter/flutter/issues/151567
2024-07-26 21:08:32 +00:00
auto-submit[bot]
f55ab0e77e
Reverts "Enable Swift Package Manager by default on master channel (#152049)" (#152243)
Reverts: flutter/flutter#152049
Initiated by: cbracken
Reason for reverting: iOS builds failing in post-submit
Original PR Author: loic-sharma

Reviewed By: {jmagman}

This change reverts the following previous change:
Changes:

1. Enables Swift Package Manager by default on the main/master channel
2. Fixes tests that fail if Swift Package Manager is enabled

Corresponding docs change: https://github.com/flutter/website/pull/10938

Addresses https://github.com/flutter/flutter/issues/151567
2024-07-24 16:49:25 +00:00
Loïc Sharma
08d8a7fa81
Enable Swift Package Manager by default on master channel (#152049)
Changes:

1. Enables Swift Package Manager by default on the main/master channel
2. Fixes tests that fail if Swift Package Manager is enabled

Corresponding docs change: https://github.com/flutter/website/pull/10938

Addresses https://github.com/flutter/flutter/issues/151567
2024-07-24 16:24:31 +00:00
Victoria Ashworth
529a4d2bac
Disable sandboxing for macOS apps and tests in CI (#149618)
macOS 14 added new requirements that un-codesigned sandbox apps must be granted access when changed. Waiting for this UI caused macOS tests to fail on macOS 14 because the test runner forced codesigning off. Additionally, adding codesigning is not sufficient, since it must still be approved before codesigning is enough to pass the check. As a workaround, this PR disables sandboxing for macOS apps/tests in CI.

![Screenshot 2024-05-30 at 2 41 33 PM](https://github.com/flutter/flutter/assets/682784/1bc32620-5edb-420a-866c-5cc529b2ac55)

https://developer.apple.com/documentation/updates/security#June-2023)
> App Sandbox now associates your macOS app with its sandbox container using its code signature. The operating system asks the person using your app to grant permission if it tries to access a sandbox container associated with a different app. For more information, see [Accessing files from the macOS App Sandbox](https://developer.apple.com/documentation/security/app_sandbox/accessing_files_from_the_macos_app_sandbox).

And that link explains why this is happening on a macOS 14 update:

> In macOS 14 and later, the operating system uses your app’s code signature to associate it with its sandbox container. If your app tries to access the sandbox container owned by another app, the system asks the person using your app whether to grant access. If the person denies access and your app is already running, then it can’t read or write the files in the other app’s sandbox container. If the person denies access while your app is launching and trying to enter the other app’s sandbox container, your app fails to launch.
> 
> The operating system also tracks the association between an app’s code signing identity and its sandbox container for helper tools, including launch agents. If a person denies permission for a launch agent to enter its sandbox container and the app fails to start, launchd starts the launch agent again and the operating system re-requests access.

Fixes https://github.com/flutter/flutter/issues/149268.
Fixes framework part of https://github.com/flutter/flutter/issues/149264.
Might fix packages issue: https://github.com/flutter/flutter/issues/149329.

Verified framework tests:
https://ci.chromium.org/ui/p/flutter/builders/staging.shadow/Mac%20plugin_test_macos/9/overview
https://ci.chromium.org/ui/p/flutter/builders/staging.shadow/Mac%20run_debug_test_macos/2/overview
https://ci.chromium.org/ui/p/flutter/builders/staging.shadow/Mac%20tool_integration_tests_4_4/2/overview
https://ci.chromium.org/ui/p/flutter/builders/staging.shadow/Mac%20integration_ui_test_test_macos/3/overview
https://ci.chromium.org/ui/p/flutter/builders/staging.shadow/Mac%20flavors_test_macos/3/overview
https://ci.chromium.org/ui/p/flutter/builders/staging.shadow/Mac_benchmark%20complex_layout_scroll_perf_macos__timeline_summary/6/overview
2024-06-04 21:51:19 +00:00
Victoria Ashworth
410af14fd8
Select simulator runtime for tests based on Xcode's preferred runtime build (#139919)
When creating a simulator for a test, select the runtime based on the selected Xcode's preferred build. This is to prevent it from using a runtime greater than its greatest supported version.

Fixes https://github.com/flutter/flutter/issues/139917.

Example test with both iOS 16 and 17 available: https://chromium-swarm.appspot.com/task?id=6672aca184395a10
2023-12-12 20:05:58 +00:00
Victoria Ashworth
ddc9b40a98
Fix typo in function name (#136273)
Rename `removeIOSimulator` to `removeIOSSimulator`.
2023-10-12 15:53:00 +00:00
stuartmorgan
2a502363e1
Add native unit tests to iOS and macOS templates (#117147)
* Improve Swift plugin implementation

* Add iOS tests

* Review feedback on structure

* Remove duplicate scheme file

* Add macOS

* Add iOS

* swift test tweaks

* unit tests

* Whitespace

* Add e2e tests
2022-12-21 19:10:22 +00:00
Jenn Magder
35afe1bdac
Stop embedding bitcode for iOS in tool (#112831) 2022-10-04 01:41:23 +00:00
Jenn Magder
489094ad98
Quiet iOS native test result zipping (#111434) 2022-09-13 23:08:41 +00:00
Jenn Magder
a4530b7c12
Make module tests pass on Xcode 14 (#110556) 2022-08-30 18:51:20 +00:00
Jenn Magder
88eca6c1ce
Fail integration test if expected bitcode markers not found (#102016) 2022-04-19 13:29:06 -07:00
Jenn Magder
57d5222876
Include -isysroot -arch and -miphoneos-version-min when creating dummy module App.framework (#97689) 2022-02-04 14:50:11 -08:00
Christopher Fujino
6054eda86b
fix lateinitialization error in devicelab-runner (#94957) 2021-12-28 18:19:16 -08:00
Jenn Magder
dc20a6066f
Skip codesigning during native macOS integration tests (#92938) 2021-11-02 16:41:32 -07:00
Jenn Magder
be8d29ffc6
Run native_ui_tests_macos in correct directory (#90829) 2021-09-27 17:38:03 -07:00
Jenn Magder
5c79a0c2f4
Run flutter_gallery macOS native tests on presubmit (#89620) 2021-09-22 13:18:07 -07:00
Darren Austin
ef5ffd08f6
Migrate devicelab framework code to null safety. (#86325)
(Attempt to reland #85993)
2021-07-13 12:14:50 -07:00
Darren Austin
08ef7752d5
Revert "Migrate core devicelab framework to null safety. (#85993)" (#86269)
This reverts commit 2175e64e4f.
2021-07-11 23:25:25 -07:00
Darren Austin
2175e64e4f
Migrate core devicelab framework to null safety. (#85993)
Migrate core devicelab framework to null safety.
2021-07-11 18:36:30 -07:00
Jenn Magder
1d2f6c5296
Revert "Set up iOS native integration_tests in ui example project (#84890)" (#84892)
This reverts commit 05d5515732.
2021-06-18 18:05:00 -07:00
Jenn Magder
05d5515732
Set up iOS native integration_tests in ui example project (#84890) 2021-06-18 17:45:11 -07:00
Jenn Magder
697928d21f
Revert "Set up iOS native integration_tests in ui example project (#84596)" (#84641)
This reverts commit ef2879a46f.
2021-06-15 10:09:41 -07:00
Jenn Magder
ef2879a46f
Set up iOS native integration_tests in ui example project (#84596) 2021-06-14 18:04:02 -07:00
Jenn Magder
94a41cde83
Mixed null safety in dev/devicelab (#84017) 2021-06-05 02:29:03 -07:00
Jenn Magder
7e02cc34f9
Bitcode strip Flutter.framework in assemble build target (#77329) 2021-03-05 10:38:57 -08:00
Jenn Magder
062022b950
Move ios_content_validation_test to pre-submit tools test (#73577) 2021-01-11 10:29:06 -08:00
Jenn Magder
3082a2806e
build ios-framework simulator slices for profile/release (#73378) 2021-01-06 12:12:23 -08:00
Jenn Magder
d4150d3f6d
Adopt Flutter.xcframework in tool (#71495) 2020-12-04 13:57:11 -08:00
Yuqian Li
684449a841
Remove measureIosCpuGpu (#67363) 2020-10-08 12:02:03 -07:00
Michael R Fairhurst
7f3c9b6bda
Remove unused 'dart:async' imports. (#65568) 2020-09-16 14:14:06 -07:00
Jenn Magder
ace54425e0
Add observatory Bonjour service to built iOS Info.plist bundle (#65138) 2020-09-02 18:47:56 -07:00
Jenn Magder
259deec221
Revert "Add observatory Bonjour service to built iOS Info.plist bundle (#65138)" (#65141)
This reverts commit 5e0aa8b9fc.
2020-09-02 18:31:45 -07:00
Jenn Magder
5e0aa8b9fc
Add observatory Bonjour service to built iOS Info.plist bundle (#65138) 2020-09-02 17:57:43 -07:00
Jenn Magder
cb819504f3
Revert "Add observatory Bonjour service to built iOS Info.plist bundle (#64988)" (#65109)
This reverts commit 4fde217dea.
2020-09-02 12:31:17 -07:00
Jenn Magder
4fde217dea
Add observatory Bonjour service to built iOS Info.plist bundle (#64988) 2020-09-02 11:11:07 -07:00
Jenn Magder
e8e5de44ec
Parse .flutter-plugins-dependencies for add-to-app iOS modules (#61269) 2020-07-28 10:16:09 -07:00
Jenn Magder
1e510ff636
Turn on add-to-app iOS platform unit tests (#61007) 2020-07-09 15:52:49 -07:00
Jenn Magder
2a7d57791d Generate bitcode for plugin frameworks for flutter build ios-framework (#49102) 2020-01-21 16:38:03 -08:00
Alexandre Ardhuin
ec1a015045
implicit-casts:false in dev (#45787) 2019-12-05 22:34:06 +01:00
Jenn Magder
fb69a393b8
Add bitcode and architectures to App.framework build ios framework command (#46130) 2019-12-05 12:16:54 -08:00
Ian Hickson
449f4a6673
License update (#45373)
* Update project.pbxproj files to say Flutter rather than Chromium

Also, the templates now have an empty organization so that we don't cause people to give their apps a Flutter copyright.

* Update the copyright notice checker to require a standard notice on all files

* Update copyrights on Dart files. (This was a mechanical commit.)

* Fix weird license headers on Dart files that deviate from our conventions; relicense Shrine.

Some were already marked "The Flutter Authors", not clear why. Their
dates have been normalized. Some were missing the blank line after the
license. Some were randomly different in trivial ways for no apparent
reason (e.g. missing the trailing period).

* Clean up the copyrights in non-Dart files. (Manual edits.)

Also, make sure templates don't have copyrights.

* Fix some more ORGANIZATIONNAMEs
2019-11-27 15:04:02 -08:00
liyuqian
c61ef90f94
Upgrade gauge for debugging (#45212)
For https://github.com/flutter/flutter/issues/45194
and see also https://github.com/flutter/packages/pull/47.
2019-11-21 13:03:02 -08:00
Jenn Magder
6e5769d425
Remove FLUTTER_DEVICELAB_XCODE_PROVISIONING_CONFIG code paths (#45136) 2019-11-19 11:19:44 -08:00
Ian Hickson
1ce4a4f36f
Make sure all our .dart files have license headers (#44467) 2019-11-08 16:53:21 -08:00
xster
604f176194 Add more flutter build ios-framework tests before the impending jonahpocalypse (#44308) 2019-11-07 13:12:56 -08:00
Alexandre Ardhuin
387f885481
Add missing trailing commas (#28673)
* add trailing commas on list/map/parameters

* add trailing commas on Invocation with nb of arg>1

* add commas for widget containing widgets

* add trailing commas if instantiation contains trailing comma

* revert bad change
2019-03-01 08:17:55 +01:00