<commit_before>package si.dlabs.gradle

import com.android.annotations.VisibleForTesting
import si.dlabs.gradle.extensions.SoterExtension
import si.dlabs.gradle.manager.TaskManager
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.internal.reflect.Instantiator

import javax.inject.Inject
/**
 * Created by blazsolar on 02/09/14.z
 */
class SoterPlugin implements Plugin<Project> {

    private final Instantiator instantiator

    private Project project;
    private TaskManager taskManager;

    private SoterExtension extension;

    @Inject
    SoterPlugin(Instantiator instantiator) {
        this.instantiator = instantiator
    }

    def isAndroidProject(Project project) {
        project.plugins.hasPlugin('com.android.application') || project.plugins.hasPlugin('com.android.library')
    }

    @Override
    void apply(Project project) {
        if (!isAndroidProject(project)) {
            throw new IllegalStateException("SoterPlugin only works with Android projects but \"${project.name}\" is none")
        }

        this.project = project;

        createExtensions()
        createTasks()
    }

    private void createExtensions() {
        extension = project.extensions.create('soter', SoterExtension,
                instantiator)
        taskManager = new TaskManager(project, extension);
    }

    private void createTasks() {

        taskManager.createTasks()

        project.afterEvaluate {
            createCheckTasks()
        }

    }

    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PROTECTED)
    final void createCheckTasks() {
        taskManager.createCheckTasks()
    }

}
<commit_msg>Support separate Android test projects<commit_after>package si.dlabs.gradle

import com.android.annotations.VisibleForTesting
import si.dlabs.gradle.extensions.SoterExtension
import si.dlabs.gradle.manager.TaskManager
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.internal.reflect.Instantiator

import javax.inject.Inject
/**
 * Created by blazsolar on 02/09/14.z
 */
class SoterPlugin implements Plugin<Project> {

    private final Instantiator instantiator

    private Project project;
    private TaskManager taskManager;

    private SoterExtension extension;

    @Inject
    SoterPlugin(Instantiator instantiator) {
        this.instantiator = instantiator
    }

    def isAndroidProject(Project project) {
        project.plugins.hasPlugin('com.android.application') || project.plugins.hasPlugin('com.android.library') || project.plugins.hasPlugin('com.android.test')
    }

    @Override
    void apply(Project project) {
        if (!isAndroidProject(project)) {
            throw new IllegalStateException("SoterPlugin only works with Android projects but \"${project.name}\" is none")
        }

        this.project = project;

        createExtensions()
        createTasks()
    }

    private void createExtensions() {
        extension = project.extensions.create('soter', SoterExtension,
                instantiator)
        taskManager = new TaskManager(project, extension);
    }

    private void createTasks() {

        taskManager.createTasks()

        project.afterEvaluate {
            createCheckTasks()
        }

    }

    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PROTECTED)
    final void createCheckTasks() {
        taskManager.createCheckTasks()
    }

}

{'fraction_non_alphanumeric': 0.08899297423887588, 'fraction_numerical': 0.00351288056206089, 'mean_word_length': 3.1218335343787698, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5557501', 'n_tokens_mistral': 947, 'n_tokens_neox': 876, 'n_words': 191}