mirror of https://github.com/sbt/sbt.git
Cleanup mainProj
This commit is contained in:
parent
ffafdc2e03
commit
a0193d28ea
|
|
@ -41,7 +41,7 @@ import sbt.internal.util.Cache.seqFormat
|
|||
import sbt.util.Logger
|
||||
import sbt.internal.CommandStrings.ExportStream
|
||||
|
||||
import xsbti.Maybe
|
||||
import xsbti.{ CrossValue, Maybe }
|
||||
import sbt.util.InterfaceUtil.{ f1, o2m }
|
||||
|
||||
import sbt.internal.util.Types._
|
||||
|
|
@ -76,8 +76,7 @@ object Defaults extends BuildCommon {
|
|||
def thisBuildCore: Seq[Setting[_]] = inScope(GlobalScope.copy(project = Select(ThisBuild)))(Seq(
|
||||
managedDirectory := baseDirectory.value / "lib_managed"
|
||||
))
|
||||
@deprecated("Use AutoPlugins and globalSbtCore instead.", "0.13.2")
|
||||
lazy val globalCore: Seq[Setting[_]] = globalDefaults(defaultTestTasks(test) ++ defaultTestTasks(testOnly) ++ defaultTestTasks(testQuick) ++ Seq(
|
||||
private[sbt] lazy val globalCore: Seq[Setting[_]] = globalDefaults(defaultTestTasks(test) ++ defaultTestTasks(testOnly) ++ defaultTestTasks(testQuick) ++ Seq(
|
||||
excludeFilter :== HiddenFileFilter
|
||||
) ++ globalIvyCore ++ globalJvmCore) ++ globalSbtCore
|
||||
|
||||
|
|
@ -196,8 +195,7 @@ object Defaults extends BuildCommon {
|
|||
historyPath <<= historyPath or target(t => Some(t / ".history")),
|
||||
sourceDirectory := baseDirectory.value / "src",
|
||||
sourceManaged := crossTarget.value / "src_managed",
|
||||
resourceManaged := crossTarget.value / "resource_managed",
|
||||
cacheDirectory := crossTarget.value / CacheDirectoryName / thisProject.value.id / "global"
|
||||
resourceManaged := crossTarget.value / "resource_managed"
|
||||
)
|
||||
|
||||
lazy val configPaths = sourceConfigPaths ++ resourceConfigPaths ++ outputConfigPaths
|
||||
|
|
@ -229,7 +227,6 @@ object Defaults extends BuildCommon {
|
|||
resources <<= Classpaths.concat(managedResources, unmanagedResources)
|
||||
)
|
||||
lazy val outputConfigPaths = Seq(
|
||||
cacheDirectory := crossTarget.value / CacheDirectoryName / thisProject.value.id / configuration.value.name,
|
||||
classDirectory := crossTarget.value / (prefix(configuration.value.name) + "classes"),
|
||||
target in doc := crossTarget.value / (prefix(configuration.value.name) + "api")
|
||||
)
|
||||
|
|
@ -358,10 +355,10 @@ object Defaults extends BuildCommon {
|
|||
override def pollInterval = interval
|
||||
override def watchingMessage(s: WatchState) = msg(s)
|
||||
override def triggeredMessage(s: WatchState) = trigMsg(s)
|
||||
override def watchPaths(s: State) = EvaluateTask.evaluateTask(Project structure s, key, s, base) match {
|
||||
case Some(Value(ps)) => ps
|
||||
case Some(Inc(i)) => throw i
|
||||
case None => sys.error("key not found: " + Def.displayFull(key))
|
||||
override def watchPaths(s: State) = EvaluateTask(Project structure s, key, s, base) match {
|
||||
case Some((_, Value(ps))) => ps
|
||||
case Some((_, Inc(i))) => throw i
|
||||
case None => sys.error("key not found: " + Def.displayFull(key))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -710,10 +707,6 @@ object Defaults extends BuildCommon {
|
|||
@deprecated("Use `Util.pairID` instead", "0.12.0")
|
||||
def pairID = Util.pairID
|
||||
|
||||
@deprecated("Use the cacheDirectory val on streams.", "0.13.0")
|
||||
def perTaskCache(key: TaskKey[_]): Setting[File] =
|
||||
cacheDirectory ~= { _ / ("for_" + key.key.label) }
|
||||
|
||||
@deprecated("Use `packageTaskSettings` instead", "0.12.0")
|
||||
def packageTasks(key: TaskKey[File], mappingsTask: Initialize[Task[Seq[(File, String)]]]) = packageTaskSettings(key, mappingsTask)
|
||||
def packageTaskSettings(key: TaskKey[File], mappingsTask: Initialize[Task[Seq[(File, String)]]]) =
|
||||
|
|
@ -848,6 +841,7 @@ object Defaults extends BuildCommon {
|
|||
def consoleQuickTask = consoleTask(externalDependencyClasspath, consoleQuick)
|
||||
def consoleTask(classpath: TaskKey[Classpath], task: TaskKey[_]): Initialize[Task[Unit]] =
|
||||
(compilers in task, classpath in task, scalacOptions in task, initialCommands in task, cleanupCommands in task, taskTemporaryDirectory in task, scalaInstance in task, streams) map {
|
||||
// TODO: Make exhaustive after zinc is updated to include https://github.com/sbt/zinc/pull/128
|
||||
case (cs: IncrementalCompilerImpl.Compilers, cp, options, initCommands, cleanup, temp, si, s) =>
|
||||
val cpFiles = data(cp)
|
||||
val fullcp = (cpFiles ++ si.allJars).distinct
|
||||
|
|
@ -978,8 +972,8 @@ object Defaults extends BuildCommon {
|
|||
|
||||
private def distinctParser(exs: Set[String], raw: Boolean): Parser[Seq[String]] =
|
||||
{
|
||||
import DefaultParsers._
|
||||
val base = token(Space) ~> token(NotSpace - "--" examples exs)
|
||||
import DefaultParsers._, Parser.and
|
||||
val base = token(Space) ~> token(and(NotSpace, not("--", "Unexpected: ---")) examples exs)
|
||||
val recurse = base flatMap { ex =>
|
||||
val (matching, notMatching) = exs.partition(GlobFilter(ex).accept _)
|
||||
distinctParser(notMatching, raw) map { result => if (raw) ex +: result else matching.toSeq ++ result }
|
||||
|
|
@ -1028,7 +1022,6 @@ object Defaults extends BuildCommon {
|
|||
lazy val runnerSettings: Seq[Setting[_]] = Seq(runnerTask)
|
||||
lazy val baseTasks: Seq[Setting[_]] = projectTasks ++ packageBase
|
||||
|
||||
lazy val baseClasspaths: Seq[Setting[_]] = Classpaths.publishSettings ++ Classpaths.baseSettings
|
||||
lazy val configSettings: Seq[Setting[_]] = Classpaths.configSettings ++ configTasks ++ configPaths ++ packageConfig ++ Classpaths.compilerPluginConfig
|
||||
|
||||
lazy val compileSettings: Seq[Setting[_]] = configSettings ++ (mainRunMainTask +: mainRunTask +: addBaseSources) ++ Classpaths.addUnmanagedLibrary
|
||||
|
|
@ -1037,10 +1030,6 @@ object Defaults extends BuildCommon {
|
|||
lazy val itSettings: Seq[Setting[_]] = inConfig(IntegrationTest)(testSettings)
|
||||
lazy val defaultConfigs: Seq[Setting[_]] = inConfig(Compile)(compileSettings) ++ inConfig(Test)(testSettings) ++ inConfig(Runtime)(Classpaths.configSettings)
|
||||
|
||||
// settings that are not specific to a configuration
|
||||
@deprecated("Settings now split into AutoPlugins.", "0.13.2")
|
||||
lazy val projectBaseSettings: Seq[Setting[_]] = projectCore ++ runnerSettings ++ paths ++ baseClasspaths ++ baseTasks ++ compileBase ++ disableAggregation
|
||||
|
||||
// These are project level settings that MUST be on every project.
|
||||
lazy val coreDefaultSettings: Seq[Setting[_]] =
|
||||
projectCore ++ disableAggregation ++ Seq(
|
||||
|
|
@ -1048,8 +1037,6 @@ object Defaults extends BuildCommon {
|
|||
baseDirectory := thisProject.value.base,
|
||||
target := baseDirectory.value / "target"
|
||||
)
|
||||
@deprecated("Default settings split into coreDefaultSettings and IvyModule/JvmModule plugins.", "0.13.2")
|
||||
lazy val defaultSettings: Seq[Setting[_]] = projectBaseSettings ++ defaultConfigs
|
||||
|
||||
}
|
||||
object Classpaths {
|
||||
|
|
@ -1136,8 +1123,6 @@ object Classpaths {
|
|||
publishLocal <<= publishTask(publishLocalConfiguration, deliverLocal),
|
||||
publishM2 <<= publishTask(publishM2Configuration, deliverLocal)
|
||||
)
|
||||
@deprecated("This has been split into jvmPublishSettings and ivyPublishSettings.", "0.13.2")
|
||||
val publishSettings: Seq[Setting[_]] = ivyPublishSettings ++ jvmPublishSettings
|
||||
|
||||
private[this] def baseGlobalDefaults = Defaults.globalDefaults(Seq(
|
||||
conflictWarning :== ConflictWarning.default("global"),
|
||||
|
|
@ -1168,7 +1153,11 @@ object Classpaths {
|
|||
val id = app.provider.id
|
||||
val scalaVersion = app.provider.scalaProvider.version
|
||||
val binVersion = binaryScalaVersion(scalaVersion)
|
||||
val cross = if (id.crossVersioned) CrossVersion.binary else CrossVersion.Disabled
|
||||
val cross = id.crossVersionedValue match {
|
||||
case CrossValue.Disabled => CrossVersion.Disabled
|
||||
case CrossValue.Full => CrossVersion.binary
|
||||
case CrossValue.Binary => CrossVersion.full
|
||||
}
|
||||
val base = ModuleID(id.groupID, id.name, sbtVersion.value, crossVersion = cross)
|
||||
CrossVersion(scalaVersion, binVersion)(base).copy(crossVersion = CrossVersion.Disabled)
|
||||
}
|
||||
|
|
@ -1185,11 +1174,11 @@ object Classpaths {
|
|||
organizationHomepage <<= organizationHomepage or homepage,
|
||||
projectInfo <<= (name, description, homepage, startYear, licenses, organizationName, organizationHomepage, scmInfo, developers) apply ModuleInfo,
|
||||
overrideBuildResolvers <<= appConfiguration(isOverrideRepositories),
|
||||
externalResolvers <<= (externalResolvers.task.?, resolvers, appResolvers, useJCenter) {
|
||||
externalResolvers := ((externalResolvers.?.value, resolvers.value, appResolvers.value, useJCenter.value) match {
|
||||
case (Some(delegated), Seq(), _, _) => delegated
|
||||
case (_, rs, Some(ars), uj) => task { ars ++ rs }
|
||||
case (_, rs, _, uj) => task { Resolver.withDefaultResolvers(rs, uj, mavenCentral = true) }
|
||||
},
|
||||
case (_, rs, Some(ars), uj) => ars ++ rs
|
||||
case (_, rs, _, uj) => Resolver.withDefaultResolvers(rs, uj, mavenCentral = true)
|
||||
}),
|
||||
appResolvers := {
|
||||
val ac = appConfiguration.value
|
||||
val uj = useJCenter.value
|
||||
|
|
@ -1319,8 +1308,6 @@ object Classpaths {
|
|||
}
|
||||
}
|
||||
)
|
||||
@deprecated("Split into ivyBaseSettings and jvmBaseSettings.", "0.13.2")
|
||||
val baseSettings: Seq[Setting[_]] = ivyBaseSettings ++ jvmBaseSettings
|
||||
|
||||
def warnResolversConflict(ress: Seq[Resolver], log: Logger): Unit = {
|
||||
val resset = ress.toSet
|
||||
|
|
@ -1686,10 +1673,9 @@ object Classpaths {
|
|||
for (f <- productsImplTask.value) yield APIMappings.store(analyzed(f, compile.value), apiURL.value).put(artifact.key, art).put(moduleID.key, module).put(configuration.key, config)
|
||||
}
|
||||
|
||||
private[this] def productsImplTask: Initialize[Task[Seq[File]]] =
|
||||
(products.task, packageBin.task, exportJars) flatMap { (psTask, pkgTask, useJars) =>
|
||||
if (useJars) Seq(pkgTask).join else psTask
|
||||
}
|
||||
private[this] def productsImplTask: Initialize[Task[Seq[File]]] = Def.task {
|
||||
if (exportJars.value) Seq(packageBin.value) else products.value
|
||||
}
|
||||
|
||||
def constructBuildDependencies: Initialize[BuildDependencies] = loadedBuild(lb => BuildUtil.dependencies(lb.units))
|
||||
|
||||
|
|
@ -2056,10 +2042,12 @@ trait BuildExtra extends BuildCommon with DefExtra {
|
|||
moduleSettings := new PomConfiguration(file.value, ivyScala.value, ivyValidate.value, managedScalaInstance.value)
|
||||
|
||||
def runInputTask(config: Configuration, mainClass: String, baseArguments: String*): Initialize[InputTask[Unit]] =
|
||||
inputTask { result =>
|
||||
(fullClasspath in config, runner in (config, run), streams, result) map { (cp, r, s, args) =>
|
||||
toError(r.run(mainClass, data(cp), baseArguments ++ args, s.log))
|
||||
}
|
||||
Def.inputTask {
|
||||
import Def._
|
||||
val r = (runner in (config, run)).value
|
||||
val cp = (fullClasspath in config).value
|
||||
val args = spaceDelimited().parsed
|
||||
toError(r.run(mainClass, data(cp), baseArguments ++ args, streams.value.log))
|
||||
}
|
||||
def runTask(config: Configuration, mainClass: String, arguments: String*): Initialize[Task[Unit]] =
|
||||
(fullClasspath in config, runner in (config, run), streams) map { (cp, r, s) =>
|
||||
|
|
|
|||
|
|
@ -100,21 +100,6 @@ sealed trait EvaluateTaskConfig {
|
|||
def minForcegcInterval: Duration
|
||||
}
|
||||
final object EvaluateTaskConfig {
|
||||
/** Pulls in the old configuration format. */
|
||||
def apply(old: EvaluateConfig): EvaluateTaskConfig = {
|
||||
object AdaptedTaskConfig extends EvaluateTaskConfig {
|
||||
def restrictions: Seq[Tags.Rule] = old.restrictions
|
||||
def checkCycles: Boolean = old.checkCycles
|
||||
def progressReporter: ExecuteProgress[Task] = old.progress
|
||||
def cancelStrategy: TaskCancellationStrategy =
|
||||
if (old.cancelable) TaskCancellationStrategy.Signal
|
||||
else TaskCancellationStrategy.Null
|
||||
def forceGarbageCollection = GCUtil.defaultForceGarbageCollection
|
||||
def minForcegcInterval = GCUtil.defaultMinForcegcInterval
|
||||
}
|
||||
AdaptedTaskConfig
|
||||
}
|
||||
|
||||
@deprecated("Use the alternative that specifies minForcegcInterval", "0.13.9")
|
||||
def apply(restrictions: Seq[Tags.Rule],
|
||||
checkCycles: Boolean,
|
||||
|
|
@ -152,14 +137,6 @@ final object EvaluateTaskConfig {
|
|||
final case class PluginData(dependencyClasspath: Seq[Attributed[File]], definitionClasspath: Seq[Attributed[File]], resolvers: Option[Seq[Resolver]], report: Option[UpdateReport], scalacOptions: Seq[String]) {
|
||||
val classpath: Seq[Attributed[File]] = definitionClasspath ++ dependencyClasspath
|
||||
}
|
||||
object PluginData {
|
||||
@deprecated("Use the alternative that specifies the compiler options and specific classpaths.", "0.13.1")
|
||||
def apply(dependencyClasspath: Seq[Attributed[File]], definitionClasspath: Seq[Attributed[File]], resolvers: Option[Seq[Resolver]], report: Option[UpdateReport]): PluginData =
|
||||
PluginData(dependencyClasspath, definitionClasspath, resolvers, report, Nil)
|
||||
@deprecated("Use the alternative that specifies the specific classpaths.", "0.13.0")
|
||||
def apply(classpath: Seq[Attributed[File]], resolvers: Option[Seq[Resolver]], report: Option[UpdateReport]): PluginData =
|
||||
PluginData(classpath, Nil, resolvers, report, Nil)
|
||||
}
|
||||
|
||||
object EvaluateTask {
|
||||
import std.{ TaskExtra, Transform }
|
||||
|
|
@ -245,7 +222,7 @@ object EvaluateTask {
|
|||
|
||||
def injectSettings: Seq[Setting[_]] = Seq(
|
||||
(state in GlobalScope) ::= dummyState,
|
||||
(streamsManager in GlobalScope) ::= dummyStreamsManager,
|
||||
(streamsManager in GlobalScope) ::= Def.dummyStreamsManager,
|
||||
(executionRoots in GlobalScope) ::= dummyRoots
|
||||
)
|
||||
|
||||
|
|
@ -260,10 +237,6 @@ object EvaluateTask {
|
|||
processResult(result, log)
|
||||
}
|
||||
|
||||
@deprecated("This method does not apply state changes requested during task execution and does not honor concurrent execution restrictions. Use 'apply' instead.", "0.11.1")
|
||||
def evaluateTask[T](structure: BuildStructure, taskKey: ScopedKey[Task[T]], state: State, ref: ProjectRef, checkCycles: Boolean = false, maxWorkers: Int = SystemProcessors): Option[Result[T]] =
|
||||
apply(structure, taskKey, state, ref, EvaluateConfig(false, defaultRestrictions(maxWorkers), checkCycles)).map(_._2)
|
||||
|
||||
/**
|
||||
* Evaluates `taskKey` and returns the new State and the result of the task wrapped in Some.
|
||||
* If the task is not defined, None is returned. The provided task key is resolved against the current project `ref`.
|
||||
|
|
@ -277,9 +250,6 @@ object EvaluateTask {
|
|||
* If the task is not defined, None is returned. The provided task key is resolved against the current project `ref`.
|
||||
* `config` configures concurrency and canceling of task execution.
|
||||
*/
|
||||
@deprecated("Use EvaluateTaskConfig option instead.", "0.13.5")
|
||||
def apply[T](structure: BuildStructure, taskKey: ScopedKey[Task[T]], state: State, ref: ProjectRef, config: EvaluateConfig): Option[(State, Result[T])] =
|
||||
apply(structure, taskKey, state, ref, EvaluateTaskConfig(config))
|
||||
def apply[T](structure: BuildStructure, taskKey: ScopedKey[Task[T]], state: State, ref: ProjectRef, config: EvaluateTaskConfig): Option[(State, Result[T])] = {
|
||||
withStreams(structure, state) { str =>
|
||||
for ((task, toNode) <- getTask(structure, taskKey, state, str, ref)) yield runTask(task, state, str, structure.index.triggers, config)(toNode)
|
||||
|
|
@ -327,14 +297,8 @@ object EvaluateTask {
|
|||
for (t <- structure.data.get(resolvedScope, taskKey.key)) yield (t, nodeView(state, streams, taskKey :: Nil))
|
||||
}
|
||||
def nodeView[HL <: HList](state: State, streams: Streams, roots: Seq[ScopedKey[_]], dummies: DummyTaskMap = DummyTaskMap(Nil)): NodeView[Task] =
|
||||
Transform((dummyRoots, roots) :: (dummyStreamsManager, streams) :: (dummyState, state) :: dummies)
|
||||
Transform((dummyRoots, roots) :: (Def.dummyStreamsManager, streams) :: (dummyState, state) :: dummies)
|
||||
|
||||
@deprecated("Use new EvaluateTaskConfig option to runTask", "0.13.5")
|
||||
def runTask[T](root: Task[T], state: State, streams: Streams, triggers: Triggers[Task], config: EvaluateConfig)(implicit taskToNode: NodeView[Task]): (State, Result[T]) =
|
||||
{
|
||||
val newConfig = EvaluateTaskConfig(config)
|
||||
runTask(root, state, streams, triggers, newConfig)(taskToNode)
|
||||
}
|
||||
def runTask[T](root: Task[T], state: State, streams: Streams, triggers: Triggers[Task], config: EvaluateTaskConfig)(implicit taskToNode: NodeView[Task]): (State, Result[T]) =
|
||||
{
|
||||
import ConcurrentRestrictions.{ completionService, TagMap, Tag, tagged, tagsKey }
|
||||
|
|
@ -406,7 +370,7 @@ object EvaluateTask {
|
|||
case in @ Incomplete(Some(node: Task[_]), _, _, _, _) => in.copy(node = transformNode(node))
|
||||
case i => i
|
||||
}
|
||||
type AnyCyclic = Execute[Task]#CyclicException[_]
|
||||
type AnyCyclic = Execute[({ type A[_] <: AnyRef })#A]#CyclicException[_]
|
||||
def convertCyclicInc: Incomplete => Incomplete = {
|
||||
case in @ Incomplete(_, _, _, _, Some(c: AnyCyclic)) =>
|
||||
in.copy(directCause = Some(new RuntimeException(convertCyclic(c))))
|
||||
|
|
|
|||
|
|
@ -13,23 +13,25 @@ final case class Extracted(structure: BuildStructure, session: SessionSettings,
|
|||
lazy val currentUnit = structure units currentRef.build
|
||||
lazy val currentProject = currentUnit defined currentRef.project
|
||||
lazy val currentLoader: ClassLoader = currentUnit.loader
|
||||
def get[T](key: TaskKey[T]): Task[T] = get(key.task)
|
||||
|
||||
/**
|
||||
* Gets the value assigned to `key` in the computed settings map.
|
||||
* If the project axis is not explicitly specified, it is resolved to be the current project according to the extracted `session`.
|
||||
* Other axes are resolved to be `Global` if they are not specified.
|
||||
*/
|
||||
def get[T](key: SettingKey[T]) = getOrError(inCurrent(key), key.key)
|
||||
def get[T](key: SettingKey[T]): T = getOrError(inCurrent(key.scope), key.key)
|
||||
def get[T](key: TaskKey[T]): Task[T] = getOrError(inCurrent(key.scope), key.key)
|
||||
|
||||
/**
|
||||
* Gets the value assigned to `key` in the computed settings map wrapped in Some. If it does not exist, None is returned.
|
||||
* If the project axis is not explicitly specified, it is resolved to be the current project according to the extracted `session`.
|
||||
* Other axes are resolved to be `Global` if they are not specified.
|
||||
*/
|
||||
def getOpt[T](key: SettingKey[T]): Option[T] = structure.data.get(inCurrent(key), key.key)
|
||||
def getOpt[T](key: SettingKey[T]): Option[T] = structure.data.get(inCurrent(key.scope), key.key)
|
||||
def getOpt[T](key: TaskKey[T]): Option[Task[T]] = structure.data.get(inCurrent(key.scope), key.key)
|
||||
|
||||
private[this] def inCurrent[T](key: SettingKey[T]): Scope = if (key.scope.project == This) key.scope.copy(project = Select(currentRef)) else key.scope
|
||||
private[this] def inCurrent[T](scope: Scope): Scope =
|
||||
if (scope.project == This) scope.copy(project = Select(currentRef)) else scope
|
||||
|
||||
/**
|
||||
* Runs the task specified by `key` and returns the transformed State and the resulting value of the task.
|
||||
|
|
|
|||
|
|
@ -148,8 +148,6 @@ object Keys {
|
|||
|
||||
// Output paths
|
||||
val classDirectory = SettingKey[File]("class-directory", "Directory for compiled classes and copied resources.", AMinusSetting)
|
||||
@deprecated("Use the cacheDirectory provided by streams.", "0.13.0")
|
||||
val cacheDirectory = SettingKey[File]("cache-directory", "Directory used for caching task data.", BMinusSetting)
|
||||
val cleanFiles = SettingKey[Seq[File]]("clean-files", "The files to recursively delete during a clean.", BSetting)
|
||||
val cleanKeepFiles = SettingKey[Seq[File]]("clean-keep-files", "Files to keep during a clean.", CSetting)
|
||||
val crossPaths = SettingKey[Boolean]("cross-paths", "If true, enables cross paths, which distinguish input and output directories for cross-building.", ASetting)
|
||||
|
|
@ -275,6 +273,7 @@ object Keys {
|
|||
val defaultConfiguration = SettingKey[Option[Configuration]]("default-configuration", "Defines the configuration used when none is specified for a dependency in ivyXML.", CSetting)
|
||||
|
||||
val products = TaskKey[Seq[File]]("products", "Build products that get packaged.", BMinusTask)
|
||||
// TODO: This is used by exportedProducts, exportedProductsIfMissing, exportedProductsNoTracking..
|
||||
@deprecated("This task is unused by the default project and will be removed.", "0.13.0")
|
||||
val productDirectories = TaskKey[Seq[File]]("product-directories", "Base directories of build products.", CTask)
|
||||
val exportJars = SettingKey[Boolean]("export-jars", "Determines whether the exported classpath for this project contains classes (false) or a packaged jar (true).", BSetting)
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ object BuiltinCommands {
|
|||
{
|
||||
val scalaVersion = e.getOpt(Keys.scalaVersion)
|
||||
val scalaHome = e.getOpt(Keys.scalaHome).flatMap(idFun)
|
||||
val instance = e.getOpt(Keys.scalaInstance.task).flatMap(_ => quiet(e.runTask(Keys.scalaInstance, s)._2))
|
||||
val instance = e.getOpt(Keys.scalaInstance).flatMap(_ => quiet(e.runTask(Keys.scalaInstance, s)._2))
|
||||
(scalaVersion, scalaHome, instance) match {
|
||||
case (sv, Some(home), Some(si)) => "local Scala version " + selectScalaVersion(sv, si) + " at " + home.getAbsolutePath
|
||||
case (_, Some(home), None) => "a local Scala build at " + home.getAbsolutePath
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ ${listConflicts(conflicting)}""")
|
|||
val m = ru.runtimeMirror(loader)
|
||||
val im = m.reflect(ap)
|
||||
val hasGetterOpt = catching(classOf[ScalaReflectionException]) opt {
|
||||
im.symbol.asType.toType.declaration(ru.newTermName("autoImport")) match {
|
||||
im.symbol.asType.toType.decl(ru.TermName("autoImport")) match {
|
||||
case ru.NoSymbol => false
|
||||
case sym => sym.asTerm.isGetter || sym.asTerm.isModule
|
||||
}
|
||||
|
|
|
|||
|
|
@ -592,7 +592,8 @@ object Project extends ProjectExtra {
|
|||
val p = EvaluateTask.executeProgress(extracted, extracted.structure, state)
|
||||
val r = EvaluateTask.restrictions(state)
|
||||
val fgc = EvaluateTask.forcegc(extracted, extracted.structure)
|
||||
runTask(taskKey, state, EvaluateTaskConfig(r, checkCycles, p, ch, fgc))
|
||||
val mfi = EvaluateTask.minForcegcInterval(extracted, extracted.structure)
|
||||
runTask(taskKey, state, EvaluateTaskConfig(r, checkCycles, p, ch, fgc, mfi))
|
||||
}
|
||||
def runTask[T](taskKey: ScopedKey[Task[T]], state: State, config: EvaluateTaskConfig): Option[(State, Result[T])] = {
|
||||
val extracted = Project.extract(state)
|
||||
|
|
@ -627,21 +628,21 @@ object Project extends ProjectExtra {
|
|||
private[sbt] trait GeneratedRootProject
|
||||
|
||||
trait ProjectExtra0 {
|
||||
implicit def wrapProjectReferenceSeqEval[T <% ProjectReference](rs: => Seq[T]): Seq[Eval[ProjectReference]] =
|
||||
implicit def wrapProjectReferenceSeqEval[T](rs: => Seq[T])(implicit ev: T => ProjectReference): Seq[Eval[ProjectReference]] =
|
||||
rs map { r => Eval.later(r: ProjectReference) }
|
||||
}
|
||||
|
||||
trait ProjectExtra extends ProjectExtra0 {
|
||||
implicit def classpathDependencyEval[T <% ClasspathDep[ProjectReference]](p: => T): Eval[ClasspathDep[ProjectReference]] =
|
||||
implicit def classpathDependencyEval[T](p: => T)(implicit ev: T => ClasspathDep[ProjectReference]): Eval[ClasspathDep[ProjectReference]] =
|
||||
Eval.later(p: ClasspathDep[ProjectReference])
|
||||
implicit def wrapProjectReferenceEval[T <% ProjectReference](ref: => T): Eval[ProjectReference] =
|
||||
implicit def wrapProjectReferenceEval[T](ref: => T)(implicit ev: T => ProjectReference): Eval[ProjectReference] =
|
||||
Eval.later(ref: ProjectReference)
|
||||
|
||||
implicit def wrapSettingDefinitionEval[T <% Def.SettingsDefinition](d: => T): Eval[Def.SettingsDefinition] = Eval.later(d)
|
||||
implicit def wrapSettingDefinitionEval[T](d: => T)(implicit ev: T => Def.SettingsDefinition): Eval[Def.SettingsDefinition] = Eval.later(d)
|
||||
implicit def wrapSettingSeqEval(ss: => Seq[Setting[_]]): Eval[Def.SettingsDefinition] = Eval.later(new Def.SettingList(ss))
|
||||
|
||||
implicit def configDependencyConstructor[T <% ProjectReference](p: T): Constructor = new Constructor(p)
|
||||
implicit def classpathDependency[T <% ProjectReference](p: T): ClasspathDep[ProjectReference] = new ClasspathDependency(p, None)
|
||||
implicit def configDependencyConstructor[T](p: T)(implicit ev: T => ProjectReference): Constructor = new Constructor(p)
|
||||
implicit def classpathDependency[T](p: T)(implicit ev: T => ProjectReference): ClasspathDep[ProjectReference] = new ClasspathDependency(p, None)
|
||||
|
||||
|
||||
// These used to be in Project so that they didn't need to get imported (due to Initialize being nested in Project).
|
||||
|
|
|
|||
|
|
@ -97,9 +97,9 @@ object Resolvers {
|
|||
abstract class DistributedVCS {
|
||||
val scheme: String
|
||||
|
||||
def clone(from: String, to: File)
|
||||
def clone(from: String, to: File): Unit
|
||||
|
||||
def checkout(branch: String, in: File)
|
||||
def checkout(branch: String, in: File): Unit
|
||||
|
||||
def toResolver: Resolver = (info: ResolveInfo) => {
|
||||
val uri = info.uri.withoutMarkerScheme
|
||||
|
|
@ -167,7 +167,7 @@ object Resolvers {
|
|||
}
|
||||
|
||||
private[this] def normalizeDirectoryName(name: String): String =
|
||||
StringUtilities.normalize(dropExtensions(name))
|
||||
dropExtensions(name).toLowerCase(Locale.ENGLISH).replaceAll("""\W+""", "-")
|
||||
|
||||
private[this] def dropExtensions(name: String): String = name.takeWhile(_ != '.')
|
||||
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ object ScopeFilter {
|
|||
/** Base functionality for filters on values of type `In` that need access to build data.*/
|
||||
sealed abstract class Base[In] { self =>
|
||||
/** Implements this filter. */
|
||||
private[sbt] def apply(data: Data): In => Boolean
|
||||
private[ScopeFilter] def apply(data: Data): In => Boolean
|
||||
|
||||
/** Constructs a filter that selects values that match this filter but not `other`.*/
|
||||
def --(other: Base[In]): Base[In] = this && -other
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ final case class ScopedKeyData[A](scoped: ScopedKey[A], value: Any) {
|
|||
def settingValue: Option[Any] = fold(const(None), const(None), Some(value))
|
||||
def description: String = fold(fmtMf("Task: %s"), fmtMf("Input task: %s"),
|
||||
"Setting: %s = %s" format (key.manifest.toString, value.toString))
|
||||
def fold[A](targ: OptManifest[_] => A, itarg: OptManifest[_] => A, s: => A): A =
|
||||
def fold[T](targ: OptManifest[_] => T, itarg: OptManifest[_] => T, s: => T): T =
|
||||
if (key.manifest.runtimeClass == classOf[Task[_]]) targ(key.manifest.typeArguments.head)
|
||||
else if (key.manifest.runtimeClass == classOf[InputTask[_]]) itarg(key.manifest.typeArguments.head)
|
||||
else s
|
||||
|
|
|
|||
|
|
@ -235,7 +235,6 @@ private[sbt] object EvaluateConfigurations {
|
|||
}
|
||||
}
|
||||
|
||||
@deprecated("This method is no longer part of the public API.", "0.13.7")
|
||||
def splitExpressions(lines: Seq[String]): (Seq[(String, Int)], Seq[(String, LineRange)]) = {
|
||||
val blank = (_: String).forall(isSpace)
|
||||
val isImport = firstNonSpaceIs("import ")
|
||||
|
|
@ -246,7 +245,6 @@ private[sbt] object EvaluateConfigurations {
|
|||
val (imports, settings) = lines.zipWithIndex span importOrBlank
|
||||
(imports filterNot fstS(blankOrComment), groupedLines(settings, blank, blankOrComment))
|
||||
}
|
||||
@deprecated("This method is deprecated and no longer used.", "0.13.7")
|
||||
def groupedLines(lines: Seq[(String, Int)], delimiter: String => Boolean, skipInitial: String => Boolean): Seq[(String, LineRange)] =
|
||||
{
|
||||
val fdelim = fstS(delimiter)
|
||||
|
|
|
|||
|
|
@ -12,14 +12,16 @@ import java.io.File
|
|||
object Inspect {
|
||||
sealed trait Mode
|
||||
final case class Details(actual: Boolean) extends Mode
|
||||
private[this] final class Opt(override val toString: String) extends Mode
|
||||
val DependencyTree: Mode = new Opt("tree")
|
||||
val Uses: Mode = new Opt("inspect")
|
||||
val Definitions: Mode = new Opt("definitions")
|
||||
private[sbt] case object DependencyTreeMode extends Mode { override def toString = "tree" }
|
||||
private[sbt] case object UsesMode extends Mode { override def toString = "inspect" }
|
||||
private[sbt] case object DefinitionsMode extends Mode { override def toString = "definitions" }
|
||||
val DependencyTree: Mode = DependencyTreeMode
|
||||
val Uses: Mode = UsesMode
|
||||
val Definitions: Mode = DefinitionsMode
|
||||
|
||||
def parser: State => Parser[(Inspect.Mode, ScopedKey[_])] = (s: State) => spacedModeParser(s) flatMap {
|
||||
case opt @ (Uses | Definitions) => allKeyParser(s).map(key => (opt, Def.ScopedKey(Global, key)))
|
||||
case opt @ (DependencyTree | Details(_)) => spacedKeyParser(s).map(key => (opt, key))
|
||||
case opt @ (UsesMode | DefinitionsMode) => allKeyParser(s).map(key => (opt, Def.ScopedKey(Global, key)))
|
||||
case opt @ (DependencyTreeMode | Details(_)) => spacedKeyParser(s).map(key => (opt, key))
|
||||
}
|
||||
val spacedModeParser: (State => Parser[Mode]) = (s: State) => {
|
||||
val actual = "actual" ^^^ Details(true)
|
||||
|
|
@ -43,12 +45,12 @@ object Inspect {
|
|||
option match {
|
||||
case Details(actual) =>
|
||||
Project.details(structure, actual, sk.scope, sk.key)
|
||||
case DependencyTree =>
|
||||
case DependencyTreeMode =>
|
||||
val basedir = new File(Project.session(s).current.build)
|
||||
Project.settingGraph(structure, basedir, sk).dependsAscii
|
||||
case Uses =>
|
||||
case UsesMode =>
|
||||
Project.showUses(Project.usedBy(structure, true, sk.key))
|
||||
case Definitions =>
|
||||
case DefinitionsMode =>
|
||||
Project.showDefinitions(sk.key, Project.definitions(structure, true, sk.key))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ package sbt
|
|||
package internal
|
||||
|
||||
import sbt.internal.util.{ Settings, Show, ~> }
|
||||
import sbt.librarymanagement.{ Configuration, Configurations, Resolver }
|
||||
import sbt.librarymanagement.{ Configuration, Configurations, Resolver, UpdateOptions }
|
||||
import sbt.internal.librarymanagement.{ InlineIvyConfiguration, IvyPaths }
|
||||
|
||||
import java.io.File
|
||||
|
|
@ -58,7 +58,7 @@ private[sbt] object Load {
|
|||
val checksums = Nil
|
||||
val ivyPaths = new IvyPaths(baseDirectory, bootIvyHome(state.configuration))
|
||||
val ivyConfiguration = new InlineIvyConfiguration(ivyPaths, Resolver.withDefaultResolvers(Nil),
|
||||
Nil, Nil, localOnly, lock, checksums, None, log)
|
||||
Nil, Nil, localOnly, lock, checksums, None, UpdateOptions(), log)
|
||||
val compilers = Compiler.compilers(ClasspathOptions.boot, ivyConfiguration)(state.configuration, log)
|
||||
val evalPluginDef = EvaluateTask.evalPluginDef(log) _
|
||||
val delegates = defaultDelegates
|
||||
|
|
@ -790,7 +790,7 @@ private[sbt] object Load {
|
|||
(dir * -GlobFilter(DefaultTargetName)).get.nonEmpty
|
||||
}
|
||||
def noPlugins(dir: File, config: LoadBuildConfiguration): LoadedPlugins =
|
||||
loadPluginDefinition(dir, config, PluginData(config.globalPluginClasspath, None, None))
|
||||
loadPluginDefinition(dir, config, PluginData(config.globalPluginClasspath, Nil, None, None, Nil))
|
||||
def buildPlugins(dir: File, s: State, config: LoadBuildConfiguration): LoadedPlugins =
|
||||
loadPluginDefinition(dir, config, buildPluginDefinition(dir, s, config))
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ private[sbt] class PluginsDebug(val available: List[AutoPlugin], val nameToKey:
|
|||
if(possible.nonEmpty) {
|
||||
val explained = possible.map(explainPluginEnable)
|
||||
val possibleString =
|
||||
if(explained.size > 1) explained.zipWithIndex.map{case (s,i) => s"$i. $s"}.mkString("Multiple plugins are available that can provide $notFoundKey:\n", "\n", "")
|
||||
if(explained.size > 1) explained.zipWithIndex.map{case (s,i) => s"$i. $s"}.mkString(s"Multiple plugins are available that can provide $notFoundKey:\n", "\n", "")
|
||||
else s"$notFoundKey is provided by an available (but not activated) plugin:\n${explained.mkString}"
|
||||
def impossiblePlugins = impossible.map(_.plugin.label).mkString(", ")
|
||||
val imPostfix = if(impossible.isEmpty) "" else s"\n\nThere are other available plugins that provide $notFoundKey, but they are impossible to add: $impossiblePlugins"
|
||||
|
|
|
|||
|
|
@ -135,7 +135,6 @@ object SessionSettings {
|
|||
oldState.log.warn("Discarding " + pluralize(oldSettings.size, " session setting") + ". Use 'session save' to persist session settings.")
|
||||
}
|
||||
|
||||
@deprecated("This method will no longer be public", "0.13.7")
|
||||
def removeRanges[T](in: Seq[T], ranges: Seq[(Int, Int)]): Seq[T] = {
|
||||
val asSet = (Set.empty[Int] /: ranges) { case (s, (hi, lo)) => s ++ (hi to lo) }
|
||||
in.zipWithIndex.flatMap { case (t, index) => if (asSet(index + 1)) Nil else t :: Nil }
|
||||
|
|
@ -181,7 +180,6 @@ object SessionSettings {
|
|||
reapply(newSession.copy(original = newSession.mergeSettings, append = Map.empty), s)
|
||||
}
|
||||
|
||||
@deprecated("This method will no longer be public", "0.13.7")
|
||||
def writeSettings(pref: ProjectRef, settings: List[SessionSetting], original: Seq[Setting[_]], structure: BuildStructure): (Seq[SessionSetting], Seq[Setting[_]]) = {
|
||||
val project = Project.getProject(pref, structure).getOrElse(sys.error("Invalid project reference " + pref))
|
||||
val writeTo: File = BuildPaths.configurationSources(project.base).headOption.getOrElse(new File(project.base, "build.sbt"))
|
||||
|
|
@ -222,7 +220,6 @@ object SessionSettings {
|
|||
(newWithPos.reverse, other ++ oldShifted)
|
||||
}
|
||||
|
||||
@deprecated("This method will no longer be public", "0.13.7")
|
||||
def needsTrailingBlank(lines: Seq[String]) = lines.nonEmpty && !lines.takeRight(1).exists(_.trim.isEmpty)
|
||||
|
||||
/** Prints all the user-defined SessionSettings (not raw) to System.out. */
|
||||
|
|
|
|||
|
|
@ -27,8 +27,7 @@ object JvmPlugin extends AutoPlugin {
|
|||
Defaults.paths ++
|
||||
Classpaths.jvmPublishSettings ++
|
||||
Classpaths.jvmBaseSettings ++
|
||||
Defaults.projectTasks ++
|
||||
Defaults.packageBase ++
|
||||
Defaults.baseTasks ++
|
||||
Defaults.compileBase ++
|
||||
Defaults.defaultConfigs
|
||||
override lazy val globalSettings: Seq[Setting[_]] =
|
||||
|
|
|
|||
Loading…
Reference in New Issue