Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Android] Show deprecation warnings for Android tests #31246

Merged
merged 8 commits into from
Feb 10, 2022

Conversation

camsim99
Copy link
Contributor

@camsim99 camsim99 commented Feb 3, 2022

This PR makes the warnings caused by the usage of deprecated APIs in the Android engine to appear when testing it.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

@camsim99 camsim99 changed the title Add option for showing deprecation warnings for android tests [Android] Add option for showing deprecation warnings for android tests Feb 3, 2022
@camsim99 camsim99 marked this pull request as ready for review February 3, 2022 23:47
@camsim99 camsim99 requested review from blasten and GaryQian February 4, 2022 00:49
@@ -17,6 +17,15 @@ apply plugin: "com.android.library"

rootProject.buildDir = project.property("build_dir")

// Shows warnings for usage of deprecated API usages if specified.
def showDeprecations = project.findProperty('show-deprecations')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to turn it on by default? Btw, how is the output different when this flag is passed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I can turn it on by default, but just FYI there are 100 deprecation warnings right now! Those print out before the tests are executed and the results are printed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems fine, if we don't turn it on, we will never migrate off of the deprecated API haha. If it prints before, we can still see test results easily at bottom of the output.

@camsim99 camsim99 changed the title [Android] Add option for showing deprecation warnings for android tests [Android] Show deprecation warnings for Android tests and add option for hiding Feb 4, 2022
@@ -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 ''
Copy link

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?

Copy link
Contributor Author

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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.

@@ -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 ''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a bit more clear if default=True were set in the parser.add_argument rather than depend on the value being None.

Copy link
Contributor

@GaryQian GaryQian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll LGTM this for now, your call on if you leave the flag in or not!

You'll also have to rebase this PR, try git pull upstream main --rebase, fix conflicts, then git push origin add_deprecation_warnings -f

@camsim99 camsim99 changed the title [Android] Show deprecation warnings for Android tests and add option for hiding [Android] Show deprecation warnings for Android tests Feb 9, 2022
@Hixie
Copy link
Contributor

Hixie commented Feb 9, 2022

Could we test this by having it verify that there's no warnings on the default flutter create app?
And maybe even test it by verifying that there is a warning on an app designed specifically to use a deprecated API?

@camsim99
Copy link
Contributor Author

Could we test this by having it verify that there's no warnings on the default flutter create app? And maybe even test it by verifying that there is a warning on an app designed specifically to use a deprecated API?

This is just adding the warnings when running the Android engine tests, so we'd expect this not to affect creating/running Flutter apps at all. I just verified this behavior myself!

@Hixie
Copy link
Contributor

Hixie commented Feb 10, 2022

Oh, I see. Can we make the warnings fatal then?

@camsim99
Copy link
Contributor Author

Oh, I see. Can we make the warnings fatal then?

I believe so, but how would you feel about me doing that after I make headway on fixing them? There are 100 at the moment, unfortunately.

@Hixie
Copy link
Contributor

Hixie commented Feb 10, 2022

oh, totally!

test-exempt: adding instrumentation to help fix code, warnings will be made fatal once there aren't any!

thanks!

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 11, 2022
zanderso pushed a commit to flutter/flutter that referenced this pull request Feb 11, 2022
* 2a8f388 Roll Skia from a424b619bc40 to ec0af1664478 (6 revisions) (flutter/engine#31352)

* ba8f1c5 Add clang-analyzer-* and clang-diagnostic-* to .clang-tidy (flutter/engine#31291)

* 1eafb40 Use H5vcc CanvasKit implementation if it is detected. (flutter/engine#31191)

* 6d99e90 Roll Dart SDK from 55c93c732da9 to b7eea441d7d1 (4 revisions) (flutter/engine#31353)

* 935b46a Roll Fuchsia Mac SDK from 5_CZ81mTD... to 5CmPcHTb1... (flutter/engine#31356)

* 244bb25 Roll Skia from ec0af1664478 to 9cb74e90792d (4 revisions) (flutter/engine#31357)

* b6b5759 Roll Skia from 9cb74e90792d to 81d4b5d5b45d (6 revisions) (flutter/engine#31360)

* 0f6db11 Roll Skia from 81d4b5d5b45d to 1f813e4c7f6d (1 revision) (flutter/engine#31362)

* 321a482 Fix AccessibilityBridge crash due to invalid access during ReplaceSemanticsObject (flutter/engine#31351)

* 2cc3abb Manual roll of ICU (flutter/engine#31132)

* c1e843d Roll Fuchsia Linux SDK from 4VEg4eRJS... to YGS2LvlDy... (flutter/engine#31364)

* fe08734 Roll Dart SDK from b7eea441d7d1 to 7e3310bbe1ed (2 revisions) (flutter/engine#31365)

* 2062e57 Add trackpad gesture PointerData types (flutter/engine#28571)

* 24fe585 Roll Skia from 1f813e4c7f6d to 5a2135af5623 (1 revision) (flutter/engine#31366)

* 11bf86a Migrate string encoding conversions to FML (flutter/engine#31334)

* 6d9f479 Roll Skia from 5a2135af5623 to 21a92dff8fdc (3 revisions) (flutter/engine#31368)

* 417a05e Roll Dart SDK from 7e3310bbe1ed to a9cfcc289ed4 (1 revision) (flutter/engine#31369)

* b04ed63 Change link to felt documentation (flutter/engine#31312)

* 3e7515a Roll Fuchsia Mac SDK from 5CmPcHTb1... to ZA5ZzabQM... (flutter/engine#31370)

* 90effff Revert "Add trackpad gesture PointerData types (#28571)" (flutter/engine#31375)

* 3764a8f Change support for VM service message from "The Dart VM Service is listening" to "The Dart VM service is listening" (flutter/engine#31361)

* 3d629c5 Fix html gradient rendering (#97762) (flutter/engine#31355)

* 963c449 [Android] Show deprecation warnings for Android tests (flutter/engine#31246)

* 0be895c Roll Dart SDK from a9cfcc289ed4 to 0041431f5ec7 (1 revision) (flutter/engine#31372)

* 18f2faf Roll Skia from 21a92dff8fdc to c5d3326d767d (7 revisions) (flutter/engine#31373)

* 1b762d3 Roll Fuchsia Linux SDK from YGS2LvlDy... to yDo1mhBKz... (flutter/engine#31374)

* 7b6a7b6 Roll Skia from c5d3326d767d to b6dfd97c5290 (10 revisions) (flutter/engine#31377)

* f55b161 [a11y] Delegate UTF8ToUTF16 to FML (flutter/engine#31376)

* d36d25f TextEditingDelta Support for the Web (flutter/engine#28527)

* aa17186 [fml] Use common FML string encoding utils (flutter/engine#31378)

* 97d9ec3 Renamed the scenario tests target to be generic emulator tests. (flutter/engine#28919)

* 902717f Roll Skia from b6dfd97c5290 to e1e2a858205f (3 revisions) (flutter/engine#31380)

* 877f820 Roll Dart SDK from 0041431f5ec7 to a15d19a0d914 (2 revisions) (flutter/engine#31381)

* 2d16729 Roll Skia from e1e2a858205f to 74ce095463e1 (2 revisions) (flutter/engine#31383)

* 8d3c0fb [web] PathRef: do not use == with doubles in assertions (flutter/engine#31382)

* d1164c1 Move recipes to repository folders. (flutter/engine#31367)

* e031e07 Roll Skia from 74ce095463e1 to 82d65d0487bd (1 revision) (flutter/engine#31384)

* 5140a44 Define thread priority enum and set thread priority for all threads in Engine (flutter/engine#30605)

* 1e46918 Roll Dart SDK from a15d19a0d914 to a3736d4e9b1b (1 revision) (flutter/engine#31397)

* 8a28948 Roll Fuchsia Linux SDK from yDo1mhBKz... to UHV3HWM3d... (flutter/engine#31398)

* ca86c79 Roll Fuchsia Mac SDK from ZA5ZzabQM... to jjxstNbgZ... (flutter/engine#31399)
clocksmith pushed a commit to clocksmith/flutter that referenced this pull request Mar 8, 2022
* 2a8f388 Roll Skia from a424b619bc40 to ec0af1664478 (6 revisions) (flutter/engine#31352)

* ba8f1c5 Add clang-analyzer-* and clang-diagnostic-* to .clang-tidy (flutter/engine#31291)

* 1eafb40 Use H5vcc CanvasKit implementation if it is detected. (flutter/engine#31191)

* 6d99e90 Roll Dart SDK from 55c93c732da9 to b7eea441d7d1 (4 revisions) (flutter/engine#31353)

* 935b46a Roll Fuchsia Mac SDK from 5_CZ81mTD... to 5CmPcHTb1... (flutter/engine#31356)

* 244bb25 Roll Skia from ec0af1664478 to 9cb74e90792d (4 revisions) (flutter/engine#31357)

* b6b5759 Roll Skia from 9cb74e90792d to 81d4b5d5b45d (6 revisions) (flutter/engine#31360)

* 0f6db11 Roll Skia from 81d4b5d5b45d to 1f813e4c7f6d (1 revision) (flutter/engine#31362)

* 321a482 Fix AccessibilityBridge crash due to invalid access during ReplaceSemanticsObject (flutter/engine#31351)

* 2cc3abb Manual roll of ICU (flutter/engine#31132)

* c1e843d Roll Fuchsia Linux SDK from 4VEg4eRJS... to YGS2LvlDy... (flutter/engine#31364)

* fe08734 Roll Dart SDK from b7eea441d7d1 to 7e3310bbe1ed (2 revisions) (flutter/engine#31365)

* 2062e57 Add trackpad gesture PointerData types (flutter/engine#28571)

* 24fe585 Roll Skia from 1f813e4c7f6d to 5a2135af5623 (1 revision) (flutter/engine#31366)

* 11bf86a Migrate string encoding conversions to FML (flutter/engine#31334)

* 6d9f479 Roll Skia from 5a2135af5623 to 21a92dff8fdc (3 revisions) (flutter/engine#31368)

* 417a05e Roll Dart SDK from 7e3310bbe1ed to a9cfcc289ed4 (1 revision) (flutter/engine#31369)

* b04ed63 Change link to felt documentation (flutter/engine#31312)

* 3e7515a Roll Fuchsia Mac SDK from 5CmPcHTb1... to ZA5ZzabQM... (flutter/engine#31370)

* 90effff Revert "Add trackpad gesture PointerData types (flutter#28571)" (flutter/engine#31375)

* 3764a8f Change support for VM service message from "The Dart VM Service is listening" to "The Dart VM service is listening" (flutter/engine#31361)

* 3d629c5 Fix html gradient rendering (flutter#97762) (flutter/engine#31355)

* 963c449 [Android] Show deprecation warnings for Android tests (flutter/engine#31246)

* 0be895c Roll Dart SDK from a9cfcc289ed4 to 0041431f5ec7 (1 revision) (flutter/engine#31372)

* 18f2faf Roll Skia from 21a92dff8fdc to c5d3326d767d (7 revisions) (flutter/engine#31373)

* 1b762d3 Roll Fuchsia Linux SDK from YGS2LvlDy... to yDo1mhBKz... (flutter/engine#31374)

* 7b6a7b6 Roll Skia from c5d3326d767d to b6dfd97c5290 (10 revisions) (flutter/engine#31377)

* f55b161 [a11y] Delegate UTF8ToUTF16 to FML (flutter/engine#31376)

* d36d25f TextEditingDelta Support for the Web (flutter/engine#28527)

* aa17186 [fml] Use common FML string encoding utils (flutter/engine#31378)

* 97d9ec3 Renamed the scenario tests target to be generic emulator tests. (flutter/engine#28919)

* 902717f Roll Skia from b6dfd97c5290 to e1e2a858205f (3 revisions) (flutter/engine#31380)

* 877f820 Roll Dart SDK from 0041431f5ec7 to a15d19a0d914 (2 revisions) (flutter/engine#31381)

* 2d16729 Roll Skia from e1e2a858205f to 74ce095463e1 (2 revisions) (flutter/engine#31383)

* 8d3c0fb [web] PathRef: do not use == with doubles in assertions (flutter/engine#31382)

* d1164c1 Move recipes to repository folders. (flutter/engine#31367)

* e031e07 Roll Skia from 74ce095463e1 to 82d65d0487bd (1 revision) (flutter/engine#31384)

* 5140a44 Define thread priority enum and set thread priority for all threads in Engine (flutter/engine#30605)

* 1e46918 Roll Dart SDK from a15d19a0d914 to a3736d4e9b1b (1 revision) (flutter/engine#31397)

* 8a28948 Roll Fuchsia Linux SDK from yDo1mhBKz... to UHV3HWM3d... (flutter/engine#31398)

* ca86c79 Roll Fuchsia Mac SDK from ZA5ZzabQM... to jjxstNbgZ... (flutter/engine#31399)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform-android waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants