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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: start using newly published bloop-gradle #4731

Merged
merged 1 commit into from Dec 15, 2022
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
2 changes: 2 additions & 0 deletions build.sbt
Expand Up @@ -446,6 +446,7 @@ lazy val metals = project
"sbtBloopVersion" -> V.sbtBloop,
"gradleBloopVersion" -> V.gradleBloop,
"mavenBloopVersion" -> V.mavenBloop,
"gradleBloopVersion" -> V.gradleBloop,
"scalametaVersion" -> V.scalameta,
"semanticdbVersion" -> V.semanticdb,
"javaSemanticdbVersion" -> V.javaSemanticdb,
Expand Down Expand Up @@ -648,6 +649,7 @@ lazy val metalsDependencies = project
"com.lihaoyi" % "mill-contrib-testng" % V.mill,
"org.virtuslab.scala-cli" % "cli_3" % V.scalaCli intransitive (),
"ch.epfl.scala" % "bloop-maven-plugin" % V.mavenBloop,
"ch.epfl.scala" %% "gradle-bloop" % V.gradleBloop,
),
)
.disablePlugins(ScalafixPlugin)
Expand Down
Expand Up @@ -6,6 +6,7 @@ import java.nio.file.Path

import scala.util.Properties

import scala.meta.internal.metals.BuildInfo
import scala.meta.internal.metals.UserConfiguration
import scala.meta.io.AbsolutePath

Expand All @@ -14,14 +15,15 @@ case class GradleBuildTool(userConfig: () => UserConfiguration)
with BloopInstallProvider {

private val initScriptName = "init-script.gradle"
private def initScript(versionToUse: String) =
private val gradleBloopVersion = BuildInfo.gradleBloopVersion
private val initScript =
s"""
|initscript {
| repositories{
| mavenCentral()
| }
| dependencies {
| classpath 'ch.epfl.scala:gradle-bloop_2.12:$versionToUse'
| classpath 'ch.epfl.scala:gradle-bloop_2.12:$gradleBloopVersion'
| }
|}
|allprojects {
Expand All @@ -30,8 +32,7 @@ case class GradleBuildTool(userConfig: () => UserConfiguration)
""".stripMargin.getBytes()

private lazy val initScriptPath: Path = {
val bloopVersion = userConfig().currentBloopVersion
Files.write(tempDir.resolve(initScriptName), initScript(bloopVersion))
Files.write(tempDir.resolve(initScriptName), initScript)
}

private lazy val gradleWrapper = {
Expand Down
2 changes: 1 addition & 1 deletion project/V.scala
Expand Up @@ -21,7 +21,7 @@ object V {
val coursierInterfaces = "1.0.11"
val debugAdapter = "3.0.4"
val genyVersion = "0.7.1"
val gradleBloop = bloop
val gradleBloop = "1.5.7-RC1"
val java8Compat = "1.0.2"
val javaSemanticdb = "0.7.4"
val jsoup = "1.15.3"
Expand Down