From 416c212dcaaca4d18b288ea4f6f28f96e68ee07f Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Thu, 22 Feb 2024 20:09:19 -0800 Subject: [PATCH 01/12] Test that clangd --check works at HEAD. --- ci/builders/linux_unopt.json | 5 +++ ci/builders/mac_unopt.json | 5 +++ testing/run_tests.py | 1 + tools/clangd_check/README.md | 27 ++++++++++++ tools/clangd_check/bin/main.dart | 75 ++++++++++++++++++++++++++++++++ tools/clangd_check/pubspec.yaml | 64 +++++++++++++++++++++++++++ tools/pub_get_offline.py | 1 + 7 files changed, 178 insertions(+) create mode 100644 tools/clangd_check/README.md create mode 100644 tools/clangd_check/bin/main.dart create mode 100644 tools/clangd_check/pubspec.yaml diff --git a/ci/builders/linux_unopt.json b/ci/builders/linux_unopt.json index 62cba879cebe0..e1edf28e5a303 100644 --- a/ci/builders/linux_unopt.json +++ b/ci/builders/linux_unopt.json @@ -79,6 +79,11 @@ "flutter/shell/testing/observatory/empty_main.dart" ] }, + { + "language": "dart", + "name": "test: clangd", + "script": "flutter/tools/clangd_check/bin/main.dart" + }, { "language": "dart", "name": "test: Lint android host", diff --git a/ci/builders/mac_unopt.json b/ci/builders/mac_unopt.json index dc6f18b3a88df..98ea8dfb6a1d9 100644 --- a/ci/builders/mac_unopt.json +++ b/ci/builders/mac_unopt.json @@ -273,6 +273,11 @@ "ios_debug_unopt_sim_arm64_extension_safe" ], "script": "flutter/testing/scenario_app/run_ios_tests.sh" + }, + { + "language": "dart", + "name": "test: clangd", + "script": "flutter/tools/clangd_check/bin/main.dart" } ] } diff --git a/testing/run_tests.py b/testing/run_tests.py index 966a02778e34d..5db3c3d3cb204 100755 --- a/testing/run_tests.py +++ b/testing/run_tests.py @@ -923,6 +923,7 @@ def build_dart_host_test_list(build_dir): os.path.join(build_dir, 'dart-sdk', 'lib', 'libraries.json'), ], ), + (os.path.join('flutter', 'tools', 'clangd_check'), []), (os.path.join('flutter', 'tools', 'dir_contents_diff'), []), (os.path.join('flutter', 'tools', 'engine_tool'), []), (os.path.join('flutter', 'tools', 'githooks'), []), diff --git a/tools/clangd_check/README.md b/tools/clangd_check/README.md new file mode 100644 index 0000000000000..88f8c9e48faed --- /dev/null +++ b/tools/clangd_check/README.md @@ -0,0 +1,27 @@ +# `clangd_check` + +`clangd_check` is a tool to run clangd on a codebase and check for diagnostics. + +The practical use of this tool is intentionally limited; it's designed to +provide a quick way to verify that `clangd` is able to parse and analyze a +C++ codebase. + +## Usage + +```sh +dart ./tools/clangd_check/bin/main.dart +``` + +On success, and with no diagnostics, `clangd_check` will exit with status 0. + +By default, `clangd_check` will try to infer the path of `clangd`, as well as +the path to `--compile-commands-dir` based on what artifacts are present in +`$ENGINE/src/out`. + +You can also specify the path to `clangd` and `--compile-commands-dir` manually: + +```sh +dart ./tools/clangd_check/bin/main.dart \ + --clangd ../buildtools/mac-arm64/clang/bin/clangd \ + --compile-commands-dir ../out/host_Debug_unopt_arm64 +``` diff --git a/tools/clangd_check/bin/main.dart b/tools/clangd_check/bin/main.dart new file mode 100644 index 0000000000000..8d8b3494f9a60 --- /dev/null +++ b/tools/clangd_check/bin/main.dart @@ -0,0 +1,75 @@ +import 'dart:convert'; +import 'dart:io' as io; + +import 'package:args/args.dart'; +import 'package:engine_repo_tools/engine_repo_tools.dart'; +import 'package:path/path.dart' as p; + +void main(List args) { + final Engine? engine = Engine.tryFindWithin(); + final ArgParser parser = ArgParser() + ..addOption( + 'clangd', + help: 'Path to clangd. Defaults to deriving the path from compile_commands.json.', + ) + ..addOption( + 'compile-commands-dir', + help: 'Path to a directory containing compile_commands.json.', + defaultsTo: engine?.latestOutput()?.compileCommandsJson.parent.path, + ); + final ArgResults results = parser.parse(args); + + final String? compileCommandsDir = results['compile-commands-dir'] as String?; + if (compileCommandsDir == null) { + io.stderr.writeln('Must provide a path to compile_commands.json'); + io.exitCode = 1; + return; + } + final io.File compileCommandsFile = io.File(p.join(compileCommandsDir, 'compile_commands.json')); + if (!compileCommandsFile.existsSync()) { + io.stderr.writeln('No compile_commands.json found in $compileCommandsDir'); + io.exitCode = 1; + return; + } + + final List compileCommands = json.decode(compileCommandsFile.readAsStringSync()) as List; + if (compileCommands.isEmpty) { + io.stderr.writeln('Unexpected: compile_commands.json is empty'); + io.exitCode = 1; + return; + } + + String? clangd = results['clangd'] as String?; + final Map entry = compileCommands.first! as Map; + final String checkFile; + if (entry case { + 'command': final String path, + 'file': final String file, + }) { + checkFile = p.split(file).skip(3).join(p.separator); + clangd ??= p.join(p.dirname(p.dirname(path.split(' ').first)), 'clang', 'bin', 'clangd'); + } else { + io.stderr.writeln('Unexpected: compile_commands.json has an unexpected format'); + io.stderr.writeln('First entry: ${const JsonEncoder.withIndent(' ').convert(entry)}'); + io.exitCode = 1; + return; + } + + // Run clangd. + final io.ProcessResult result = io.Process.runSync(clangd, [ + '--compile-commands-dir', + compileCommandsDir, + '--check=$checkFile', + ]); + io.stdout.write(result.stdout); + io.stderr.write(result.stderr); + if ((result.stderr as String).contains('Path specified by --compile-commands-dir does not exist')) { + io.stdout.writeln('clangd_check failed: --compile-commands-dir does not exist'); + io.exitCode = 1; + } else if ((result.stderr as String).contains('Failed to resolve path')) { + io.stdout.writeln('clangd_check failed: --check file does not exist'); + io.exitCode = 1; + } else { + io.exitCode = result.exitCode; + } +} diff --git a/tools/clangd_check/pubspec.yaml b/tools/clangd_check/pubspec.yaml new file mode 100644 index 0000000000000..c994325d65411 --- /dev/null +++ b/tools/clangd_check/pubspec.yaml @@ -0,0 +1,64 @@ +# Copyright 2013 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +name: clangd_check +publish_to: none + +# Do not add any dependencies that require more than what is provided in +# //third_party/dart/pkg or //third_party/dart/third_party/pkg. +# In particular, package:test is not usable here. + +# If you do add packages here, make sure you can run `pub get --offline`, and +# check the .packages and .package_config to make sure all the paths are +# relative to this directory into //third_party/dart + +environment: + sdk: '>=3.2.0-0 <4.0.0' + +dependencies: + args: any + engine_repo_tools: any + path: any + source_span: any + +dev_dependencies: + async_helper: any + expect: any + litetest: any + process_fakes: any + smith: any + +dependency_overrides: + args: + path: ../../../third_party/dart/third_party/pkg/args + async: + path: ../../../third_party/dart/third_party/pkg/async + async_helper: + path: ../../../third_party/dart/pkg/async_helper + collection: + path: ../../../third_party/dart/third_party/pkg/collection + engine_repo_tools: + path: ../pkg/engine_repo_tools + expect: + path: ../../../third_party/dart/pkg/expect + file: + path: ../../../third_party/dart/third_party/pkg/file/packages/file + git_repo_tools: + path: ../pkg/git_repo_tools + litetest: + path: ../../testing/litetest + meta: + path: ../../../third_party/dart/pkg/meta + path: + path: ../../../third_party/dart/third_party/pkg/path + platform: + path: ../../third_party/pkg/platform + process: + path: ../../third_party/pkg/process + process_fakes: + path: ../pkg/process_fakes + process_runner: + path: ../../third_party/pkg/process_runner + smith: + path: ../../../third_party/dart/pkg/smith diff --git a/tools/pub_get_offline.py b/tools/pub_get_offline.py index 06d427a693048..942075d4e5027 100644 --- a/tools/pub_get_offline.py +++ b/tools/pub_get_offline.py @@ -34,6 +34,7 @@ os.path.join(ENGINE_DIR, 'tools', 'api_check'), os.path.join(ENGINE_DIR, 'tools', 'build_bucket_golden_scraper'), os.path.join(ENGINE_DIR, 'tools', 'clang_tidy'), + os.path.join(ENGINE_DIR, 'tools', 'clangd_check'), os.path.join(ENGINE_DIR, 'tools', 'compare_goldens'), os.path.join(ENGINE_DIR, 'tools', 'const_finder'), os.path.join(ENGINE_DIR, 'tools', 'dir_contents_diff'), From 062bd310fa6044bdccfadbb610b484cb82e8f25c Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Thu, 22 Feb 2024 20:27:01 -0800 Subject: [PATCH 02/12] ++ --- tools/clangd_check/pubspec.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/clangd_check/pubspec.yaml b/tools/clangd_check/pubspec.yaml index c994325d65411..b82318fa62fee 100644 --- a/tools/clangd_check/pubspec.yaml +++ b/tools/clangd_check/pubspec.yaml @@ -62,3 +62,7 @@ dependency_overrides: path: ../../third_party/pkg/process_runner smith: path: ../../../third_party/dart/pkg/smith + source_span: + path: ../../../third_party/dart/third_party/pkg/source_span + term_glyph: + path: ../../../third_party/dart/third_party/pkg/term_glyph From 05fa9975df5eef30b43bba7e4ccd6d523fcfe9b3 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Thu, 22 Feb 2024 20:42:48 -0800 Subject: [PATCH 03/12] ++ --- testing/run_tests.py | 1 - 1 file changed, 1 deletion(-) diff --git a/testing/run_tests.py b/testing/run_tests.py index 5db3c3d3cb204..966a02778e34d 100755 --- a/testing/run_tests.py +++ b/testing/run_tests.py @@ -923,7 +923,6 @@ def build_dart_host_test_list(build_dir): os.path.join(build_dir, 'dart-sdk', 'lib', 'libraries.json'), ], ), - (os.path.join('flutter', 'tools', 'clangd_check'), []), (os.path.join('flutter', 'tools', 'dir_contents_diff'), []), (os.path.join('flutter', 'tools', 'engine_tool'), []), (os.path.join('flutter', 'tools', 'githooks'), []), From a0e7cc0611bc2b88867d1d7c82d632e503502b88 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Fri, 23 Feb 2024 11:13:30 -0800 Subject: [PATCH 04/12] Headers and try providing --clangd for the builders. --- ci/builders/linux_unopt.json | 5 ++++- ci/builders/mac_unopt.json | 5 ++++- tools/clangd_check/bin/main.dart | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ci/builders/linux_unopt.json b/ci/builders/linux_unopt.json index e1edf28e5a303..09d578ec51b66 100644 --- a/ci/builders/linux_unopt.json +++ b/ci/builders/linux_unopt.json @@ -82,7 +82,10 @@ { "language": "dart", "name": "test: clangd", - "script": "flutter/tools/clangd_check/bin/main.dart" + "script": "flutter/tools/clangd_check/bin/main.dart", + "parameters": [ + "--clangd=buildtools/linux-x64/clang/bin/clangd" + ] }, { "language": "dart", diff --git a/ci/builders/mac_unopt.json b/ci/builders/mac_unopt.json index 98ea8dfb6a1d9..da7bc7be33745 100644 --- a/ci/builders/mac_unopt.json +++ b/ci/builders/mac_unopt.json @@ -277,7 +277,10 @@ { "language": "dart", "name": "test: clangd", - "script": "flutter/tools/clangd_check/bin/main.dart" + "script": "flutter/tools/clangd_check/bin/main.dart", + "parameters": [ + "--clangd=buildtools/mac-x64/clang/bin/clangd" + ] } ] } diff --git a/tools/clangd_check/bin/main.dart b/tools/clangd_check/bin/main.dart index 8d8b3494f9a60..ede96040db7b0 100644 --- a/tools/clangd_check/bin/main.dart +++ b/tools/clangd_check/bin/main.dart @@ -1,3 +1,7 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + import 'dart:convert'; import 'dart:io' as io; @@ -46,6 +50,7 @@ void main(List args) { 'command': final String path, 'file': final String file, }) { + // Given a path like ../../flutter/foo.cc, we want to check foo.cc. checkFile = p.split(file).skip(3).join(p.separator); clangd ??= p.join(p.dirname(p.dirname(path.split(' ').first)), 'clang', 'bin', 'clangd'); } else { From 9a5169fd073ba27e5f9061001f0b44a6399bf8b7 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Mon, 26 Feb 2024 18:54:50 -0800 Subject: [PATCH 05/12] More debugging. --- tools/clangd_check/bin/main.dart | 34 +++++++++++++++++++------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/tools/clangd_check/bin/main.dart b/tools/clangd_check/bin/main.dart index ede96040db7b0..c38be993e9c94 100644 --- a/tools/clangd_check/bin/main.dart +++ b/tools/clangd_check/bin/main.dart @@ -61,20 +61,26 @@ void main(List args) { } // Run clangd. - final io.ProcessResult result = io.Process.runSync(clangd, [ - '--compile-commands-dir', - compileCommandsDir, - '--check=$checkFile', - ]); - io.stdout.write(result.stdout); - io.stderr.write(result.stderr); - if ((result.stderr as String).contains('Path specified by --compile-commands-dir does not exist')) { - io.stdout.writeln('clangd_check failed: --compile-commands-dir does not exist'); + try { + final io.ProcessResult result = io.Process.runSync(clangd, [ + '--compile-commands-dir', + compileCommandsDir, + '--check=$checkFile', + ]); + io.stdout.write(result.stdout); + io.stderr.write(result.stderr); + if ((result.stderr as String).contains('Path specified by --compile-commands-dir does not exist')) { + io.stdout.writeln('clangd_check failed: --compile-commands-dir does not exist'); + io.exitCode = 1; + } else if ((result.stderr as String).contains('Failed to resolve path')) { + io.stdout.writeln('clangd_check failed: --check file does not exist'); + io.exitCode = 1; + } else { + io.exitCode = result.exitCode; + } + } on io.ProcessException catch (e) { + io.stderr.writeln('Failed to run clangd: $e'); + io.stderr.writeln(const JsonEncoder.withIndent(' ').convert(entry)); io.exitCode = 1; - } else if ((result.stderr as String).contains('Failed to resolve path')) { - io.stdout.writeln('clangd_check failed: --check file does not exist'); - io.exitCode = 1; - } else { - io.exitCode = result.exitCode; } } From 7eea7fa17c07a1acdc15eb02703497fead27ed62 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Mon, 25 Mar 2024 11:07:06 -0700 Subject: [PATCH 06/12] Make the clangd finder more robust. --- tools/clangd_check/bin/main.dart | 39 ++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/tools/clangd_check/bin/main.dart b/tools/clangd_check/bin/main.dart index c38be993e9c94..cb19b49b18b30 100644 --- a/tools/clangd_check/bin/main.dart +++ b/tools/clangd_check/bin/main.dart @@ -47,12 +47,47 @@ void main(List args) { final Map entry = compileCommands.first! as Map; final String checkFile; if (entry case { - 'command': final String path, + 'command': final String command, 'file': final String file, }) { // Given a path like ../../flutter/foo.cc, we want to check foo.cc. checkFile = p.split(file).skip(3).join(p.separator); - clangd ??= p.join(p.dirname(p.dirname(path.split(' ').first)), 'clang', 'bin', 'clangd'); + // On CI, the command path is different from the local path. + // Find the engine root and derive the clangd path from there. + if (clangd == null) { + // Strip the command to find the path to the engine root. + // i.e. "command": "/path/to/engine/src/... arg1 arg2 ..." + // + // This now looks like "../../flutter/buildtools/{platform}/{...}" + final String commandPath = p.dirname(command.split(' ').first); + + // Find the canonical path to the command (i.e. resolve "../" and ".") + // + // This now looks like "/path/to/engine/src/flutter/buildtools/{platform}/{...}" + final String path = p.canonicalize( + p.join(compileCommandsDir, commandPath), + ); + + // Extract which platform we're building for (e.g. linux-x64, mac-arm64, mac-x64). + final String platform = RegExp( + r'buildtools/([^/]+)/', + ).firstMatch(path)!.group(1)!; + + // Find the engine root and derive the clangd path from there. + final Engine compileCommandsEngineRoot = Engine.findWithin(path); + clangd = p.join( + // engine/src/flutter + compileCommandsEngineRoot.flutterDir.path, + // buildtools + 'buildtools', + // {platform} + platform, + // clangd + 'clang', + 'bin', + 'clangd', + ); + } } else { io.stderr.writeln('Unexpected: compile_commands.json has an unexpected format'); io.stderr.writeln('First entry: ${const JsonEncoder.withIndent(' ').convert(entry)}'); From 3fbc0c38102e39c743badaaf4bb782c2c0dac2f0 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Mon, 25 Mar 2024 11:50:51 -0700 Subject: [PATCH 07/12] Ignore unknown arguments. --- ci/builders/linux_unopt.json | 3 ++- ci/builders/mac_unopt.json | 3 ++- tools/clangd_check/bin/main.dart | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ci/builders/linux_unopt.json b/ci/builders/linux_unopt.json index cbb64cc0fdf41..a89b337a7a8cc 100644 --- a/ci/builders/linux_unopt.json +++ b/ci/builders/linux_unopt.json @@ -91,7 +91,8 @@ "name": "test: clangd", "script": "flutter/tools/clangd_check/bin/main.dart", "parameters": [ - "--clangd=buildtools/linux-x64/clang/bin/clangd" + "--clangd=buildtools/linux-x64/clang/bin/clangd", + "--ignore-unknown-clangd-args" ] }, { diff --git a/ci/builders/mac_unopt.json b/ci/builders/mac_unopt.json index 8cc8ac87830fc..48c8296d15246 100644 --- a/ci/builders/mac_unopt.json +++ b/ci/builders/mac_unopt.json @@ -299,7 +299,8 @@ "name": "test: clangd", "script": "flutter/tools/clangd_check/bin/main.dart", "parameters": [ - "--clangd=buildtools/mac-x64/clang/bin/clangd" + "--clangd=buildtools/mac-x64/clang/bin/clangd", + "--ignore-unknown-clangd-args" ] } ] diff --git a/tools/clangd_check/bin/main.dart b/tools/clangd_check/bin/main.dart index cb19b49b18b30..7ce93a5449007 100644 --- a/tools/clangd_check/bin/main.dart +++ b/tools/clangd_check/bin/main.dart @@ -12,6 +12,10 @@ import 'package:path/path.dart' as p; void main(List args) { final Engine? engine = Engine.tryFindWithin(); final ArgParser parser = ArgParser() + ..addFlag( + 'ignore-unknown-clangd-args', + help: 'Ignore unknown arguments passed to clangd.', + ) ..addOption( 'clangd', help: 'Path to clangd. Defaults to deriving the path from compile_commands.json.', @@ -101,6 +105,10 @@ void main(List args) { '--compile-commands-dir', compileCommandsDir, '--check=$checkFile', + // Ignore unknown arguments. + // Sometimes there is a wrapper script that has additional arguments. + if (results['ignore-unknown-clangd-args'] as bool) + '-Wno-unknown-warning-option', ]); io.stdout.write(result.stdout); io.stderr.write(result.stderr); From cd4dbd22fa226c7a3666c36812b074dfb15eb4af Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Tue, 26 Mar 2024 11:17:50 -0700 Subject: [PATCH 08/12] Revert, using .clangd instead. --- ci/builders/linux_unopt.json | 3 +-- ci/builders/mac_unopt.json | 3 +-- tools/clangd_check/bin/main.dart | 14 ++++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ci/builders/linux_unopt.json b/ci/builders/linux_unopt.json index a89b337a7a8cc..cbb64cc0fdf41 100644 --- a/ci/builders/linux_unopt.json +++ b/ci/builders/linux_unopt.json @@ -91,8 +91,7 @@ "name": "test: clangd", "script": "flutter/tools/clangd_check/bin/main.dart", "parameters": [ - "--clangd=buildtools/linux-x64/clang/bin/clangd", - "--ignore-unknown-clangd-args" + "--clangd=buildtools/linux-x64/clang/bin/clangd" ] }, { diff --git a/ci/builders/mac_unopt.json b/ci/builders/mac_unopt.json index 48c8296d15246..8cc8ac87830fc 100644 --- a/ci/builders/mac_unopt.json +++ b/ci/builders/mac_unopt.json @@ -299,8 +299,7 @@ "name": "test: clangd", "script": "flutter/tools/clangd_check/bin/main.dart", "parameters": [ - "--clangd=buildtools/mac-x64/clang/bin/clangd", - "--ignore-unknown-clangd-args" + "--clangd=buildtools/mac-x64/clang/bin/clangd" ] } ] diff --git a/tools/clangd_check/bin/main.dart b/tools/clangd_check/bin/main.dart index 7ce93a5449007..c97ae4a2090f6 100644 --- a/tools/clangd_check/bin/main.dart +++ b/tools/clangd_check/bin/main.dart @@ -13,8 +13,10 @@ void main(List args) { final Engine? engine = Engine.tryFindWithin(); final ArgParser parser = ArgParser() ..addFlag( - 'ignore-unknown-clangd-args', - help: 'Ignore unknown arguments passed to clangd.', + 'help', + abbr: 'h', + help: 'Print this usage information.', + negatable: false, ) ..addOption( 'clangd', @@ -26,6 +28,10 @@ void main(List args) { defaultsTo: engine?.latestOutput()?.compileCommandsJson.parent.path, ); final ArgResults results = parser.parse(args); + if (results['help'] as bool) { + io.stdout.writeln(parser.usage); + return; + } final String? compileCommandsDir = results['compile-commands-dir'] as String?; if (compileCommandsDir == null) { @@ -105,10 +111,6 @@ void main(List args) { '--compile-commands-dir', compileCommandsDir, '--check=$checkFile', - // Ignore unknown arguments. - // Sometimes there is a wrapper script that has additional arguments. - if (results['ignore-unknown-clangd-args'] as bool) - '-Wno-unknown-warning-option', ]); io.stdout.write(result.stdout); io.stderr.write(result.stderr); From 04b4e90af3c4b9deab95bdff1f2a3796c47d3c48 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Tue, 26 Mar 2024 12:46:18 -0700 Subject: [PATCH 09/12] Add missing .clangd. --- .clangd | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .clangd diff --git a/.clangd b/.clangd new file mode 100644 index 0000000000000..c36b4792d750c --- /dev/null +++ b/.clangd @@ -0,0 +1,10 @@ +# Used to allow clangd to run on CI platforms as part of //tools/clangd_check. +# +# Intended to have no effect elsewhere. +# +# See also: +# - https://clangd.llvm.org/config#compileflags +# - https://github.com/clangd/clangd/issues/662 +CompileFlags: + Add: -Wno-unknown-warning-option + Remove: [-m*, -f*] From f83db157fc4d085e65ac7fc915b7d0bfe6dcfc6f Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Thu, 28 Mar 2024 10:06:10 -0700 Subject: [PATCH 10/12] Try 2 new builders. --- .ci.yaml | 10 ++++++ ci/builders/linux_unopt.json | 8 ----- ci/builders/linux_unopt_debug_no_rbe.json | 32 +++++++++++++++++++ ci/builders/mac_unopt.json | 8 ----- ci/builders/mac_unopt_debug_no_rbe.json | 38 +++++++++++++++++++++++ 5 files changed, 80 insertions(+), 16 deletions(-) create mode 100644 ci/builders/linux_unopt_debug_no_rbe.json create mode 100644 ci/builders/mac_unopt_debug_no_rbe.json diff --git a/.ci.yaml b/.ci.yaml index eac0999d9ea7d..a8fddce789cb6 100644 --- a/.ci.yaml +++ b/.ci.yaml @@ -322,6 +322,11 @@ targets: - ci/** - flutter_frontend_server/** + - name: Linux clangd + recipe: engine_v2/engine_v2 + properties: + config_name: linux_unopt_debug_no_rbe + - name: Linux linux_unopt recipe: engine_v2/engine_v2 timeout: 120 @@ -407,6 +412,11 @@ targets: drone_dimensions: - os=Mac-13 + - name: Mac clangd + recipe: engine_v2/engine_v2 + properties: + config_name: mac_unopt_debug_no_rbe + - name: Mac mac_unopt recipe: engine_v2/engine_v2 properties: diff --git a/ci/builders/linux_unopt.json b/ci/builders/linux_unopt.json index cbb64cc0fdf41..4987afb3773ab 100644 --- a/ci/builders/linux_unopt.json +++ b/ci/builders/linux_unopt.json @@ -86,14 +86,6 @@ "flutter/shell/testing/observatory/empty_main.dart" ] }, - { - "language": "dart", - "name": "test: clangd", - "script": "flutter/tools/clangd_check/bin/main.dart", - "parameters": [ - "--clangd=buildtools/linux-x64/clang/bin/clangd" - ] - }, { "language": "dart", "name": "test: Lint android host", diff --git a/ci/builders/linux_unopt_debug_no_rbe.json b/ci/builders/linux_unopt_debug_no_rbe.json new file mode 100644 index 0000000000000..566ece3c5ff63 --- /dev/null +++ b/ci/builders/linux_unopt_debug_no_rbe.json @@ -0,0 +1,32 @@ +{ + "_comment": [ + "This build is only used to generate compile_commands.json for clangd ", + "and should not be used for any other purpose." + ], + "builds": [ + { + "drone_dimensions": ["device_type=none", "os=Linux", "cores=32"], + "gn": [ + "--runtime-mode", + "debug", + "--unoptimized", + "--prebuilt-dart-sdk", + "--no-rbe", + "--no-goma" + ], + "name": "linux_unopt_debug_no_rbe", + "ninja": { + "config": "linux_unopt_debug_no_rbe", + "targets": ["flutter/build/dart:copy_dart_sdk"] + }, + "tests": [ + { + "language": "dart", + "name": "clangd", + "script": "flutter/tools/clangd_check/bin/main.dart", + "parameters": ["--clangd=buildtools/linux-x64/clang/bin/clangd"] + } + ] + } + ] +} diff --git a/ci/builders/mac_unopt.json b/ci/builders/mac_unopt.json index 8cc8ac87830fc..ed7a8da7d7408 100644 --- a/ci/builders/mac_unopt.json +++ b/ci/builders/mac_unopt.json @@ -293,14 +293,6 @@ "ios_debug_unopt_sim_arm64_extension_safe" ], "script": "flutter/testing/scenario_app/run_ios_tests.sh" - }, - { - "language": "dart", - "name": "test: clangd", - "script": "flutter/tools/clangd_check/bin/main.dart", - "parameters": [ - "--clangd=buildtools/mac-x64/clang/bin/clangd" - ] } ] } diff --git a/ci/builders/mac_unopt_debug_no_rbe.json b/ci/builders/mac_unopt_debug_no_rbe.json new file mode 100644 index 0000000000000..2c8c5eddab5d0 --- /dev/null +++ b/ci/builders/mac_unopt_debug_no_rbe.json @@ -0,0 +1,38 @@ +{ + "_comment": [ + "This build is only used to generate compile_commands.json for clangd ", + "and should not be used for any other purpose." + ], + "builds": [ + { + "drone_dimensions": [ + "device_type=none", + "os=Mac-13", + "cpu=x86", + "mac_model=Macmini8,1" + ], + "gn": [ + "--runtime-mode", + "debug", + "--unoptimized", + "--prebuilt-dart-sdk", + "--no-rbe", + "--no-goma", + "--xcode-symlinks" + ], + "name": "mac_unopt_debug_no_rbe", + "ninja": { + "config": "mac_unopt_debug_no_rbe", + "targets": ["flutter/build/dart:copy_dart_sdk"] + }, + "tests": [ + { + "language": "dart", + "name": "clangd", + "script": "flutter/tools/clangd_check/bin/main.dart", + "parameters": ["--clangd=buildtools/mac-x64/clang/bin/clangd"] + } + ] + } + ] +} From 154a2171756bcf5e7608bde81eb4dca0bc4171c8 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Thu, 28 Mar 2024 10:07:08 -0700 Subject: [PATCH 11/12] Bringup --- .ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.ci.yaml b/.ci.yaml index a8fddce789cb6..0ed01aec564df 100644 --- a/.ci.yaml +++ b/.ci.yaml @@ -324,6 +324,7 @@ targets: - name: Linux clangd recipe: engine_v2/engine_v2 + bringup: true properties: config_name: linux_unopt_debug_no_rbe @@ -414,6 +415,7 @@ targets: - name: Mac clangd recipe: engine_v2/engine_v2 + bringup: true properties: config_name: mac_unopt_debug_no_rbe From b6dc330b245090b4db92544f0c49267af9347f9e Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Thu, 28 Mar 2024 13:12:15 -0700 Subject: [PATCH 12/12] ++ --- ci/licenses_golden/licenses_flutter | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index ee89116474024..b15a809e5a236 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -41990,6 +41990,7 @@ ORIGIN: ../../../flutter/vulkan/vulkan_utilities.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/vulkan/vulkan_window.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/vulkan/vulkan_window.h + ../../../flutter/LICENSE TYPE: LicenseType.bsd +FILE: ../../../flutter/.clangd FILE: ../../../flutter/.pylintrc FILE: ../../../flutter/assets/asset_manager.cc FILE: ../../../flutter/assets/asset_manager.h