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

Commit 8bcf638

Browse files
authored
Add a "pub workspace" to the root of the engine repository (#53539)
... and use it in `engine_tool` to prove everything is working, i.e. on CI and elsewhere. Partial work towards flutter/flutter#147883. Supersedes and closes #51782 (which was a prototype). See also: - https://flutter.dev/go/pub-workspace, the design doc on the feature. - dart-lang/pub-dev#7762, an example PR. I'll probably end up moving the inline docs in `pubspec.yaml` to a `docs/*.md` once that's a thing.
1 parent 4bc673e commit 8bcf638

File tree

12 files changed

+248
-59
lines changed

12 files changed

+248
-59
lines changed

ci/licenses_golden/excluded_files

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
../../../flutter/.ci.yaml
1313
../../../flutter/.clang-format
1414
../../../flutter/.clang-tidy
15+
../../../flutter/.dart_tool
1516
../../../flutter/.git
1617
../../../flutter/.gitattributes
1718
../../../flutter/.github
@@ -254,6 +255,8 @@
254255
../../../flutter/lib/web_ui/pubspec.yaml
255256
../../../flutter/lib/web_ui/test
256257
../../../flutter/prebuilts
258+
../../../flutter/pubspec.lock
259+
../../../flutter/pubspec.yaml
257260
../../../flutter/runtime/dart_isolate_unittests.cc
258261
../../../flutter/runtime/dart_lifecycle_unittests.cc
259262
../../../flutter/runtime/dart_plugin_registrant_unittests.cc

lib/ui/channel_buffers.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,8 @@ class ChannelBuffers {
400400
@Native<Void Function(Handle, Bool)>(symbol: 'PlatformConfigurationNativeApi::SendChannelUpdate')
401401
external static void _sendChannelUpdate(String name, bool listening);
402402

403+
// TODO(matanlurey): have original authors document; see https://github.com/flutter/flutter/issues/151917.
404+
// ignore: public_member_api_docs
403405
void sendChannelUpdate(String name, {required bool listening}) => _sendChannelUpdate(name, listening);
404406

405407
/// Deprecated. Migrate to [setListener] instead.

lib/ui/compositing.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ class ShaderMaskEngineLayer extends _EngineLayerWrapper {
246246
/// This does not apply when using the `dart:ui` API directly, without using the
247247
/// Flutter framework bindings, `flutter_test` framework, et al.
248248
abstract class SceneBuilder {
249+
// TODO(matanlurey): have original authors document; see https://github.com/flutter/flutter/issues/151917.
250+
// ignore: public_member_api_docs
249251
factory SceneBuilder() = _NativeSceneBuilder;
250252

251253
/// Pushes a transform operation onto the operation stack.

lib/ui/experiments/scene.dart

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,34 @@ base class SceneNode extends NativeFieldWrapperClass1 {
5050
return result;
5151
}
5252

53+
// TODO(matanlurey): have original authors document; see https://github.com/flutter/flutter/issues/151917.
54+
// ignore: public_member_api_docs
5355
static SceneNodeValue fromTransform(Float64List matrix4) {
5456
final SceneNode sceneNode = SceneNode._create();
5557
sceneNode._initFromTransform(matrix4);
5658
return SceneNodeValue.fromValue(sceneNode);
5759
}
5860

61+
// TODO(matanlurey): have original authors document; see https://github.com/flutter/flutter/issues/151917.
62+
// ignore: public_member_api_docs
5963
void addChild(SceneNode sceneNode) {
6064
_addChild(sceneNode);
6165
}
6266

67+
// TODO(matanlurey): have original authors document; see https://github.com/flutter/flutter/issues/151917.
68+
// ignore: public_member_api_docs
6369
void setTransform(Float64List matrix4) {
6470
_setTransform(matrix4);
6571
}
6672

73+
// TODO(matanlurey): have original authors document; see https://github.com/flutter/flutter/issues/151917.
74+
// ignore: public_member_api_docs
6775
void setAnimationState(String animationName, bool playing, bool loop, double weight, double timeScale) {
6876
_setAnimationState(animationName, playing, loop, weight, timeScale);
6977
}
7078

79+
// TODO(matanlurey): have original authors document; see https://github.com/flutter/flutter/issues/151917.
80+
// ignore: public_member_api_docs
7181
void seekAnimation(String animationName, double time) {
7282
_seekAnimation(animationName, time);
7383
}
@@ -126,32 +136,45 @@ base class SceneNode extends NativeFieldWrapperClass1 {
126136

127137
/// Returns a fresh instance of [SceneShader].
128138
SceneShader sceneShader() => SceneShader._(this, debugName: _debugName);
139+
129140
}
130141

142+
// TODO(matanlurey): have original authors document; see https://github.com/flutter/flutter/issues/151917.
143+
// ignore: public_member_api_docs
131144
class SceneNodeValue {
132145
SceneNodeValue._(this._future, this._value) {
133146
_future?.then((SceneNode result) => _value = result);
134147
}
135148

149+
// TODO(matanlurey): have original authors document; see https://github.com/flutter/flutter/issues/151917.
150+
// ignore: public_member_api_docs
136151
static SceneNodeValue fromFuture(Future<SceneNode> future) {
137152
return SceneNodeValue._(future, null);
138153
}
139154

155+
// TODO(matanlurey): have original authors document; see https://github.com/flutter/flutter/issues/151917.
156+
// ignore: public_member_api_docs
140157
static SceneNodeValue fromValue(SceneNode value) {
141158
return SceneNodeValue._(null, value);
142159
}
143160

144161
final Future<SceneNode>? _future;
145162
SceneNode? _value;
146163

164+
// TODO(matanlurey): have original authors document; see https://github.com/flutter/flutter/issues/151917.
165+
// ignore: public_member_api_docs
147166
bool get isComplete {
148167
return _value != null;
149168
}
150169

170+
// TODO(matanlurey): have original authors document; see https://github.com/flutter/flutter/issues/151917.
171+
// ignore: public_member_api_docs
151172
Future<SceneNode>? get future {
152173
return _future;
153174
}
154175

176+
// TODO(matanlurey): have original authors document; see https://github.com/flutter/flutter/issues/151917.
177+
// ignore: public_member_api_docs
155178
SceneNode? get value {
156179
return _value;
157180
}
@@ -186,6 +209,8 @@ base class SceneShader extends Shader {
186209
// ignore: unused_field
187210
final String? _debugName;
188211

212+
// TODO(matanlurey): have original authors document; see https://github.com/flutter/flutter/issues/151917.
213+
// ignore: public_member_api_docs
189214
void setCameraTransform(Float64List matrix4) {
190215
_setCameraTransform(matrix4);
191216
}

lib/ui/key.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ enum KeyEventType {
1616
/// The key is held, causing a repeated key input.
1717
repeat;
1818

19+
// TODO(matanlurey): have original authors document; see https://github.com/flutter/flutter/issues/151917.
20+
// ignore: public_member_api_docs
1921
String get label {
2022
return switch (this) {
2123
down => 'Key Down',
@@ -46,6 +48,8 @@ enum KeyEventDeviceType {
4648
/// The device is a device connected to an HDMI bus.
4749
hdmi;
4850

51+
// TODO(matanlurey): have original authors document; see https://github.com/flutter/flutter/issues/151917.
52+
// ignore: public_member_api_docs
4953
String get label {
5054
return switch (this) {
5155
keyboard => 'Keyboard',

lib/ui/painting.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2598,6 +2598,8 @@ base class _NativeEngineLayer extends NativeFieldWrapperClass1 implements Engine
25982598
/// Paths can be drawn on canvases using [Canvas.drawPath], and can
25992599
/// used to create clip regions using [Canvas.clipPath].
26002600
abstract class Path {
2601+
// TODO(matanlurey): have original authors document; see https://github.com/flutter/flutter/issues/151917.
2602+
// ignore: public_member_api_docs
26012603
factory Path() = _NativePath;
26022604

26032605
/// Creates a copy of another [Path].

lib/ui/platform_dispatcher.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2195,6 +2195,8 @@ class ViewConstraints {
21952195
/// [DisplayFeatureState.postureHalfOpened]. For [DisplayFeatureType.cutout],
21962196
/// the state is not used and has the [DisplayFeatureState.unknown] value.
21972197
class DisplayFeature {
2198+
// TODO(matanlurey): have original authors document; see https://github.com/flutter/flutter/issues/151917.
2199+
// ignore: public_member_api_docs
21982200
const DisplayFeature({
21992201
required this.bounds,
22002202
required this.type,

lib/ui/semantics.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,12 @@ class SemanticsAction {
284284
_kFocusIndex: focus,
285285
};
286286

287+
// TODO(matanlurey): have original authors document; see https://github.com/flutter/flutter/issues/151917.
288+
// ignore: public_member_api_docs
287289
static List<SemanticsAction> get values => _kActionById.values.toList(growable: false);
288290

291+
// TODO(matanlurey): have original authors document; see https://github.com/flutter/flutter/issues/151917.
292+
// ignore: public_member_api_docs
289293
static SemanticsAction? fromIndex(int index) => _kActionById[index];
290294

291295
@override
@@ -638,8 +642,12 @@ class SemanticsFlag {
638642
_kIsExpandedIndex: isExpanded,
639643
};
640644

645+
// TODO(matanlurey): have original authors document; see https://github.com/flutter/flutter/issues/151917.
646+
// ignore: public_member_api_docs
641647
static List<SemanticsFlag> get values => _kFlagById.values.toList(growable: false);
642648

649+
// TODO(matanlurey): have original authors document; see https://github.com/flutter/flutter/issues/151917.
650+
// ignore: public_member_api_docs
643651
static SemanticsFlag? fromIndex(int index) => _kFlagById[index];
644652

645653
@override

pubspec.yaml

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
# This file represents a "workspace" that applies to the whole repository.
2+
#
3+
# See <https://flutter.dev/go/pub-workspace> for details.
4+
#
5+
# The `flutter/engine` repository is a quasi-monorepo, with multiple Dart tools
6+
# and packages that are all interdependent. Third party dependencies are managed
7+
# by the `DEPS` file in the root of the repository, and are synced to either the
8+
# `third_party` (i.e. `//flutter/third_party`) or `../third_party` (i.e.
9+
# `//third_party`) directories by `gclient sync`.
10+
#
11+
# Every dependency declared here are dependencies used by _one or more_ of the
12+
# packages in the repository (though there is no enforcement of this). This file
13+
# then generates a `.dart_tool/package_config.json` file that is used by the
14+
# rest of the repository to resolve dependencies.
15+
#
16+
# ==============================================================================
17+
# WORKFLOWS
18+
# ==============================================================================
19+
#
20+
# ------------------------------------------------------------------------------
21+
# (1) ADDING A NEW DEPENDENCY
22+
# ------------------------------------------------------------------------------
23+
# Dependencies need to be added either via the DEPS file, or by checking if they
24+
# are available in the vendored Dart SDK (see notes below on library locations).
25+
# If dependencies are available, see (4) for how to add dependencies to a package in the workspace.
26+
#
27+
# ------------------------------------------------------------------------------
28+
# (2) CREATING A NEW PACKAGE
29+
# ------------------------------------------------------------------------------
30+
# If creating a package, say in ./tools or ./tools/pkg, ensure the following
31+
# header in its respective `pubspec.yaml`:
32+
# ```
33+
# # We don't publish packages to pub.dev from the engine repository.
34+
# publish_to: none
35+
#
36+
# # Required for workspace support.
37+
# environment:
38+
# sdk: ^3.5.0-294.0.dev
39+
#
40+
# # This package is managed as part of the engine workspace.
41+
# resolution: workspace
42+
# ```
43+
#
44+
# See (4) for how to add dependencies to a package in the workspace.
45+
#
46+
# ------------------------------------------------------------------------------
47+
# (3) MIGRATING A NON-WORKSPACE PACKAGE TO USING THE WORKSPACE
48+
# ------------------------------------------------------------------------------
49+
# Many packages in this repo are still using a pre-workspace style pubspec.yaml,
50+
# either with manually declared `dependency_overrides` (much of ./tools) or by
51+
# using pub (./web_sdk, ./lib/web_ui). To migrate a package to the workspace:
52+
#
53+
# A. Add the `resolution: workspace` field to the pubspec.yaml.
54+
# B. Update the minimum SDK version to at least `^3.5.0-294.0.dev`.
55+
# C. Add the package to the `workspace` field in this file.
56+
# D. Ensure every dependency in the package is added to the `dependencies` field
57+
# in this file, following instructions in (4).
58+
#
59+
# Once `dart pub get` is run on the workspace, the package will be resolved as
60+
# part of the workspace, and the `dependency_overrides` in this file will be
61+
# applied to the package.
62+
#
63+
# ------------------------------------------------------------------------------
64+
# (4) ADDING DEPENDENCIES TO A PACKAGE IN THIS WORKSPACE
65+
# ------------------------------------------------------------------------------
66+
# When adding a dependency to a package in the workspace, add the dependency to
67+
# the `dependencies` field in this file. If the dependency is located within
68+
# the repository, use the `path` field to point to the package.
69+
#
70+
# If the dependency is a third party package, add it to the
71+
# `dependency_overrides` field in this file. The `any` version constraint is
72+
# used to indicate that the version of the package is not important, as it is
73+
# managed by the `DEPS` file.
74+
75+
name: _engine_workspace
76+
77+
# Required for workspace support.
78+
environment:
79+
sdk: ^3.5.0-294.0.dev
80+
81+
# Declare all packages that are part of the workspace.
82+
workspace:
83+
- tools/engine_tool
84+
85+
# Declare all dependencies that are used by one or more packages.
86+
#
87+
# A few notes:
88+
# 1. There is no distinction between "dependencies" and "dev_dependencies";
89+
# those notions are for *publishing* packages, not for managing a workspace.
90+
# Specific packages in the workspace itself will declare whether they are
91+
# dependencies or dev_dependencies, but here it is a union of both.
92+
#
93+
# 2. The `any` version constraint is used to indicate that the version of the
94+
# package is not important, as it is managed by the `DEPS` file. In other
95+
# words, "if the test pass, ship it".
96+
#
97+
# While not enforced by tooling, try to keep this list in alphabetical order.
98+
# TODO(matanlurey): https://dart.dev/tools/linter-rules/sort_pub_dependencies.
99+
dependencies:
100+
args: any
101+
async_helper: any
102+
expect: any
103+
file: any
104+
logging: any
105+
meta: any
106+
path: any
107+
platform: any
108+
process_runner: any
109+
smith: any
110+
111+
# Instructs pub on how to resolve the dependencies that are part of "DEPS".
112+
#
113+
# For historic reasons, there are ~3 or so places packages might be located:
114+
#
115+
# - `./third_party/pkg/{name}`: for packages vended directly as part of "DEPS".
116+
# Usually these are Flutter engine specific packages, i.e. they did not exist
117+
# in the Dart vended SDK (the other options below). Typically these originate
118+
# from pub (https://pub.dev) and are mirrored into a Google Git repository:
119+
# <https://flutter.googlesource.com/>.
120+
#
121+
# - `./third_party/dart/pkg/{name}`: for packages that lives *in* the Dart SDK,
122+
# which is in turn vendored into the Flutter engine repository. You can see
123+
# a full list of available packages here:
124+
# <https://github.com/dart-lang/sdk/tree/main/pkg>.
125+
#
126+
# - `./third_party/dart/third_party/pkg/{name}`: for packages that are vendored
127+
# into the Dart SDK from pub.dev. These are often first-party packages from
128+
# the Dart team, but not part of the Dart SDK itself. You can see a full list
129+
# of available packages here:
130+
# <https://github.com/dart-lang/sdk/blob/main/DEPS>.
131+
dependency_overrides:
132+
args:
133+
path: ./third_party/dart/third_party/pkg/args
134+
async:
135+
path: ./third_party/dart/third_party/pkg/async
136+
async_helper:
137+
path: ./third_party/dart/pkg/async_helper
138+
collection:
139+
path: ./third_party/dart/third_party/pkg/collection
140+
engine_build_configs:
141+
path: ./tools/pkg/engine_build_configs
142+
engine_repo_tools:
143+
path: ./tools/pkg/engine_repo_tools
144+
expect:
145+
path: ./third_party/dart/pkg/expect
146+
file:
147+
path: ./third_party/dart/third_party/pkg/file/packages/file
148+
litetest:
149+
path: ./testing/litetest
150+
logging:
151+
path: ./third_party/dart/third_party/pkg/logging
152+
meta:
153+
path: ./third_party/dart/pkg/meta
154+
path:
155+
path: ./third_party/dart/third_party/pkg/path
156+
platform:
157+
path: ./third_party/pkg/platform
158+
process:
159+
path: ./third_party/pkg/process
160+
process_fakes:
161+
path: ./tools/pkg/process_fakes
162+
process_runner:
163+
path: ./third_party/pkg/process_runner
164+
smith:
165+
path: ./third_party/dart/pkg/smith
166+
source_span:
167+
path: ./third_party/dart/third_party/pkg/source_span
168+
string_scanner:
169+
path: ./third_party/dart/third_party/pkg/string_scanner
170+
term_glyph:
171+
path: ./third_party/dart/third_party/pkg/term_glyph
172+
yaml:
173+
path: ./third_party/dart/third_party/pkg/yaml

tools/clang_tidy/test/header_filter_regex_test.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ void main() {
3636
test('contains every root directory in the regex', () {
3737
// These are a list of directories that should _not_ be included.
3838
const Set<String> intentionallyOmitted = <String>{
39+
'.dart_tool',
3940
'.git',
4041
'.github',
4142
'build_overrides',

0 commit comments

Comments
 (0)