private List<File> getAospJavaClassPath() { List<File> classDirs = new ArrayList<>(1); for (File dir : getIntermediateDirs()) { File classes = new File(dir, "classes"); if (classes.exists()) { classDirs.add(classes); } else { classes = new File(dir, "classes.jar"); if (classes.exists()) { classDirs.add(classes); } } } if (classDirs.isEmpty()) { client.log(null, "No bytecode found: Has the project been built? (%1$s)", getName()); } return classDirs; }
private List<File> getAospJavaSourcePath() { List<File> sources = new ArrayList<>(2); // Normal sources File src = new File(dir, "src"); if (src.exists()) { sources.add(src); } // Generates sources for (File dir : getIntermediateDirs()) { File classes = new File(dir, "src"); if (classes.exists()) { sources.add(classes); } } if (sources.isEmpty()) { client.log(null, "Warning: Could not find sources or generated sources for project %1$s", getName()); } return sources; }
String projectName = project.getName();
ResourceMerger merger = new ResourceMerger(0); ResourceSet resourceSet = new ResourceSet(project.getName(), getProjectResourceLibraryName()) { @Override
ResourceMerger merger = new ResourceMerger(0); ResourceSet resourceSet = new ResourceSet(project.getName(), getProjectResourceLibraryName()) { @Override
String message = String.format("No `.class` files were found in project \"%1$s\", " + "so none of the classfile based checks could be run. " + "Does the project need to be built first?", project.getName()); Location location = Location.create(project.getDir()); client.report(new Context(this, project, main, project.getDir()),
@NonNull @Override protected Project createProject(@NonNull File dir, @NonNull File referenceDir) { Project project = super.createProject(dir, referenceDir); if (project.isGradleProject()) { @SuppressWarnings("SpellCheckingInspection") String message = String.format("\"`%1$s`\" is a Gradle project. To correctly " + "analyze Gradle projects, you should run \"`gradlew :lint`\" instead.", project.getName()); Location location = Location.create(project.getDir()); Context context = new Context(driver, project, project, project.getDir()); if (context.isEnabled(IssueRegistry.LINT_ERROR) && !getConfiguration(project, null).isIgnored(context, IssueRegistry.LINT_ERROR, location, message)) { report(context, IssueRegistry.LINT_ERROR, project.getConfiguration(null).getSeverity( IssueRegistry.LINT_ERROR), location, message, TextFormat.RAW); } } return project; }