@@ -73,7 +73,27 @@ scala_config(scala_version = scala_version)
7373
7474load ("@io_bazel_rules_scala//scala:toolchains.bzl" , "scala_register_toolchains" , "scala_toolchains" )
7575
76- scala_toolchains (fetch_sources = True , twitter_scrooge = True )
76+ # Configure twitter_scrooge toolchain with custom dependencies from thrift_deps.
77+ # Note: thrift_deps must be loaded before this is evaluated.
78+ # The finagle dependencies (finagle-thrift, finagle-core) are needed as compile
79+ # dependencies for the generated scrooge code when thrift services are defined.
80+ # We use scrooge_core_with_finagle which bundles finagle deps with scrooge_core.
81+ scala_toolchains (
82+ fetch_sources = True ,
83+ twitter_scrooge = {
84+ "libthrift" : "@thrift_deps//:org_apache_thrift_libthrift" ,
85+ # Use scrooge_core_with_finagle to include finagle on the compile classpath
86+ # for generated thrift service code. Must use @px// prefix to reference
87+ # the main workspace from within the generated @rules_scala_toolchains repo.
88+ "scrooge_core" : "@px//src/stirling/source_connectors/socket_tracer/testing/containers/thriftmux:scrooge_core_with_finagle" ,
89+ "scrooge_generator" : "@thrift_deps//:com_twitter_scrooge_generator_2_13" ,
90+ "util_core" : "@thrift_deps//:com_twitter_util_core_2_13" ,
91+ "util_logging" : "@thrift_deps//:com_twitter_util_logging_2_13" ,
92+ "javax_annotation_api" : "@thrift_deps//:javax_annotation_javax_annotation_api" ,
93+ "mustache" : "@thrift_deps//:com_github_spullara_mustache_java_compiler" ,
94+ "scopt" : "@thrift_deps//:com_github_scopt_scopt_2_13" ,
95+ },
96+ )
7797
7898scala_register_toolchains ()
7999
@@ -193,26 +213,6 @@ load("@thrift_deps//:defs.bzl", thrift_pinned_maven_install = "pinned_maven_inst
193213
194214thrift_pinned_maven_install ()
195215
196- # twitter_scrooge will use incompatible versions of @scrooge_jars and @thrift_jars.
197- # These bind statements ensure that the correct versions of finagle libthrift, scrooge core
198- # and scrooge generator are used to ensure successful compilation.
199- # See https://github.com/bazelbuild/rules_scala/issues/592 and
200- # https://github.com/bazelbuild/rules_scala/pull/847 for more details.
201- bind (
202- name = "io_bazel_rules_scala/dependency/thrift/scrooge_core" ,
203- actual = "//src/stirling/source_connectors/socket_tracer/testing/containers/thriftmux:scrooge_jars" ,
204- )
205-
206- bind (
207- name = "io_bazel_rules_scala/dependency/thrift/scrooge_generator" ,
208- actual = "//src/stirling/source_connectors/socket_tracer/testing/containers/thriftmux:scrooge_jars" ,
209- )
210-
211- bind (
212- name = "io_bazel_rules_scala/dependency/thrift/libthrift" ,
213- actual = "//src/stirling/source_connectors/socket_tracer/testing/containers/thriftmux:thrift_jars" ,
214- )
215-
216216# gazelle:repo bazel_gazelle
217217# Gazelle depes need to be loaded last to make sure they don't override our dependencies.
218218# The first one wins when it comes to package declaration.
0 commit comments