mirror of https://github.com/sbt/sbt.git
Optimize imports in Defaults, Main and Keys
It was becoming a pain to work on these files in intellij because the auto-import feature would implicitly optimize all of the imports in these files, leading to a large diff. I'd then have to go and manually add the import that I care about. This change does add some wildcard imports, which I don't always love, but these files are so unwieldy already that I think it's worth it to have the imports follow the format preferred by intellij.
This commit is contained in:
parent
34ef5ab500
commit
de7c67ea45
|
|
@ -7,19 +7,28 @@
|
|||
|
||||
package sbt
|
||||
|
||||
import Def.{ Initialize, ScopedKey, Setting, SettingsDefinition }
|
||||
import java.io.{ File, PrintWriter }
|
||||
import java.net.{ URI, URL }
|
||||
import java.util.Optional
|
||||
import java.util.concurrent.{ TimeUnit, Callable }
|
||||
import Keys._
|
||||
import org.apache.ivy.core.module.{ descriptor, id }, descriptor.ModuleDescriptor,
|
||||
id.ModuleRevisionId
|
||||
import Project.{ inConfig, inScope, inTask, richInitialize, richInitializeTask, richTaskSessionVar }
|
||||
import sbt.internal._
|
||||
import java.util.concurrent.{ Callable, TimeUnit }
|
||||
|
||||
import org.apache.ivy.core.module.descriptor.ModuleDescriptor
|
||||
import org.apache.ivy.core.module.id.ModuleRevisionId
|
||||
import sbt.Def.{ Initialize, ScopedKey, Setting, SettingsDefinition }
|
||||
import sbt.Keys._
|
||||
import sbt.Project.{
|
||||
inConfig,
|
||||
inScope,
|
||||
inTask,
|
||||
richInitialize,
|
||||
richInitializeTask,
|
||||
richTaskSessionVar
|
||||
}
|
||||
import sbt.Scope.{ GlobalScope, ThisScope, fillTaskAxis }
|
||||
import sbt.internal.CommandStrings.ExportStream
|
||||
import sbt.internal.inc.ZincUtil
|
||||
import sbt.internal._
|
||||
import sbt.internal.inc.JavaInterfaceUtil._
|
||||
import sbt.internal.inc.ZincUtil
|
||||
import sbt.internal.io.{ Source, WatchState }
|
||||
import sbt.internal.librarymanagement._
|
||||
import sbt.internal.librarymanagement.mavenint.{
|
||||
|
|
@ -27,71 +36,68 @@ import sbt.internal.librarymanagement.mavenint.{
|
|||
SbtPomExtraProperties
|
||||
}
|
||||
import sbt.internal.server.{
|
||||
LanguageServerReporter,
|
||||
Definition,
|
||||
LanguageServerProtocol,
|
||||
LanguageServerReporter,
|
||||
ServerHandler
|
||||
}
|
||||
import sbt.internal.testing.TestLogger
|
||||
import sbt.internal.util._
|
||||
import sbt.internal.util.Attributed.data
|
||||
import sbt.internal.util.complete._
|
||||
import sbt.internal.util.Types._
|
||||
import sbt.internal.util._
|
||||
import sbt.internal.util.complete._
|
||||
import sbt.io.Path._
|
||||
import sbt.io.syntax._
|
||||
import sbt.io.{
|
||||
AllPassFilter,
|
||||
DirectoryFilter,
|
||||
FileFilter,
|
||||
FileTreeView,
|
||||
GlobFilter,
|
||||
Hash,
|
||||
HiddenFileFilter,
|
||||
IO,
|
||||
NameFilter,
|
||||
NothingFilter,
|
||||
Path,
|
||||
PathFinder,
|
||||
TypedPath
|
||||
}, Path._
|
||||
import sbt.io._
|
||||
import sbt.librarymanagement.Artifact.{ DocClassifier, SourceClassifier }
|
||||
import sbt.librarymanagement.Configurations.{
|
||||
Compile,
|
||||
CompilerPlugin,
|
||||
IntegrationTest,
|
||||
names,
|
||||
Provided,
|
||||
Runtime,
|
||||
Test
|
||||
Test,
|
||||
names
|
||||
}
|
||||
import sbt.librarymanagement.CrossVersion.{ binarySbtVersion, binaryScalaVersion, partialVersion }
|
||||
import sbt.librarymanagement._
|
||||
import sbt.librarymanagement.ivy._
|
||||
import sbt.librarymanagement.syntax._
|
||||
import sbt.std.TaskExtra._
|
||||
import sbt.testing.{ AnnotatedFingerprint, Framework, Runner, SubclassFingerprint }
|
||||
import sbt.util.CacheImplicits._
|
||||
import sbt.util.InterfaceUtil.{ toJavaFunction => f1 }
|
||||
import sbt.util._
|
||||
import sbt.util.CacheImplicits._
|
||||
import sjsonnew.shaded.scalajson.ast.unsafe.JValue
|
||||
import sjsonnew._
|
||||
import xsbti.CrossValue
|
||||
import xsbti.compile.{ AnalysisContents, IncOptions, IncToolOptionsUtil }
|
||||
|
||||
import scala.collection.immutable.ListMap
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
import scala.util.control.NonFatal
|
||||
import scala.xml.NodeSeq
|
||||
import Scope.{ fillTaskAxis, GlobalScope, ThisScope }
|
||||
import sjsonnew.{ IsoLList, JsonFormat, LList, LNil, :*: }
|
||||
import sjsonnew.shaded.scalajson.ast.unsafe.JValue
|
||||
import std.TaskExtra._
|
||||
import testing.{ Framework, Runner, AnnotatedFingerprint, SubclassFingerprint }
|
||||
import xsbti.compile.{ IncToolOptionsUtil, AnalysisContents, IncOptions }
|
||||
import xsbti.CrossValue
|
||||
|
||||
// incremental compiler
|
||||
import sbt.SlashSyntax0._
|
||||
import sbt.internal.inc.{
|
||||
Analysis,
|
||||
AnalyzingCompiler,
|
||||
FileValueCache,
|
||||
Locate,
|
||||
ManagedLoggedReporter,
|
||||
MixedAnalyzingCompiler,
|
||||
ScalaInstance
|
||||
}
|
||||
import xsbti.compile.{
|
||||
ClassFileManagerType,
|
||||
ClasspathOptionsUtil,
|
||||
CompilerCache,
|
||||
Compilers,
|
||||
CompileAnalysis,
|
||||
CompileOptions,
|
||||
CompileOrder,
|
||||
CompileResult,
|
||||
CompilerCache,
|
||||
Compilers,
|
||||
DefinesClass,
|
||||
Inputs,
|
||||
MiniSetup,
|
||||
|
|
@ -100,16 +106,6 @@ import xsbti.compile.{
|
|||
Setup,
|
||||
TransactionalManagerType
|
||||
}
|
||||
import sbt.internal.inc.{
|
||||
AnalyzingCompiler,
|
||||
Analysis,
|
||||
FileValueCache,
|
||||
Locate,
|
||||
ManagedLoggedReporter,
|
||||
MixedAnalyzingCompiler,
|
||||
ScalaInstance
|
||||
}
|
||||
import sbt.SlashSyntax0._
|
||||
|
||||
object Defaults extends BuildCommon {
|
||||
final val CacheDirectoryName = "cache"
|
||||
|
|
@ -937,7 +933,7 @@ object Defaults extends BuildCommon {
|
|||
stamps.getOrElse(
|
||||
c, {
|
||||
val x = {
|
||||
import analysis.{ relations => rel, apis }
|
||||
import analysis.{ apis, relations => rel }
|
||||
rel.internalClassDeps(c).map(intlStamp(_, analysis, s + c)) ++
|
||||
rel.externalDeps(c).map(stamp) +
|
||||
(apis.internal.get(c) match {
|
||||
|
|
@ -1163,7 +1159,7 @@ object Defaults extends BuildCommon {
|
|||
packageTaskSettings(packageBin, packageBinMappings) ++
|
||||
packageTaskSettings(packageSrc, packageSrcMappings) ++
|
||||
packageTaskSettings(packageDoc, packageDocMappings) ++
|
||||
Seq(`package` := packageBin.value)
|
||||
Seq(Keys.`package` := packageBin.value)
|
||||
|
||||
def packageBinMappings = products map { _ flatMap Path.allSubpaths }
|
||||
def packageDocMappings = doc map { Path.allSubpaths(_).toSeq }
|
||||
|
|
@ -1747,7 +1743,8 @@ object Defaults extends BuildCommon {
|
|||
}
|
||||
|
||||
private def distinctParser(exs: Set[String], raw: Boolean): Parser[Seq[String]] = {
|
||||
import DefaultParsers._, Parser.and
|
||||
import DefaultParsers._
|
||||
import 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 _)
|
||||
|
|
@ -1825,8 +1822,8 @@ object Defaults extends BuildCommon {
|
|||
)
|
||||
}
|
||||
object Classpaths {
|
||||
import Keys._
|
||||
import Defaults._
|
||||
import Keys._
|
||||
|
||||
def concatDistinct[T](
|
||||
a: ScopedTaskable[Seq[T]],
|
||||
|
|
@ -2516,8 +2513,8 @@ object Classpaths {
|
|||
|
||||
val moduleIdJsonKeyFormat: sjsonnew.JsonKeyFormat[ModuleID] =
|
||||
new sjsonnew.JsonKeyFormat[ModuleID] {
|
||||
import sjsonnew.support.scalajson.unsafe._
|
||||
import LibraryManagementCodec._
|
||||
import sjsonnew.support.scalajson.unsafe._
|
||||
val moduleIdFormat: JsonFormat[ModuleID] = implicitly[JsonFormat[ModuleID]]
|
||||
def write(key: ModuleID): String =
|
||||
CompactPrinter(Converter.toJsonUnsafe(key)(moduleIdFormat))
|
||||
|
|
@ -2612,7 +2609,7 @@ object Classpaths {
|
|||
val updateConf = {
|
||||
// Log captures log messages at all levels, except ivy logs.
|
||||
// Use full level when debug is enabled so that ivy logs are shown.
|
||||
import UpdateLogging.{ Full, DownloadOnly, Default }
|
||||
import UpdateLogging.{ Default, DownloadOnly, Full }
|
||||
val conf = updateConfiguration.value
|
||||
val maybeUpdateLevel = (logLevel in update).?.value
|
||||
val conf1 = maybeUpdateLevel.orElse(state0.get(logLevel.key)) match {
|
||||
|
|
@ -2979,6 +2976,7 @@ object Classpaths {
|
|||
}
|
||||
|
||||
import java.util.LinkedHashSet
|
||||
|
||||
import collection.JavaConverters._
|
||||
def interSort(
|
||||
projectRef: ProjectRef,
|
||||
|
|
|
|||
|
|
@ -9,84 +9,31 @@ package sbt
|
|||
|
||||
import java.io.{ File, InputStream }
|
||||
import java.net.URL
|
||||
import scala.concurrent.duration.{ FiniteDuration, Duration }
|
||||
import Def.ScopedKey
|
||||
import sbt.internal.inc.ScalaInstance
|
||||
import xsbti.compile.{
|
||||
DefinesClass,
|
||||
ClasspathOptions,
|
||||
CompileAnalysis,
|
||||
CompileOptions,
|
||||
CompileOrder,
|
||||
Compilers,
|
||||
CompileResult,
|
||||
ExternalHooks,
|
||||
GlobalsCache,
|
||||
IncOptions,
|
||||
Inputs,
|
||||
PreviousResult,
|
||||
Setup
|
||||
}
|
||||
import scala.xml.{ Node => XNode, NodeSeq }
|
||||
import org.apache.ivy.core.module.{ descriptor, id }
|
||||
import descriptor.ModuleDescriptor, id.ModuleRevisionId
|
||||
import testing.Framework
|
||||
import KeyRanks._
|
||||
|
||||
import sbt.internal.{
|
||||
BuildStructure,
|
||||
LoadedBuild,
|
||||
PluginDiscovery,
|
||||
BuildDependencies,
|
||||
SessionSettings,
|
||||
LogManager
|
||||
}
|
||||
import sbt.io.{ FileFilter, FileTreeDataView, TypedPath, WatchService }
|
||||
import sbt.io.FileEventMonitor.Event
|
||||
import sbt.internal.io.WatchState
|
||||
import sbt.internal.server.ServerHandler
|
||||
import sbt.internal.util.{ AttributeKey, SourcePosition }
|
||||
|
||||
import sbt.librarymanagement.Configurations.CompilerPlugin
|
||||
import sbt.librarymanagement.LibraryManagementCodec._
|
||||
import sbt.librarymanagement.ivy.{ Credentials, UpdateOptions }
|
||||
import sbt.librarymanagement.{
|
||||
Artifact,
|
||||
ConfigRef,
|
||||
Configuration,
|
||||
ConflictManager,
|
||||
ConflictWarning,
|
||||
CrossVersion,
|
||||
Developer,
|
||||
DependencyResolution,
|
||||
EvictionWarning,
|
||||
EvictionWarningOptions,
|
||||
GetClassifiersModule,
|
||||
MakePomConfiguration,
|
||||
MavenRepository,
|
||||
ModuleConfiguration,
|
||||
ModuleID,
|
||||
ModuleInfo,
|
||||
ModuleSettings,
|
||||
PublishConfiguration,
|
||||
Publisher,
|
||||
Resolver,
|
||||
RetrieveConfiguration,
|
||||
ScalaModuleInfo,
|
||||
ScalaVersion,
|
||||
ScmInfo,
|
||||
TrackLevel,
|
||||
UnresolvedWarningConfiguration,
|
||||
UpdateConfiguration,
|
||||
UpdateLogging,
|
||||
UpdateReport
|
||||
}
|
||||
import sbt.librarymanagement.InclExclRule
|
||||
import sbt.internal.librarymanagement.{ CompatibilityWarningOptions, IvySbt }
|
||||
import sbt.librarymanagement.ivy.{ IvyConfiguration, IvyPaths }
|
||||
import sbt.util.{ Level, Logger }
|
||||
import org.apache.ivy.core.module.descriptor.ModuleDescriptor
|
||||
import org.apache.ivy.core.module.id.ModuleRevisionId
|
||||
import org.apache.logging.log4j.core.Appender
|
||||
import sbt.BuildSyntax._
|
||||
import sbt.Def.ScopedKey
|
||||
import sbt.KeyRanks._
|
||||
import sbt.internal._
|
||||
import sbt.internal.inc.ScalaInstance
|
||||
import sbt.internal.io.WatchState
|
||||
import sbt.internal.librarymanagement.{ CompatibilityWarningOptions, IvySbt }
|
||||
import sbt.internal.server.ServerHandler
|
||||
import sbt.internal.util.{ AttributeKey, SourcePosition }
|
||||
import sbt.io.FileEventMonitor.Event
|
||||
import sbt.io.{ FileFilter, FileTreeDataView, TypedPath, WatchService }
|
||||
import sbt.librarymanagement.Configurations.CompilerPlugin
|
||||
import sbt.librarymanagement.LibraryManagementCodec._
|
||||
import sbt.librarymanagement._
|
||||
import sbt.librarymanagement.ivy.{ Credentials, IvyConfiguration, IvyPaths, UpdateOptions }
|
||||
import sbt.testing.Framework
|
||||
import sbt.util.{ Level, Logger }
|
||||
import xsbti.compile._
|
||||
|
||||
import scala.concurrent.duration.{ Duration, FiniteDuration }
|
||||
import scala.xml.{ NodeSeq, Node => XNode }
|
||||
|
||||
// format: off
|
||||
|
||||
|
|
|
|||
|
|
@ -7,63 +7,33 @@
|
|||
|
||||
package sbt
|
||||
|
||||
import sbt.internal.{
|
||||
Act,
|
||||
Aggregation,
|
||||
BuildStructure,
|
||||
CommandExchange,
|
||||
CommandStrings,
|
||||
CrossJava,
|
||||
DefaultBackgroundJobService,
|
||||
EvaluateConfigurations,
|
||||
Inspect,
|
||||
IvyConsole,
|
||||
Load,
|
||||
LoadedBuildUnit,
|
||||
LogManager,
|
||||
Output,
|
||||
PluginsDebug,
|
||||
ProjectNavigation,
|
||||
Script,
|
||||
SessionSettings,
|
||||
SetResult,
|
||||
SettingCompletions
|
||||
}
|
||||
import sbt.internal.util.{
|
||||
AttributeKey,
|
||||
AttributeMap,
|
||||
ConsoleOut,
|
||||
GlobalLogging,
|
||||
LineRange,
|
||||
MainAppender,
|
||||
SimpleReader,
|
||||
Types
|
||||
}
|
||||
import sbt.util.{ Level, Logger, Show }
|
||||
import sbt.internal.util.complete.{ DefaultParsers, Parser }
|
||||
import sbt.internal.inc.ScalaInstance
|
||||
import sbt.compiler.EvalImports
|
||||
import Types.{ const, idFun }
|
||||
import Aggregation.AnyKeys
|
||||
import Project.LoadAction
|
||||
import xsbti.compile.CompilerCache
|
||||
|
||||
import scala.annotation.tailrec
|
||||
import sbt.io.{ FileTreeDataView, IO }
|
||||
import sbt.io.syntax._
|
||||
import java.io.{ File, IOException }
|
||||
import java.net.URI
|
||||
import java.util.{ Locale, Properties }
|
||||
|
||||
import sbt.BasicCommandStrings.{ Shell, TemplateCommand }
|
||||
import sbt.Project.LoadAction
|
||||
import sbt.compiler.EvalImports
|
||||
import sbt.internal.Aggregation.AnyKeys
|
||||
import sbt.internal.CommandStrings.BootCommand
|
||||
import sbt.internal.inc.ScalaInstance
|
||||
import sbt.internal.util.Types.{ const, idFun }
|
||||
import sbt.internal.util.complete.Parser
|
||||
import sbt.internal.util._
|
||||
import sbt.internal._
|
||||
import sbt.io.syntax._
|
||||
import sbt.io.{ FileTreeDataView, IO }
|
||||
import sbt.util.{ Level, Logger, Show }
|
||||
import xsbti.compile.CompilerCache
|
||||
|
||||
import scala.annotation.tailrec
|
||||
import scala.util.control.NonFatal
|
||||
import BasicCommandStrings.{ Shell, TemplateCommand }
|
||||
import CommandStrings.BootCommand
|
||||
|
||||
/** This class is the entry point for sbt. */
|
||||
final class xMain extends xsbti.AppMain {
|
||||
def run(configuration: xsbti.AppConfiguration): xsbti.MainResult = {
|
||||
import BasicCommandStrings.{ DashClient, DashDashClient, runEarly }
|
||||
import BasicCommands.early
|
||||
import BasicCommandStrings.{ runEarly, DashClient, DashDashClient }
|
||||
import BuiltinCommands.defaults
|
||||
import sbt.internal.CommandStrings.{ BootCommand, DefaultsCommand, InitCommand }
|
||||
import sbt.internal.client.NetworkClient
|
||||
|
|
@ -188,12 +158,12 @@ object StandardMain {
|
|||
}
|
||||
}
|
||||
|
||||
import DefaultParsers._
|
||||
import sbt.BasicCommandStrings._
|
||||
import sbt.BasicCommands._
|
||||
import sbt.CommandUtil._
|
||||
import sbt.TemplateCommandUtil.templateCommand
|
||||
import sbt.internal.CommandStrings._
|
||||
import BasicCommandStrings._
|
||||
import BasicCommands._
|
||||
import CommandUtil._
|
||||
import TemplateCommandUtil.templateCommand
|
||||
import sbt.internal.util.complete.DefaultParsers._
|
||||
|
||||
object BuiltinCommands {
|
||||
def initialAttributes = AttributeMap.empty
|
||||
|
|
|
|||
Loading…
Reference in New Issue