Skip to content

Commit 20d804f

Browse files
Merge pull request #125 from alexarchambault/merge-upstream
Merge upstream changes
2 parents 7169d10 + 67a0287 commit 20d804f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+396
-4057
lines changed

.git-blame-ignore-revs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Scala Steward: Reformat with scalafmt 3.0.8
2+
9f3d87ca53be47fb391f90b7370c4dbc6914b503
3+
4+
# Scala Steward: Reformat with scalafmt 3.6.1
5+
77bc6a5845189a9659476d29fd7c02be5327ab8a

.github/workflows/steward.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.scala-steward.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
updates.ignore = [
22
{ groupId = "com.github.plokhotnyuk.jsoniter-scala" },
3+
{ groupId = "ch.epfl.scala", artifactId = "nailgun-server" },
4+
{ groupId = "ch.epfl.scala", artifactId = "sbt-release-early" }
35
]
46
commits.message = "build(deps): Update ${artifactName} from ${currentVersion} to ${nextVersion}"
57
updates.limit = 5

.scalafmt.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "3.5.8"
1+
version = "3.6.1"
22
runner.dialect = scala213
33
maxColumn = 100
44
docstrings.style = Asterisk

backend/src/main/scala/bloop/CompilerCache.scala

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import javax.tools.JavaFileObject.Kind
1414
import javax.tools.{JavaCompiler => JavaxCompiler}
1515

1616
import scala.collection.mutable.HashSet
17-
import scala.concurrent.ExecutionContext
1817

1918
import bloop.CompilerCache.JavacKey
2019
import bloop.io.AbsolutePath
@@ -33,7 +32,6 @@ import sbt.internal.inc.javac.JavaTools
3332
import sbt.internal.inc.javac.Javadoc
3433
import sbt.internal.inc.javac.WriteReportingJavaFileObject
3534
import sbt.internal.util.LoggerWriter
36-
import sbt.librarymanagement.Resolver
3735
import xsbti.ComponentProvider
3836
import xsbti.VirtualFile
3937
import xsbti.compile.ClassFileManager
@@ -49,19 +47,12 @@ object CompilerCache {
4947
}
5048
final class CompilerCache(
5149
componentProvider: ComponentProvider,
52-
retrieveDir: AbsolutePath,
53-
logger: Logger,
54-
userResolvers: List[Resolver],
55-
userScalaCache: Option[ConcurrentHashMap[ScalaInstance, ScalaCompiler]],
56-
userJavacCache: Option[ConcurrentHashMap[JavacKey, JavaCompiler]],
57-
scheduler: ExecutionContext
50+
logger: Logger
5851
) {
5952

60-
private val scalaCompilerCache =
61-
userScalaCache.getOrElse(new ConcurrentHashMap[ScalaInstance, ScalaCompiler]())
53+
private val scalaCompilerCache = new ConcurrentHashMap[ScalaInstance, ScalaCompiler]()
6254

63-
private val javaCompilerCache =
64-
userJavacCache.getOrElse(new ConcurrentHashMap[JavacKey, JavaCompiler]())
55+
private val javaCompilerCache = new ConcurrentHashMap[JavacKey, JavaCompiler]()
6556

6657
def get(
6758
scalaInstance: ScalaInstance,
@@ -88,12 +79,7 @@ final class CompilerCache(
8879
private[bloop] def withLogger(logger: Logger): CompilerCache = {
8980
new CompilerCache(
9081
componentProvider,
91-
retrieveDir,
92-
logger,
93-
userResolvers,
94-
userScalaCache,
95-
userJavacCache,
96-
scheduler
82+
logger
9783
)
9884
}
9985

backend/src/main/scala/bloop/task/Task.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import scala.util.Success
1212
import scala.util.Try
1313

1414
import monix.eval.{Task => MonixTask}
15+
import monix.execution.Callback
1516
import monix.execution.Cancelable
1617
import monix.execution.CancelableFuture
1718
import monix.execution.Scheduler
18-
import monix.execution.Callback
1919

2020
/**
2121
* This task was introduced as a compatibilty layer to ublock bloop migration from monix2.

backend/src/main/scala/sbt/internal/inc/bloop/internal/BloopNameHashing.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package sbt.internal.inc.bloop.internal
22

33
import scala.collection.parallel.immutable.ParVector
4+
45
import bloop.task.Task
56

67
import _root_.bloop.UniqueCompileInputs

backend/src/main/scala/sbt/internal/inc/bloop/internal/BloopStamps.scala

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ import xsbti.compile.analysis.Stamp
1515

1616
object BloopStamps {
1717
private val converter = PlainVirtualFileConverter.converter
18-
def initial: ReadStamps = {
19-
Stamps.initial(
20-
Stamper.forLastModifiedInRootPaths(converter),
21-
// The hash is for the sources
22-
BloopStamps.forHash,
23-
Stamper.forHashInRootPaths(converter)
24-
)
25-
}
18+
19+
private def underlying = Stamps.initial(
20+
BloopStamps.forHash,
21+
// The hash is for the sources
22+
BloopStamps.forHash,
23+
Stamper.forHashInRootPaths(converter)
24+
)
25+
def initial: ReadStamps = Stamps.timeWrapBinaryStamps(underlying, converter)
2626

2727
private final val emptyHash = scala.util.Random.nextInt()
2828
private final val directoryHash = scala.util.Random.nextInt()
@@ -34,8 +34,11 @@ object BloopStamps {
3434
def directoryHash(path: Path): FileHash = FileHash.of(path, directoryHash)
3535
def isDirectoryHash(fh: FileHash): Boolean = fh.hash == directoryHash
3636

37-
def forHash(file: VirtualFileRef): Hash = {
38-
fromBloopHashToZincHash(ByteHasher.hashFileContents(converter.toPath(file).toFile()))
37+
def forHash(fileRef: VirtualFileRef): Hash = {
38+
val file = converter.toPath(fileRef).toFile()
39+
if (file.exists())
40+
fromBloopHashToZincHash(ByteHasher.hashFileContents(file))
41+
else fromBloopHashToZincHash(0)
3942
}
4043

4144
def emptyStamps: Stamp = EmptyStamp

backend/src/test/scala/bloop/CompilerCacheSpec.scala

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import javax.tools.DiagnosticListener
88
import javax.tools.JavaFileObject
99
import javax.tools.StandardLocation
1010

11-
import scala.concurrent.ExecutionContext
12-
1311
import bloop.io.AbsolutePath
1412
import bloop.io.Paths
1513
import bloop.logging.RecordingLogger
@@ -77,8 +75,7 @@ class CompilerCacheSpec {
7775
val wr2 = new WriteReportingJavaFileObject(fo2, classFileManager)
7876
val wr3 = new WriteReportingJavaFileObject(fo3, classFileManager)
7977

80-
val ec = ExecutionContext.global
81-
val compilerCache = new CompilerCache(null, tempDir, logger, List.empty, None, None, ec)
78+
val compilerCache = new CompilerCache(null, logger)
8279
val bloopCompiler = new compilerCache.BloopJavaCompiler(compiler)
8380
val invalidatingFileManager =
8481
new bloopCompiler.BloopInvalidatingFileManager(javacFileManager, classFileManager)
@@ -135,12 +132,11 @@ class CompilerCacheSpec {
135132
private def withCompilerCache(op: CompilerCache => Unit): Unit = {
136133
val tempDir = AbsolutePath(Files.createTempDirectory("compiler-cache-spec"))
137134
try {
138-
val ec = ExecutionContext.global
139135
val logger = new RecordingLogger()
140136
val componentProvider =
141137
BloopComponentCompiler.getComponentProvider(tempDir.resolve("components"))
142138
val compilerCache =
143-
new CompilerCache(componentProvider, tempDir, logger, List.empty, None, None, ec)
139+
new CompilerCache(componentProvider, logger)
144140
op(compilerCache)
145141
} finally {
146142
Paths.delete(tempDir)

build.sbt

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ lazy val shared = project
6262
sonatypeSetting,
6363
name := "bloop-shared",
6464
libraryDependencies ++= Seq(
65-
Dependencies.bsp4s,
65+
Dependencies.jsoniterCore,
66+
Dependencies.jsoniterMacros,
67+
Dependencies.bsp4s excludeAll ExclusionRule(
68+
organization = "com.github.plokhotnyuk.jsoniter-scala"
69+
),
6670
Dependencies.coursierInterface,
6771
Dependencies.zinc,
6872
Dependencies.log4j,
@@ -84,10 +88,12 @@ lazy val backend = project
8488
sonatypeSetting,
8589
name := "bloop-backend",
8690
buildInfoPackage := "bloop.internal.build",
87-
buildInfoKeys := BloopBackendInfoKeys,
91+
buildInfoKeys := Seq[BuildInfoKey](
92+
Keys.scalaVersion,
93+
Keys.scalaOrganization
94+
),
8895
buildInfoObject := "BloopScalaInfo",
8996
libraryDependencies ++= List(
90-
Dependencies.javaDebug,
9197
Dependencies.nailgun,
9298
Dependencies.scalazCore,
9399
Dependencies.scalazConcurrent,
@@ -117,27 +123,6 @@ val testResourceSettings = {
117123
})
118124
}
119125

120-
// Needs to be called `jsonConfig` because of naming conflict with sbt universe...
121-
lazy val config = project
122-
.disablePlugins(ScalafixPlugin)
123-
.settings(
124-
sonatypeSetting,
125-
name := "bloop-config",
126-
crossScalaVersions := Seq(Dependencies.Scala212Version, Dependencies.Scala213Version),
127-
scalacOptions := {
128-
scalacOptions.value.filterNot(opt => opt == "-deprecation"),
129-
},
130-
testResourceSettings,
131-
testSettings,
132-
libraryDependencies ++= {
133-
List(
134-
Dependencies.jsoniterCore,
135-
Dependencies.jsoniterMacros % Provided,
136-
Dependencies.scalacheck % Test
137-
)
138-
}
139-
)
140-
141126
lazy val tmpDirSettings = Def.settings(
142127
javaOptions in Test += {
143128
val tmpDir = (baseDirectory in ThisBuild).value / "target" / "tests-tmp"
@@ -150,8 +135,7 @@ import build.BuildImplementation.jvmOptions
150135
lazy val frontend: Project = project
151136
.dependsOn(
152137
backend,
153-
backend % "test->test",
154-
config
138+
backend % "test->test"
155139
)
156140
.enablePlugins(BuildInfoPlugin)
157141
.configs(IntegrationTest)
@@ -180,7 +164,18 @@ lazy val frontend: Project = project
180164
bloopName := "bloop",
181165
(Compile / run / mainClass) := Some("bloop.Cli"),
182166
buildInfoPackage := "bloop.internal.build",
183-
buildInfoKeys := bloopInfoKeys(nativeBridge04, jsBridge1),
167+
buildInfoKeys := List[BuildInfoKey](
168+
Keys.organization,
169+
build.BuildKeys.bloopName,
170+
Keys.version,
171+
Keys.scalaVersion,
172+
nailgunClientLocation,
173+
"zincVersion" -> Dependencies.zincVersion,
174+
"bspVersion" -> Dependencies.bspVersion,
175+
"nativeBridge04" -> (nativeBridge04Name + "_" + Keys.scalaBinaryVersion.value),
176+
"jsBridge1" -> (jsBridge1Name + "_" + Keys.scalaBinaryVersion.value),
177+
"snailgunVersion" -> Dependencies.snailgunVersion
178+
),
184179
(run / javaOptions) ++= jvmOptions,
185180
(Test / javaOptions) ++= jvmOptions,
186181
tmpDirSettings,
@@ -193,19 +188,21 @@ lazy val frontend: Project = project
193188
Dependencies.jsoniterMacros % Provided,
194189
Dependencies.caseApp,
195190
Dependencies.scalaDebugAdapter,
191+
Dependencies.bloopConfig,
196192
Dependencies.libdaemonjvm,
197193
Dependencies.logback
198194
)
199195
)
200196

197+
val jsBridge1Name = "bloop-js-bridge-1"
201198
lazy val jsBridge1 = project
202199
.dependsOn(frontend % Provided, frontend % "test->test")
203200
.in(file("bridges") / "scalajs-1")
204201
.disablePlugins(ScalafixPlugin)
205202
.settings(testSettings)
206203
.settings(
207204
sonatypeSetting,
208-
name := "bloop-js-bridge-1",
205+
name := jsBridge1Name,
209206
libraryDependencies ++= List(
210207
Dependencies.scalaJsLinker1,
211208
Dependencies.scalaJsLogging1,
@@ -216,14 +213,15 @@ lazy val jsBridge1 = project
216213
)
217214
)
218215

216+
val nativeBridge04Name = "bloop-native-bridge-0-4"
219217
lazy val nativeBridge04 = project
220218
.dependsOn(frontend % Provided, frontend % "test->test")
221219
.in(file("bridges") / "scala-native-0.4")
222220
.disablePlugins(ScalafixPlugin)
223221
.settings(testSettings)
224222
.settings(
225223
sonatypeSetting,
226-
name := "bloop-native-bridge-0.4",
224+
name := nativeBridge04Name,
227225
libraryDependencies += Dependencies.scalaNativeTools04,
228226
(Test / javaOptions) ++= jvmOptions,
229227
(Test / fork) := true

0 commit comments

Comments
 (0)