This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
[Android] Show deprecation warnings for Android tests #31246
Merged
fluttergithubbot
merged 8 commits into
flutter-team-archive:main
from
camsim99:add_deprecation_warnings
Feb 10, 2022
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0f1e6a2
Add setting for finding deprecations
camsim99 f45e1eb
Add option for seeing warnings
camsim99 8b102ca
Edit warning, read me
camsim99 48edf28
Match variable formatting corretly
camsim99 9157cfd
Set on by default, specify Android
camsim99 07663ba
Add Gary's clarification
camsim99 2ea97b3
Remove option
camsim99 76f7bd7
Merge remote-tracking branch 'upstream/main' into add_deprecation_war…
camsim99 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 |
|---|---|---|
|
|
@@ -326,7 +326,7 @@ def JavaBin(): | |
| return os.path.join(JavaHome(), 'bin', 'java.exe' if IsWindows() else 'java') | ||
|
|
||
|
|
||
| def RunJavaTests(filter, android_variant='android_debug_unopt'): | ||
| def RunJavaTests(filter, android_variant='android_debug_unopt', ignore_android_deprecations=False): | ||
| """Runs the Java JUnit unit tests for the Android embedding""" | ||
| test_runner_dir = os.path.join(buildroot_dir, 'flutter', 'shell', 'platform', 'android', 'test_runner') | ||
| gradle_bin = os.path.join(buildroot_dir, 'gradle', 'bin', 'gradle.bat' if IsWindows() else 'gradle') | ||
|
|
@@ -336,10 +336,13 @@ def RunJavaTests(filter, android_variant='android_debug_unopt'): | |
| gradle_cache_dir = os.path.join(out_dir, android_variant, 'robolectric_tests', '.gradle') | ||
|
|
||
| test_class = filter if filter else 'io.flutter.FlutterTestSuite' | ||
| ignore_deprecations = 'true' if ignore_android_deprecations else '' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be a bit more clear if |
||
|
|
||
| command = [ | ||
| gradle_bin, | ||
| '-Pflutter_jar=%s' % flutter_jar, | ||
| '-Pbuild_dir=%s' % build_dir, | ||
| '-Pignore-deprecations=%s' % ignore_deprecations, | ||
| 'testDebugUnitTest', | ||
| '--tests=%s' % test_class, | ||
| '--rerun-tasks', | ||
|
|
@@ -567,6 +570,8 @@ def main(): | |
| default=False, help='Provide the sanitizer suppressions lists to the via environment to the tests.') | ||
| parser.add_argument('--adb-path', dest='adb_path', action='store', | ||
| default=None, help='Provide the path of adb used for android tests. By default it looks on $PATH.') | ||
| parser.add_argument('--ignore-android-deprecations', dest='ignore_android_deprecations', help='Hide warnings concerning usage of deprecated APIs when running Android tests', | ||
| action="store_true") | ||
|
|
||
| args = parser.parse_args() | ||
|
|
||
|
|
@@ -613,7 +618,7 @@ def main(): | |
| if ',' in java_filter or '*' in java_filter: | ||
| print('Can only filter JUnit4 tests by single entire class name, eg "io.flutter.SmokeTest". Ignoring filter=' + java_filter) | ||
| java_filter = None | ||
| RunJavaTests(java_filter, args.android_variant) | ||
| RunJavaTests(java_filter, args.android_variant, args.ignore_android_deprecations) | ||
|
|
||
| if 'android' in types: | ||
| assert not IsWindows(), "Android engine files can't be compiled on Windows." | ||
|
|
||
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.
could it be set in build.gradle directly, or is the flag helpful for some situations?
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 only added the flag in case someone wants to hide the warnings, but I can remove the flag if you don't see a need for that?
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.
@GaryQian any thoughts on this?
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.
No strong opinions either way. If the warnings show up before everything else, it's unlikely people would actively turn it off, but also more customization is not that much overhead either.