-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[tool] Add initial file-based command skipping #8928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
auto-submit
merged 8 commits into
flutter:main
from
stuartmorgan-g:repo-tool-file-based-filtering
Apr 18, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2d70133
Add skip support
stuartmorgan-g 09ab2da
Add initial filtering to many of the expensive commands
stuartmorgan-g 72248b0
Clarify comment
stuartmorgan-g 3ba35e0
Merge branch 'main' into repo-tool-file-based-filtering
stuartmorgan-g ed206c8
Merge branch 'main' into repo-tool-file-based-filtering
stuartmorgan-g dfab5c2
Merge branch 'main' into repo-tool-file-based-filtering
stuartmorgan-g f62c278
Collect common helpers
stuartmorgan-g b1b16ec
Merge branch 'main' into repo-tool-file-based-filtering
stuartmorgan-g File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// 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. | ||
|
||
/// Returns true for repository-level paths of files that do not affect *any* | ||
/// code-related commands (example builds, Dart analysis, native code analysis, | ||
/// native tests, Dart tests, etc.) for use in command-ignored-files lists for | ||
/// commands that are only affected by package code. | ||
bool isRepoLevelNonCodeImpactingFile(String path) { | ||
return <String>[ | ||
'AUTHORS', | ||
'CODEOWNERS', | ||
'CONTRIBUTING.md', | ||
'LICENSE', | ||
'README.md', | ||
// This deliberate lists specific files rather than excluding the whole | ||
// .github directory since it's better to have false negatives than to | ||
// accidentally skip tests if something is later added to the directory | ||
// that could affect packages. | ||
'.github/PULL_REQUEST_TEMPLATE.md', | ||
'.github/dependabot.yml', | ||
'.github/labeler.yml', | ||
'.github/post_merge_labeler.yml', | ||
'.github/workflows/pull_request_label.yml', | ||
].contains(path); | ||
} | ||
|
||
/// Returns true for native (non-Dart) code files, for use in command-ignored- | ||
/// files lists for commands that aren't affected by native code (e.g., Dart | ||
/// analysis and unit tests). | ||
bool isNativeCodeFile(String path) { | ||
return path.endsWith('.c') || | ||
path.endsWith('.cc') || | ||
path.endsWith('.cpp') || | ||
path.endsWith('.h') || | ||
path.endsWith('.m') || | ||
path.endsWith('.swift') || | ||
path.endsWith('.java') || | ||
path.endsWith('.kt'); | ||
} | ||
|
||
/// Returns true for package-level human-focused support files, for use in | ||
/// command-ignored-files lists for commands that aren't affected by files that | ||
/// aren't used in any builds. | ||
/// | ||
/// This must *not* include metadata files that do affect builds, such as | ||
/// pubspec.yaml. | ||
bool isPackageSupportFile(String path) { | ||
return path.endsWith('/AUTHORS') || | ||
path.endsWith('/CHANGELOG.md') || | ||
path.endsWith('/CONTRIBUTING.md') || | ||
path.endsWith('/README.md'); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I haven't seen running
test()
in a for loop before. Does this pattern work well in IDEs? For example if I try to rerun a failing test, it typically passes the name of the test toflutter test
.Also, this include the
$
, which I believe doesn't work well with Visual Studio I think.Same for the command tests below.
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.
I'm pretty sure we do it in a few other places already. VS Code supports it well; it looks like this before you run it:


and then this after:
Re-running individual entries from the IDE works. (IIRC, the way Dart
test
works is that it runs through the whole program and handles alltest
calls by collecting the names they are called with, and then running tests uses that collected set, so if you pass a name matching a generated name, by the time it tries to do the match the generated name is guaranteed to exist.)The problem we had was with
group ('test $SomeClass')
, which confused the tree in VS. I'm not sure if that still happens or has been fixed, but it also wasn't buying us anything because we didn't actually want a dynamic name, unlike the loop case.