Allow engine variants other than "host_debug" to be clang-tidy linted#29668
Allow engine variants other than "host_debug" to be clang-tidy linted#29668fluttergithubbot merged 6 commits intoflutter:masterfrom
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.
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.
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.
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.
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 🙂
| if (job.result.exitCode == 0) { | ||
| continue; | ||
| } | ||
| if (job.exception != null) { |
There was a problem hiding this comment.
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 breaks so doesn't show the other job failures.
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.
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.
christopherfujino
left a comment
There was a problem hiding this comment.
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-variantand--src-diroption to theclang-tidylinter script.Update
lint.shto pass along thesrc-dirinstead of thecompile-commandspath. The dart script will interpret this assrc-dir/out/host_debug/compile_commands.jsonby default. Alternative--target-variantcan be passed into the shell script.This will allow variants (is that the right word here?) other than
host_debugto 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-commandsand still works.Other improvements:
--format-style=fileto use.clang-formatfile for fixes.--repooption, 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.