<commit_before>package io.codearte.accurest.plugin

import io.codearte.accurest.wiremock.DslToWiremockClientConverter
import io.codearte.accurest.wiremock.RecursiveFilesConverter
import org.gradle.api.internal.ConventionTask
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.TaskAction

//TODO: Implement as an incremental task: https://gradle.org/docs/current/userguide/custom_tasks.html#incremental_tasks ?
class GenerateWiremockClientStubsFromDslTask extends ConventionTask {

	@InputDirectory
	File contractsDslDir
	@InputDirectory
	File stubsOutputDir

	@TaskAction
	void generate() {
		project.logger.info("Accurest Plugin: Invoking GroovyDSL to Wiremock client stubs conversion")
		project.logger.debug("From '${getContractsDslDir()}' to '${getStubsOutputDir()}'")

		RecursiveFilesConverter converter = new RecursiveFilesConverter(new DslToWiremockClientConverter(), getContractsDslDir(),
				getStubsOutputDir())
		converter.processFiles()<commit_msg>Stubs output directory is created automatically when needed<commit_after>package io.codearte.accurest.plugin

import io.codearte.accurest.wiremock.DslToWiremockClientConverter
import io.codearte.accurest.wiremock.RecursiveFilesConverter
import org.gradle.api.internal.ConventionTask
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction

//TODO: Implement as an incremental task: https://gradle.org/docs/current/userguide/custom_tasks.html#incremental_tasks ?
class GenerateWiremockClientStubsFromDslTask extends ConventionTask {

	@InputDirectory
	File contractsDslDir
	@OutputDirectory
	File stubsOutputDir

	@TaskAction
	void generate() {
		project.logger.info("Accurest Plugin: Invoking GroovyDSL to Wiremock client stubs conversion")
		project.logger.debug("From '${getContractsDslDir()}' to '${getStubsOutputDir()}'")

		RecursiveFilesConverter converter = new RecursiveFilesConverter(new DslToWiremockClientConverter(), getContractsDslDir(),
				getStubsOutputDir())
		converter.processFiles()
{'fraction_non_alphanumeric': 0.08865075499269362, 'fraction_numerical': 0.0, 'mean_word_length': 7.282258064516129, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '6726438', 'n_tokens_mistral': 646, 'n_tokens_neox': 604, 'n_words': 114}