diff options
author | xinruiy <xinruiy@google.com> | 2021-10-21 16:49:50 -0700 |
---|---|---|
committer | Liz Yu <xinruiy@google.com> | 2021-11-15 20:22:57 +0000 |
commit | 8d3b895b42bdbf909ad76a6779b4fcb79a3599ce (patch) | |
tree | 62f74484c3c68977acfb38f5faccace06ac27488 /android-lint/src | |
parent | 622fe1ef61182d567585016ad59ad33acc023f2a (diff) | |
download | idea-8d3b895b42bdbf909ad76a6779b4fcb79a3599ce.tar.gz |
Allow build system to customize lint jars
Prviously, we have to collect lint jars from lint client. It asks to
create different lint model when different build system is used.
With this cl, AndoridModel.getLintRuleJarsOverride is provided to allow
build system to provide their own lint rule jars without implement lint
model. Build-in detectors may not work in such case since we do not have
build system specified lint model which is need by part of detectors.
bug: b/203566707
Test: unit test added
Change-Id: I399582211afc1ebc1b49a52c9da939777e5e8730
Diffstat (limited to 'android-lint/src')
-rw-r--r-- | android-lint/src/com/android/tools/idea/lint/AndroidLintIdeClient.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/android-lint/src/com/android/tools/idea/lint/AndroidLintIdeClient.java b/android-lint/src/com/android/tools/idea/lint/AndroidLintIdeClient.java index b4bbc9e6aa5..2b15917ada1 100644 --- a/android-lint/src/com/android/tools/idea/lint/AndroidLintIdeClient.java +++ b/android-lint/src/com/android/tools/idea/lint/AndroidLintIdeClient.java @@ -370,6 +370,22 @@ public class AndroidLintIdeClient extends LintIdeClient { @NonNull @Override + public Iterable<File> findRuleJars(@NotNull com.android.tools.lint.detector.api.Project project) { + Module module = getModule(project); + if (module != null) { + AndroidModel model = AndroidModel.get(module); + if (model != null) { + Iterable<File> lintRuleJars = model.getLintRuleJarsOverride(); + if (lintRuleJars != null) { + return lintRuleJars; + } + } + } + return super.findRuleJars(project); + } + + @NonNull + @Override public List<File> getResourceFolders(@NonNull com.android.tools.lint.detector.api.Project project) { Module module = getModule(project); if (module == null) { |