summaryrefslogtreecommitdiff
path: root/lint/src
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2022-02-17 16:17:55 -0800
committerYuriy Solodkyy <solodkyy@google.com>2022-03-14 23:24:18 +0000
commitcad4043a1d1fe1b59fbba60d5b5f911dc0b106a1 (patch)
tree606c9048a45bb35264d3653bae021e0c4eceba68 /lint/src
parentdb8a656c287721518f97a12a1082b5badff1823e (diff)
downloadidea-cad4043a1d1fe1b59fbba60d5b5f911dc0b106a1.tar.gz
Fix lint inclusion of dependencies for in-IDE lint analysis
This CL makes sure that the checkDependencies flag is always true in the lint driver when running in the IDE. It also adds a first Gradle-based lint IDE check for a multi- module setup which verifies this fix as well as other problems in this area which were addressed by Change-Id Ic2cb684bf12d691266d6fa93b6fbb86dffec5665. Test: AndroidLintGradleTest#testUnusedResources Bug: 220332124 Change-Id: Ib39fc71b1914e31cdf5c7cec8e11ef7aa9c10a7f
Diffstat (limited to 'lint/src')
-rw-r--r--lint/src/com/android/tools/idea/lint/common/LintIdeClient.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/lint/src/com/android/tools/idea/lint/common/LintIdeClient.java b/lint/src/com/android/tools/idea/lint/common/LintIdeClient.java
index 091d15e5f68..87f01c34f17 100644
--- a/lint/src/com/android/tools/idea/lint/common/LintIdeClient.java
+++ b/lint/src/com/android/tools/idea/lint/common/LintIdeClient.java
@@ -149,7 +149,10 @@ public class LintIdeClient extends LintClient implements Disposable {
try {
LintModelLintOptions lintOptions = model.getLintOptions();
driver.setCheckTestSources(lintOptions.getCheckTestSources());
- driver.setCheckDependencies(lintOptions.getCheckDependencies());
+ driver.setCheckGeneratedSources(lintOptions.getCheckGeneratedSources());
+ // We're not setting check dependencies based on the AGP settings;
+ // in the IDE, different semantics apply (you select the inspection scope).
+ // We'll set it to true (unconditionally on build model type) below.
}
catch (Exception e) {
LOG.error(e);
@@ -157,6 +160,9 @@ public class LintIdeClient extends LintClient implements Disposable {
}
}
+ // In the IDE we always analyze all dependencies (and we'll filter based on IDE scope)
+ driver.setCheckDependencies(true);
+
return driver;
}