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

import org.gradle.api.DefaultTask;
import org.gradle.api.Project;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;
import org.gradle.api.tasks.TaskAction;
import org.mockito.release.notes.util.IOUtil;

import java.io.File;

public class InitVersioningTask extends DefaultTask{

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

    private static final String FALLBACK_INITIAL_VERSION = "0.0.1";

    private File versionFile;

    @TaskAction public void initVersioning(){
        if(versionFile.exists()){
            LOG.lifecycle("  File version.properties already exists, nothing to create.");
        } else{
            createVersionPropertiesFile(getProject(), versionFile);
        }
    }

    private void createVersionPropertiesFile(Project project, File versionFile) {
        LOG.lifecycle("  Required file version.properties doesn't exist. Creating it automatically. Remember about checking it into VCS!");
        LOG.lifecycle("  You shouldn't configure project.version in build.gradle anymore. Version from version.properties will be used instead.");

        String version = determineVersion(project);

        String versionFileContent = "#Version of the produced binaries. This file is intended to be checked-in.\n"
                + "#It will be automatically bumped by release automation.\n"
                + "version=" + version + "\n";

        IOUtil.writeFile(versionFile, versionFileContent);
    }

    private String determineVersion(Project project){
        if("unspecified".equals(project.getVersion()) ){
            LOG.lifecycle("  BEWARE! Project.version is unspecified. Version will be set to {}. You can change it manually in version.properties.", FALLBACK_INITIAL_VERSION);
            return FALLBACK_INITIAL_VERSION;
        } else{
            LOG.lifecycle("  Initial project version in version.properties set to {} (taken from project.version property).", project.getVersion());
            return project.getVersion().toString();
        }
    }

    public File getVersionFile() {
        return versionFile;
    }

    public void setVersionFile(File versionFile) {
        this.versionFile = versionFile;
    }
}<commit_msg>Tweaked the logging a bit<commit_after>package org.mockito.release.internal.gradle;

import org.gradle.api.DefaultTask;
import org.gradle.api.Project;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;
import org.gradle.api.tasks.TaskAction;
import org.mockito.release.notes.util.IOUtil;

import java.io.File;

public class InitVersioningTask extends DefaultTask{

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

    private static final String FALLBACK_INITIAL_VERSION = "0.0.1";

    private File versionFile;

    @TaskAction public void initVersioning(){
        if(versionFile.exists()){
            LOG.lifecycle("  File '{}' already exists, nothing to do.", versionFile.getName());
        } else{
            createVersionPropertiesFile(getProject(), versionFile);
        }
    }

    private void createVersionPropertiesFile(Project project, File versionFile) {
        LOG.lifecycle("  Creating '{}' file. Remember to check it into VCS!", versionFile.getName());
        LOG.lifecycle("  You shouldn't configure project.version in 'build.gradle' any more. Version from '{}' will be used instead.", versionFile.getName());

        String version = determineVersion(project);

        String versionFileContent = "#Version of the produced binaries. This file is intended to be checked-in.\n"
                + "#It will be automatically bumped by release automation.\n"
                + "version=" + version + "\n";

        IOUtil.writeFile(versionFile, versionFileContent);
    }

    private String determineVersion(Project project){
        if("unspecified".equals(project.getVersion()) ){
            LOG.lifecycle("  BEWARE! 'project.version' is unspecified. Version will be set to '{}'. You can change it in '{}'.",
                    FALLBACK_INITIAL_VERSION, versionFile.getName());
            return FALLBACK_INITIAL_VERSION;
        } else{
            LOG.lifecycle("  Initial project version in '{}' set to '{}' (taken from 'project.version' property).",
                    versionFile.getName(), project.getVersion());
            return project.getVersion().toString();
        }
    }

    public File getVersionFile() {
        return versionFile;
    }

    public void setVersionFile(File versionFile) {
        this.versionFile = versionFile;
    }
}
{'fraction_non_alphanumeric': 0.10185185185185185, 'fraction_numerical': 0.0012919896640826874, 'mean_word_length': 3.103356890459364, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5014557', 'n_tokens_mistral': 1236, 'n_tokens_neox': 1179, 'n_words': 339}