<commit_before>/* sbt -- Simple Build Tool
 * Copyright 2009 <NAME>
 */
package sbt

import scala.collection.{mutable, Map, Set}

sealed trait ProductsSources extends NotNull
{
	def products: Iterable[Path]
	def sources: Iterable[Path]
}
sealed trait ProductsWrapper extends NotNull
{
	def from(sources: => Iterable[Path]): ProductsSources = from(Path.lazyPathFinder(sources))
	def from(sources: PathFinder): ProductsSources
}
/** Provides methods to define tasks with basic conditional execution based on the sources
* and products of the task. */
trait FileTasks extends Project
{
	implicit def wrapProduct(product: => Path): ProductsWrapper = wrapProducts(product :: Nil)
	implicit def wrapProducts(productsList: => Iterable[Path]): ProductsWrapper =
		new ProductsWrapper
		{
			def from(sourceFinder: PathFinder) =
				new ProductsSources
				{
					lazy val products = productsList
					lazy val sources = sourceFinder.get
				}
		}
	def fileTask(files: ProductsSources)(action: => Option[String]): Task =
		task
		{
			val products = files.products
			existenceCheck(products)(action)
			{
				val sources = files.sources
				val oldestProductModifiedTime = mapLastModified(products).reduceLeft(_ min _)
				val newestSourceModifiedTime = mapLastModified(sources).reduceLeft(_ max _)
				if(oldestProductModifiedTime < newestSourceModifiedTime)
				{
					if(log.atLevel(Level.Debug))
					{
						log.debug("Task execution required because the following sources are newer than at least one product: ")
						logDebugIndented(sources.filter(_.lastModified > oldestProductModifiedTime))
						log.debug(" The following products are older than at least one source: ")<commit_msg>Fixed problem with FileTask laziness.<commit_after>/* sbt -- Simple Build Tool
 * Copyright 2009 <NAME>
 */
package sbt

import scala.collection.{mutable, Map, Set}

sealed trait ProductsSources extends NotNull
{
	def products: Iterable[Path]
	def sources: Iterable[Path]
}
sealed trait ProductsWrapper extends NotNull
{
	def from(sources: => Iterable[Path]): ProductsSources = from(Path.lazyPathFinder(sources))
	def from(sources: PathFinder): ProductsSources
}
/** Provides methods to define tasks with basic conditional execution based on the sources
* and products of the task. */
trait FileTasks extends Project
{
	implicit def wrapProduct(product: => Path): ProductsWrapper = wrapProducts(product :: Nil)
	implicit def wrapProducts(productsList: => Iterable[Path]): ProductsWrapper =
		new ProductsWrapper
		{
			def from(sourceFinder: PathFinder) =
				new ProductsSources
				{
					def products = productsList
					def sources = sourceFinder.get
				}
		}
	def fileTask(files: ProductsSources)(action: => Option[String]): Task =
		task
		{
			val products = files.products
			existenceCheck(products)(action)
			{
				val sources = files.sources
				val oldestProductModifiedTime = mapLastModified(products).reduceLeft(_ min _)
				val newestSourceModifiedTime = mapLastModified(sources).reduceLeft(_ max _)
				if(oldestProductModifiedTime < newestSourceModifiedTime)
				{
					if(log.atLevel(Level.Debug))
					{
						log.debug("Task execution required because the following sources are newer than at least one product: ")
						logDebugIndented(sources.filter(_.lastModified > oldestProductModifiedTime))
						log.debug(" The following products are older than at least one source: ")
{'fraction_non_alphanumeric': 0.08840922531046717, 'fraction_numerical': 0.002365464222353637, 'mean_word_length': 4.545901639344263, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '226899', 'n_tokens_mistral': 1058, 'n_tokens_neox': 911, 'n_words': 280}