use of com.android.tools.klint.detector.api.Detector in project kotlin by JetBrains.
the class LintDriver method checkProject.
private void checkProject(@NonNull Project project, @NonNull Project main) {
File projectDir = project.getDir();
Context projectContext = new Context(this, project, null, projectDir);
fireEvent(EventType.SCANNING_PROJECT, projectContext);
List<Project> allLibraries = project.getAllLibraries();
Set<Project> allProjects = new HashSet<Project>(allLibraries.size() + 1);
allProjects.add(project);
allProjects.addAll(allLibraries);
mCurrentProjects = allProjects.toArray(new Project[allProjects.size()]);
mCurrentProject = project;
for (Detector check : mApplicableDetectors) {
check.beforeCheckProject(projectContext);
if (mCanceled) {
return;
}
}
assert mCurrentProject == project;
runFileDetectors(project, main);
if (!Scope.checkSingleFile(mScope)) {
List<Project> libraries = project.getAllLibraries();
for (Project library : libraries) {
Context libraryContext = new Context(this, library, project, projectDir);
fireEvent(EventType.SCANNING_LIBRARY_PROJECT, libraryContext);
mCurrentProject = library;
for (Detector check : mApplicableDetectors) {
check.beforeCheckLibraryProject(libraryContext);
if (mCanceled) {
return;
}
}
assert mCurrentProject == library;
runFileDetectors(library, main);
if (mCanceled) {
return;
}
assert mCurrentProject == library;
for (Detector check : mApplicableDetectors) {
check.afterCheckLibraryProject(libraryContext);
if (mCanceled) {
return;
}
}
}
}
mCurrentProject = project;
for (Detector check : mApplicableDetectors) {
check.afterCheckProject(projectContext);
if (mCanceled) {
return;
}
}
if (mCanceled) {
mClient.report(projectContext, // Must provide an issue since API guarantees that the issue parameter
IssueRegistry.CANCELLED, Severity.INFORMATIONAL, Location.create(project.getDir()), "Lint canceled by user", TextFormat.RAW);
}
mCurrentProjects = null;
}
Aggregations