Skip to content

Commit d6bea06

Browse files
authored
Merge pull request #15794 from dwijnand/bp/bridgeChanges
2 parents 07d6c8d + a541401 commit d6bea06

File tree

19 files changed

+65
-28
lines changed

19 files changed

+65
-28
lines changed
Submodule cats updated 942 files
Submodule fs2 updated 118 files
Submodule http4s updated 577 files
Submodule scalacheck updated 88 files

community-build/src/scala/dotty/communitybuild/projects.scala

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ final case class SbtCommunityProject(
140140
case Some(ivyHome) => List(s"-Dsbt.ivy.home=$ivyHome")
141141
case _ => Nil
142142
extraSbtArgs ++ sbtProps ++ List(
143-
"-sbt-version", "1.6.2",
143+
"-sbt-version", "1.7.1",
144144
"-Dsbt.supershell=false",
145145
s"-Ddotty.communitybuild.dir=$communitybuildDir",
146146
s"--addPluginSbtFile=$sbtPluginFilePath"
@@ -265,9 +265,8 @@ object projects:
265265

266266
lazy val scalacheck = SbtCommunityProject(
267267
project = "scalacheck",
268-
sbtTestCommand = "jvm/test;js/test",
269-
sbtPublishCommand = "jvm/publishLocal;js/publishLocal",
270-
sbtDocCommand = forceDoc("jvm")
268+
sbtTestCommand = "coreJVM/test;coreJS/test",
269+
sbtPublishCommand = "coreJVM/publishLocal;coreJS/publishLocal"
271270
)
272271

273272
lazy val scalatest: SbtCommunityProject = SbtCommunityProject(
@@ -506,10 +505,8 @@ object projects:
506505

507506
lazy val scalaJava8Compat = SbtCommunityProject(
508507
project = "scala-java8-compat",
509-
// the fnGen subproject must be built with 2.12.x
510-
sbtTestCommand = s"++2.12.14; ++$compilerVersion; set fnGen/dependencyOverrides := Nil; test",
511-
sbtPublishCommand = s"++2.12.14; ++$compilerVersion; set fnGen/dependencyOverrides := Nil; publishLocal",
512-
scalacOptions = Nil // avoid passing Scala 3 options to Scala 2.12 in fnGen subproject
508+
sbtTestCommand = "test",
509+
sbtPublishCommand = "publishLocal",
513510
)
514511

515512
lazy val verify = SbtCommunityProject(
@@ -550,8 +547,8 @@ object projects:
550547

551548
lazy val cats = SbtCommunityProject(
552549
project = "cats",
553-
sbtTestCommand = "set Global/scalaJSStage := FastOptStage;buildJVM;validateAllJS",
554-
sbtPublishCommand = "catsJVM/publishLocal;catsJS/publishLocal",
550+
sbtTestCommand = "set Global/scalaJSStage := FastOptStage;rootJVM/test;rootJS/test",
551+
sbtPublishCommand = "rootJVM/publishLocal;rootJS/publishLocal",
555552
dependencies = List(discipline, disciplineMunit, scalacheck, simulacrumScalafixAnnotations),
556553
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init") // disable -Ysafe-init, due to -Xfatal-warning
557554

@@ -755,7 +752,7 @@ object projects:
755752

756753
lazy val http4s = SbtCommunityProject(
757754
project = "http4s",
758-
sbtTestCommand = "tests/test; server/test; client/test; ember-core/test; ember-server/test; ember-client/test; circe/test",
755+
sbtTestCommand = """set ThisBuild / tlFatalWarnings := false; server/test; client/test; ember-core/test; ember-server/test; ember-client/test; circe/test""",
759756
sbtPublishCommand = "publishLocal",
760757
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init"),
761758
dependencies = List(cats, catsEffect3, fs2, disciplineMunit, scalacheckEffect)

project/Dependencies.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ object Dependencies {
2525
"com.vladsch.flexmark" % "flexmark-ext-yaml-front-matter" % flexmarkVersion,
2626
)
2727

28-
val newCompilerInterface = "org.scala-sbt" % "compiler-interface" % "1.4.3"
28+
val newCompilerInterface = "org.scala-sbt" % "compiler-interface" % "1.7.1"
2929
val oldCompilerInterface = "org.scala-sbt" % "compiler-interface" % "1.3.5"
3030
}

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.6.2
1+
sbt.version=1.7.1

sbt-bridge/src/dotty/tools/xsbt/DelegatingReporter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ public void doReport(Diagnostic dia, Context ctx) {
3939
StringBuilder rendered = new StringBuilder();
4040
rendered.append(messageAndPos(dia, ctx));
4141
Message message = dia.msg();
42+
String diagnosticCode = String.valueOf(message.errorId().errorNumber());
4243
boolean shouldExplain = Diagnostic.shouldExplain(dia, ctx);
4344
if (shouldExplain && !message.explanation().isEmpty()) {
4445
rendered.append(explanation(message, ctx));
4546
}
4647

47-
delegate.log(new Problem(position, message.msg(), severity, rendered.toString()));
48+
delegate.log(new Problem(position, message.msg(), severity, rendered.toString(), diagnosticCode));
4849
}
4950

5051
private static Severity severityOf(int level) {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package dotty.tools.xsbt;
2+
3+
import java.util.Optional;
4+
5+
final public class DiagnosticCode implements xsbti.DiagnosticCode {
6+
private final String _code;
7+
private final Optional<String> _explanation;
8+
9+
public DiagnosticCode(String code, Optional<String> explanation) {
10+
super();
11+
this._code = code;
12+
this._explanation = explanation;
13+
}
14+
15+
public String code() {
16+
return _code;
17+
}
18+
19+
public Optional<String> explanation() {
20+
return _explanation;
21+
}
22+
23+
}

sbt-bridge/src/dotty/tools/xsbt/Problem.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ final public class Problem implements xsbti.Problem {
99
private final String _message;
1010
private final Severity _severity;
1111
private final Optional<String> _rendered;
12+
private final String _diagnosticCode;
1213

13-
public Problem(Position position, String message, Severity severity, String rendered) {
14+
public Problem(Position position, String message, Severity severity, String rendered, String diagnosticCode) {
1415
super();
1516
this._position = position;
1617
this._message = message;
1718
this._severity = severity;
1819
this._rendered = Optional.of(rendered);
20+
this._diagnosticCode = diagnosticCode;
1921
}
2022

2123
public String category() {
@@ -38,8 +40,17 @@ public Optional<String> rendered() {
3840
return _rendered;
3941
}
4042

43+
public Optional<xsbti.DiagnosticCode> diagnosticCode() {
44+
// NOTE: It's important for compatibility that we only construct a
45+
// DiagnosticCode here to maintain compatibility with older versions of
46+
// zinc while using this newer version of the compiler. If we would
47+
// contstruct it earlier, you'd end up with ClassNotFoundExceptions for
48+
// DiagnosticCode.
49+
return Optional.of(new DiagnosticCode(_diagnosticCode, Optional.empty()));
50+
}
51+
4152
@Override
4253
public String toString() {
43-
return "Problem(" + _position + ", " + _message + ", " + _severity + ", " + _rendered + ")";
54+
return "Problem(" + _position + ", " + _message + ", " + _severity + ", " + _rendered + ", " + _diagnosticCode + ")";
4455
}
4556
}

sbt-test/compilerReporter/simple/project/Reporter.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ object Reporter {
3636
assert(line.isPresent() == true)
3737
assert(line.get() == 9)
3838

39+
val diagnosticCode = mainProblem.diagnosticCode()
40+
assert(diagnosticCode.isPresent() == true)
41+
val code = diagnosticCode.get()
42+
assert(diagnosticCode.get().code() == "6")
43+
3944
val pointer = mainProblem.position().pointer()
4045
assert(pointer.isPresent() == true)
4146
assert(pointer.get() == 10)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.6.2
1+
sbt.version=1.7.1

semanticdb/project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.6.2
1+
sbt.version=1.7.1
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.6.2
1+
sbt.version=1.7.1
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.6.2
1+
sbt.version=1.7.1

0 commit comments

Comments
 (0)