Skip to content

Commit d3b3f86

Browse files
authored
Merge pull request #146 from tgodzik/updates
Update fork with all the newest changes
2 parents 4fbabb6 + f33c8f0 commit d3b3f86

61 files changed

Lines changed: 1024 additions & 872 deletions

File tree

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ jobs:
6767
.github/setup-test-projects.sh &&\
6868
./mill -i 'backend[_].test.compile' &&\
6969
./mill -i 'frontend[_].test.compile' &&\
70-
./mill -i 'backend[2.12.17].test' &&\
71-
./mill -i 'frontend[2.12.17].test'
70+
./mill -i 'backend[2.12.18].test' &&\
71+
./mill -i 'frontend[2.12.18].test'
7272
shell: bash
7373

7474
jvm-tests:

.scalafmt.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "3.7.3"
1+
version = "3.7.8"
22

33
align.preset = more
44
maxColumn = 100

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ final class BloopClassFileManager(
200200
}
201201

202202
def complete(success: Boolean): Unit = {
203+
204+
val deleteAfterCompilation = Task { BloopPaths.delete(AbsolutePath(backupDir)) }
203205
if (success) {
204206
dependentClassFilesLinks.foreach { unnecessaryClassFileLink =>
205207
Files.deleteIfExists(unnecessaryClassFileLink)
@@ -219,12 +221,14 @@ final class BloopClassFileManager(
219221
newClassesDir,
220222
clientExternalClassesDir.underlying,
221223
inputs.ioScheduler,
222-
enableCancellation = false
224+
enableCancellation = false,
225+
inputs.logger
223226
)
224227
.map { walked =>
225228
readOnlyCopyDenylist.++=(walked.target)
226229
()
227230
}
231+
.flatMap(_ => deleteAfterCompilation)
228232
}
229233
}
230234
)
@@ -247,7 +251,9 @@ final class BloopClassFileManager(
247251
// Delete all compilation products generated in the new classes directory
248252
val deleteNewDir = Task { BloopPaths.delete(AbsolutePath(newClassesDir)); () }.memoize
249253
backgroundTasksForFailedCompilation.+=((_, _, clientTracer: BraveTracer) => {
250-
clientTracer.traceTask("delete class files after")(_ => deleteNewDir)
254+
clientTracer.traceTask("delete class files after")(_ =>
255+
deleteNewDir.flatMap(_ => deleteAfterCompilation)
256+
)
251257
})
252258

253259
backgroundTasksForFailedCompilation.+=(
@@ -274,13 +280,15 @@ final class BloopClassFileManager(
274280
Paths.get(readOnlyClassesDirPath),
275281
clientExternalClassesDir.underlying,
276282
inputs.ioScheduler,
277-
enableCancellation = false
283+
enableCancellation = false,
284+
inputs.logger
278285
)
279286
.map(_ => ())
280287
}
281288
}
282289
)
283290
}
291+
284292
}
285293

286294
private def move(c: File): File = {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,8 @@ object Compiler {
434434
readOnlyClassesDir,
435435
clientClassesDir.underlying,
436436
compileInputs.ioScheduler,
437-
enableCancellation = false
437+
enableCancellation = false,
438+
compileInputs.logger
438439
)
439440

440441
lastCopy.map { _ =>

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import monix.execution.cancelables.CompositeCancelable
2222
import monix.reactive.Consumer
2323
import monix.reactive.MulticastStrategy
2424
import monix.reactive.Observable
25+
import bloop.logging.Logger
26+
import scala.util.control.NonFatal
2527

2628
object ParallelOps {
2729

@@ -67,7 +69,8 @@ object ParallelOps {
6769
origin: Path,
6870
target: Path,
6971
scheduler: Scheduler,
70-
enableCancellation: Boolean
72+
enableCancellation: Boolean,
73+
logger: Logger
7174
): Task[FileWalk] = Task.defer {
7275
val isCancelled = AtomicBoolean(false)
7376

@@ -152,7 +155,7 @@ object ParallelOps {
152155

153156
val copyFileSequentially = Consumer.foreachTask[((Path, BasicFileAttributes), Path)] {
154157
case ((originFile, originAttrs), targetFile) =>
155-
def copy(replaceExisting: Boolean): Unit = {
158+
def copy(replaceExisting: Boolean): Unit = try {
156159
if (replaceExisting) {
157160
Files.copy(
158161
originFile,
@@ -168,6 +171,12 @@ object ParallelOps {
168171
)
169172
}
170173
()
174+
} catch {
175+
case NonFatal(t) =>
176+
logger.report(
177+
s"Unexpected error when copying $originFile to $targetFile, you might need to restart the build server.",
178+
t
179+
)
171180
}
172181

173182
// It's important that this task is not forked for performance reasons

backend/src/main/scala/bloop/reporter/Reporter.scala

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,16 @@ abstract class Reporter(
9494
case _ =>
9595
val mappedPos = p.position
9696
val problemID = if (p.position.sourceFile.isPresent) nextID() else -1
97-
Problem(problemID, p.severity, p.message, mappedPos, p.category, p.diagnosticCode())
97+
Problem(
98+
problemID,
99+
p.severity,
100+
p.message,
101+
mappedPos,
102+
p.category,
103+
p.diagnosticCode(),
104+
p.diagnosticRelatedInformation(),
105+
p.actions()
106+
)
98107
}
99108
}
100109

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ object BloopZincCompiler {
247247
skip: Boolean = false,
248248
incrementalCompilerOptions: IncOptions,
249249
extra: List[(String, String)]
250-
): Task[CompileConfiguration] = Task.now {
250+
)(implicit logger: ObservedLogger[_]): Task[CompileConfiguration] = Task.now {
251251
// Remove directories from classpath hashes, we're only interested in jars
252252
val jarClasspathHashes = BloopLookup.filterOutDirsFromHashedClasspath(classpathHashes)
253253
val compileSetup = MiniSetup.of(
@@ -284,7 +284,7 @@ object BloopZincCompiler {
284284
earlyOutput = None,
285285
// deals with pipelining, not supported yet
286286
earlyAnalysisStore = None,
287-
stamper = BloopStamps.initial
287+
stamper = BloopStamps.initial(logger)
288288
)
289289
}
290290
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ object ZincInternals {
2424
rangePosition.orElse {
2525
for { line <- asIntPos(position.line()) } yield (
2626
line,
27-
asIntPos(position.pointer()).getOrElse(0)
27+
asIntPos(position.pointer()).orElse(asIntPos(position.offset())).getOrElse(0)
2828
)
2929
}
3030
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,10 @@ final class BloopAnalysisCallback(
229229
externalSourceDependency(sourceClassName, targetBinaryClassName, api, context)
230230
case None =>
231231
// dependency is some other binary on the classpath
232-
externalBinaryDependency(classFile, onBinaryName, sourceFile)
232+
val name = classFile.toString()
233+
// avoid binary deps which are not one of those
234+
if (name.endsWith(".class") || name.endsWith(".jar"))
235+
externalBinaryDependency(classFile, onBinaryName, sourceFile)
233236
}
234237
}
235238

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ object BloopIncremental {
4848
}
4949
}
5050

51-
val current = BloopStamps.initial
51+
val current = BloopStamps.initial(log)
5252
val externalAPI = getExternalAPI(lookup)
5353
val previous = previous0 match { case a: Analysis => a }
5454
val previousRelations = previous.relations

0 commit comments

Comments
 (0)