Skip to content

Commit 952a336

Browse files
Merge commit '2a7436083' into merge-upstream
Conflicts: benchmarks/src/main/scala/bloop/HotBloopBenchmark.scala benchmarks/src/main/scala/sbt/HotSbtBenchmark.scala bloop4j/src/main/scala/bloop/bloop4j/api/NakedLowLevelBuildClient.scala bloop4j/src/main/scala/bloop/bloop4j/api/ScalaLowLevelBuildClient.scala bloopgun-core/src/main/scala/bloop/bloopgun/Bloopgun.scala bloopgun-core/src/main/scala/bloop/bloopgun/core/ServerStatus.scala build.sbt buildpress-config/src/main/scala/buildpress/config/Config.scala frontend/src/main/scala/bloop/Bloop.scala frontend/src/test/scala/bloop/BaseCompileSpec.scala frontend/src/test/scala/bloop/DeduplicationSpec.scala frontend/src/test/scala/bloop/bsp/BspClientTest.scala integrations/gradle-bloop/src/test/scala/bloop/integrations/gradle/ConfigGenerationSuite.scala integrations/maven-bloop/src/test/scala/bloop/integrations/maven/MavenConfigGenerationSuite.scala launcher-test/src/test/scala/bloop/launcher/LauncherBaseSuite.scala launcher/src/main/scala/bloop/launcher/bsp/BspBridge.scala
2 parents c76f3e4 + 2a74360 commit 952a336

File tree

107 files changed

+319
-566
lines changed

Some content is hidden

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

107 files changed

+319
-566
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ website/build/bloop-gh-pages/
3434
node_modules/
3535
package-lock.json
3636
.metals/
37+
**/metals.sbt
3738
*.lock
3839
benchmark-bridge/corpus/

backend/src/main/scala/bloop/BloopClassFileManager.scala

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import bloop.io.AbsolutePath
1616
import bloop.io.ParallelOps
1717
import bloop.io.ParallelOps.CopyMode
1818
import bloop.io.{Paths => BloopPaths}
19-
import bloop.reporter.Reporter
2019
import bloop.tracing.BraveTracer
2120

2221
import monix.eval.Task
@@ -210,7 +209,7 @@ final class BloopClassFileManager(
210209
backgroundTasksWhenNewSuccessfulAnalysis.+=(
211210
(
212211
clientExternalClassesDir: AbsolutePath,
213-
clientReporter: Reporter,
212+
_,
214213
clientTracer: BraveTracer
215214
) => {
216215
clientTracer.traceTaskVerbose("copy new products to external classes dir") { _ =>
@@ -220,7 +219,6 @@ final class BloopClassFileManager(
220219
newClassesDir,
221220
clientExternalClassesDir.underlying,
222221
inputs.ioScheduler,
223-
inputs.logger,
224222
enableCancellation = false
225223
)
226224
.map { walked =>
@@ -248,20 +246,14 @@ final class BloopClassFileManager(
248246

249247
// Delete all compilation products generated in the new classes directory
250248
val deleteNewDir = Task { BloopPaths.delete(AbsolutePath(newClassesDir)); () }.memoize
251-
backgroundTasksForFailedCompilation.+=(
252-
(
253-
clientExternalClassesDir: AbsolutePath,
254-
clientReporter: Reporter,
255-
clientTracer: BraveTracer
256-
) => {
257-
clientTracer.traceTask("delete class files after")(_ => deleteNewDir)
258-
}
259-
)
249+
backgroundTasksForFailedCompilation.+=((_, _, clientTracer: BraveTracer) => {
250+
clientTracer.traceTask("delete class files after")(_ => deleteNewDir)
251+
})
260252

261253
backgroundTasksForFailedCompilation.+=(
262254
(
263255
clientExternalClassesDir: AbsolutePath,
264-
clientReporter: Reporter,
256+
_,
265257
clientTracer: BraveTracer
266258
) =>
267259
Task.defer {
@@ -282,7 +274,6 @@ final class BloopClassFileManager(
282274
Paths.get(readOnlyClassesDirPath),
283275
clientExternalClassesDir.underlying,
284276
inputs.ioScheduler,
285-
inputs.logger,
286277
enableCancellation = false
287278
)
288279
.map(_ => ())

backend/src/main/scala/bloop/BloopClasspathEntryLookup.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ final class BloopClasspathEntryLookup(
5151
case null =>
5252
if (entry.isDirectory()) entryHash -> new DirectoryDefinesClass(entry)
5353
else entryHash -> computeDefinesClassForJar
54-
case current @ (cachedHash, cachedDefinesClass) =>
54+
case current @ (cachedHash, _) =>
5555
if (entryHash.hash() == cachedHash.hash()) current
5656
else entryHash -> computeDefinesClassForJar
5757
}
@@ -106,7 +106,7 @@ final class BloopClasspathEntryLookup(
106106
}
107107

108108
private def subDirectory(base: File, parts: Seq[String]): File =
109-
(base /: parts)((b, p) => new File(b, p))
109+
parts.foldLeft(base) { (b, p) => new File(b, p) }
110110

111111
private def components(className: String): (Seq[String], String) = {
112112
assume(!className.isEmpty)

backend/src/main/scala/bloop/Compiler.scala

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import bloop.util.CacheHashCode
2525
import bloop.util.UUIDUtil
2626

2727
import monix.eval.Task
28-
import monix.execution.CancelableFuture
2928
import monix.execution.Scheduler
3029
import sbt.internal.inc.Analysis
3130
import sbt.internal.inc.ConcreteAnalysisContents
@@ -338,13 +337,6 @@ object Compiler {
338337
Setup.create(lookup, skip, cacheFile, compilerCache, incOptions, reporter, progress, empty)
339338
}
340339

341-
def runAggregateTasks(tasks: List[Task[Unit]]): CancelableFuture[Unit] = {
342-
Task
343-
.gatherUnordered(tasks)
344-
.map(_ => ())
345-
.runAsync(compileInputs.ioScheduler)
346-
}
347-
348340
val start = System.nanoTime()
349341
val scalaInstance = compileInputs.scalaInstance
350342
val classpathOptions = compileInputs.classpathOptions
@@ -442,11 +434,10 @@ object Compiler {
442434
readOnlyClassesDir,
443435
clientClassesDir.underlying,
444436
compileInputs.ioScheduler,
445-
compileInputs.logger,
446437
enableCancellation = false
447438
)
448439

449-
lastCopy.map { fs =>
440+
lastCopy.map { _ =>
450441
clientLogger.debug(
451442
s"Finished copying classes from $readOnlyClassesDir to $clientClassesDir"
452443
)

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,7 @@ final class CompilerCache(
127127
componentProvider,
128128
Some(Paths.getCacheDirectory("bridge-cache").toFile),
129129
bridgeSources,
130-
retrieveDir.toFile,
131-
logger,
132-
scheduler
130+
logger
133131
)
134132
}
135133
}

backend/src/main/scala/bloop/DependencyResolution.scala

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ object DependencyResolution {
3434
logger: Logger,
3535
resolveSources: Boolean = false,
3636
additionalRepos: Seq[Repository] = Nil
37-
)(implicit ec: scala.concurrent.ExecutionContext): Array[AbsolutePath] = {
37+
): Array[AbsolutePath] = {
3838
resolveWithErrors(artifacts, logger, resolveSources, additionalRepos) match {
3939
case Right(paths) => paths
4040
case Left(error) => throw error
@@ -54,15 +54,15 @@ object DependencyResolution {
5454
logger: Logger,
5555
resolveSources: Boolean = false,
5656
additionalRepositories: Seq[Repository] = Nil
57-
)(implicit ec: scala.concurrent.ExecutionContext): Either[CoursierError, Array[AbsolutePath]] = {
57+
): Either[CoursierError, Array[AbsolutePath]] = {
5858
val dependencies = artifacts.map { artifact =>
5959
import artifact._
6060
logger.debug(s"Resolving $organization:$module:$version")(DebugFilter.All)
6161
val baseDep = coursierapi.Dependency.of(organization, module, version)
6262
if (resolveSources) baseDep.withClassifier("sources")
6363
else baseDep
6464
}
65-
resolveDependenciesWithErrors(dependencies, logger, resolveSources, additionalRepositories)
65+
resolveDependenciesWithErrors(dependencies, resolveSources, additionalRepositories)
6666
}
6767

6868
/**
@@ -77,11 +77,10 @@ object DependencyResolution {
7777
*/
7878
def resolveDependenciesWithErrors(
7979
dependencies: Seq[coursierapi.Dependency],
80-
logger: Logger,
8180
resolveSources: Boolean = false,
8281
additionalRepositories: Seq[Repository] = Nil
83-
)(implicit ec: scala.concurrent.ExecutionContext): Either[CoursierError, Array[AbsolutePath]] = {
84-
var fetch = coursierapi.Fetch
82+
): Either[CoursierError, Array[AbsolutePath]] = {
83+
val fetch = coursierapi.Fetch
8584
.create()
8685
.withDependencies(dependencies: _*)
8786
if (resolveSources)

backend/src/main/scala/bloop/ScalaInstance.scala

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ final class ScalaInstance private (
124124

125125
object ScalaInstance {
126126
import bloop.io.AbsolutePath
127-
import scala.concurrent.ExecutionContext
128127

129128
private[ScalaInstance] val bootClassLoader: ClassLoader = {
130129
if (!scala.util.Properties.isJavaAtLeast("9")) null
@@ -170,7 +169,7 @@ object ScalaInstance {
170169
scalaVersion: String,
171170
allJars: Seq[AbsolutePath],
172171
logger: Logger
173-
)(implicit ec: ExecutionContext): ScalaInstance = {
172+
): ScalaInstance = {
174173
val jarsKey = allJars.map(_.underlying).sortBy(_.toString).toList
175174
if (allJars.nonEmpty) {
176175
def newInstance = {
@@ -197,7 +196,7 @@ object ScalaInstance {
197196
scalaName: String,
198197
scalaVersion: String,
199198
logger: Logger
200-
)(implicit ec: ExecutionContext): ScalaInstance = {
199+
): ScalaInstance = {
201200
def resolveInstance: ScalaInstance = {
202201
val allPaths = DependencyResolution.resolve(
203202
List(DependencyResolution.Artifact(scalaOrg, scalaName, scalaVersion)),
@@ -237,9 +236,7 @@ object ScalaInstance {
237236
* happen to be so strict as to prevent getting the location from the protected
238237
* domain.
239238
*/
240-
def scalaInstanceForJavaProjects(
241-
logger: Logger
242-
)(implicit ec: ExecutionContext): Option[ScalaInstance] = {
239+
def scalaInstanceForJavaProjects(logger: Logger): Option[ScalaInstance] = {
243240
lazy val tempDirectory = Files.createTempDirectory("bloop-scala-instance")
244241
implicit val filter = DebugFilter.Compilation
245242
def findLocationForClazz(clazz: Class[_], jarName: String): Option[Path] = {
@@ -249,7 +246,7 @@ object ScalaInstance {
249246

250247
try Some(Paths.get(expectedPath))
251248
catch {
252-
case t: java.nio.file.FileSystemNotFoundException =>
249+
case _: java.nio.file.FileSystemNotFoundException =>
253250
// When bloop is bootstrapped by coursier, jars are available from resources instead
254251
logger.debug(
255252
s"Load jar from resource because scheme '${expectedPath.getScheme}' has no file system provider"

backend/src/main/scala/bloop/io/ClasspathHasher.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ object ClasspathHasher {
108108
}
109109
} catch {
110110
// Can happen when a file doesn't exist, for example
111-
case monix.execution.misc.NonFatal(t) => BloopStamps.emptyHash(path)
111+
case monix.execution.misc.NonFatal(_) => BloopStamps.emptyHash(path)
112112
}
113113
classpathHashes(idx) = hash
114114
hashingPromises.remove(path, p)
@@ -152,7 +152,7 @@ object ClasspathHasher {
152152
}
153153
}
154154

155-
tracer.traceTaskVerbose("computing hashes") { tracer =>
155+
tracer.traceTaskVerbose("computing hashes") { _ =>
156156
val acquiredByOtherTasks = new mutable.ListBuffer[Task[Unit]]()
157157
val acquiredByThisHashingProcess = new mutable.ListBuffer[AcquiredTask]()
158158

@@ -189,7 +189,7 @@ object ClasspathHasher {
189189

190190
val initEntries = Task {
191191
classpath.zipWithIndex.foreach {
192-
case t @ (absoluteEntry, idx) =>
192+
case (absoluteEntry, idx) =>
193193
acquireHashingEntry(absoluteEntry.underlying, idx)
194194
}
195195
}.doOnCancel(Task { isCancelled.compareAndSet(false, true); () })
@@ -198,7 +198,7 @@ object ClasspathHasher {
198198
val acquiredTask = Observable.fromIterable(acquiredByThisHashingProcess)
199199

200200
val cancelableAcquiredTask = Task.create[Unit] { (scheduler, cb) =>
201-
val (out, consumerSubscription) = parallelConsumer.createSubscriber(cb, scheduler)
201+
val (out, _) = parallelConsumer.createSubscriber(cb, scheduler)
202202
val _ = acquiredTask.subscribe(out)
203203
Cancelable { () =>
204204
isCancelled.compareAndSet(false, true); ()

backend/src/main/scala/bloop/io/ParallelOps.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import java.util.concurrent.ConcurrentHashMap
1111

1212
import scala.concurrent.Promise
1313

14-
import bloop.logging.Logger
15-
1614
import monix.eval.Task
1715
import monix.execution.Cancelable
1816
import monix.execution.Scheduler
@@ -67,7 +65,6 @@ object ParallelOps {
6765
origin: Path,
6866
target: Path,
6967
scheduler: Scheduler,
70-
logger: Logger,
7168
enableCancellation: Boolean
7269
): Task[FileWalk] = Task.defer {
7370
val isCancelled = AtomicBoolean(false)
@@ -192,7 +189,7 @@ object ParallelOps {
192189
if (!changedMetadata) ()
193190
else copy(replaceExisting = true)
194191
// Can happen when the file does not exist, replace in that case
195-
case Failure(t: IOException) => copy(replaceExisting = true)
192+
case Failure(_: IOException) => copy(replaceExisting = true)
196193
case Failure(t) => throw t
197194
}
198195
case CopyMode.NoReplace =>

backend/src/main/scala/bloop/logging/ProcessLogger.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ class ProcessLogger(underlying: Logger, process: Process) {
2020
private[this] val processErr = process.getErrorStream
2121

2222
def start(): Unit = {
23-
implicit val ctx: DebugFilter = DebugFilter.All
2423
underlying.printDebug("Starting to log output from process...")
2524
new StreamLogger(underlying.info, processOut).start()
2625
new StreamLogger(underlying.error, processErr).start()

0 commit comments

Comments
 (0)