aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2011-10-05 15:24:46 -0700
committerTor Norbye <tnorbye@google.com>2011-10-20 16:33:18 -0700
commita85107f7d763276a5a040cf68e2046ac54202015 (patch)
treefcf2004972706cc2bd852fbbfb530be27dc2fe0c /build
parentb8fa164ff18774b0d25f29aac08acea19cb8deaf (diff)
downloadsdk-a85107f7d763276a5a040cf68e2046ac54202015.zip
sdk-a85107f7d763276a5a040cf68e2046ac54202015.tar.gz
sdk-a85107f7d763276a5a040cf68e2046ac54202015.tar.bz2
Static analyzer
This changeset adds a static analyzer, "lint", which looks for various potential bugs in Android projects. It has 3 parts: (1) A library which performs the actual static checks. This library is standalone: it does not depend on Eclipse. (Technically the library has two halves: an API half, for use by third party developers to write additional detectors, and an actual implementation of a bunch of built-in checks.) (2) A command line driver, "lint", which runs the static checks and emits any warnings to standard out. This can be thought of as a replacement for the layoutopt tool. (3) Eclipse integration. Lint errors are added to the Problems view as well as shown as editor annotations. There's an options panel for controlling which detectors are enabled. There's also a quickfix for disabling errors directly within the editor and a marker resolution for disabling them via the Problems view. The static checks are run on an XML file right after it has been saved. (This is optional via a toggle on the same preference page as the detector list.) The static checks are also run when you export an APK, and if any fatal errors are found the export is abandoned. (This is also optional via an option). Finally you can run a full lint through the Android Tools menu, and there's also an action to clear all the lint markers there. There's also a new indicator on the layout editor which shows whether there are lint errors on the associated file, and when clicked brings up a dialog listing the specific errors. This changeset also includes a number of checks: * An accessibility detector which warns about images missing contentDescriptions * A drawable selector detector which warns about state lists where not all states are reachable (e.g. it is not the case that only the last item in the list omits a state qualifier) * A detector finding duplicate ids, not just in the current layout but across included layouts (transitively) as well * All the layoutopt ones ported to Java + DOM * Unit tests for the above. The focus here is on getting the infrastructure in place, and it currently focuses on XML resource files and analyzing them efficiently. See the comment in XmlVisitor for details on that. Change-Id: Ic5f5f37d92bfb96ff901b959aaac24db33552ff7
Diffstat (limited to 'build')
-rw-r--r--build/tools.atree4
-rwxr-xr-xbuild/tools.windows.atree3
2 files changed, 7 insertions, 0 deletions
diff --git a/build/tools.atree b/build/tools.atree
index 7b8bb76..eb273eb 100644
--- a/build/tools.atree
+++ b/build/tools.atree
@@ -61,6 +61,7 @@ bin/layoutopt tools/layoutopt
bin/traceview tools/traceview
bin/android tools/android
bin/monkeyrunner tools/monkeyrunner
+bin/lint tools/lint
# sdk.git Ant templates for project build files
@@ -105,6 +106,9 @@ framework/guavalib.jar tools/lib/guavalib.jar
framework/jsilver.jar tools/lib/jsilver.jar
framework/jython.jar tools/lib/jython.jar
framework/mkidentity-prebuilt.jar tools/lib/mkidentity.jar
+framework/lint.jar tools/lib/lint.jar
+framework/lint_api.jar tools/lib/lint_api.jar
+framework/lint_checks.jar tools/lib/lint_checks.jar
# 3rd Party java libraries
framework/groovy-all-1.7.0.jar tools/lib/groovy-all-1.7.0.jar
diff --git a/build/tools.windows.atree b/build/tools.windows.atree
index 066050e..1340498 100755
--- a/build/tools.windows.atree
+++ b/build/tools.windows.atree
@@ -33,6 +33,9 @@ bin/dmtracedump.exe strip tools/dmtracedump.exe
rm tools/draw9patch
sdk/draw9patch/etc/draw9patch.bat tools/draw9patch.bat
+rm tools/lint
+sdk/lint/cli/etc/lint.bat tools/lint.bat
+
rm tools/emulator
rm tools/emulator-arm
rm tools/emulator-x86