You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Consider warnings-as-errors for plugin CI builds #91868
This is something I was thinking about based on this comment, but would apply to iOS as well (and macOS): the way the native code for plugins on some platforms is built, the build environment may change in ways that create warnings (e.g., the way the Flutter tool updates the min deployment version on iOS to match the app's min deployment version frequently creates deprecation warnings that don't exist in our builds), so we generally don't want to make warnings errors to avoid breaking plugin clients. However, that means warnings aren't surfaced in our CI, which in practice means we don't notice when new ones are added by PRs, which makes warnings kind of useless.
I think we should consider either:
modifying the build on disk before building in CI to add -Werror, or
add build output parsing to notice errors, and fail the CI step.
Both have some maintenance complexity, but continuing to ignore warnings on the native side doesn't seem like a good option.
The build context is sightly different though, right? For instance, IIRC it didn't flag availability checks that we didn't need after bumping the example app minimum versions. (Or maybe that's just not a warning under our current settings?)
For this issue, all that's left is fully enabling Android warnings as errors. flutter/packages#3293 sets up the structure and does it for some packages, but we need to get it enabled for the remaining packages as well. Each of these has the arguments commented out in build.gradle with a reference to this issue:
@stuartmorgan So I went ahead and enabled the compiler options for video_player_android, just to see what the fallout would look like.
I get a bunch of errors relating to annotations inside ExoPlayer itself:
Logs
navaronbracke@MacBook-Pro-van-Navaron example % flutter build apk --release
💪 Building with sound null safety 💪
Warning: unexpected element (uri:"", local:"extension-level"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
Warning: unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
/Users/navaronbracke/.gradle/caches/transforms-3/17d52bfcf76ba92f8a9219102f650808/transformed/jetified-exoplayer-common-2.18.1-api.jar(/com/google/android/exoplayer2/C.class): warning: Cannot find annotation method 'replacement()' in type 'InlineMe': class file for com.google.errorprone.annotations.InlineMe not found
/Users/navaronbracke/.gradle/caches/transforms-3/17d52bfcf76ba92f8a9219102f650808/transformed/jetified-exoplayer-common-2.18.1-api.jar(/com/google/android/exoplayer2/C.class): warning: Cannot find annotation method 'imports()' in type 'InlineMe'
/Users/navaronbracke/.gradle/caches/transforms-3/17d52bfcf76ba92f8a9219102f650808/transformed/jetified-exoplayer-common-2.18.1-api.jar(/com/google/android/exoplayer2/C.class): warning: Cannot find annotation method 'replacement()' in type 'InlineMe'
/Users/navaronbracke/.gradle/caches/transforms-3/17d52bfcf76ba92f8a9219102f650808/transformed/jetified-exoplayer-common-2.18.1-api.jar(/com/google/android/exoplayer2/C.class): warning: Cannot find annotation method 'imports()' in type 'InlineMe'
/Users/navaronbracke/.gradle/caches/transforms-3/17d52bfcf76ba92f8a9219102f650808/transformed/jetified-exoplayer-common-2.18.1-api.jar(/com/google/android/exoplayer2/C.class): warning: Cannot find annotation method 'replacement()' in type 'InlineMe'
/Users/navaronbracke/.gradle/caches/transforms-3/17d52bfcf76ba92f8a9219102f650808/transformed/jetified-exoplayer-common-2.18.1-api.jar(/com/google/android/exoplayer2/C.class): warning: Cannot find annotation method 'imports()' in type 'InlineMe'
/Users/navaronbracke/.gradle/caches/transforms-3/17d52bfcf76ba92f8a9219102f650808/transformed/jetified-exoplayer-common-2.18.1-api.jar(/com/google/android/exoplayer2/C.class): warning: Cannot find annotation method 'replacement()' in type 'InlineMe'
/Users/navaronbracke/.gradle/caches/transforms-3/17d52bfcf76ba92f8a9219102f650808/transformed/jetified-exoplayer-common-2.18.1-api.jar(/com/google/android/exoplayer2/C.class): warning: Cannot find annotation method 'imports()' in type 'InlineMe'
/Users/navaronbracke/.gradle/caches/transforms-3/17d52bfcf76ba92f8a9219102f650808/transformed/jetified-exoplayer-common-2.18.1-api.jar(/com/google/android/exoplayer2/C.class): warning: Cannot find annotation method 'replacement()' in type 'InlineMe'
/Users/navaronbracke/.gradle/caches/transforms-3/17d52bfcf76ba92f8a9219102f650808/transformed/jetified-exoplayer-common-2.18.1-api.jar(/com/google/android/exoplayer2/C.class): warning: Cannot find annotation method 'imports()' in type 'InlineMe'
/Users/navaronbracke/.gradle/caches/transforms-3/17d52bfcf76ba92f8a9219102f650808/transformed/jetified-exoplayer-common-2.18.1-api.jar(/com/google/android/exoplayer2/util/Util.class): warning: Cannot find annotation method 'value()' in type 'EnsuresNonNull': class file for org.checkerframework.checker.nullness.qual.EnsuresNonNull not found
/Users/navaronbracke/.gradle/caches/transforms-3/17d52bfcf76ba92f8a9219102f650808/transformed/jetified-exoplayer-common-2.18.1-api.jar(/com/google/android/exoplayer2/util/Util.class): warning: Cannot find annotation method 'value()' in type 'EnsuresNonNull'
error: warnings found and -Werror specified
1 error
12 warnings
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':video_player_android:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 36s
Running Gradle task 'assembleRelease'... 38.0s
Gradle task assembleRelease failed with exit code 1
It builds fine if I remove the compiler args. We might need to bump exoplayer it seems.
I'll see what it gives when I bump to 2.18.2.
I had a similar missing class file issue with the maps plugin, and was able to work around it by injecting a dependency that defined the missing pieces from the example; I'll have that PR up sometime next week (once I fix the warnings that were married by that initial probably).
@navaronbrackeThis is what I did for the similar maps issue. It wasn't the same symbols, but if you can find out what package defines the symbols you are missing the same injection approach would likely work.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
jmagman commentedon Oct 15, 2021
The Analyze test should already be doing this for iOS and macOS...
https://github.com/flutter/plugins/blob/fb6622092bb8f1a56b701f6c6ede551b6c986d06/script/tool/lib/src/xcode_analyze_command.dart#L100
'GCC_TREAT_WARNINGS_AS_ERRORS=YES',https://github.com/flutter/plugins/blob/176cfb8083bc85eb071599ee8f5ef65b732b8ffd/.cirrus.yml#L280-L281
https://github.com/flutter/plugins/blob/176cfb8083bc85eb071599ee8f5ef65b732b8ffd/.cirrus.yml#L308-L309
Run here:
https://cirrus-ci.com/task/5813760171442176?logs=xcode_analyze#L14
stuartmorgan-g commentedon Oct 15, 2021
The build context is sightly different though, right? For instance, IIRC it didn't flag availability checks that we didn't need after bumping the example app minimum versions. (Or maybe that's just not a warning under our current settings?)
stuartmorgan-g commentedon Jan 31, 2023
See also:
--fatal-warningsinflutter build, and related discussion in flutter-team-archive/plugins#7062stuartmorgan-g commentedon Mar 2, 2023
I spun this out into #121819
For this issue, all that's left is fully enabling Android warnings as errors. flutter/packages#3293 sets up the structure and does it for some packages, but we need to get it enabled for the remaining packages as well. Each of these has the arguments commented out in
build.gradlewith a reference to this issue:[ci+various] Partially enable javac warning checks (#3293)
navaronbracke commentedon Mar 5, 2023
@stuartmorgan So I went ahead and enabled the compiler options for
video_player_android, just to see what the fallout would look like.I get a bunch of errors relating to annotations inside
ExoPlayeritself:Logs
It builds fine if I remove the compiler args. We might need to bump
exoplayerit seems.I'll see what it gives when I bump to
2.18.2.stuartmorgan-g commentedon Mar 5, 2023
I had a similar missing class file issue with the maps plugin, and was able to work around it by injecting a dependency that defined the missing pieces from the example; I'll have that PR up sometime next week (once I fix the warnings that were married by that initial probably).
stuartmorgan-g commentedon Mar 7, 2023
@navaronbracke This is what I did for the similar maps issue. It wasn't the same symbols, but if you can find out what package defines the symbols you are missing the same injection approach would likely work.
navaronbracke commentedon Mar 7, 2023
Thanks! I'll take a stab at
video_player_androidwith this in mind.navaronbracke commentedon Mar 8, 2023
@stuartmorgan Apparently the warnings I get (see the logs in #91868 (comment)) come from two different dependencies:
InlineMesymbol fromcom.google.errorprone.annotationsEnsuresNonNullsymbol fromorg.checkerframework.checker.nullness.qualTurns out those are excluded here? https://github.com/google/ExoPlayer/blob/release-v2/library/common/build.gradle#L28-L37
The versions of those dependencies are defined here: https://github.com/google/ExoPlayer/blob/r2.18.1/constants.gradle
Edit: Apparently, besides the dependency issue, there were no errors. phew
github-actions commentedon Mar 25, 2023
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.