|
| 1 | +# Test configuration for test/shell/test_twitter_scrooge_toolchains.sh. |
| 2 | +module(name = "twitter_scrooge_toolchains") |
| 3 | + |
| 4 | +bazel_dep(name = "rules_scala") |
| 5 | +local_path_override( |
| 6 | + module_name = "rules_scala", |
| 7 | + path = "../..", |
| 8 | +) |
| 9 | + |
| 10 | +bazel_dep(name = "latest_dependencies") |
| 11 | +local_path_override( |
| 12 | + module_name = "latest_dependencies", |
| 13 | + path = "../../deps/latest", |
| 14 | +) |
| 15 | + |
| 16 | +bazel_dep( |
| 17 | + name = "protobuf", |
| 18 | + version = "31.1", |
| 19 | + repo_name = "com_google_protobuf", |
| 20 | +) |
| 21 | + |
| 22 | +# Temporarily required for `protoc` toolchainization until resolution of |
| 23 | +# protocolbuffers/protobuf#19679. |
| 24 | +single_version_override( |
| 25 | + module_name = "protobuf", |
| 26 | + patch_strip = 1, |
| 27 | + patches = ["//:protobuf.patch"], |
| 28 | + version = "31.1", |
| 29 | +) |
| 30 | + |
| 31 | +bazel_dep(name = "rules_jvm_external", version = "6.7") |
| 32 | + |
| 33 | +maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") |
| 34 | +maven.install( |
| 35 | + artifacts = [ |
| 36 | + "com.github.scopt:scopt_2.12:4.0.0-RC2", |
| 37 | + "com.github.spullara.mustache.java:compiler:0.8.18", |
| 38 | + "com.twitter:scrooge-core_2.12:21.2.0", |
| 39 | + "com.twitter:scrooge-generator_2.12:21.2.0", |
| 40 | + "com.twitter:util-core_2.12:21.2.0", |
| 41 | + "com.twitter:util-logging_2.12:21.2.0", |
| 42 | + "javax.annotation:javax.annotation-api:1.3.2", |
| 43 | + "org.apache.thrift:libthrift:0.10.0", |
| 44 | + ], |
| 45 | + lock_file = "//:maven_install.json", |
| 46 | +) |
| 47 | +use_repo(maven, "maven") |
| 48 | + |
| 49 | +scala_protoc = use_extension( |
| 50 | + "@rules_scala//scala/extensions:protoc.bzl", |
| 51 | + "scala_protoc", |
| 52 | + dev_dependency = True, |
| 53 | +) |
| 54 | +use_repo(scala_protoc, "rules_scala_protoc_toolchains") |
| 55 | + |
| 56 | +register_toolchains("@rules_scala_protoc_toolchains//...:all") |
| 57 | + |
| 58 | +scala_config = use_extension( |
| 59 | + "@rules_scala//scala/extensions:config.bzl", |
| 60 | + "scala_config", |
| 61 | +) |
| 62 | +scala_config.settings(scala_version = "2.12.20") |
| 63 | + |
| 64 | +scala_deps = use_extension( |
| 65 | + "@rules_scala//scala/extensions:deps.bzl", |
| 66 | + "scala_deps", |
| 67 | + dev_dependency = True, |
| 68 | +) |
| 69 | +scala_deps.scala() |
| 70 | + |
| 71 | +# When using `setup_scrooge_toolchain` with all its dependencies specified in a |
| 72 | +# `BUILD` file, you don't need to instantiate this builtin toolchain. In that |
| 73 | +# case, make sure to register your custom toolchain via `register_toolchains` |
| 74 | +# (see below). See the `//:toolchain_from_build_file` comments in the `BUILD` |
| 75 | +# file for further details. |
| 76 | +# |
| 77 | +# It's OK to remove any of these overrides in order to use the builtin defaults |
| 78 | +# for those dependencies instead. |
| 79 | +# |
| 80 | +# However, if you remove the `scrooge_generator` override, the toolchain will |
| 81 | +# also depend on the builtin `mustache` and `scopt` repos. You will need to |
| 82 | +# remove the `mustache` and `scopt` overrides, too, to use the builtin repos |
| 83 | +# instead. |
| 84 | +scala_deps.twitter_scrooge( |
| 85 | + javax_annotation_api = "@maven//:javax_annotation_javax_annotation_api", |
| 86 | + libthrift = "@maven//:org_apache_thrift_libthrift", |
| 87 | + mustache = "@maven//:com_github_spullara_mustache_java_compiler", |
| 88 | + scopt = "@maven//:com_github_scopt_scopt_2_12", |
| 89 | + scrooge_core = "@maven//:com_twitter_scrooge_core_2_12", |
| 90 | + scrooge_generator = "@maven//:com_twitter_scrooge_generator_2_12", |
| 91 | + util_core = "@maven//:com_twitter_util_core_2_12", |
| 92 | + util_logging = "@maven//:com_twitter_util_logging_2_12", |
| 93 | +) |
| 94 | + |
| 95 | +# If you want to depend on any of the builtin repos when using |
| 96 | +# `setup_scala_toolchain` in a `BUILD` file, you will need to: |
| 97 | +# |
| 98 | +# - Remove the `scala_deps.twitter_scrooge()` overrides for those repos. This |
| 99 | +# enables the module extension to generate the builtin repos for those |
| 100 | +# dependencies. |
| 101 | +# |
| 102 | +# - Uncomment the `use_repo` call below to import the builtin repos into the |
| 103 | +# main module's scope. |
| 104 | +# |
| 105 | +# `version_suffix` should match the `scala_version` argument to |
| 106 | +# `scala_config.settings()`. |
| 107 | +#version_suffix = "_2_12_20" |
| 108 | +#[ |
| 109 | +# use_repo(scala_deps, repo + version_suffix) |
| 110 | +# for repo in [ |
| 111 | +# "libthrift", |
| 112 | +# "io_bazel_rules_scala_scrooge_core", |
| 113 | +# "io_bazel_rules_scala_scrooge_generator", |
| 114 | +# "io_bazel_rules_scala_util_core", |
| 115 | +# "io_bazel_rules_scala_util_logging", |
| 116 | +# "io_bazel_rules_scala_javax_annotation_api", |
| 117 | +# "io_bazel_rules_scala_mustache", |
| 118 | +# "io_bazel_rules_scala_scopt", |
| 119 | +# ] |
| 120 | +#] |
| 121 | + |
| 122 | +# To depend on the toolchain defined by `setup_scala_toolchain` by default, |
| 123 | +# instead of the builtin toolchain, uncomment this line. You can also specify it |
| 124 | +# on demand via: |
| 125 | +# |
| 126 | +# bazel build --extra_toolchains=//:toolchain_from_build_file //... |
| 127 | +# |
| 128 | +#register_toolchains("//:toolchain_from_build_file") |
0 commit comments