diff options
author | Tor Norbye <tnorbye@google.com> | 2012-05-07 09:33:13 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2012-05-14 14:26:38 -0700 |
commit | d02dad911cea4f854e32cc99e10cdd31ab89a795 (patch) | |
tree | 499c90f565312abbfdc12ec7b8b114da5b1a406e /eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders | |
parent | bbee9ca7579750dc3812036554b3494d81bf2e8f (diff) | |
download | device_generic_opengl-transport-d02dad911cea4f854e32cc99e10cdd31ab89a795.tar.gz device_generic_opengl-transport-d02dad911cea4f854e32cc99e10cdd31ab89a795.tar.bz2 device_generic_opengl-transport-d02dad911cea4f854e32cc99e10cdd31ab89a795.zip |
Run lint on save in Java files, checking .java and .class files
This changeset adds support for per-save file checking in Java source
files. It will run both source file and bytecode based checks,
possibly at different times (since they are updated at different
times). This required some changes to the incremental lint runner,
since now incremental checking means possibly touching more than one
file (multiple inner classes for a single source), as well as
distinguishing between the source files containing markers (the .java
file) and the actual files being analyzed (the .class files).
This changeset also formalizes incremental lint checking a bit: it now
distinguishes between the affected scope of an issue (all the various
file types that can affect an issue), as well as the scope sets that
are capable of analyzing the issue independently.
Take the API check for example. Its affected scope includes both XML
files and Java class files, since both can contain API references (in
the case of XML, a <GridLayout> reference is an invocation of a
constructor of the GridLayout class for example). However, we can
analyze a standalone class file, or a standalone XML file, and
incrementally update issues found in the file, without regard for the
other. Therefore, the API detector has two separate analysis scopes:
classes, and XML resources. The manifest registration detector on the
other hand needs to look at both the manifest file and the class
files; it cannot look at just a subset of these.
Change-Id: Ibf5ca8a90846256e0817b419908ee53f8354412a
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders')
-rw-r--r-- | eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PreCompilerBuilder.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PreCompilerBuilder.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PreCompilerBuilder.java index c4e9caeac..b471c3faa 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PreCompilerBuilder.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/PreCompilerBuilder.java @@ -24,6 +24,7 @@ import com.android.ide.eclipse.adt.internal.build.Messages; import com.android.ide.eclipse.adt.internal.build.RenderScriptProcessor; import com.android.ide.eclipse.adt.internal.build.SourceProcessor; import com.android.ide.eclipse.adt.internal.lint.EclipseLintClient; +import com.android.ide.eclipse.adt.internal.lint.LintDeltaProcessor; import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs; import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs.BuildVerbosity; import com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper; @@ -294,6 +295,11 @@ public class PreCompilerBuilder extends BaseBuilder { dv = new PreCompilerDeltaVisitor(this, sourceFolderPathList, mProcessors); delta.accept(dv); + // Check for errors on save/build, if enabled + if (AdtPrefs.getPrefs().isLintOnSave()) { + LintDeltaProcessor.create().process(delta); + } + // Check to see if Manifest.xml, Manifest.java, or R.java have changed: mMustCompileResources |= dv.getCompileResources(); |