Skip to content

Commit

Permalink
Merge pull request #15794 from dwijnand/bp/bridgeChanges
Browse files Browse the repository at this point in the history
  • Loading branch information
dwijnand authored Aug 3, 2022
2 parents 07d6c8d + a541401 commit d6bea06
Show file tree
Hide file tree
Showing 19 changed files with 65 additions and 28 deletions.
2 changes: 1 addition & 1 deletion community-build/community-projects/cats
Submodule cats updated 942 files
2 changes: 1 addition & 1 deletion community-build/community-projects/discipline
2 changes: 1 addition & 1 deletion community-build/community-projects/fs2
Submodule fs2 updated 118 files
2 changes: 1 addition & 1 deletion community-build/community-projects/http4s
Submodule http4s updated 577 files
2 changes: 1 addition & 1 deletion community-build/community-projects/scalacheck
Submodule scalacheck updated 88 files
+343 −61 .github/workflows/ci.yml
+1 −1 .github/workflows/clean.yml
+3 −0 README.markdown
+80 −225 build.sbt
+0 −0 core/js/src/main/scala/org/scalacheck/Platform.scala
+0 −0 core/js/src/main/scala/org/scalacheck/time/JavaTimeArbitrary.scala
+0 −0 core/js/src/main/scala/org/scalacheck/time/JavaTimeChoose.scala
+0 −0 core/js/src/main/scala/org/scalacheck/time/JavaTimeCogen.scala
+0 −0 core/js/src/main/scala/org/scalacheck/time/JavaTimeShrink.scala
+0 −0 core/jvm/src/main/scala/org/scalacheck/Platform.scala
+5 −8 core/jvm/src/main/scala/org/scalacheck/time/JavaTimeArbitrary.scala
+0 −0 core/jvm/src/main/scala/org/scalacheck/time/JavaTimeChoose.scala
+0 −0 core/jvm/src/main/scala/org/scalacheck/time/JavaTimeCogen.scala
+0 −0 core/jvm/src/main/scala/org/scalacheck/time/JavaTimeShrink.scala
+7 −1 core/jvm/src/test/scala/org/scalacheck/ArbitrarySpecification.scala
+0 −0 core/jvm/src/test/scala/org/scalacheck/ChooseSpecification.scala
+0 −0 core/jvm/src/test/scala/org/scalacheck/CogenSpecification.scala
+1 −1 core/jvm/src/test/scala/org/scalacheck/GenSpecification.scala
+0 −0 core/jvm/src/test/scala/org/scalacheck/LazyPropertiesSpecification.scala
+0 −0 core/jvm/src/test/scala/org/scalacheck/PropertyFilterSpecification.scala
+8 −20 core/jvm/src/test/scala/org/scalacheck/SerializabilitySpecification.scala
+0 −0 core/jvm/src/test/scala/org/scalacheck/ShrinkSpecificationJVM.scala
+0 −0 core/jvm/src/test/scala/org/scalacheck/TestAll.scala
+0 −0 core/jvm/src/test/scala/org/scalacheck/TestSpecification.scala
+137 −0 core/jvm/src/test/scala/org/scalacheck/commands/CommandsShrinkSpecification.scala
+0 −0 core/jvm/src/test/scala/org/scalacheck/commands/CommandsSpecification.scala
+0 −0 core/jvm/src/test/scala/org/scalacheck/examples/IntMapSpec.scala
+0 −0 core/jvm/src/test/scala/org/scalacheck/examples/StringUtils.scala
+0 −0 core/jvm/src/test/scala/org/scalacheck/rng/SeedSpecification.scala
+0 −0 core/jvm/src/test/scala/org/scalacheck/time/ShrinkSpecification.scala
+0 −0 core/native/src/main/scala/org/scalacheck/Platform.scala
+0 −0 core/native/src/main/scala/org/scalacheck/time/JavaTimeArbitrary.scala
+0 −0 core/native/src/main/scala/org/scalacheck/time/JavaTimeChoose.scala
+0 −0 core/native/src/main/scala/org/scalacheck/time/JavaTimeCogen.scala
+0 −0 core/native/src/main/scala/org/scalacheck/time/JavaTimeShrink.scala
+0 −0 core/shared/src/main/scala-2.13+/org/scalacheck/ScalaVersionSpecific.scala
+0 −0 core/shared/src/main/scala-2.13+/org/scalacheck/util/BuildableVersionSpecific.scala
+0 −0 core/shared/src/main/scala-2.13-/org/scalacheck/ScalaVersionSpecific.scala
+0 −0 core/shared/src/main/scala-2.13-/org/scalacheck/util/BuildableVersionSpecific.scala
+65 −36 core/shared/src/main/scala/org/scalacheck/Arbitrary.scala
+0 −0 core/shared/src/main/scala/org/scalacheck/Cogen.scala
+4 −4 core/shared/src/main/scala/org/scalacheck/Gen.scala
+0 −0 core/shared/src/main/scala/org/scalacheck/Prop.scala
+1 −1 core/shared/src/main/scala/org/scalacheck/Properties.scala
+0 −0 core/shared/src/main/scala/org/scalacheck/ScalaCheckFramework.scala
+0 −0 core/shared/src/main/scala/org/scalacheck/Shrink.scala
+0 −0 core/shared/src/main/scala/org/scalacheck/Test.scala
+29 −1 core/shared/src/main/scala/org/scalacheck/commands/Commands.scala
+0 −0 core/shared/src/main/scala/org/scalacheck/rng/Seed.scala
+3 −1 core/shared/src/main/scala/org/scalacheck/util/Buildable.scala
+0 −0 core/shared/src/main/scala/org/scalacheck/util/CmdLineParser.scala
+0 −0 core/shared/src/main/scala/org/scalacheck/util/ConsoleReporter.scala
+0 −0 core/shared/src/main/scala/org/scalacheck/util/FreqMap.scala
+0 −0 core/shared/src/main/scala/org/scalacheck/util/Pretty.scala
+0 −0 core/shared/src/test/scala-2.13+/org/scalacheck/time/OrderingVersionSpecific.scala
+0 −0 core/shared/src/test/scala-2.13-/org/scalacheck/time/OrderingVersionSpecific.scala
+1 −1 core/shared/src/test/scala/org/scalacheck/NoPropertyNestingSpecification.scala
+0 −0 core/shared/src/test/scala/org/scalacheck/PropSpecification.scala
+4 −4 core/shared/src/test/scala/org/scalacheck/ShrinkSpecification.scala
+0 −0 core/shared/src/test/scala/org/scalacheck/StatsSpecification.scala
+0 −0 core/shared/src/test/scala/org/scalacheck/TestFingerprint.scala
+0 −0 core/shared/src/test/scala/org/scalacheck/examples/Examples.scala
+0 −0 core/shared/src/test/scala/org/scalacheck/examples/MathSpec.scala
+0 −0 core/shared/src/test/scala/org/scalacheck/util/BuildableSpecification.scala
+0 −0 core/shared/src/test/scala/org/scalacheck/util/PrettySpecification.scala
+0 −0 core/shared/src/test/scala/scala/StringSpecification.scala
+2 −2 examples/commands-leveldb/build.sbt
+1 −1 examples/commands-leveldb/project/build.properties
+2 −2 examples/commands-leveldb/src/test/scala/CommandsLevelDB.scala
+2 −2 examples/commands-nix/build.sbt
+1 −1 examples/commands-nix/project/build.properties
+2 −2 examples/commands-nix/src/test/scala/CommandsNix.scala
+4 −4 examples/commands-redis/build.sbt
+1 −1 examples/commands-redis/project/build.properties
+3 −3 examples/commands-redis/src/test/scala/CommandsRedis.scala
+1 −1 examples/scalajs/README.md
+2 −2 examples/scalajs/build.sbt
+1 −1 examples/scalajs/project/build.properties
+1 −1 examples/scalajs/project/plugins.sbt
+1 −1 examples/scalajs/src/test/scala/example/ScalaJSExampleTest.scala
+2 −2 examples/simple-sbt/build.sbt
+1 −1 examples/simple-sbt/project/build.properties
+1 −1 examples/simple-sbt/src/test/scala/Demo.scala
+0 −30 project/MimaSettings.scala
+1 −1 project/build.properties
+8 −19 project/plugin.sbt
+0 −59 release.sh
+0 −18 tools/travis-script.sh
19 changes: 8 additions & 11 deletions community-build/src/scala/dotty/communitybuild/projects.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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.6.2",
"-sbt-version", "1.7.1",
"-Dsbt.supershell=false",
s"-Ddotty.communitybuild.dir=$communitybuildDir",
s"--addPluginSbtFile=$sbtPluginFilePath"
Expand Down Expand Up @@ -265,9 +265,8 @@ object projects:

lazy val scalacheck = SbtCommunityProject(
project = "scalacheck",
sbtTestCommand = "jvm/test;js/test",
sbtPublishCommand = "jvm/publishLocal;js/publishLocal",
sbtDocCommand = forceDoc("jvm")
sbtTestCommand = "coreJVM/test;coreJS/test",
sbtPublishCommand = "coreJVM/publishLocal;coreJS/publishLocal"
)

lazy val scalatest: SbtCommunityProject = SbtCommunityProject(
Expand Down Expand Up @@ -506,10 +505,8 @@ object projects:

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

lazy val verify = SbtCommunityProject(
Expand Down Expand Up @@ -550,8 +547,8 @@ object projects:

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

Expand Down Expand Up @@ -755,7 +752,7 @@ object projects:

lazy val http4s = SbtCommunityProject(
project = "http4s",
sbtTestCommand = "tests/test; server/test; client/test; ember-core/test; ember-server/test; ember-client/test; circe/test",
sbtTestCommand = """set ThisBuild / tlFatalWarnings := false; server/test; client/test; ember-core/test; ember-server/test; ember-client/test; circe/test""",
sbtPublishCommand = "publishLocal",
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Ysafe-init"),
dependencies = List(cats, catsEffect3, fs2, disciplineMunit, scalacheckEffect)
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ object Dependencies {
"com.vladsch.flexmark" % "flexmark-ext-yaml-front-matter" % flexmarkVersion,
)

val newCompilerInterface = "org.scala-sbt" % "compiler-interface" % "1.4.3"
val newCompilerInterface = "org.scala-sbt" % "compiler-interface" % "1.7.1"
val oldCompilerInterface = "org.scala-sbt" % "compiler-interface" % "1.3.5"
}
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.6.2
sbt.version=1.7.1
3 changes: 2 additions & 1 deletion sbt-bridge/src/dotty/tools/xsbt/DelegatingReporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ public void doReport(Diagnostic dia, Context ctx) {
StringBuilder rendered = new StringBuilder();
rendered.append(messageAndPos(dia, ctx));
Message message = dia.msg();
String diagnosticCode = String.valueOf(message.errorId().errorNumber());
boolean shouldExplain = Diagnostic.shouldExplain(dia, ctx);
if (shouldExplain && !message.explanation().isEmpty()) {
rendered.append(explanation(message, ctx));
}

delegate.log(new Problem(position, message.msg(), severity, rendered.toString()));
delegate.log(new Problem(position, message.msg(), severity, rendered.toString(), diagnosticCode));
}

private static Severity severityOf(int level) {
Expand Down
23 changes: 23 additions & 0 deletions sbt-bridge/src/dotty/tools/xsbt/DiagnosticCode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package dotty.tools.xsbt;

import java.util.Optional;

final public class DiagnosticCode implements xsbti.DiagnosticCode {
private final String _code;
private final Optional<String> _explanation;

public DiagnosticCode(String code, Optional<String> explanation) {
super();
this._code = code;
this._explanation = explanation;
}

public String code() {
return _code;
}

public Optional<String> explanation() {
return _explanation;
}

}
15 changes: 13 additions & 2 deletions sbt-bridge/src/dotty/tools/xsbt/Problem.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ final public class Problem implements xsbti.Problem {
private final String _message;
private final Severity _severity;
private final Optional<String> _rendered;
private final String _diagnosticCode;

public Problem(Position position, String message, Severity severity, String rendered) {
public Problem(Position position, String message, Severity severity, String rendered, String diagnosticCode) {
super();
this._position = position;
this._message = message;
this._severity = severity;
this._rendered = Optional.of(rendered);
this._diagnosticCode = diagnosticCode;
}

public String category() {
Expand All @@ -38,8 +40,17 @@ public Optional<String> rendered() {
return _rendered;
}

public Optional<xsbti.DiagnosticCode> diagnosticCode() {
// NOTE: It's important for compatibility that we only construct a
// DiagnosticCode here to maintain compatibility with older versions of
// zinc while using this newer version of the compiler. If we would
// contstruct it earlier, you'd end up with ClassNotFoundExceptions for
// DiagnosticCode.
return Optional.of(new DiagnosticCode(_diagnosticCode, Optional.empty()));
}

@Override
public String toString() {
return "Problem(" + _position + ", " + _message + ", " + _severity + ", " + _rendered + ")";
return "Problem(" + _position + ", " + _message + ", " + _severity + ", " + _rendered + ", " + _diagnosticCode + ")";
}
}
5 changes: 5 additions & 0 deletions sbt-test/compilerReporter/simple/project/Reporter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ object Reporter {
assert(line.isPresent() == true)
assert(line.get() == 9)

val diagnosticCode = mainProblem.diagnosticCode()
assert(diagnosticCode.isPresent() == true)
val code = diagnosticCode.get()
assert(diagnosticCode.get().code() == "6")

val pointer = mainProblem.position().pointer()
assert(pointer.isPresent() == true)
assert(pointer.get() == 10)
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.6.2
sbt.version=1.7.1
2 changes: 1 addition & 1 deletion semanticdb/project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.6.2
sbt.version=1.7.1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.6.2
sbt.version=1.7.1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.6.2
sbt.version=1.7.1

2 comments on commit d6bea06

@michelou
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dwijnand Line 41 in source file simple/project/Reporter.java is useless right ?!

@dwijnand
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is.

Please sign in to comment.