@@ -64,6 +64,8 @@ object BloopKeys {
6464 settingKey[File ](" Directory where to write bloop configuration files" )
6565 val bloopIsMetaBuild : SettingKey [Boolean ] =
6666 settingKey[Boolean ](" Is this a meta build?" )
67+ val bloopExportMetaBuild : SettingKey [Boolean ] =
68+ settingKey[Boolean ](" Automatically export the sbt meta-build on load (needed by Metals)." )
6769 val bloopAggregateSourceDependencies : SettingKey [Boolean ] =
6870 settingKey[Boolean ](" Flag to tell bloop to aggregate bloop config files in the same bloop dir" )
6971 val bloopExportJarClassifiers : SettingKey [Option [Set [String ]]] =
@@ -151,6 +153,11 @@ object BloopDefaults {
151153 .map(_.split(" ," ).toSet)
152154 .orElse(Some (Set (" sources" )))
153155 },
156+ BloopKeys .bloopExportMetaBuild := {
157+ Option (System .getProperty(" bloop.export-meta-build" ))
158+ .orElse(Option (System .getenv(" BLOOP_EXPORT_META_BUILD" )))
159+ .contains(" true" )
160+ },
154161 BloopKeys .bloopInstall := bloopInstall.value,
155162 BloopKeys .bloopAggregateSourceDependencies := true ,
156163 // Override classifiers so that we don't resolve always docs
@@ -167,10 +174,11 @@ object BloopDefaults {
167174 },
168175 Keys .onLoad := {
169176 val oldOnLoad = Keys .onLoad.value
177+ val isMetaBuild = BloopKeys .bloopIsMetaBuild.value
178+ val exportMetaBuild = BloopKeys .bloopExportMetaBuild.value
170179 oldOnLoad.andThen { state =>
171- val isMetaBuild = BloopKeys .bloopIsMetaBuild.value
172- if (! isMetaBuild) state
173- else runCommandAndRemaining(" bloopInstall" )(state)
180+ if (isMetaBuild && exportMetaBuild) runCommandAndRemaining(" bloopInstall" )(state)
181+ else state
174182 }
175183 },
176184 BloopKeys .bloopSupportedConfigurations := List (
0 commit comments