<commit_before>package at.dotpoint.gradle.haxe.task

import at.dotpoint.gradle.cross.configuration.builder.ConfigurationBuilder
import at.dotpoint.gradle.cross.configuration.model.IConfiguration
import at.dotpoint.gradle.cross.sourceset.ISourceSet
import at.dotpoint.gradle.cross.task.AConvertTask
import at.dotpoint.gradle.cross.variant.model.flavor.IFlavor
import at.dotpoint.gradle.cross.variant.model.flavor.library.ILibraryFlavor
import at.dotpoint.gradle.cross.variant.model.platform.IPlatform
import org.gradle.api.tasks.TaskAction
import org.gradle.util.GFileUtils
/**
 * Created by RK on 21.05.2016.
 */
class GenerateHXMLTask extends AConvertTask
{

	private ISourceSet sourceSet;

    //
	private File hxmlFile;

	// ------------------------------------------------------------ //
	// ------------------------------------------------------------ //

	/**
	 *
	 * @return
	 */
	public File getHxmlFile()
	{
		if( this.hxmlFile == null )
			this.hxmlFile = new File( this.getOutputDir(), "convert.hxml" );

		return this.hxmlFile
	}

	/**
	 *
	 * @param hxmlFile
	 */
	public void setHxmlFile( File hxmlFile )
	{
		this.hxmlFile = hxmlFile
	}

	/**
	 *
	 * @param sourceSet
	 */
	public void setSourceSet( ISourceSet sourceSet )
	{
		this.sourceSet = sourceSet;
		this.source = sourceSet.source;

		this.inputs.files( this.source );
		this.outputs.file( this.getHxmlFile() );
	}

	// ------------------------------------------------------------ //
	// ------------------------------------------------------------ //

	/**
	 *
	 */
    @TaskAction
    public void generateHXML()
    {
		if( !hxmlFile.exists() )
		{
			hxmlFile.parentFile.mkdirs();
			hxmlFile.createNewFile();
		}

		// -------------- //

		String content = "";

		content += "\n## generated via gradle task:";
		content += "\n## " + this.name;

		content += "\n\n## classpaths:"
		content += "\n" + this.getClassPaths();

		content += "\n\n## configurations:"
		content += "\n" + this.getConfigurations();

		content += "\n\n## output:"
		content += "\n" + this.getOutput();

		// -------------- //

		hxmlFile.text = content;
    }

	/**
	 *
	 * @return
	 */
	private String getClassPaths()
	{
		String cps = "";

		this.sourceSet.source.getSrcDirs().each
		{
			cps += "\n" + "-cp " + GFileUtils.relativePath( this.project.projectDir, it.absoluteFile );
		}
<commit_msg>minor hxml generation formatting<commit_after>package at.dotpoint.gradle.haxe.task

import at.dotpoint.gradle.cross.configuration.builder.ConfigurationBuilder
import at.dotpoint.gradle.cross.configuration.model.IConfiguration
import at.dotpoint.gradle.cross.sourceset.ISourceSet
import at.dotpoint.gradle.cross.task.AConvertTask
import at.dotpoint.gradle.cross.variant.model.flavor.IFlavor
import at.dotpoint.gradle.cross.variant.model.flavor.library.ILibraryFlavor
import at.dotpoint.gradle.cross.variant.model.platform.IPlatform
import org.gradle.api.tasks.TaskAction
import org.gradle.util.GFileUtils
/**
 * Created by RK on 21.05.2016.
 */
class GenerateHXMLTask extends AConvertTask
{

	private ISourceSet sourceSet;

    //
	private File hxmlFile;

	// ------------------------------------------------------------ //
	// ------------------------------------------------------------ //

	/**
	 *
	 * @return
	 */
	public File getHxmlFile()
	{
		if( this.hxmlFile == null )
			this.hxmlFile = new File( this.getOutputDir(), "convert.hxml" );

		return this.hxmlFile
	}

	/**
	 *
	 * @param hxmlFile
	 */
	public void setHxmlFile( File hxmlFile )
	{
		this.hxmlFile = hxmlFile
	}

	/**
	 *
	 * @param sourceSet
	 */
	public void setSourceSet( ISourceSet sourceSet )
	{
		this.sourceSet = sourceSet;
		this.source = sourceSet.source;

		this.inputs.files( this.source );
		this.outputs.file( this.getHxmlFile() );
	}

	// ------------------------------------------------------------ //
	// ------------------------------------------------------------ //

	/**
	 *
	 */
    @TaskAction
    public void generateHXML()
    {
		if( !hxmlFile.exists() )
		{
			hxmlFile.parentFile.mkdirs();
			hxmlFile.createNewFile();
		}

		// -------------- //

		String content = "##";

		content += "\n## generated via gradle task:";
		content += "\n## " + this.name;

		content += "\n\n## classpaths:"
		content += this.getClassPaths();

		content += "\n\n## configurations:"
		content += this.getConfigurations();

		content += "\n\n## output:"
		content += this.getOutput();

		// -------------- //

		hxmlFile.text = content;
    }

	/**
	 *
	 * @return
	 */
	private String getClassPaths()
	{
		String cps = "";

		this.sourceSet.source.getSrcDirs().each
		{
			cps += "\n" + "-cp " + GFileUtils.relativePath( this.project.projectDir, it.absoluteFile );
		}

{'fraction_non_alphanumeric': 0.2503192848020434, 'fraction_numerical': 0.0034057045551298426, 'mean_word_length': 2.0179833012202955, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 33}, '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': '7060246', 'n_tokens_mistral': 1603, 'n_tokens_neox': 1434, 'n_words': 250}