diff --git a/community-build/src/scala/dotty/communitybuild/projects.scala b/community-build/src/scala/dotty/communitybuild/projects.scala index d079bb862253..5a9347aa87c2 100644 --- a/community-build/src/scala/dotty/communitybuild/projects.scala +++ b/community-build/src/scala/dotty/communitybuild/projects.scala @@ -140,7 +140,7 @@ final case class SbtCommunityProject( case Some(ivyHome) => List(s"-Dsbt.ivy.home=$ivyHome") case _ => Nil extraSbtArgs ++ sbtProps ++ List( - "-sbt-version", "1.9.0", + "-sbt-version", "1.9.3", "-Dsbt.supershell=false", s"-Ddotty.communitybuild.dir=$communitybuildDir", s"--addPluginSbtFile=$sbtPluginFilePath" diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 4b2a9e2815be..a1fe972c4c34 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -28,5 +28,5 @@ object Dependencies { "com.vladsch.flexmark" % "flexmark-ext-yaml-front-matter" % flexmarkVersion, ) - val compilerInterface = "org.scala-sbt" % "compiler-interface" % "1.9.0" + val compilerInterface = "org.scala-sbt" % "compiler-interface" % "1.9.3" } diff --git a/project/build.properties b/project/build.properties index 40b3b8e7b655..52413ab79a18 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.0 +sbt.version=1.9.3 diff --git a/sbt-bridge/src/dotty/tools/xsbt/CompilerBridgeDriver.java b/sbt-bridge/src/dotty/tools/xsbt/CompilerBridgeDriver.java index 6a018287ea53..c5c2e0adaef4 100644 --- a/sbt-bridge/src/dotty/tools/xsbt/CompilerBridgeDriver.java +++ b/sbt-bridge/src/dotty/tools/xsbt/CompilerBridgeDriver.java @@ -136,8 +136,23 @@ synchronized public void run(VirtualFile[] sources, AnalysisCallback callback, L doCompile(compiler, sourcesBuffer.toList(), context); for (xsbti.Problem problem: delegate.problems()) { - callback.problem(problem.category(), problem.position(), problem.message(), problem.severity(), - true); + try { + AnalysisCallback2 callback2 = (AnalysisCallback2)callback; + callback2.problem2( + problem.category(), + problem.position(), + problem.message(), + problem.severity(), + true, // reported + problem.rendered(), + problem.diagnosticCode(), + problem.diagnosticRelatedInformation(), + problem.actions() + ); + } catch (NoClassDefFoundError e) { + callback.problem(problem.category(), problem.position(), problem.message(), problem.severity(), + true); + } } } else { delegate.printSummary(); diff --git a/sbt-bridge/test/xsbt/DependencySpecification.scala b/sbt-bridge/test/xsbt/DependencySpecification.scala index a3fec950e120..54d37048dd09 100644 --- a/sbt-bridge/test/xsbt/DependencySpecification.scala +++ b/sbt-bridge/test/xsbt/DependencySpecification.scala @@ -209,4 +209,4 @@ class DependencySpecification { compilerForTesting.extractDependenciesFromSrcs(srcA, srcB, srcC, srcD) classDependencies } -} \ No newline at end of file +} diff --git a/sbt-bridge/test/xsbti/TestCallback.scala b/sbt-bridge/test/xsbti/TestCallback.scala index 0f48ad9a18ef..3398590b169a 100644 --- a/sbt-bridge/test/xsbti/TestCallback.scala +++ b/sbt-bridge/test/xsbti/TestCallback.scala @@ -1,4 +1,4 @@ -/** Copied from https://github.com/sbt/sbt/blob/0.13/interface/src/test/scala/xsbti/TestCallback.scala */ +// Taken from https://github.com/sbt/zinc/blob/aa1c04f445092e87f76aaceee4da61ea0724419e/internal/zinc-testing/src/main/scala/xsbti/TestCallback.scala package xsbti import java.io.File @@ -8,49 +8,95 @@ import xsbti.VirtualFileRef import xsbti.api.ClassLike import xsbti.api.DependencyContext import DependencyContext._ -import java.util.EnumSet +import java.{util => ju} +import ju.Optional + +class TestCallback extends AnalysisCallback2 { + case class TestUsedName(name: String, scopes: ju.EnumSet[UseScope]) -class TestCallback extends AnalysisCallback -{ - case class TestUsedName(name: String, scopes: EnumSet[UseScope]) val classDependencies = new ArrayBuffer[(String, String, DependencyContext)] - val binaryDependencies = new ArrayBuffer[(Path, String, String, VirtualFileRef, DependencyContext)] - val products = new ArrayBuffer[(VirtualFileRef, Path)] - val usedNamesAndScopes = scala.collection.mutable.Map.empty[String, Set[TestUsedName]].withDefaultValue(Set.empty) - val classNames = scala.collection.mutable.Map.empty[VirtualFileRef, Set[(String, String)]].withDefaultValue(Set.empty) - val apis: scala.collection.mutable.Map[VirtualFileRef, Seq[ClassLike]] = scala.collection.mutable.Map.empty + val binaryDependencies = + new ArrayBuffer[(Path, String, String, VirtualFileRef, DependencyContext)] + val productClassesToSources = + scala.collection.mutable.Map.empty[Path, VirtualFileRef] + val usedNamesAndScopes = scala.collection.mutable.Map + .empty[String, Set[TestUsedName]] + .withDefaultValue(Set.empty) + val classNames = scala.collection.mutable.Map + .empty[VirtualFileRef, Set[(String, String)]] + .withDefaultValue(Set.empty) + val apis: scala.collection.mutable.Map[VirtualFileRef, Seq[ClassLike]] = + scala.collection.mutable.Map.empty def usedNames = usedNamesAndScopes.view.mapValues(_.map(_.name)).toMap override def startSource(source: File): Unit = ??? override def startSource(source: VirtualFile): Unit = { - assert(!apis.contains(source), s"startSource can be called only once per source file: $source") + assert( + !apis.contains(source), + s"startSource can be called only once per source file: $source" + ) apis(source) = Seq.empty } - override def binaryDependency(binary: File, name: String, fromClassName: String, source: File, context: DependencyContext): Unit = ??? - override def binaryDependency(binary: Path, name: String, fromClassName: String, source: VirtualFileRef, context: DependencyContext): Unit = { + override def binaryDependency( + binary: File, + name: String, + fromClassName: String, + source: File, + context: DependencyContext + ): Unit = ??? + override def binaryDependency( + binary: Path, + name: String, + fromClassName: String, + source: VirtualFileRef, + context: DependencyContext + ): Unit = { binaryDependencies += ((binary, name, fromClassName, source, context)) } - override def generatedNonLocalClass(source: File, module: File, binaryClassName: String, srcClassName: String): Unit = ??? - override def generatedNonLocalClass(source: VirtualFileRef, module: Path, binaryClassName: String, srcClassName: String): Unit = { - products += ((source, module)) - classNames(source) += ((srcClassName, binaryClassName)) + override def generatedNonLocalClass( + source: File, + module: File, + binaryClassName: String, + srcClassName: String + ): Unit = ??? + + override def generatedNonLocalClass( + sourceFile: VirtualFileRef, + classFile: Path, + binaryClassName: String, + srcClassName: String + ): Unit = { + productClassesToSources += ((classFile, sourceFile)) + classNames(sourceFile) += ((srcClassName, binaryClassName)) () } override def generatedLocalClass(source: File, module: File): Unit = ??? - override def generatedLocalClass(source: VirtualFileRef, module: Path): Unit = { - products += ((source, module)) + override def generatedLocalClass( + sourceFile: VirtualFileRef, + classFile: Path + ): Unit = { + productClassesToSources += ((classFile, sourceFile)) () } - override def classDependency(onClassName: String, sourceClassName: String, context: DependencyContext): Unit = { - if (onClassName != sourceClassName) classDependencies += ((onClassName, sourceClassName, context)) + override def classDependency( + onClassName: String, + sourceClassName: String, + context: DependencyContext + ): Unit = { + if (onClassName != sourceClassName) + classDependencies += ((onClassName, sourceClassName, context)) } - override def usedName(className: String, name: String, scopes: EnumSet[UseScope]): Unit = { + override def usedName( + className: String, + name: String, + scopes: ju.EnumSet[UseScope] + ): Unit = { usedNamesAndScopes(className) += TestUsedName(name, scopes) } @@ -59,7 +105,24 @@ class TestCallback extends AnalysisCallback apis(source) = classApi +: apis(source) } - override def problem(category: String, pos: xsbti.Position, message: String, severity: xsbti.Severity, reported: Boolean): Unit = () + override def problem( + category: String, + pos: xsbti.Position, + message: String, + severity: xsbti.Severity, + reported: Boolean + ): Unit = () + override def problem2( + category: String, + pos: Position, + msg: String, + severity: Severity, + reported: Boolean, + rendered: Optional[String], + diagnosticCode: Optional[xsbti.DiagnosticCode], + diagnosticRelatedInformation: ju.List[xsbti.DiagnosticRelatedInformation], + actions: ju.List[xsbti.Action] + ): Unit = () override def dependencyPhaseCompleted(): Unit = () override def apiPhaseCompleted(): Unit = () override def enabled(): Boolean = true @@ -68,29 +131,39 @@ class TestCallback extends AnalysisCallback override def mainClass(source: VirtualFileRef, className: String): Unit = ??? override def classesInOutputJar(): java.util.Set[String] = ??? - override def getPickleJarPair(): java.util.Optional[xsbti.T2[Path, Path]] = ??? + override def getPickleJarPair(): java.util.Optional[xsbti.T2[Path, Path]] = + ??? override def isPickleJava(): Boolean = ??? } object TestCallback { - case class ExtractedClassDependencies(memberRef: Map[String, Set[String]], - inheritance: Map[String, Set[String]], - localInheritance: Map[String, Set[String]]) + case class ExtractedClassDependencies( + memberRef: Map[String, Set[String]], + inheritance: Map[String, Set[String]], + localInheritance: Map[String, Set[String]] + ) object ExtractedClassDependencies { def fromPairs( - memberRefPairs: collection.Seq[(String, String)], - inheritancePairs: collection.Seq[(String, String)], - localInheritancePairs: collection.Seq[(String, String)] - ): ExtractedClassDependencies = { - ExtractedClassDependencies(pairsToMultiMap(memberRefPairs), + memberRefPairs: collection.Seq[(String, String)], + inheritancePairs: collection.Seq[(String, String)], + localInheritancePairs: collection.Seq[(String, String)] + ): ExtractedClassDependencies = { + ExtractedClassDependencies( + pairsToMultiMap(memberRefPairs), pairsToMultiMap(inheritancePairs), - pairsToMultiMap(localInheritancePairs)) + pairsToMultiMap(localInheritancePairs) + ) } - private def pairsToMultiMap[A, B](pairs: collection.Seq[(A, B)]): Map[A, Set[B]] = { - pairs.groupBy(_._1).view.mapValues(values => values.map(_._2).toSet) - .toMap.withDefaultValue(Set.empty) + private def pairsToMultiMap[A, B]( + pairs: collection.Seq[(A, B)] + ): Map[A, Set[B]] = { + pairs + .groupBy(_._1) + .view + .mapValues(values => values.map(_._2).toSet) + .toMap + .withDefaultValue(Set.empty) } } } - diff --git a/sbt-test/sbt-dotty/dotty-knowledge.i17/project/build.properties b/sbt-test/sbt-dotty/dotty-knowledge.i17/project/build.properties deleted file mode 100644 index 46e43a97ed86..000000000000 --- a/sbt-test/sbt-dotty/dotty-knowledge.i17/project/build.properties +++ /dev/null @@ -1 +0,0 @@ -sbt.version=1.8.2 diff --git a/tests/cmdTest-sbt-tests/sourcepath-with-inline-api-hash/project/build.properties b/tests/cmdTest-sbt-tests/sourcepath-with-inline-api-hash/project/build.properties index 40b3b8e7b655..52413ab79a18 100644 --- a/tests/cmdTest-sbt-tests/sourcepath-with-inline-api-hash/project/build.properties +++ b/tests/cmdTest-sbt-tests/sourcepath-with-inline-api-hash/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.0 +sbt.version=1.9.3 diff --git a/tests/cmdTest-sbt-tests/sourcepath-with-inline/project/build.properties b/tests/cmdTest-sbt-tests/sourcepath-with-inline/project/build.properties index 40b3b8e7b655..52413ab79a18 100644 --- a/tests/cmdTest-sbt-tests/sourcepath-with-inline/project/build.properties +++ b/tests/cmdTest-sbt-tests/sourcepath-with-inline/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.0 +sbt.version=1.9.3