diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 255116c2cf6b..3208ba7e96fc 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -255,7 +255,9 @@ jobs: - bash: | set -euo pipefail eval "$(./dev-env/bin/dade-assist)" - bazel test --config scala_2_13 //libs-scala/ports/... + bazel build --config scala_2_13 //libs-scala/... + # gatling-utils tests fail with a ClassNotFoundException for scala.collection.SeqLike + bazel test --config scala_2_13 -- //libs-scala/... -//libs-scala/gatling-utils/... displayName: 'Build' env: DAML_SDK_RELEASE_VERSION: $(release_tag) diff --git a/bazel_tools/proto.bzl b/bazel_tools/proto.bzl index b17729b2170e..20d211333fe3 100644 --- a/bazel_tools/proto.bzl +++ b/bazel_tools/proto.bzl @@ -10,6 +10,7 @@ load("@io_bazel_rules_scala//scala:scala.bzl", "scala_library") load("@os_info//:os_info.bzl", "is_windows") load("@rules_pkg//:pkg.bzl", "pkg_tar") load("@rules_proto//proto:defs.bzl", "proto_library") +load("@scala_version//:index.bzl", "scala_major_version_suffix") # taken from rules_proto: # https://github.com/stackb/rules_proto/blob/f5d6eea6a4528bef3c1d3a44d486b51a214d61c2/compile.bzl#L369-L393 @@ -177,10 +178,10 @@ def _proto_scala_srcs(name, grpc): def _proto_scala_deps(grpc, proto_deps): return [ "@maven//:com_google_protobuf_protobuf_java", - "@maven//:com_thesamet_scalapb_lenses_2_12", - "@maven//:com_thesamet_scalapb_scalapb_runtime_2_12", + "@maven//:com_thesamet_scalapb_lenses_{}".format(scala_major_version_suffix), + "@maven//:com_thesamet_scalapb_scalapb_runtime_{}".format(scala_major_version_suffix), ] + ([ - "@maven//:com_thesamet_scalapb_scalapb_runtime_grpc_2_12", + "@maven//:com_thesamet_scalapb_scalapb_runtime_grpc_{}".format(scala_major_version_suffix), "@maven//:io_grpc_grpc_api", "@maven//:io_grpc_grpc_core", "@maven//:io_grpc_grpc_protobuf", diff --git a/bazel_tools/runfiles/src/main/scala/com/digitalasset/daml/bazeltools/BazelRunfiles.scala b/bazel_tools/runfiles/src/main/scala/com/digitalasset/daml/bazeltools/BazelRunfiles.scala index 60cc12568dea..544e6b01b136 100644 --- a/bazel_tools/runfiles/src/main/scala/com/digitalasset/daml/bazeltools/BazelRunfiles.scala +++ b/bazel_tools/runfiles/src/main/scala/com/digitalasset/daml/bazeltools/BazelRunfiles.scala @@ -27,7 +27,7 @@ trait BazelRunfiles { val workspacePathString = MainWorkspacePath .resolve(path) .toString - .replaceAllLiterally("\\", "/") + .replace("\\", "/") val runfilePath = Option(Runfiles.create.rlocation(workspacePathString)) Paths.get(runfilePath.getOrElse(throw new IllegalArgumentException(path.toString))) } else diff --git a/bazel_tools/scala.bzl b/bazel_tools/scala.bzl index 4220cb70fe96..abf46f4ebf84 100644 --- a/bazel_tools/scala.bzl +++ b/bazel_tools/scala.bzl @@ -42,6 +42,7 @@ version_specific = { "-Xlint:unsound-match", "-Xlint:by-name-right-associative", # will never be by-name if used correctly "-Xfuture", + "-language:higherKinds", ], } @@ -152,8 +153,8 @@ default_compile_arguments = { "unused_dependency_checker_mode": "error", } -silencer_plugin = "@maven//:com_github_ghik_silencer_plugin_2_12_12" -silencer_lib = "@maven//:com_github_ghik_silencer_lib_2_12_12" +silencer_plugin = "@maven//:com_github_ghik_silencer_plugin_{}".format(scala_version_suffix) +silencer_lib = "@maven//:com_github_ghik_silencer_lib_{}".format(scala_version_suffix) default_initial_heap_size = "128m" default_max_heap_size = "1g" diff --git a/ledger-api/rs-grpc-akka/BUILD.bazel b/ledger-api/rs-grpc-akka/BUILD.bazel index c0b3aa7ce4a8..ad4b3563939c 100644 --- a/ledger-api/rs-grpc-akka/BUILD.bazel +++ b/ledger-api/rs-grpc-akka/BUILD.bazel @@ -6,6 +6,10 @@ load("//bazel_tools:scala.bzl", "da_scala_binary", "da_scala_library", "da_scala da_scala_library( name = "rs-grpc-akka", srcs = glob(["src/main/scala/**/*.scala"]), + scala_deps = [ + "@maven//:com_typesafe_akka_akka_actor", + "@maven//:com_typesafe_akka_akka_stream", + ], tags = ["maven_coordinates=com.daml:rs-grpc-akka:__VERSION__"], visibility = [ "//visibility:public", @@ -13,8 +17,6 @@ da_scala_library( deps = [ "//ledger-api/rs-grpc-bridge", "//libs-scala/concurrent", - "@maven//:com_typesafe_akka_akka_actor_2_12", - "@maven//:com_typesafe_akka_akka_stream_2_12", "@maven//:io_grpc_grpc_stub", "@maven//:org_reactivestreams_reactive_streams", ], diff --git a/ledger-api/rs-grpc-akka/src/main/scala/com/digitalasset/grpc/adapter/AkkaExecutionSequencer.scala b/ledger-api/rs-grpc-akka/src/main/scala/com/digitalasset/grpc/adapter/AkkaExecutionSequencer.scala index 241f300876c4..ce918f79db2f 100644 --- a/ledger-api/rs-grpc-akka/src/main/scala/com/digitalasset/grpc/adapter/AkkaExecutionSequencer.scala +++ b/ledger-api/rs-grpc-akka/src/main/scala/com/digitalasset/grpc/adapter/AkkaExecutionSequencer.scala @@ -49,10 +49,10 @@ object AkkaExecutionSequencer { system match { case extendedSystem: ExtendedActorSystem => new AkkaExecutionSequencer( - extendedSystem.systemActorOf(Props[RunnableSequencingActor], name))( + extendedSystem.systemActorOf(Props[RunnableSequencingActor](), name))( Timeout.durationToTimeout(terminationTimeout)) case _ => - new AkkaExecutionSequencer(system.actorOf(Props[RunnableSequencingActor], name))( + new AkkaExecutionSequencer(system.actorOf(Props[RunnableSequencingActor](), name))( Timeout.durationToTimeout(terminationTimeout)) } diff --git a/ledger-api/rs-grpc-akka/src/main/scala/com/digitalasset/grpc/adapter/AkkaExecutionSequencerPool.scala b/ledger-api/rs-grpc-akka/src/main/scala/com/digitalasset/grpc/adapter/AkkaExecutionSequencerPool.scala index c0ca0c8af687..d20fdf37a924 100644 --- a/ledger-api/rs-grpc-akka/src/main/scala/com/digitalasset/grpc/adapter/AkkaExecutionSequencerPool.scala +++ b/ledger-api/rs-grpc-akka/src/main/scala/com/digitalasset/grpc/adapter/AkkaExecutionSequencerPool.scala @@ -8,7 +8,6 @@ import java.util.concurrent.atomic.AtomicInteger import akka.Done import akka.actor.ActorSystem -import scala.collection.breakOut import scala.concurrent.duration.{DurationInt, FiniteDuration} import scala.concurrent.{Await, ExecutionContext, Future} @@ -34,7 +33,7 @@ class AkkaExecutionSequencerPool( def closeAsync(): Future[Unit] = { implicit val ec: ExecutionContext = system.dispatcher - val eventuallyClosed: Future[Seq[Done]] = Future.sequence(pool.map(_.closeAsync)(breakOut)) + val eventuallyClosed: Future[Seq[Done]] = Future.sequence(pool.view.map(_.closeAsync).toSeq) Future.firstCompletedOf( Seq( system.whenTerminated.map(_ => ()), // Cut it short if the ActorSystem stops. diff --git a/ledger-api/testing-utils/BUILD.bazel b/ledger-api/testing-utils/BUILD.bazel index fa3e6937f7af..0f548b1b6f66 100644 --- a/ledger-api/testing-utils/BUILD.bazel +++ b/ledger-api/testing-utils/BUILD.bazel @@ -6,10 +6,24 @@ load( "da_scala_library", "da_scala_test_suite", ) +load("//bazel_tools:scala.bzl", "silencer_plugin") da_scala_library( name = "testing-utils", srcs = glob(["src/main/scala/**/*.scala"]), + plugins = [ + silencer_plugin, + ], + scala_deps = [ + "@maven//:com_typesafe_akka_akka_actor", + "@maven//:com_typesafe_akka_akka_stream", + "@maven//:org_scalactic_scalactic", + "@maven//:org_scalatest_scalatest", + "@maven//:org_scala_lang_modules_scala_collection_compat", + ], + scalacopts = [ + "-P:silencer:lineContentFilters=import scala.collection.compat", + ], tags = ["maven_coordinates=com.daml:testing-utils:__VERSION__"], visibility = [ "//visibility:public", @@ -26,13 +40,9 @@ da_scala_library( "//libs-scala/grpc-utils", "//libs-scala/resources", "@maven//:com_google_guava_guava", - "@maven//:com_typesafe_akka_akka_actor_2_12", - "@maven//:com_typesafe_akka_akka_stream_2_12", "@maven//:com_typesafe_config", "@maven//:io_grpc_grpc_core", "@maven//:io_grpc_grpc_netty", - "@maven//:org_scalactic_scalactic_2_12", - "@maven//:org_scalatest_scalatest_2_12", "@maven//:org_slf4j_slf4j_api", ], ) diff --git a/ledger-api/testing-utils/src/main/scala/com/digitalasset/ledger/api/testing/utils/MultiFixtureBase.scala b/ledger-api/testing-utils/src/main/scala/com/digitalasset/ledger/api/testing/utils/MultiFixtureBase.scala index 8771fcfd602a..2ee69f988e23 100644 --- a/ledger-api/testing-utils/src/main/scala/com/digitalasset/ledger/api/testing/utils/MultiFixtureBase.scala +++ b/ledger-api/testing-utils/src/main/scala/com/digitalasset/ledger/api/testing/utils/MultiFixtureBase.scala @@ -83,7 +83,7 @@ trait MultiFixtureBase[FixtureId, TestContext] } } - val timeoutPromise = Promise[Assertion] + val timeoutPromise = Promise[Assertion]() es.schedule( () => timeoutPromise.failure(new TimeoutException(s"Timed out after $timeLimit")), timeLimit.toMillis, @@ -103,7 +103,7 @@ trait MultiFixtureBase[FixtureId, TestContext] /** Same as forAllFixtures, nicer to use with the "test" in allFixtures { ctx => ??? } syntax */ protected def allFixtures(runTest: TestContext => Future[Assertion]): Future[Assertion] = - forAllFixtures(fixture => runTest(fixture.context)) + forAllFixtures(fixture => runTest(fixture.context())) protected def forAllFixtures(runTest: TestFixture => Future[Assertion]): Future[Assertion] = { forAllMatchingFixtures { case f => runTest(f) } diff --git a/ledger-api/testing-utils/src/main/scala/com/digitalasset/ledger/api/testing/utils/MultiResourceBase.scala b/ledger-api/testing-utils/src/main/scala/com/digitalasset/ledger/api/testing/utils/MultiResourceBase.scala index 9c113bff1c0d..492fa3e53b0f 100644 --- a/ledger-api/testing-utils/src/main/scala/com/digitalasset/ledger/api/testing/utils/MultiResourceBase.scala +++ b/ledger-api/testing-utils/src/main/scala/com/digitalasset/ledger/api/testing/utils/MultiResourceBase.scala @@ -5,6 +5,7 @@ package com.daml.ledger.api.testing.utils import org.scalatest.AsyncTestSuite +import scala.collection.compat._ import scala.collection.immutable trait MultiResourceBase[FixtureId, TestContext] @@ -31,7 +32,7 @@ trait MultiResourceBase[FixtureId, TestContext] case class MultiResource[FixtureId, TestContext](resources: Map[FixtureId, Resource[TestContext]]) extends Resource[Map[FixtureId, () => TestContext]] { override lazy val value: Map[FixtureId, () => TestContext] = - resources.mapValues(r => () => r.value) + resources.view.mapValues(r => () => r.value).toMap override def setup(): Unit = resources.foreach(_._2.setup()) override def close(): Unit = resources.foreach(_._2.close()) } diff --git a/ledger/participant-integration-api/BUILD.bazel b/ledger/participant-integration-api/BUILD.bazel index 130e8b2dcaac..8f82b40ffb06 100644 --- a/ledger/participant-integration-api/BUILD.bazel +++ b/ledger/participant-integration-api/BUILD.bazel @@ -60,6 +60,7 @@ compile_deps = [ "@maven//:io_netty_netty_transport", "@maven//:net_logstash_logback_logstash_logback_encoder", "@maven//:org_flywaydb_flyway_core", + "@maven//:org_scala_lang_modules_scala_collection_compat_2_12", "@maven//:org_scala_lang_modules_scala_java8_compat_2_12", "@maven//:org_scalaz_scalaz_core_2_12", "@maven//:io_opentelemetry_opentelemetry_api", diff --git a/ledger/participant-state/kvutils/app/BUILD.bazel b/ledger/participant-state/kvutils/app/BUILD.bazel index 86177addf3ee..9b5816d6ba4d 100644 --- a/ledger/participant-state/kvutils/app/BUILD.bazel +++ b/ledger/participant-state/kvutils/app/BUILD.bazel @@ -49,6 +49,7 @@ da_scala_library( "@maven//:com_typesafe_akka_akka_stream_2_12", "@maven//:io_dropwizard_metrics_metrics_core", "@maven//:io_netty_netty_handler", + "@maven//:org_scala_lang_modules_scala_collection_compat_2_12", "@maven//:org_scala_lang_modules_scala_java8_compat_2_12", ], ) diff --git a/libs-scala/build-info/BUILD.bazel b/libs-scala/build-info/BUILD.bazel index 8da22bba0768..08a3a67402fe 100644 --- a/libs-scala/build-info/BUILD.bazel +++ b/libs-scala/build-info/BUILD.bazel @@ -13,6 +13,9 @@ da_scala_library( "//:mvn_version_file", ], tags = ["maven_coordinates=com.daml:build-info:__VERSION__"], + versioned_scala_deps = { + "2.12": ["@maven//:org_scala_lang_modules_scala_collection_compat"], + }, visibility = [ "//:__subpackages__", ], diff --git a/libs-scala/build-info/src/main/scala/com/digitalasset/buildinfo/BuildInfo.scala b/libs-scala/build-info/src/main/scala/com/digitalasset/buildinfo/BuildInfo.scala index 2d8d23a36574..4d4e4b5b423f 100644 --- a/libs-scala/build-info/src/main/scala/com/digitalasset/buildinfo/BuildInfo.scala +++ b/libs-scala/build-info/src/main/scala/com/digitalasset/buildinfo/BuildInfo.scala @@ -5,7 +5,7 @@ package com.daml.buildinfo import java.io.{BufferedReader, InputStreamReader} -import scala.collection.JavaConverters.asScalaIteratorConverter +import scala.jdk.CollectionConverters._ object BuildInfo { val Version: String = diff --git a/libs-scala/concurrent/BUILD.bazel b/libs-scala/concurrent/BUILD.bazel index 703baef51b57..f331a983849b 100644 --- a/libs-scala/concurrent/BUILD.bazel +++ b/libs-scala/concurrent/BUILD.bazel @@ -7,6 +7,7 @@ load( "da_scala_test", "lf_scalacopts", ) +load("@scala_version//:index.bzl", "scala_major_version", "scala_version_suffix") scalacopts = lf_scalacopts + [ "-P:wartremover:traverser:org.wartremover.warts.NonUnitStatements", @@ -16,7 +17,10 @@ da_scala_library( name = "concurrent", srcs = glob(["src/main/scala/**/*.scala"]), plugins = [ - "@maven//:org_typelevel_kind_projector_2_12_12", + "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + ], + scala_deps = [ + "@maven//:org_scalaz_scalaz_core", ], scalacopts = scalacopts, tags = ["maven_coordinates=com.daml:concurrent:__VERSION__"], @@ -24,7 +28,6 @@ da_scala_library( "//visibility:public", ], deps = [ - "@maven//:org_scalaz_scalaz_core_2_12", "@maven//:org_slf4j_slf4j_api", ], ) @@ -32,11 +35,13 @@ da_scala_library( da_scala_test( name = "test", srcs = glob(["src/test/scala/**/*.scala"]), + scala_deps = [ + "@maven//:com_chuusai_shapeless", + "@maven//:org_scalaz_scalaz_core", + ], scalacopts = scalacopts, silent_annotations = True, deps = [ ":concurrent", - "@maven//:com_chuusai_shapeless_2_12", - "@maven//:org_scalaz_scalaz_core_2_12", ], ) diff --git a/libs-scala/concurrent/src/main/scala/concurrent/ExecutionContextOf.scala b/libs-scala/concurrent/src/main/scala/concurrent/ExecutionContextOf.scala index c4d829259916..f22552dcde44 100644 --- a/libs-scala/concurrent/src/main/scala/concurrent/ExecutionContextOf.scala +++ b/libs-scala/concurrent/src/main/scala/concurrent/ExecutionContextOf.scala @@ -3,7 +3,6 @@ package com.daml.concurrent -import scala.language.higherKinds import scala.{concurrent => sc} sealed abstract class ExecutionContextOf { diff --git a/libs-scala/concurrent/src/main/scala/concurrent/FutureOf.scala b/libs-scala/concurrent/src/main/scala/concurrent/FutureOf.scala index 89c1c77b10be..533fc6e4c4dc 100644 --- a/libs-scala/concurrent/src/main/scala/concurrent/FutureOf.scala +++ b/libs-scala/concurrent/src/main/scala/concurrent/FutureOf.scala @@ -3,7 +3,7 @@ package com.daml.concurrent -import scala.language.{higherKinds, implicitConversions} +import scala.language.implicitConversions import scala.{concurrent => sc} import scala.util.Try @@ -108,7 +108,7 @@ object FutureOf { def transform[B](s: A => B, f: Throwable => Throwable)( implicit ec: ExecutionContext[EC]): Future[EC, B] = - self.removeExecutionContext transform (s, f) + self.removeExecutionContext.transform(s, f) def foreach[U](f: A => U)(implicit ec: ExecutionContext[EC]): Unit = self.removeExecutionContext foreach f diff --git a/libs-scala/concurrent/src/test/scala/concurrent/ExecutionContextSpec.scala b/libs-scala/concurrent/src/test/scala/concurrent/ExecutionContextSpec.scala index 2761768a22c5..8cfa2071cd46 100644 --- a/libs-scala/concurrent/src/test/scala/concurrent/ExecutionContextSpec.scala +++ b/libs-scala/concurrent/src/test/scala/concurrent/ExecutionContextSpec.scala @@ -5,13 +5,11 @@ package com.daml.concurrent import scala.{concurrent => sc} -import com.github.ghik.silencer.silent import org.scalatest.wordspec.AnyWordSpec import org.scalatest.matchers.should.Matchers import shapeless.test.illTyped @SuppressWarnings(Array("org.wartremover.warts.NonUnitStatements")) -@silent("Unused import") class ExecutionContextSpec extends AnyWordSpec with Matchers { import ExecutionContextSpec._ @@ -76,7 +74,7 @@ class ExecutionContextSpec extends AnyWordSpec with Matchers { } "using intersections" should { - import TestImplicits.{Elephant, Cat, cryptozoology} + import TestImplicits.{Elephant, cryptozoology} "prefer the intersection" in { theEC[Elephant] should ===(cryptozoology) diff --git a/libs-scala/contextualized-logging/BUILD.bazel b/libs-scala/contextualized-logging/BUILD.bazel index 4d86494acdff..69beeee08a63 100644 --- a/libs-scala/contextualized-logging/BUILD.bazel +++ b/libs-scala/contextualized-logging/BUILD.bazel @@ -10,16 +10,23 @@ load( da_scala_library( name = "contextualized-logging", srcs = glob(["src/main/scala/**/*.scala"]), + scala_deps = [ + "@maven//:com_typesafe_akka_akka_actor", + "@maven//:com_typesafe_akka_akka_stream", + ], scalacopts = ["-Xsource:2.13"], silent_annotations = True, tags = ["maven_coordinates=com.daml:contextualized-logging:__VERSION__"], + versioned_scala_deps = { + "2.12": [ + "@maven//:org_scala_lang_modules_scala_collection_compat", + ], + }, visibility = [ "//visibility:public", ], deps = [ "//libs-scala/grpc-utils", - "@maven//:com_typesafe_akka_akka_actor_2_12", - "@maven//:com_typesafe_akka_akka_stream_2_12", "@maven//:io_grpc_grpc_api", "@maven//:net_logstash_logback_logstash_logback_encoder", "@maven//:org_slf4j_slf4j_api", @@ -29,19 +36,21 @@ da_scala_library( da_scala_test_suite( name = "contextualized-logging-tests", srcs = glob(["src/test/suite/**/*.scala"]), + scala_deps = [ + "@maven//:com_chuusai_shapeless", + "@maven//:io_circe_circe_core", + "@maven//:io_circe_circe_generic", + "@maven//:io_circe_circe_parser", + "@maven//:org_mockito_mockito_scala", + "@maven//:org_typelevel_cats_core", + "@maven//:org_typelevel_cats_kernel", + ], deps = [ ":contextualized-logging", "@maven//:ch_qos_logback_logback_classic", "@maven//:ch_qos_logback_logback_core", - "@maven//:com_chuusai_shapeless_2_12", - "@maven//:io_circe_circe_core_2_12", - "@maven//:io_circe_circe_generic_2_12", - "@maven//:io_circe_circe_parser_2_12", "@maven//:net_logstash_logback_logstash_logback_encoder", "@maven//:org_mockito_mockito_core", - "@maven//:org_mockito_mockito_scala_2_12", "@maven//:org_slf4j_slf4j_api", - "@maven//:org_typelevel_cats_core_2_12", - "@maven//:org_typelevel_cats_kernel_2_12", ], ) diff --git a/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingContext.scala b/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingContext.scala index fa9dc9445012..6c4ec5dc021c 100644 --- a/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingContext.scala +++ b/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingContext.scala @@ -7,7 +7,7 @@ import net.logstash.logback.argument.StructuredArgument import net.logstash.logback.marker.MapEntriesAppendingMarker import org.slf4j.Marker -import scala.collection.JavaConverters.mapAsJavaMapConverter +import scala.jdk.CollectionConverters._ object LoggingContext { diff --git a/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingContextOf.scala b/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingContextOf.scala index e0332136dde0..67159e67d0a5 100644 --- a/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingContextOf.scala +++ b/libs-scala/contextualized-logging/src/main/scala/com/digitalasset/logging/LoggingContextOf.scala @@ -5,7 +5,7 @@ package com.daml.logging import com.github.ghik.silencer.silent -import scala.language.{higherKinds, implicitConversions} +import scala.language.implicitConversions /** [[LoggingContext]] with a phantom type parameter representing what kind of * details are in it. If a function that accepts a LoggingContext is supposed diff --git a/libs-scala/contextualized-logging/src/test/suite/scala/com/digitalasset/logging/ContextualizedLoggerIT.scala b/libs-scala/contextualized-logging/src/test/suite/scala/com/digitalasset/logging/ContextualizedLoggerIT.scala index e1ef037b2879..01e35fe40608 100644 --- a/libs-scala/contextualized-logging/src/test/suite/scala/com/digitalasset/logging/ContextualizedLoggerIT.scala +++ b/libs-scala/contextualized-logging/src/test/suite/scala/com/digitalasset/logging/ContextualizedLoggerIT.scala @@ -96,7 +96,7 @@ object ContextualizedLoggerIT { val contextualizedLogger = ContextualizedLogger.createFor(logger) t(contextualizedLogger) output.close() - output.toString.split(System.lineSeparator()) + output.toString.split(System.lineSeparator()).toIndexedSeq } private[this] def setupLogger(encoder: Encoder[ILoggingEvent]): (Logger, OutputStream) = { diff --git a/libs-scala/flyway-testing/BUILD.bazel b/libs-scala/flyway-testing/BUILD.bazel index 519a9ac8e374..b319efd56b97 100644 --- a/libs-scala/flyway-testing/BUILD.bazel +++ b/libs-scala/flyway-testing/BUILD.bazel @@ -6,11 +6,16 @@ load("//bazel_tools:scala.bzl", "da_scala_library") da_scala_library( name = "flyway-testing", srcs = glob(["src/main/scala/**/*.scala"]), + scala_deps = [ + "@maven//:org_scalactic_scalactic", + "@maven//:org_scalatest_scalatest", + ], tags = ["maven_coordinates=com.daml:flyway-testing:__VERSION__"], + versioned_scala_deps = { + "2.12": ["@maven//:org_scala_lang_modules_scala_collection_compat"], + }, visibility = ["//visibility:public"], deps = [ "@maven//:org_flywaydb_flyway_core", - "@maven//:org_scalactic_scalactic_2_12", - "@maven//:org_scalatest_scalatest_2_12", ], ) diff --git a/libs-scala/flyway-testing/src/main/scala/flyway/AbstractImmutableMigrationsSpec.scala b/libs-scala/flyway-testing/src/main/scala/flyway/AbstractImmutableMigrationsSpec.scala index 49df3344c0ca..f15ed2dabde6 100644 --- a/libs-scala/flyway-testing/src/main/scala/flyway/AbstractImmutableMigrationsSpec.scala +++ b/libs-scala/flyway-testing/src/main/scala/flyway/AbstractImmutableMigrationsSpec.scala @@ -16,7 +16,7 @@ import org.flywaydb.core.internal.scanner.{LocationScannerCache, ResourceNameCac import org.scalatest.matchers.should.Matchers._ import org.scalatest.wordspec.AnyWordSpec -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ abstract class AbstractImmutableMigrationsSpec extends AnyWordSpec { protected def migrationsResourcePath: String diff --git a/libs-scala/gatling-utils/BUILD.bazel b/libs-scala/gatling-utils/BUILD.bazel index d0ec5568e136..782abc69e972 100644 --- a/libs-scala/gatling-utils/BUILD.bazel +++ b/libs-scala/gatling-utils/BUILD.bazel @@ -7,6 +7,8 @@ load( "da_scala_test", "lf_scalacopts", ) +load("@scala_version//:index.bzl", "scala_version_suffix") +load("//bazel_tools:scala.bzl", "silencer_plugin") scalacopts = lf_scalacopts + [ "-P:wartremover:traverser:org.wartremover.warts.NonUnitStatements", @@ -16,9 +18,18 @@ da_scala_library( name = "gatling-utils", srcs = glob(["src/main/scala/**/*.scala"]), plugins = [ - "@maven//:org_typelevel_kind_projector_2_12_12", + "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + silencer_plugin, + ], + scala_deps = [ + "@maven//:com_typesafe_akka_akka_actor", + "@maven//:org_scalaz_scalaz_core", + "@maven//:com_typesafe_scala_logging_scala_logging", + "@maven//:org_scala_lang_modules_scala_collection_compat", + ], + scalacopts = scalacopts + [ + "-P:silencer:lineContentFilters=import scala.collection.compat", ], - scalacopts = scalacopts, tags = ["maven_coordinates=com.daml:gatling-utils:__VERSION__"], visibility = ["//visibility:public"], runtime_deps = [ @@ -26,11 +37,8 @@ da_scala_library( ], deps = [ "//libs-scala/scala-utils", - "@maven//:com_typesafe_akka_akka_actor_2_12", - "@maven//:com_typesafe_scala_logging_scala_logging_2_12", "@maven//:io_gatling_gatling_app", "@maven//:io_gatling_gatling_core", - "@maven//:org_scalaz_scalaz_core_2_12", "@maven//:org_slf4j_slf4j_api", ], ) @@ -48,17 +56,19 @@ da_scala_test( ":test-simulation-logs", ], plugins = [ - "@maven//:org_typelevel_kind_projector_2_12_12", + "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + ], + scala_deps = [ + "@maven//:org_scalacheck_scalacheck", + "@maven//:org_scalatest_scalatest", + "@maven//:org_scalatestplus_scalacheck_1_14", + "@maven//:org_scalaz_scalaz_core", + "@maven//:org_scalaz_scalaz_scalacheck_binding", ], scalacopts = scalacopts, deps = [ ":gatling-utils", "//bazel_tools/runfiles:scala_runfiles", "//libs-scala/scalatest-utils", - "@maven//:org_scalacheck_scalacheck_2_12", - "@maven//:org_scalatest_scalatest_2_12", - "@maven//:org_scalatestplus_scalacheck_1_14_2_12", - "@maven//:org_scalaz_scalaz_core_2_12", - "@maven//:org_scalaz_scalaz_scalacheck_binding_2_12", ], ) diff --git a/libs-scala/gatling-utils/src/main/scala/com/daml/gatling/stats/SimulationLog.scala b/libs-scala/gatling-utils/src/main/scala/com/daml/gatling/stats/SimulationLog.scala index 4088c7f975f3..161d0b8b7d46 100644 --- a/libs-scala/gatling-utils/src/main/scala/com/daml/gatling/stats/SimulationLog.scala +++ b/libs-scala/gatling-utils/src/main/scala/com/daml/gatling/stats/SimulationLog.scala @@ -11,6 +11,7 @@ import java.io.File import scalaz._ import Scalaz._ +import scala.collection.compat._ import scala.collection.immutable.ListMap import com.daml.gatling.stats.util.NonEmptySyntax._ @@ -241,7 +242,7 @@ object SimulationLog { simulation <- processSimulation(scenarios)(rowsByType.getOrElse("RUN", List.empty)) } yield simulation - private def groupRowsByType(fileContent: String) = + private def groupRowsByType(fileContent: String): String \/ Map[String, List[Seq[String]]] = \/.fromTryCatchNonFatal { fileContent .split('\n') @@ -249,7 +250,9 @@ object SimulationLog { .collect { case rowType +: fields => rowType -> fields } .toList .groupBy(_._1) + .view .mapValues(_.map(_._2)) + .toMap }.leftMap(_.getMessage) def processScenarios(requestsByUser: Map[Int, Seq[RequestStats]])( @@ -260,10 +263,12 @@ object SimulationLog { .collect { case Seq(label, userId, "START", _*) => userId -> label } .foldRight(Map.empty[String, ScenarioStats]) { case ((userId, label), result) => - val requestsByType = requestsByUser + val requestsByType: Map[String, RequestTypeStats] = requestsByUser .getOrElse(userId.toInt, Seq.empty) .groupBy(_.requestLabel) + .view .mapValues(RequestTypeStats.fromRequestStats) + .toMap val s = result.getOrElse(label, ScenarioStats(label)) result + (label -> s.copy( maxUsers = s.maxUsers + 1, diff --git a/libs-scala/gatling-utils/src/test/scala/com/daml/gatling/stats/SimulationLogSpec.scala b/libs-scala/gatling-utils/src/test/scala/com/daml/gatling/stats/SimulationLogSpec.scala index 4e5246c9308e..7e7abc466f20 100644 --- a/libs-scala/gatling-utils/src/test/scala/com/daml/gatling/stats/SimulationLogSpec.scala +++ b/libs-scala/gatling-utils/src/test/scala/com/daml/gatling/stats/SimulationLogSpec.scala @@ -26,19 +26,19 @@ class SimulationLogSpec extends AnyFlatSpec with Matchers with TypeCheckedTriple SimulationLog.fromFile(requiredResource(s"$simulationLog/$fileName.txt")) it should "fail if file does not exist" in { - SimulationLog.fromFile(new File("DOES-NOT-EXIST-OgUzdJsvKHc9TtfNiLXA")) shouldBe 'left + SimulationLog.fromFile(new File("DOES-NOT-EXIST-OgUzdJsvKHc9TtfNiLXA")) shouldBe Symbol("left") } it should "fail if no RUN entry" in { - resultFor("no-run") shouldBe 'left + resultFor("no-run") shouldBe Symbol("left") } it should "fail if no USER entry" in { - resultFor("no-user") shouldBe 'left + resultFor("no-user") shouldBe Symbol("left") } it should "fail if multiple RUN entries" in { - resultFor("multiple-run") shouldBe 'left + resultFor("multiple-run") shouldBe Symbol("left") } it should "return correct result for minimal log" in { diff --git a/libs-scala/postgresql-testing/BUILD.bazel b/libs-scala/postgresql-testing/BUILD.bazel index b92319177a96..26d03c3ed975 100644 --- a/libs-scala/postgresql-testing/BUILD.bazel +++ b/libs-scala/postgresql-testing/BUILD.bazel @@ -13,6 +13,15 @@ da_scala_library( data = [ "@postgresql_dev_env//:all", ], + scala_deps = [ + "@maven//:org_scalactic_scalactic", + "@maven//:org_scalatest_scalatest", + ], + versioned_scala_deps = { + "2.12": [ + "@maven//:org_scala_lang_modules_scala_collection_compat", + ], + }, visibility = [ "//visibility:public", ], @@ -22,7 +31,5 @@ da_scala_library( "//libs-scala/ports", "//libs-scala/resources", "@maven//:commons_io_commons_io", - "@maven//:org_scalactic_scalactic_2_12", - "@maven//:org_scalatest_scalatest_2_12", ], ) diff --git a/libs-scala/postgresql-testing/src/main/scala/com/digitalasset/testing/postgresql/PostgresAround.scala b/libs-scala/postgresql-testing/src/main/scala/com/digitalasset/testing/postgresql/PostgresAround.scala index ea9b81f867c0..dcf5bbbbd77f 100644 --- a/libs-scala/postgresql-testing/src/main/scala/com/digitalasset/testing/postgresql/PostgresAround.scala +++ b/libs-scala/postgresql-testing/src/main/scala/com/digitalasset/testing/postgresql/PostgresAround.scala @@ -15,7 +15,7 @@ import com.daml.testing.postgresql.PostgresAround._ import org.apache.commons.io.{FileUtils, IOUtils} import org.slf4j.LoggerFactory -import scala.collection.JavaConverters.asScalaBufferConverter +import scala.jdk.CollectionConverters._ import scala.util.Try import scala.util.control.NonFatal @@ -149,7 +149,7 @@ trait PostgresAround { "UNICODE", "-A", "trust", - dataDir.toString.replaceAllLiterally("\\", "/"), + dataDir.toString.replace("\\", "/"), ) private def createConfigFile(configPath: Path): Unit = { @@ -232,7 +232,7 @@ trait PostgresAround { } private def readLogs(): Seq[String] = - Try(paths.map(paths => Files.readAllLines(paths.logFile).asScala).getOrElse(Seq.empty)) + Try(paths.map(paths => Files.readAllLines(paths.logFile).asScala.toSeq).getOrElse(Seq.empty)) .getOrElse(Seq.empty) private def deleteRecursively(tempDir: Path): Unit = diff --git a/libs-scala/resources-akka/BUILD.bazel b/libs-scala/resources-akka/BUILD.bazel index 2dc6355972f2..795ffa49fa1e 100644 --- a/libs-scala/resources-akka/BUILD.bazel +++ b/libs-scala/resources-akka/BUILD.bazel @@ -6,25 +6,29 @@ load("//bazel_tools:scala.bzl", "da_scala_library", "da_scala_test_suite") da_scala_library( name = "resources-akka", srcs = glob(["src/main/scala/**/*.scala"]), + scala_deps = [ + "@maven//:com_typesafe_akka_akka_actor", + "@maven//:com_typesafe_akka_akka_stream", + ], tags = ["maven_coordinates=com.daml:resources-akka:__VERSION__"], visibility = [ "//visibility:public", ], deps = [ "//libs-scala/resources", - "@maven//:com_typesafe_akka_akka_actor_2_12", - "@maven//:com_typesafe_akka_akka_stream_2_12", ], ) da_scala_test_suite( name = "resources-akka-tests", srcs = glob(["src/test/suite/**/*.scala"]), + scala_deps = [ + "@maven//:com_typesafe_akka_akka_actor", + "@maven//:com_typesafe_akka_akka_stream", + ], deps = [ ":resources-akka", "//libs-scala/resources", "//libs-scala/resources:resources-test-lib", - "@maven//:com_typesafe_akka_akka_actor_2_12", - "@maven//:com_typesafe_akka_akka_stream_2_12", ], ) diff --git a/libs-scala/resources/BUILD.bazel b/libs-scala/resources/BUILD.bazel index 6651652cd6a9..b270f6e8e7c7 100644 --- a/libs-scala/resources/BUILD.bazel +++ b/libs-scala/resources/BUILD.bazel @@ -2,17 +2,21 @@ # SPDX-License-Identifier: Apache-2.0 load("//bazel_tools:scala.bzl", "da_scala_library", "da_scala_test_suite") +load("@scala_version//:index.bzl", "scala_major_version") da_scala_library( name = "resources", - srcs = glob(["src/main/scala/**/*.scala"]), + srcs = glob(["src/main/scala/**/*.scala"]) + glob(["src/main/{}/**/*.scala".format(scala_major_version)]), + scala_deps = [ + "@maven//:org_scala_lang_modules_scala_java8_compat", + "@maven//:org_scala_lang_modules_scala_collection_compat", + ], tags = ["maven_coordinates=com.daml:resources:__VERSION__"], visibility = [ "//visibility:public", ], deps = [ "//libs-scala/contextualized-logging", - "@maven//:org_scala_lang_modules_scala_java8_compat_2_12", ], ) @@ -30,6 +34,9 @@ da_scala_library( da_scala_test_suite( name = "resources-tests", srcs = glob(["src/test/suite/**/*.scala"]), + scala_deps = [ + "@maven//:org_scala_lang_modules_scala_collection_compat", + ], silent_annotations = True, deps = [ ":resources", diff --git a/libs-scala/resources/src/main/2.12/com/daml/resources/UnitCanBuildFrom.scala b/libs-scala/resources/src/main/2.12/com/daml/resources/UnitCanBuildFrom.scala new file mode 100644 index 000000000000..d0a911e3dbb2 --- /dev/null +++ b/libs-scala/resources/src/main/2.12/com/daml/resources/UnitCanBuildFrom.scala @@ -0,0 +1,20 @@ +// Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.daml.resources + +import scala.collection.generic.CanBuildFrom +import scala.collection.mutable + +private[resources] final class UnitCanBuildFrom[T, C[_]] extends CanBuildFrom[C[T], T, Unit] { + override def apply(): mutable.Builder[T, Unit] = UnitBuilder + override def apply(from: C[T]): mutable.Builder[T, Unit] = apply() +} + +private[resources] object UnitBuilder extends mutable.Builder[Any, Unit] { + override def +=(elem: Any): this.type = this + + override def clear(): Unit = () + + override def result(): Unit = () +} diff --git a/libs-scala/resources/src/main/2.13/com/daml/resources/UnitCanBuildFrom.scala b/libs-scala/resources/src/main/2.13/com/daml/resources/UnitCanBuildFrom.scala new file mode 100644 index 000000000000..8e5639d233e5 --- /dev/null +++ b/libs-scala/resources/src/main/2.13/com/daml/resources/UnitCanBuildFrom.scala @@ -0,0 +1,20 @@ +// Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +package com.daml.resources + +import scala.collection.compat._ +import scala.collection.mutable + +private[resources] final class UnitCanBuildFrom[T, C[_]] extends Factory[T, Unit] { + override def fromSpecific(it: IterableOnce[T]) = () + override def newBuilder: mutable.Builder[T, Unit] = UnitBuilder +} + +private[resources] object UnitBuilder extends mutable.Builder[Any, Unit] { + override def addOne(elem: Any): this.type = this + + override def clear(): Unit = () + + override def result(): Unit = () +} diff --git a/libs-scala/resources/src/main/scala/com/digitalasset/resources/ResourceFactories.scala b/libs-scala/resources/src/main/scala/com/digitalasset/resources/ResourceFactories.scala index 26fd30661a7f..aec0c6d20960 100644 --- a/libs-scala/resources/src/main/scala/com/digitalasset/resources/ResourceFactories.scala +++ b/libs-scala/resources/src/main/scala/com/digitalasset/resources/ResourceFactories.scala @@ -7,15 +7,12 @@ import java.util.concurrent.atomic.AtomicBoolean import com.daml.resources.HasExecutionContext.executionContext -import scala.collection.generic.CanBuildFrom -import scala.collection.mutable +import scala.collection.compat._ import scala.concurrent.{Future, Promise} import scala.util.{Failure, Success} final class ResourceFactories[Context: HasExecutionContext] { - import scala.language.higherKinds - private type R[+T] = Resource[Context, T] /** @@ -101,12 +98,12 @@ final class ResourceFactories[Context: HasExecutionContext] { * @tparam U The return type. * @return A [[Resource]] with a sequence of the values of the sequenced [[Resource]]s as its underlying value. */ - def sequence[T, C[X] <: Traversable[X], U](seq: C[R[T]])( - implicit bf: CanBuildFrom[C[R[T]], T, U], + def sequence[T, C[X] <: Iterable[X], U](seq: C[R[T]])( + implicit bf: Factory[T, U], context: Context, ): R[U] = new R[U] { private val resource = seq - .foldLeft(successful(bf()))((builderResource, elementResource) => + .foldLeft(successful(bf.newBuilder))((builderResource, elementResource) => for { builder <- builderResource // Consider the builder in the accumulator resource element <- elementResource // Consider the value in the actual resource element @@ -129,23 +126,9 @@ final class ResourceFactories[Context: HasExecutionContext] { * @tparam C The [[Traversable]] actual type. * @return A [[Resource]] sequencing the [[Resource]]s and no underlying value. */ - def sequenceIgnoringValues[T, C[X] <: Traversable[X]](seq: C[R[T]])( + def sequenceIgnoringValues[T, C[X] <: Iterable[X]](seq: C[R[T]])( implicit context: Context ): R[Unit] = - sequence(seq)(new UnitCanBuildFrom, context) - - final class UnitCanBuildFrom[T, C[X] <: Traversable[X]] extends CanBuildFrom[C[R[T]], T, Unit] { - override def apply(from: C[R[T]]): mutable.Builder[T, Unit] = apply() - - override def apply(): mutable.Builder[T, Unit] = UnitBuilder - } - - object UnitBuilder extends mutable.Builder[Any, Unit] { - override def +=(elem: Any): this.type = this - - override def clear(): Unit = () - - override def result(): Unit = () - } + sequence(seq)(new UnitCanBuildFrom[T, Nothing], context) } diff --git a/libs-scala/scala-utils/BUILD.bazel b/libs-scala/scala-utils/BUILD.bazel index 5f306d34e60e..7da5b3020180 100644 --- a/libs-scala/scala-utils/BUILD.bazel +++ b/libs-scala/scala-utils/BUILD.bazel @@ -27,10 +27,12 @@ da_scala_library( da_scala_test( name = "test", srcs = glob(["src/test/scala/**/*.scala"]), + scala_deps = [ + "@maven//:org_scalaz_scalaz_core", + ], scalacopts = scalacopts, deps = [ ":scala-utils", "//libs-scala/scalatest-utils", - "@maven//:org_scalaz_scalaz_core_2_12", ], ) diff --git a/libs-scala/scala-utils/src/main/scala/com/daml/scalautil/Statement.scala b/libs-scala/scala-utils/src/main/scala/com/daml/scalautil/Statement.scala index d7f539ba0b4a..9f4443f977c7 100644 --- a/libs-scala/scala-utils/src/main/scala/com/daml/scalautil/Statement.scala +++ b/libs-scala/scala-utils/src/main/scala/com/daml/scalautil/Statement.scala @@ -12,7 +12,7 @@ object Statement { * @tparam A return type of the expression that gets discarded. */ @specialized def discard[A](evaluateForSideEffectOnly: A): Unit = { - val _: A = evaluateForSideEffectOnly + val _ = evaluateForSideEffectOnly () //Return unit to prevent warning due to discarding value } } diff --git a/libs-scala/scalatest-utils/BUILD.bazel b/libs-scala/scalatest-utils/BUILD.bazel index c364bad78e13..59f927c6a655 100644 --- a/libs-scala/scalatest-utils/BUILD.bazel +++ b/libs-scala/scalatest-utils/BUILD.bazel @@ -7,32 +7,35 @@ load( "da_scala_test", "lf_scalacopts", ) +load("@scala_version//:index.bzl", "scala_version_suffix") da_scala_library( name = "scalatest-utils", srcs = glob(["src/main/**/*.scala"]), plugins = [ - "@maven//:org_typelevel_kind_projector_2_12_12", + "@maven//:org_typelevel_kind_projector_{}".format(scala_version_suffix), + ], + scala_deps = [ + "@maven//:org_scalacheck_scalacheck", + "@maven//:org_scalactic_scalactic", + "@maven//:org_scalatest_scalatest", + "@maven//:org_scalatestplus_scalacheck_1_14", + "@maven//:org_scalaz_scalaz_core", ], scalacopts = lf_scalacopts, tags = ["maven_coordinates=com.daml:scalatest-utils:__VERSION__"], visibility = ["//visibility:public"], - deps = [ - "@maven//:org_scalacheck_scalacheck_2_12", - "@maven//:org_scalactic_scalactic_2_12", - "@maven//:org_scalatest_scalatest_2_12", - "@maven//:org_scalatestplus_scalacheck_1_14_2_12", - "@maven//:org_scalaz_scalaz_core_2_12", - ], ) da_scala_test( name = "test", size = "small", srcs = glob(["src/test/**/*.scala"]), + scala_deps = [ + "@maven//:org_scalaz_scalaz_core", + ], scalacopts = lf_scalacopts, deps = [ ":scalatest-utils", - "@maven//:org_scalaz_scalaz_core_2_12", ], ) diff --git a/libs-scala/scalatest-utils/src/main/scala/scalatest/AsyncForAll.scala b/libs-scala/scalatest-utils/src/main/scala/scalatest/AsyncForAll.scala index aa9822acfd3d..d4b6f5900865 100644 --- a/libs-scala/scalatest-utils/src/main/scala/scalatest/AsyncForAll.scala +++ b/libs-scala/scalatest-utils/src/main/scala/scalatest/AsyncForAll.scala @@ -23,7 +23,7 @@ trait AsyncForAll { .getOrElse(sys error "random Gen failed") implicit val assertionMonoid: Monoid[Future[Assertion]] = - Monoid liftMonoid (Applicative[Future], Monoid instance ((_, result) => result, succeed)) + Monoid.liftMonoid(Applicative[Future], Monoid.instance((_, result) => result, succeed)) runs foldMap { a => f(a) recoverWith { case ae: TestFailedException => diff --git a/libs-scala/scalatest-utils/src/main/scala/scalatest/Equalz.scala b/libs-scala/scalatest-utils/src/main/scala/scalatest/Equalz.scala index 88911b2e46b1..b43362edbe4d 100644 --- a/libs-scala/scalatest-utils/src/main/scala/scalatest/Equalz.scala +++ b/libs-scala/scalatest-utils/src/main/scala/scalatest/Equalz.scala @@ -6,7 +6,6 @@ package com.daml.scalatest import org.scalatest.matchers.dsl.{MatcherFactory1} import org.scalatest.matchers.{MatchResult, Matcher} import org.scalatest.matchers.should.Matchers -import scala.language.higherKinds import scalaz.Equal /** Provides the `equalz` [[Matcher]]. diff --git a/libs-scala/timer-utils/src/main/scala/com/digitalasset/timer/PromiseTask.scala b/libs-scala/timer-utils/src/main/scala/com/digitalasset/timer/PromiseTask.scala index e2367274c77a..0ba1e06193e9 100644 --- a/libs-scala/timer-utils/src/main/scala/com/digitalasset/timer/PromiseTask.scala +++ b/libs-scala/timer-utils/src/main/scala/com/digitalasset/timer/PromiseTask.scala @@ -11,10 +11,10 @@ import scala.util.control.NonFatal private class PromiseTask[A](value: => Future[A]) extends TimerTask with Promise[A] { - private val p = Promise[A] + private val p = Promise[A]() override def run(): Unit = { - p.tryCompleteWith { + p.completeWith { try value catch { case NonFatal(t) => Future.failed(t) } } diff --git a/scala-protoc-plugins/scalapb/BUILD.bazel b/scala-protoc-plugins/scalapb/BUILD.bazel index 734bb27bb7e7..f2832aa30a8a 100644 --- a/scala-protoc-plugins/scalapb/BUILD.bazel +++ b/scala-protoc-plugins/scalapb/BUILD.bazel @@ -7,11 +7,13 @@ da_scala_binary( name = "compiler_plugin", srcs = glob(["*.scala"]), main_class = "com.daml.protoc.plugins.scalapb.ScalaPbCompilerPlugin", + scala_deps = [ + "@maven//:com_thesamet_scalapb_compilerplugin", + "@maven//:com_thesamet_scalapb_protoc_bridge", + ], visibility = ["//visibility:public"], deps = [ "@maven//:com_google_protobuf_protobuf_java", - "@maven//:com_thesamet_scalapb_compilerplugin_2_12", - "@maven//:com_thesamet_scalapb_protoc_bridge_2_12", ], )