Skip to content

Commit a88a3be

Browse files
committed
Sbt: Rename SbtBloop to BloopPlugin, AutoImported to BloopKeys
This is in accordance with sbt's recommended practices and how other sbt plugins are organised.
1 parent 2c79d11 commit a88a3be

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

build-integrations/global/src/main/scala/bloop/build/integrations/IntegrationPlugin.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ package bloop.build.integrations
22

33
import java.io.File
44

5-
import bloop.integrations.sbt.{AutoImported => BloopKeys, SbtBloop}
5+
import bloop.integrations.sbt.{BloopKeys, BloopPlugin => SbtBloopPlugin}
66
import sbt.{AutoPlugin, Def, PluginTrigger, Plugins, Keys, ThisBuild, Global}
77

88
object IntegrationPlugin extends AutoPlugin {
99
import sbt.plugins.JvmPlugin
1010
override def trigger: PluginTrigger = allRequirements
11-
override def requires: Plugins = JvmPlugin && SbtBloop
11+
override def requires: Plugins = JvmPlugin && SbtBloopPlugin
1212
val autoImport = PluginKeys
1313

1414
override def globalSettings: Seq[Def.Setting[_]] =

integrations/sbt-bloop/src/main/scala/bloop/integrations/sbt/SbtBloop.scala

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,20 @@ import sbt.{
1919
}
2020
import xsbti.compile.CompileOrder
2121

22-
object SbtBloop extends AutoPlugin {
22+
object BloopPlugin extends AutoPlugin {
2323
import sbt.plugins.JvmPlugin
2424
override def requires = JvmPlugin
2525
override def trigger = allRequirements
26-
final val autoImport = AutoImported
26+
final val autoImport = BloopKeys
2727

2828
override def globalSettings: Seq[Def.Setting[_]] = PluginImplementation.globalSettings
2929
override def buildSettings: Seq[Def.Setting[_]] = PluginImplementation.buildSettings
3030
override def projectSettings: Seq[Def.Setting[_]] = PluginImplementation.projectSettings
3131
}
3232

33-
object AutoImported {
33+
object BloopKeys {
3434
import sbt.{SettingKey, TaskKey, settingKey, taskKey}
35+
3536
val bloopConfigDir: SettingKey[File] =
3637
settingKey[File]("Directory where to write bloop configuration files")
3738
val bloopAggregateSourceDependencies: SettingKey[Boolean] =
@@ -57,7 +58,6 @@ object AutoImported {
5758
}
5859

5960
object PluginImplementation {
60-
import bloop.integrations.sbt.{AutoImported => BloopKeys}
6161
val globalSettings: Seq[Def.Setting[_]] = List(
6262
BloopKeys.bloopInstall := PluginDefaults.bloopInstall.value,
6363
BloopKeys.bloopAggregateSourceDependencies := false
@@ -122,7 +122,7 @@ object PluginImplementation {
122122

123123
lazy val generateBloopProductDirectories: Def.Initialize[File] = Def.setting {
124124
val configuration = Keys.configuration.value
125-
val bloopTarget = AutoImported.bloopTargetDir.value
125+
val bloopTarget = BloopKeys.bloopTargetDir.value
126126
val classesDir = bloopTarget / (Defaults.prefix(configuration.name) + "classes")
127127
if (!classesDir.exists()) sbt.IO.createDirectory(classesDir)
128128
classesDir
@@ -219,7 +219,7 @@ object PluginImplementation {
219219
cpo.filterLibrary)
220220
}
221221

222-
val classesDir = AutoImported.bloopProductDirectories.value.head.toPath()
222+
val classesDir = BloopKeys.bloopProductDirectories.value.head.toPath()
223223

224224
/* This is a best-effort to export source directories + stray source files that
225225
* are not contained in them. Source directories are superior over source files because
@@ -251,7 +251,7 @@ object PluginImplementation {
251251
// TODO(jvican): Override classes directories here too (e.g. plugins are defined in the build)
252252
val scalacOptions = {
253253
val scalacOptions0 = Keys.scalacOptions.value.toArray
254-
val internalClasspath = AutoImported.bloopInternalClasspath.value
254+
val internalClasspath = BloopKeys.bloopInternalClasspath.value
255255
internalClasspath.foldLeft(scalacOptions0) {
256256
case (scalacOptions, (oldClassesDir, newClassesDir)) =>
257257
val old1 = oldClassesDir.toString
@@ -366,7 +366,7 @@ object PluginImplementation {
366366
if ((dep != currentProject) || (conf.name != c && self.name != c)) {
367367
val classpathKey = (Keys.productDirectories in (dep, sbt.ConfigKey(c)))
368368
productDirs += classpathKey.get(data).getOrElse(sbt.std.TaskExtra.constant(Nil))
369-
val bloopKey = (AutoImported.bloopProductDirectories in (dep, sbt.ConfigKey(c)))
369+
val bloopKey = (BloopKeys.bloopProductDirectories in (dep, sbt.ConfigKey(c)))
370370
bloopProductDirs += bloopKey.get(data).getOrElse(sbt.std.TaskExtra.constant(Nil))
371371
}
372372
}
@@ -382,7 +382,7 @@ object PluginImplementation {
382382
}
383383

384384
final lazy val emulateDependencyClasspath: Def.Initialize[Task[Seq[File]]] = Def.task {
385-
val internalClasspath = AutoImported.bloopInternalClasspath.value.map(_._2)
385+
val internalClasspath = BloopKeys.bloopInternalClasspath.value.map(_._2)
386386
val externalClasspath = Keys.externalDependencyClasspath.value.map(_.data)
387387
internalClasspath ++ externalClasspath
388388
}
@@ -391,11 +391,11 @@ object PluginImplementation {
391391
val configKey = sbt.ConfigKey(Keys.configuration.value.name)
392392
Def.task {
393393
import sbt._
394-
val t = AutoImported.bloopClassDirectory.value
394+
val t = BloopKeys.bloopClassDirectory.value
395395
val dirs =
396396
Classpaths
397397
.concatSettings(Keys.unmanagedResourceDirectories.in(configKey),
398-
AutoImported.bloopManagedResourceDirectories.in(configKey))
398+
BloopKeys.bloopManagedResourceDirectories.in(configKey))
399399
.value
400400
val s = Keys.streams.value
401401
val cacheStore = bloop.integrations.sbt.Compat.generateCacheFile(s, "copy-resources-bloop")
@@ -414,7 +414,7 @@ object PluginImplementation {
414414
val oldUnmanagedResourceDirs = Keys.managedResourceDirectories.in(configKey).value
415415
val oldResourceDir = Keys.resourceManaged.in(configKey).value
416416
val newResourceDir =
417-
AutoImported.bloopResourceManaged.in(configKey).value / Defaults.nameForSrc(configName)
417+
BloopKeys.bloopResourceManaged.in(configKey).value / Defaults.nameForSrc(configName)
418418
oldUnmanagedResourceDirs.map { dir =>
419419
if (dir == oldResourceDir) newResourceDir else dir
420420
}

0 commit comments

Comments
 (0)