-
Notifications
You must be signed in to change notification settings - Fork 6k
Allow engine variants other than "host_debug" to be clang-tidy linted #29668
Conversation
e667d37
to
15a6f9e
Compare
import 'package:path/path.dart' as path; | ||
|
||
// Path to root of the flutter/engine repository containing this script. | ||
final String _engineRoot = path.dirname(path.dirname(path.dirname(path.dirname(path.fromUri(io.Platform.script))))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're computing this here, maybe we don't need the --repo
command line argument anymore. Or the other way around, if you have the --repo
argument, this is just the parent directory of that, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was there any case where --repo
needs to handle some other repo directory? I wasn't sure why it was passed in in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pattern is probably safe here since we're always running the script from source, but it would break if the script were compiled to a snapshot and then the snapshot moved somewhere else before being run.
We can keep this and get rid of the --repo
argument if that is simpler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would break if the script were compiled to a snapshot and then the snapshot moved somewhere else before being run.
If you do that and it doesn't work: Give The Script A Break 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed --repo
.
@@ -229,16 +229,8 @@ class ClangTidy { | |||
if (job.result.exitCode == 0) { | |||
continue; | |||
} | |||
if (job.exception != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to remove this block. It was only showing the first file linter errors because a linter failure makes the process fail, which populates the job.exception
, and break
s so doesn't show the other job failures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch
8d4bec4
to
6e33389
Compare
import 'package:path/path.dart' as path; | ||
|
||
// Path to root of the flutter/engine repository containing this script. | ||
final String _engineRoot = path.dirname(path.dirname(path.dirname(path.dirname(path.fromUri(io.Platform.script))))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pattern is probably safe here since we're always running the script from source, but it would break if the script were compiled to a snapshot and then the snapshot moved somewhere else before being run.
We can keep this and get rid of the --repo
argument if that is simpler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this shouldn't be an issue for beta branches, provided the engine builds were passing at the time the branch was made.
Add a new
--target-variant
and--src-dir
option to theclang-tidy
linter script.Update
lint.sh
to pass along thesrc-dir
instead of thecompile-commands
path. The dart script will interpret this assrc-dir/out/host_debug/compile_commands.json
by default. Alternative--target-variant
can be passed into the shell script.This will allow variants (is that the right word here?) other than
host_debug
to be run by the linter.The recipe can then run the script for different targets
https://flutter.googlesource.com/recipes/+/refs/heads/main/recipes/engine_unopt.py#99
will become something like:
Note: in the future when the recipe is updated to use
--target-variant
, any outstanding PRs older than this script change will fail until merged in/rebased. I don't think it will impact future releases since they are versioned (will a beta release without this change run with that recipe? @christopherfujino )Git pre-push hook continues to pass in
--compile-commands
and still works.Other improvements:
--format-style=file
to use.clang-format
file for fixes.--repo
option, calculate that directory relative to the script path.flutter/flutter#61661
Pre-launch Checklist
writing and running engine tests.
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.