Skip to content

Commit

Permalink
Add getSourceInfos similar to sbt#1226
Browse files Browse the repository at this point in the history
  • Loading branch information
Friendseeker committed Sep 27, 2024
1 parent 075d5fc commit 469b96d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ private final class CachedCompiler0(
underlyingReporter: DelegatingReporter,
compileProgress: CompileProgress
): Unit = {
// cast down to AnalysisCallback2
val callback2 = callback.asInstanceOf[xsbti.AnalysisCallback2]
// cast down to AnalysisCallback3
val callback3 = callback.asInstanceOf[xsbti.AnalysisCallback3]

compiler.set(callback, underlyingReporter)
if (command.shouldStopWithInfo) {
Expand All @@ -177,7 +177,7 @@ private final class CachedCompiler0(
run.compileFiles(sources)
processUnreportedWarnings(run)
underlyingReporter.problems.foreach(p =>
callback2.problem2(
callback3.problem2(
p.category,
p.position,
p.message,
Expand All @@ -193,7 +193,7 @@ private final class CachedCompiler0(

underlyingReporter.printSummary()
if (!noErrors(underlyingReporter)) {
val infos = callback.getSourceInfos
val infos = callback3.getSourceInfos
handleErrors(infos, log)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
package xsbti;

import xsbti.api.DependencyContext;
import xsbti.compile.analysis.ReadSourceInfos;

import java.io.File;
import java.nio.file.Path;
Expand Down Expand Up @@ -261,6 +260,4 @@ void problem(String what,
boolean isPickleJava();

Optional<T2<Path, Path>> getPickleJarPair();

ReadSourceInfos getSourceInfos();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Zinc - The incremental compiler for Scala.
* Copyright Scala Center, Lightbend, and Mark Harrah
*
* Licensed under Apache License 2.0
* SPDX-License-Identifier: Apache-2.0
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/

package xsbti;
import xsbti.compile.analysis.ReadSourceInfos;

/**
* Extension to AnalysisCallback2
* refer to AnalysisCallback2.java for explanation
*/
public interface AnalysisCallback3 extends AnalysisCallback2 {
ReadSourceInfos getSourceInfos();
}
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ private final class AnalysisCallback(
progress: Option[CompileProgress],
incHandlerOpt: Option[Incremental.IncrementalCallback],
log: Logger
) extends xsbti.AnalysisCallback2 {
) extends xsbti.AnalysisCallback3 {
import Incremental.CompileCycleResult

// This must have a unique value per AnalysisCallback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import xsbti.compile.analysis.ReadSourceInfos

import scala.collection.mutable.ArrayBuffer

class TestCallback extends AnalysisCallback2 {
class TestCallback extends AnalysisCallback3 {
case class TestUsedName(name: String, scopes: ju.EnumSet[UseScope])

val classDependencies = new ArrayBuffer[(String, String, DependencyContext)]
Expand Down

0 comments on commit 469b96d

Please sign in to comment.