Java Code Examples for com.android.tools.lint.detector.api.Detector#appliesTo()

The following examples show how to use com.android.tools.lint.detector.api.Detector#appliesTo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LintDriver.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
private void checkBuildScripts(Project project, Project main) {
    List<Detector> detectors = mScopeDetectors.get(Scope.GRADLE_FILE);
    if (detectors != null) {
        List<File> files = project.getSubset();
        if (files == null) {
            files = project.getGradleBuildScripts();
        }
        for (File file : files) {
            Context context = new Context(this, project, main, file);
            fireEvent(EventType.SCANNING_FILE, context);
            for (Detector detector : detectors) {
                if (detector.appliesTo(context, file)) {
                    detector.beforeCheckFile(context);
                    detector.visitBuildScript(context, Maps.<String, Object>newHashMap());
                    detector.afterCheckFile(context);
                }
            }
        }
    }
}
 
Example 2
Source File: LintDriver.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
private void checkProGuard(Project project, Project main) {
    List<Detector> detectors = mScopeDetectors.get(Scope.PROGUARD_FILE);
    if (detectors != null) {
        List<File> files = project.getProguardFiles();
        for (File file : files) {
            Context context = new Context(this, project, main, file);
            fireEvent(EventType.SCANNING_FILE, context);
            for (Detector detector : detectors) {
                if (detector.appliesTo(context, file)) {
                    detector.beforeCheckFile(context);
                    detector.run(context);
                    detector.afterCheckFile(context);
                }
            }
        }
    }
}
 
Example 3
Source File: LintDriver.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
private void checkPropertyFile(Project project, Project main, List<Detector> detectors,
        String relativePath) {
    File file = new File(project.getDir(), relativePath);
    if (file.exists()) {
        Context context = new Context(this, project, main, file);
        fireEvent(EventType.SCANNING_FILE, context);
        for (Detector detector : detectors) {
            if (detector.appliesTo(context, file)) {
                detector.beforeCheckFile(context);
                detector.run(context);
                detector.afterCheckFile(context);
            }
        }
    }
}