Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flag to support source dependencies #394

Merged
merged 1 commit into from Mar 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions build.sbt
@@ -1,5 +1,8 @@
import build.BuildImplementation.BuildDefaults

// Tell bloop to aggregate source deps (benchmark) config files in the same bloop config dir
bloopAggregateSourceDependencies in Global := true

/***************************************************************************************************/
/* This is the build definition of the source deps */
/***************************************************************************************************/
Expand Down
Expand Up @@ -17,6 +17,8 @@ object AutoImported {
import sbt.{SettingKey, TaskKey, settingKey, taskKey}
val bloopConfigDir: SettingKey[File] =
settingKey[File]("Directory where to write bloop configuration files")
val bloopAggregateSourceDependencies: SettingKey[Boolean] =
settingKey[Boolean]("Flag to tell bloop to aggregate bloop config files in the same bloop dir.")
val bloopProductDirectories: TaskKey[Seq[File]] =
taskKey[Seq[File]]("Bloop product directories")
val bloopManagedResourceDirectories: SettingKey[Seq[File]] =
Expand All @@ -38,7 +40,8 @@ object AutoImported {
object PluginImplementation {
import bloop.integrations.sbt.{AutoImported => BloopKeys}
val globalSettings: Seq[Def.Setting[_]] = List(
BloopKeys.bloopInstall := PluginDefaults.bloopInstall.value
BloopKeys.bloopInstall := PluginDefaults.bloopInstall.value,
BloopKeys.bloopAggregateSourceDependencies := false
)

import Compat._
Expand All @@ -59,10 +62,15 @@ object PluginImplementation {
BloopKeys.bloopTargetDir := PluginDefaults.bloopTargetDir.value,
BloopKeys.bloopConfigDir := Def.settingDyn {
val ref = Keys.thisProjectRef.value
val rootBuild = sbt.BuildRef(Keys.loadedBuild.value.root)
Def.setting {
(BloopKeys.bloopConfigDir in sbt.Global).?.value.getOrElse {
// We do this so that it works nicely with source dependencies.
(Keys.baseDirectory in ref in ThisBuild).value / ".bloop-config"
if (BloopKeys.bloopAggregateSourceDependencies.in(sbt.Global).value) {
(Keys.baseDirectory in rootBuild).value / ".bloop-config"
} else {
// We do this so that it works nicely with source dependencies.
(Keys.baseDirectory in ref in ThisBuild).value / ".bloop-config"
}
}
}
}.value
Expand Down