Skip to content

Commit

Permalink
Merge branch 'main' into 1-multi-win-foundation
Browse files Browse the repository at this point in the history
  • Loading branch information
hbatagelo authored Jan 6, 2025
2 parents 8739d84 + 66832de commit d3e2dc2
Show file tree
Hide file tree
Showing 392 changed files with 9,800 additions and 7,766 deletions.
30 changes: 0 additions & 30 deletions .ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -416,36 +416,6 @@ targets:
properties:
config_name: linux_unopt

- name: Linux Web Framework tests
recipe: engine/web_engine_framework
enabled_branches:
- main
properties:
add_recipes_cq: "true"
cores: "32"
gclient_variables: >-
{"download_emsdk": true}
dependencies: >-
[
{"dependency": "chrome_and_driver", "version": "version:119.0.6045.9"},
{"dependency": "curl", "version": "version:7.64.0"}
]
no_goma: "true"
drone_dimensions: >
["device_type=none", "os=Linux"]
shard: web_tests
subshards: >-
["0", "1", "2", "3", "4", "5", "6", "7_last"]
timeout: 120
runIf:
- DEPS
- .ci.yaml
- lib/web_ui/**
- web_sdk/**
- tools/**
- ci/**
- flutter_frontend_server/**

- name: Linux mac_android_aot_engine
recipe: engine_v2/engine_v2
timeout: 240
Expand Down
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Checks: >-
-google-default-arguments,
-google-objc-global-variable-declaration,
-google-objc-avoid-throwing-exception,
-google-readability-casting,
-clang-analyzer-nullability.NullPassedToNonnull,
-clang-analyzer-nullability.NullablePassedToNonnull,
-clang-analyzer-nullability.NullReturnedFromNonnull,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/third_party_scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
name: Vulnerability scanning
needs:
extract-deps
uses: "google/osv-scanner-action/.github/workflows/[email protected].0"
uses: "google/osv-scanner-action/.github/workflows/[email protected].2"
with:
# Download the artifact uploaded in extract-deps step
download-artifact: osv-lockfile-${{github.sha}}
Expand Down
20 changes: 10 additions & 10 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ vars = {
'flutter_git': 'https://flutter.googlesource.com',
'skia_git': 'https://skia.googlesource.com',
'llvm_git': 'https://llvm.googlesource.com',
'skia_revision': 'bd7d952398d511dbba69346c912eccd445126d5d',
'skia_revision': 'f784f78a5669962a23243ff67997239a64ce8c99',

# WARNING: DO NOT EDIT canvaskit_cipd_instance MANUALLY
# See `lib/web_ui/README.md` for how to roll CanvasKit to a new version.
Expand Down Expand Up @@ -56,24 +56,24 @@ vars = {
# Dart is: https://github.com/dart-lang/sdk/blob/main/DEPS
# You can use //tools/dart/create_updated_flutter_deps.py to produce
# updated revision list of existing dependencies.
'dart_revision': '1a28e6c86b09f1c83365f54388c32ed97c9e9b31',
'dart_revision': '37bbc285d8d2ad66843703d7f60dcdf23fd76175',

# WARNING: DO NOT EDIT MANUALLY
# The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
'dart_binaryen_rev': '93883fde36ac158fd415dcd6dbd387dcfd928d3c',
'dart_boringssl_rev': 'bb13a96931dd90d6570fa6151e19ef426d5c641f',
'dart_binaryen_rev': '87f9dac127b387715d8d96ac7ec8fd469d8c2dab',
'dart_boringssl_rev': '57f525e425a95e7c89fa2df926fa93273bd47311',
'dart_core_rev': '7f9f597e64fa52faebd3c0a2214f61a7b081174d',
'dart_devtools_rev': '3e5327a02693b1405359dc5322d7f0a40151b9b7',
'dart_http_rev': '79470d014b467f01b0e7c5b63ab6c86b22dec8db',
'dart_libprotobuf_rev': '24487dd1045c7f3d64a21f38a3f0c06cc4cf2edb',
'dart_perfetto_rev': '13ce0c9e13b0940d2476cd0cff2301708a9a2e2b',
'dart_protobuf_gn_rev': 'ca669f79945418f6229e4fef89b666b2a88cbb10',
'dart_protobuf_rev': 'da7279c56734cffed4deb1e3a6f93bdcefccf6b8',
'dart_pub_rev': '30bfc439fedba1ee3daadcf542f1483479bc4909',
'dart_pub_rev': '58de642dc1d07601f6eb2b4ecd94555c0210106b',
'dart_tools_rev': '223daf5300a5e3f6e09b7e24a5fda1009d6708f7',
'dart_watcher_rev': 'bc44e6f6b85972e516c44b9ae6c042b4cbd7c72b',
'dart_web_rev': 'bdf112ec64d28285cc29c6c78274ff3a827bb79b',
'dart_webdev_rev': '5f30c560dc4e3df341356c43ec1a766ee6b74a7c',
'dart_webdev_rev': 'ab620d1a81adc57b5045a189e076b9930ae66208',
'dart_webkit_inspection_protocol_rev': 'effa75205516757795683d527c3dea9546eb0c32',
'dart_yaml_edit_rev': 'fbdc70acc164af187772e013a2e1364cd05b88dc',

Expand Down Expand Up @@ -320,7 +320,7 @@ deps = {
# WARNING: Unused Dart dependencies in the list below till "WARNING:" marker are removed automatically - see create_updated_flutter_deps.py.

'src/flutter/third_party/dart/third_party/binaryen/src':
Var('chromium_git') + '/external/github.com/WebAssembly/binaryen.git@93883fde36ac158fd415dcd6dbd387dcfd928d3c',
Var('chromium_git') + '/external/github.com/WebAssembly/binaryen.git@87f9dac127b387715d8d96ac7ec8fd469d8c2dab',

'src/flutter/third_party/dart/third_party/devtools':
{'dep_type': 'cipd', 'packages': [{'package': 'dart/third_party/flutter/devtools', 'version': 'git_revision:3e5327a02693b1405359dc5322d7f0a40151b9b7'}]},
Expand Down Expand Up @@ -353,7 +353,7 @@ deps = {
Var('dart_git') + '/markdown.git@4d5dbc659955973902f2585c54e94d453532db70',

'src/flutter/third_party/dart/third_party/pkg/native':
Var('dart_git') + '/native.git@8ea1a9db0af42933eb22334c4506ca464d7237e9',
Var('dart_git') + '/native.git@da5dc148a0430b6c4224b59178db5385d79b2298',

'src/flutter/third_party/dart/third_party/pkg/package_config':
Var('dart_git') + '/package_config.git@76f2f6c245451da1fa24d7bbb00251b909e729a5',
Expand Down Expand Up @@ -428,7 +428,7 @@ deps = {
Var('dart_git') + '/yaml_edit.git' + '@' + Var('dart_yaml_edit_rev'),

'src/flutter/third_party/dart/tools/sdks/dart-sdk':
{'dep_type': 'cipd', 'packages': [{'package': 'dart/dart-sdk/${{platform}}', 'version': 'git_revision:7fce3544047c41018b8c00b4453c0262f463dd74'}]},
{'dep_type': 'cipd', 'packages': [{'package': 'dart/dart-sdk/${{platform}}', 'version': 'git_revision:f863f0b43625eb04539a34d7cc25029ba80dd522'}]},

# WARNING: end of dart dependencies list that is cleaned up automatically - see create_updated_flutter_deps.py.

Expand Down Expand Up @@ -870,7 +870,7 @@ deps = {
'packages': [
{
'package': 'fuchsia/sdk/core/linux-amd64',
'version': '5taAI9-tnFN84ZJvrs2E-sXIhxas7Bw7jxCrLtzcnaEC'
'version': 'zvsXvTuk-Z1Mgtn34lhXHPbQAAPOVrHYuEZZJqa6N9oC'
}
],
'condition': 'download_fuchsia_deps and not download_fuchsia_sdk',
Expand Down
170 changes: 167 additions & 3 deletions ci/bin/format.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ enum MessageType {
}

enum FormatCheck {
dart,
gn,
java,
python,
Expand All @@ -53,6 +54,8 @@ FormatCheck nameToFormatCheck(String name) {
switch (name) {
case 'clang':
return FormatCheck.clang;
case 'dart':
return FormatCheck.dart;
case 'gn':
return FormatCheck.gn;
case 'java':
Expand All @@ -72,6 +75,8 @@ String formatCheckToName(FormatCheck check) {
switch (check) {
case FormatCheck.clang:
return 'C++/ObjC/Shader';
case FormatCheck.dart:
return 'Dart';
case FormatCheck.gn:
return 'GN';
case FormatCheck.java:
Expand All @@ -87,8 +92,7 @@ String formatCheckToName(FormatCheck check) {

List<String> formatCheckNames() {
return FormatCheck.values
.map<String>((FormatCheck check) =>
check.toString().replaceFirst('$FormatCheck.', ''))
.map<String>((FormatCheck check) => check.name)
.toList();
}

Expand Down Expand Up @@ -141,6 +145,14 @@ abstract class FormatChecker {
allFiles: allFiles,
messageCallback: messageCallback,
);
case FormatCheck.dart:
return DartFormatChecker(
processManager: processManager,
baseGitRef: baseGitRef,
repoDir: repoDir,
allFiles: allFiles,
messageCallback: messageCallback,
);
case FormatCheck.gn:
return GnFormatChecker(
processManager: processManager,
Expand Down Expand Up @@ -786,6 +798,157 @@ class GnFormatChecker extends FormatChecker {
}
}

/// Checks the format of any .dart files using the "dart format" command.
class DartFormatChecker extends FormatChecker {
DartFormatChecker({
super.processManager,
required super.baseGitRef,
required Directory repoDir,
super.allFiles,
super.messageCallback,
}) : super(
repoDir: repoDir,
) {
// $ENGINE/flutter/third_party/dart/tools/sdks/dart-sdk/bin/dart
_dartBin = path.join(
repoDir.absolute.parent.path,
'flutter',
'third_party',
'dart',
'tools',
'sdks',
'dart-sdk',
'bin',
Platform.isWindows ? 'dart.exe' : 'dart',
);
}

late final String _dartBin;

@override
Future<bool> checkFormatting() async {
message('Checking Dart formatting...');
return (await _runDartFormat(fixing: false)) == 0;
}

@override
Future<bool> fixFormatting() async {
message('Fixing Dart formatting...');
return (await _runDartFormat(fixing: true)) == 0;
}

Future<int> _runDartFormat({required bool fixing}) async {
final List<String> filesToCheck = await getFileList(<String>['*.dart']);

final List<String> cmd = <String>[
_dartBin,
'format',
'--set-exit-if-changed',
'--show=none',
if (!fixing) '--output=show',
if (fixing) '--output=write',
];
final List<WorkerJob> jobs = <WorkerJob>[];
for (final String file in filesToCheck) {
jobs.add(WorkerJob(<String>[...cmd, file]));
}
final ProcessPool dartFmt = ProcessPool(
processRunner: _processRunner,
printReport: namedReport('dart format'),
);

Iterable<WorkerJob> incorrect;
final List<WorkerJob> errorJobs = [];
if (!fixing) {
final Stream<WorkerJob> completedJobs = dartFmt.startWorkers(jobs);
final List<WorkerJob> diffJobs = <WorkerJob>[];
await for (final WorkerJob completedJob in completedJobs) {
if (completedJob.result.exitCode != 0 && completedJob.result.exitCode != 1) {
// The formatter had a problem formatting the file.
errorJobs.add(completedJob);
} else if (completedJob.result.exitCode == 1) {
diffJobs.add(
WorkerJob(<String>[
'git',
'diff',
'--no-index',
'--no-color',
'--ignore-cr-at-eol',
'--',
completedJob.command.last,
'-',
], stdinRaw: codeUnitsAsStream(completedJob.result.stdoutRaw)),
);
}
}
final ProcessPool diffPool = ProcessPool(
processRunner: _processRunner,
printReport: namedReport('diff'),
);
final List<WorkerJob> completedDiffs = await diffPool.runToCompletion(diffJobs);
incorrect = completedDiffs.where((WorkerJob job) {
return job.result.exitCode != 0;
});
} else {
final List<WorkerJob> completedJobs = await dartFmt.runToCompletion(jobs);
final List<WorkerJob> incorrectJobs = incorrect = [];
for (final WorkerJob job in completedJobs) {
if (job.result.exitCode != 0 && job.result.exitCode != 1) {
// The formatter had a problem formatting the file.
errorJobs.add(job);
} else if (job.result.exitCode == 1) {
incorrectJobs.add(job);
}
}
}

reportDone();

if (incorrect.isNotEmpty) {
final bool plural = incorrect.length > 1;
if (fixing) {
message('Fixing ${incorrect.length} dart file${plural ? 's' : ''}'
' which ${plural ? 'were' : 'was'} formatted incorrectly.');
} else {
error('Found ${incorrect.length} Dart file${plural ? 's' : ''}'
' which ${plural ? 'were' : 'was'} formatted incorrectly.');
stdout.writeln();
stdout.writeln('To fix, run `et format` or:');
stdout.writeln();
stdout.writeln('git apply <<DONE');
for (final WorkerJob job in incorrect) {
stdout.write(job.result.stdout
.replaceFirst('b/-', 'b/${job.command[job.command.length - 2]}')
.replaceFirst('b/-', 'b/${job.command[job.command.length - 2]}')
.replaceFirst(RegExp('\\+Formatted \\d+ files? \\(\\d+ changed\\) in \\d+.\\d+ seconds.\n'), '')
);
}
stdout.writeln('DONE');
stdout.writeln();
}
_printErrorJobs(errorJobs);
} else if (errorJobs.isNotEmpty) {
_printErrorJobs(errorJobs);
} else {
message('All dart files formatted correctly.');
}
return fixing ? errorJobs.length : (incorrect.length + errorJobs.length);
}

void _printErrorJobs(List<WorkerJob> errorJobs) {
if (errorJobs.isNotEmpty) {
final bool plural = errorJobs.length > 1;
error('The formatter failed to run on ${errorJobs.length} Dart file${plural ? 's' : ''}.');
stdout.writeln();
for (final WorkerJob job in errorJobs) {
stdout.writeln('--> ${job.command.last} produced the following error:');
stdout.write(job.result.stderr);
stdout.writeln();
}
}
}
}

/// Checks the format of any .py files using the "yapf" command.
class PythonFormatChecker extends FormatChecker {
PythonFormatChecker({
Expand Down Expand Up @@ -1144,7 +1307,8 @@ Future<int> main(List<String> arguments) async {
parser.addMultiOption('check',
abbr: 'c',
allowed: formatCheckNames(),
defaultsTo: formatCheckNames(),
// TODO(goderbauer): Enable dart by default when we turned on the formatter.
defaultsTo: formatCheckNames()..remove(FormatCheck.dart.name),
help: 'Specifies which checks will be performed. Defaults to all checks. '
'May be specified more than once to perform multiple types of checks. ');
parser.addFlag('verbose', help: 'Print verbose output.', defaultsTo: verbose);
Expand Down
Loading

0 comments on commit d3e2dc2

Please sign in to comment.