<commit_before>package org.mockito.release.internal.gradle;

import org.gradle.api.Action;
import org.gradle.api.Project;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;
import org.gradle.api.plugins.ExtraPropertiesExtension;
import org.mockito.release.gradle.VersioningPlugin;
import org.mockito.release.version.Version;
import org.mockito.release.version.VersionFile;

import java.io.File;

import static org.mockito.release.internal.gradle.util.CommonSettings.TASK_GROUP;

public class DefaultVersioningPlugin implements VersioningPlugin {

    private static Logger LOG = Logging.getLogger(DefaultVersioningPlugin.class);

    public void apply(Project project) {
        final File versionFile = new File(project.getRootDir(), "version.properties");
        VersionFile versionInfo = Version.versionFile(versionFile);
        project.getExtensions().add(VersionFile.class.getName(), versionInfo);

        ExtraPropertiesExtension ext = project.getExtensions().getExtraProperties();
        final String version;
        if (ext.has("release_version")) {
            version = ext.get("release_version").toString();
            LOG.lifecycle("  Using version '{}' supplied via 'release_version' project property.", version);
        } else {
            version = versionInfo.getVersion();
            LOG.lifecycle("  Using version '{}' from '{}' file.", version, versionFile.getName());
        }

        project.allprojects(new Action<Project>() {
            @Override<commit_msg>Improved logging, added a TODO<commit_after>package org.mockito.release.internal.gradle;

import org.gradle.api.Action;
import org.gradle.api.Project;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;
import org.gradle.api.plugins.ExtraPropertiesExtension;
import org.mockito.release.gradle.VersioningPlugin;
import org.mockito.release.version.Version;
import org.mockito.release.version.VersionFile;

import java.io.File;

import static org.mockito.release.internal.gradle.util.CommonSettings.TASK_GROUP;

public class DefaultVersioningPlugin implements VersioningPlugin {

    private static Logger LOG = Logging.getLogger(DefaultVersioningPlugin.class);

    public void apply(Project project) {
        //TODO "version.properties" is hardcoded all over the place.
        // At the very least we should have a constant in this plugin.
        final File versionFile = new File(project.getRootDir(), "version.properties");
        VersionFile versionInfo = Version.versionFile(versionFile);
        project.getExtensions().add(VersionFile.class.getName(), versionInfo);

        ExtraPropertiesExtension ext = project.getExtensions().getExtraProperties();
        final String version;
        if (ext.has("release_version")) {
            version = ext.get("release_version").toString();
            LOG.lifecycle("  Building version '{}' (value supplied via 'release_version' project property).", version);
        } else {
            version = versionInfo.getVersion();
            LOG.lifecycle("  Building version '{}' (value loaded from '{}' file).", version, versionFile.getName());
        }

        project.allprojects(new Action<Project>() {
            @Override
{'fraction_non_alphanumeric': 0.11104218362282878, 'fraction_numerical': 0.0, 'mean_word_length': 3.8134328358208953, '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': '4267405', 'n_tokens_mistral': 852, 'n_tokens_neox': 825, 'n_words': 186}