Android lint sometimes has false-negatives when incremental compiling |
|||
Issue descriptionTo reproduce (from lambroslambrou@): I've uploaded a CL here: https://codereview.chromium.org/1815803002/ This "UnusedResources" bug is quite flaky, but these steps seem to repro the problem consistently with a minimal app: Patch the CL into your checkout. Configure a new out/foo directory with 'gn args' and set target_os = "android" (just that, no other args). Build the remoting_host_apk target. Now edit the remoting/android/BUILD.gn and uncomment the line which adds AnotherClass.java. Build the remoting_host_apk target again. When I do this, I get the following output: ninja: Entering directory `out/bare-bones-host-apk' [1/1] Regenerating ninja files [18/34] ACTION //remoting/android:remoting_host_apk__java__lint(//build/toolchain/android:arm) res/layout/main.xml The resource `R.layout.main` appears to be unused: UnusedResources [warning] Lint found 1 new issues. - For full explanation refer to out/bare-bones-host-apk/gen/remoting/android/remoting_host_apk__java__lint/result.xml - Wanna suppress these issues? 1. Read comment in build/android/lint/suppressions.xml 2. Run "python build/android/lint/suppress.py out/bare-bones-host-apk/gen/remoting/android/remoting_host_apk__java__lint/result.xml" [33/33] STAMP obj/remoting/android/remoting_host_apk.stamp
,
Mar 22 2016
Looked into this and have found a few gems: One reason it may appears flakey: If you re-run manually without setting FORCE_REBUILD=1, then the command isn't actually run (due to it detecting its inputs to have not been changed) In this case though, the problem is with an optimization I recently added: https://codereview.chromium.org/1733893003 This attempted to only lint .java files that have changed, and was meant to be applied only when no resource directory is specified. There's an edge case that's being hit here: If you have an AndroidManiest.xml, we pass to lint it's parent directory. lint then detects a res/ as a sibling, and slurps in the resources even though no --resources were passed! It looks like this implicit passing of src/ and res/ is an unintended consequence of the GN usage of lint, but may be relied upon by GYP. The fix (I think) is to put the AndroidManifest.xml in the temp directory along with the sources when --java-files is present, and to just disable the optimization when --src-dirs is present (GYP).
,
Mar 22 2016
,
Mar 24 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/26befa044b2ce9ed1b5dfd83eb5a67d1a964bb8c commit 26befa044b2ce9ed1b5dfd83eb5a67d1a964bb8c Author: agrieve <agrieve@chromium.org> Date: Thu Mar 24 00:20:00 2016 Stop lint.py pulling in implicit dependencies via AndroidManifest.xml This will mean even fewer UnusedResource checks, but that is covered by: https://bugs.chromium.org/p/chromium/issues/detail?id=595810 BUG= 597007 Review URL: https://codereview.chromium.org/1826563002 Cr-Commit-Position: refs/heads/master@{#382986} [modify] https://crrev.com/26befa044b2ce9ed1b5dfd83eb5a67d1a964bb8c/build/android/gyp/lint.py [modify] https://crrev.com/26befa044b2ce9ed1b5dfd83eb5a67d1a964bb8c/chrome/test/chromedriver/test/webview_shell/java/AndroidManifest.xml [rename] https://crrev.com/26befa044b2ce9ed1b5dfd83eb5a67d1a964bb8c/chrome/test/chromedriver/test/webview_shell/java/res/mipmap/icon.png
,
Mar 24 2016
|
|||
►
Sign in to add a comment |
|||
Comment 1 by agrieve@chromium.org
, Mar 22 2016