Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit a29b7b4

Browse files
Merge branch 'main' into fix/nested_same_mask_filter
2 parents 9f44c8f + 9bbe981 commit a29b7b4

File tree

1,204 files changed

+67037
-55751
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,204 files changed

+67037
-55751
lines changed

.ci.yaml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ platform_properties:
3030
{"dependency": "open_jdk", "version": "version:17"}
3131
]
3232
device_type: none
33-
os: Mac-13
33+
os: Mac-13|Mac-14
3434
$flutter/osx_sdk : >-
3535
{
3636
"sdk_version": "15a240d"
@@ -177,15 +177,6 @@ targets:
177177
- os=Linux
178178
dimensions:
179179
kvm: "1"
180-
# TODO(https://github.com/flutter/flutter/issues/138559): Re-enable/delete.
181-
# runIfNot:
182-
# - lib/web_ui/**
183-
# - shell/platform/android/**
184-
# - shell/platform/darwin/**
185-
# - shell/platform/glfw/**
186-
# - shell/platform/linux/**
187-
# - shell/platform/windows/**
188-
# - web_sdk/**
189180

190181
- name: Linux linux_clang_tidy
191182
recipe: engine_v2/engine_v2
@@ -372,7 +363,7 @@ targets:
372363
"sdk_version": "15a240d"
373364
}
374365
drone_dimensions:
375-
- os=Mac-13
366+
- os=Mac-13|Mac-14
376367

377368
- name: Linux mac_clangd
378369
recipe: engine_v2/engine_v2
@@ -401,7 +392,7 @@ targets:
401392
"sdk_version": "15a240d"
402393
}
403394
drone_dimensions:
404-
- os=Mac-13
395+
- os=Mac-13|Mac-14
405396
- cpu=x86
406397

407398
- name: Mac impeller-cmake-example

.github/workflows/engine-cp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
run: |
3131
echo "COMMIT_SHA=$(echo ${{ github.event.pull_request.merge_commit_sha }})" >> $GITHUB_ENV
3232
- name: Checkout Flutter Engine Repo
33-
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f
33+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
3434
with:
3535
repository: flutteractionsbot/engine
3636
path: engine

.github/workflows/scorecards-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ jobs:
2222
id-token: write
2323
steps:
2424
- name: "Checkout code"
25-
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f
25+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
2626
with:
2727
persist-credentials: false
2828
- name: "Run analysis"
29-
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736
29+
uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534
3030
with:
3131
results_file: results.sarif
3232
results_format: sarif
@@ -49,6 +49,6 @@ jobs:
4949

5050
# Upload the results to GitHub's code scanning dashboard.
5151
- name: "Upload to code-scanning"
52-
uses: github/codeql-action/upload-sarif@cdcdbb579706841c47f7063dda365e292e5cad7a
52+
uses: github/codeql-action/upload-sarif@b611370bb5703a7efb587f9d136a52ea24c5c38c
5353
with:
5454
sarif_file: results.sarif

.github/workflows/third_party_scan.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
contents: read
2222
steps:
2323
- name: "Checkout code"
24-
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f
24+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
2525
with:
2626
persist-credentials: false
2727
- name: "setup python"
@@ -41,7 +41,7 @@ jobs:
4141
name: Vulnerability scanning
4242
needs:
4343
extract-deps
44-
uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml@v1.7.1"
44+
uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml@v1.8.1"
4545
with:
4646
# Download the artifact uploaded in extract-deps step
4747
download-artifact: osv-lockfile-${{github.sha}}
@@ -52,4 +52,5 @@ jobs:
5252
permissions:
5353
# Needed to upload the SARIF results to code-scanning dashboard.
5454
security-events: write
55+
actions: read
5556
contents: read

BUILD.gn

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,10 @@ if (build_engine_artifacts) {
283283
group("dist") {
284284
testonly = true
285285

286-
deps = [ "//flutter/sky/dist" ]
286+
deps = [
287+
"//flutter/lib/gpu/dist",
288+
"//flutter/sky/dist",
289+
]
287290
}
288291

289292
if (is_fuchsia && enable_unittests) {

CONTRIBUTING.md

Lines changed: 172 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,182 @@ contributing guide.
1414

1515
## Style
1616

17-
The Flutter engine follows Google style for the languages it uses:
18-
19-
- [C++](https://google.github.io/styleguide/cppguide.html)
20-
- **Note**: The Linux embedding generally follows idiomatic GObject-based C
21-
style. Use of C++ is discouraged in that embedding to avoid creating hybrid
22-
code that feels unfamiliar to either developers used to working with
23-
`GObject` or C++ developers. For example, do not use STL collections or
24-
`std::string`. Exceptions:
25-
- C-style casts are forbidden; use C++ casts.
26-
- Use `nullptr` rather than `NULL`.
27-
- Avoid `#define`; for internal constants use `static constexpr` instead.
28-
- [Objective-C][objc_style] (including [Objective-C++][objcc_style])
29-
- [Java][java_style]
30-
31-
C/C++ and Objective-C/C++ files are formatted with `clang-format`, and GN files
32-
with `gn format`.
17+
The Flutter engine _generally_ follows Google style for the languages it uses,
18+
with some exceptions.
3319

20+
### C/C++
21+
22+
Follows the [Google C++ Style Guide][google_cpp_style] and is automatically
23+
formatted with `clang-format`.
24+
25+
Some additional considerations that are in compliance with the style guide, but
26+
are worth noting:
27+
28+
#### Judiciously use shared_ptr
29+
30+
The engine currently (as of 2024-05-15) uses `shared_ptr` liberally, which can
31+
be expensive to copy, and is not always necessary.
32+
33+
The C++ style guide has a
34+
[section on ownership and smart pointers][cpp_ownership] worth reading:
35+
36+
> Do not design your code to use shared ownership without a very good reason.
37+
> One such reason is to avoid expensive copy operations, but you should only do
38+
> this if the performance benefits are significant, and the underlying object is
39+
> immutable.
40+
41+
Prefer using `std::unique_ptr` when possible.
42+
43+
#### Judiciously use `auto`
44+
45+
The C++ style guide has a [section on type deduction][cpp_auto] that is worth
46+
reading:
47+
48+
> The fundamental rule is: use type deduction only to make the code clearer or
49+
> safer, and do not use it merely to avoid the inconvenience of writing an
50+
> explicit type. When judging whether the code is clearer, keep in mind that
51+
> your readers are not necessarily on your team, or familiar with your project,
52+
> so types that you and your reviewer experience as unnecessary clutter will
53+
> very often provide useful information to others. For example, you can assume
54+
> that the return type of `make_unique<Foo>()` is obvious, but the return type
55+
> of `MyWidgetFactory()` probably isn't.
56+
57+
Due to our codebase's extensive use of `shared_ptr`, `auto` can have surprising
58+
performance implications. See [#49801][pr_49801] for an example.
59+
60+
#### Linux Embedding
61+
62+
> [!NOTE]
63+
> The Linux embedding instead follows idiomatic GObject-based C style.
64+
65+
Use of C++ in the [Linux embedding][] is discouraged in that embedding to avoid
66+
creating hybrid code that feels unfamiliar to either developers used to working
67+
with `GObject` or C++ developers.
68+
69+
For example, _do not_ use STL collections or `std::string`, but _do_:
70+
71+
- Use C++ casts (C-style casts are forbidden).
72+
- Use `nullptr` rather than `NULL`.
73+
- Avoid `#define`; for internal constants use `static constexpr` instead.
74+
75+
### Dart
76+
77+
The Flutter engine _intends_ to follow the [Dart style guide][dart_style] but
78+
currently follows the [Flutter style guide][flutter_style], with the following
79+
exceptions:
80+
81+
#### Use of type inference is allowed
82+
83+
The [Dart style guide][dart_inference] only requires explicit types when type
84+
inference is not possible, but the Flutter style guide always requires explicit
85+
types. The engine is moving towards the Dart style guide, but this is a gradual
86+
process. In the meantime, follow these guidelines:
87+
88+
- **Always** annotate when inference is not possible.
89+
- **Prefer** annotating when inference is possible but the type is not
90+
obvious.
91+
92+
Some cases when using `var`/`final`/`const` is appropriate:
93+
94+
- When the type is obvious from the right-hand side of the assignment:
95+
96+
```dart
97+
// Capitalized constructor name always returns a Foo.
98+
var foo = Foo();
99+
100+
// Similar with factory constructors.
101+
var bar = Bar.create();
102+
103+
// Literals (strings, numbers, lists, maps, etc) always return the same type.
104+
var name = 'John Doe';
105+
var flag = true;
106+
var numbers = [1, 2, 3];
107+
var map = {'one': 1, 'two': 2, 'three': 3};
108+
```
109+
110+
- When the type is obvious from the method name:
111+
112+
```dart
113+
// toString() always returns a String.
114+
var string = foo().toString();
115+
116+
// It's reasonable to assume that length returns an int.
117+
var length = string.length;
118+
```
119+
120+
- When the type is obvious from the context:
121+
122+
```dart
123+
// When variables are in the same scope, reduce() clearly returns an int.
124+
var list = [1, 2, 3];
125+
var sum = list.reduce((a, b) => a + b);
126+
```
127+
128+
Some cases where an explicit type should be considered:
129+
130+
- When the type is not obvious from the right-hand side of the assignment:
131+
132+
```dart
133+
// What does 'fetchLatest()' return?
134+
ImageBuffer buffer = fetchLatest();
135+
136+
// What does this large chain of method calls return?
137+
Iterable<int> numbers = foo().bar().map((b) => b.baz());
138+
```
139+
140+
- When there are semantic implications to the type:
141+
142+
```dart
143+
// Without 'num', the map would be inferred as 'Map<String, int>'.
144+
const map = <String, num>{'one': 1, 'two': 2, 'three': 3};
145+
```
146+
147+
- Or, **when a reviewer requests it**!
148+
149+
Remember that the goal is to make the code more readable and maintainable, and
150+
explicit types _can_ help with that. Code can be changed, so it's always
151+
possible to add or remove type annotations later as the code evolves, so avoid
152+
bikeshedding over this.
153+
154+
### Java
155+
156+
Follows the [Google Java Style Guide][java_style] and is automatically formatted
157+
with `google-java-format`.
158+
159+
### Objective-C
160+
161+
Follows the [Google Objective-C Style Guide][objc_style], including for
162+
Objective-C++ and is automatically formatted with `clang-format`.
163+
164+
### Python
165+
166+
Follows the [Google Python Style Guide][google_python_style] and is
167+
automatically formatted with `yapf`.
168+
169+
> [!WARNING]
170+
> Historically, the engine grew a number of one-off Python scripts, often as
171+
> part of the testing or build infrastructure (i.e. command-line tools). We are
172+
> instead moving towards using Dart for these tasks, so new Python scripts
173+
> should be avoided whenever possible.
174+
175+
### GN
176+
177+
Automatically formatted with `gn format`.
178+
179+
[cpp_auto]: https://google.github.io/styleguide/cppguide.html#Type_deduction
180+
[cpp_ownership]: https://google.github.io/styleguide/cppguide.html#Ownership_and_Smart_Pointers
181+
[dart_inference]: https://dart.dev/effective-dart/design#types
182+
[dart_style]: https://dart.dev/effective-dart/style
183+
[linux embedding]: shell/platform/linux
184+
[google_cpp_style]: https://google.github.io/styleguide/cppguide.html
185+
[pr_49801]: https://github.com/flutter/engine/pull/49801
34186
[code_of_conduct]: https://github.com/flutter/flutter/blob/master/CODE_OF_CONDUCT.md
35187
[contrib_guide]: https://github.com/flutter/flutter/blob/master/CONTRIBUTING.md
36-
[engine_dev_setup]: https://github.com/flutter/flutter/wiki/Setting-up-the-Engine-development-environment
188+
[engine_dev_setup]: https://github.com/flutter/flutter/blob/master/docs/engine/contributing/Setting-up-the-Engine-development-environment.md
189+
[flutter_style]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
37190
[objc_style]: https://google.github.io/styleguide/objcguide.html
38-
[objcc_style]: https://google.github.io/styleguide/objcguide.html#objective-c
39191
[java_style]: https://google.github.io/styleguide/javaguide.html
192+
[google_python_style]: https://google.github.io/styleguide/pyguide.html
40193

41194
## Testing
42195

@@ -82,7 +235,7 @@ $ flutter/tools/gn --runtime-mode=debug --unoptimized --no-lto --mac-cpu=arm64
82235
$ ninja -j100 -C out/host_debug_unopt_arm64
83236
# Run all cross-platform C++ tests for the debug build arm64 variant.
84237
$ cd flutter/testing
85-
$ ./run_tests.py --variant=host_debug_unopt_arm64 --type=engine`
238+
$ ./run_tests.py --variant=host_debug_unopt_arm64 --type=engine
86239
```
87240

88241
### Directory

0 commit comments

Comments
 (0)