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

import scala.xml.NodeSeq
import StringUtilities.{appendable,nonEmpty}

/** A project that provides a classpath. */
trait ClasspathProject extends Project
{
	/** The local classpath for this project.*/
	def projectClasspath(config: Configuration): PathFinder

	/** Returns the classpath of this project and the classpaths of all dependencies for the
	* given configuration.  Specifically, this concatentates projectClasspath(config) for all
	* projects of type ClasspathProject in topologicalSort. */
	def fullClasspath(config: Configuration): PathFinder =
		Path.lazyPathFinder
		{
			val set = new wrap.MutableSetWrapper(new java.util.LinkedHashSet[Path])
			for(project <- topologicalSort)
			{
				project match
				{
					case sp: ClasspathProject => set ++= sp.projectClasspath(config).get
					case _ => ()
				}
			}
			set.toList
		}
}
trait BasicDependencyProject extends BasicManagedProject with UnmanagedClasspathProject
{
	/** This returns the classpath for only this project for the given configuration.*/
	def projectClasspath(config: Configuration) = fullUnmanagedClasspath(config) +++ managedClasspath(config)
}
/** A project that provides a directory in which jars can be manually managed.*/
trait UnmanagedClasspathProject extends ClasspathProject
{
	/** The location of the manually managed (unmanaged) dependency directory.*/
	def dependencyPath: Path
	/** The classpath containing all jars in the unmanaged directory. */
	def unmanagedClasspath: PathFinder =
	{
		val base = descendents(dependencyPath, "*.jar")
		if(scratch)
			base +++ (info.projectPath * "*.jar")
		else
			base
	}
	/** The classpath containing all unmanaged classpath elements for the given configuration. This typically includes
	* at least 'unmanagedClasspath'.*/
	def fullUnmanagedClasspath(config: Configuration): PathFinder
}

trait IvyTasks extends Project
{
	def ivyTask(action: => Unit) =
		task
		{
			try { action; None }<commit_msg>Exclude launcher jar from unmanaged classpath, allowing it to be put in the lib/ or project root directories.<commit_after>/* sbt -- Simple Build Tool
 * Copyright 2009  <NAME>
 */
package sbt

import scala.xml.NodeSeq
import StringUtilities.{appendable,nonEmpty}

/** A project that provides a classpath. */
trait ClasspathProject extends Project
{
	/** The local classpath for this project.*/
	def projectClasspath(config: Configuration): PathFinder

	/** Returns the classpath of this project and the classpaths of all dependencies for the
	* given configuration.  Specifically, this concatentates projectClasspath(config) for all
	* projects of type ClasspathProject in topologicalSort. */
	def fullClasspath(config: Configuration): PathFinder =
		Path.lazyPathFinder
		{
			val set = new wrap.MutableSetWrapper(new java.util.LinkedHashSet[Path])
			for(project <- topologicalSort)
			{
				project match
				{
					case sp: ClasspathProject => set ++= sp.projectClasspath(config).get
					case _ => ()
				}
			}
			set.toList
		}
}
trait BasicDependencyProject extends BasicManagedProject with UnmanagedClasspathProject
{
	/** This returns the classpath for only this project for the given configuration.*/
	def projectClasspath(config: Configuration) = fullUnmanagedClasspath(config) +++ managedClasspath(config)
}
/** A project that provides a directory in which jars can be manually managed.*/
trait UnmanagedClasspathProject extends ClasspathProject
{
	/** The location of the manually managed (unmanaged) dependency directory.*/
	def dependencyPath: Path
	/** The classpath containing all jars in the unmanaged directory. */
	def unmanagedClasspath: PathFinder =
	{
		val base = descendents(dependencyPath, jarFilter)
		if(scratch)
			base +++ (info.projectPath * jarFilter)
		else
			base
	}
	/* Explicitly filter (x)sbt-launch(er)-<version>.jar, since it contains minified versions of various classes.*/
	private def jarFilter: NameFilter = "*.jar" - "*sbt-launch*.jar"
	/** The classpath containing all unmanaged classpath elements for the given configuration. This typically includes
	* at least 'unmanagedClasspath'.*/
	def fullUnmanagedClasspath(config: Configuration): PathFinder
}

trait IvyTasks extends Project
{
	def ivyTask(action: => Unit) =
		task
		{
			try { action; None }
{'fraction_non_alphanumeric': 0.0881740337884749, 'fraction_numerical': 0.0018514232816477668, 'mean_word_length': 4.457070707070707, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '7139096', 'n_tokens_mistral': 1279, 'n_tokens_neox': 1189, 'n_words': 412}