|
| 1 | +"""Test targets to ensure dependency version compatibility. |
| 2 | + |
| 3 | +Copied and adapted targets from the main repo as noted. |
| 4 | +""" |
| 5 | +load( |
| 6 | + ":defs.bzl", |
| 7 | + "default_outputs_test", |
| 8 | + "scalafmt_scala_test", |
| 9 | + "scrooge_transitive_outputs_test", |
| 10 | +) |
| 11 | +load("@rules_proto//proto:defs.bzl", "proto_library") |
| 12 | +load("@rules_scala//jmh:jmh.bzl", "scala_benchmark_jmh") |
| 13 | +load("@rules_scala//scala/scalafmt:phase_scalafmt_ext.bzl", "ext_scalafmt") |
| 14 | +load("@rules_scala//scala:advanced_usage/scala.bzl", "make_scala_test") |
| 15 | +load( |
| 16 | + "@rules_scala//scala:scala.bzl", |
| 17 | + "scala_binary", |
| 18 | + "scala_doc", |
| 19 | + "scala_junit_test", |
| 20 | + "scala_library", |
| 21 | + "scala_specs2_junit_test", |
| 22 | + "scala_test", |
| 23 | +) |
| 24 | +load("@rules_scala//scala_proto:scala_proto.bzl", "scala_proto_library") |
| 25 | +load("@rules_scala//thrift:thrift.bzl", "thrift_library") |
| 26 | +load( |
| 27 | + "@rules_scala//twitter_scrooge:twitter_scrooge.bzl", |
| 28 | + "scrooge_java_library", |
| 29 | + "scrooge_scala_library", |
| 30 | +) |
| 31 | + |
| 32 | +# From: `test/BUILD` |
| 33 | +scala_binary( |
| 34 | + name = "ScalaBinary", |
| 35 | + srcs = ["ScalaBinary.scala"], |
| 36 | + main_class = "scalarules.test.ScalaBinary", |
| 37 | + deps = [ |
| 38 | + ":HelloLib", |
| 39 | + ], |
| 40 | +) |
| 41 | + |
| 42 | +scala_library( |
| 43 | + name = "HelloLib", |
| 44 | + srcs = ["HelloLib.scala"], |
| 45 | +) |
| 46 | + |
| 47 | +scala_doc( |
| 48 | + name = "ScalaDoc", |
| 49 | + deps = [":HelloLib"], |
| 50 | +) |
| 51 | + |
| 52 | +# From: `examples/testing/multi_frameworks_toolchain/example/BUILD` |
| 53 | +scala_test( |
| 54 | + name = "scalatest_example", |
| 55 | + srcs = ["ScalaTestExampleTest.scala"], |
| 56 | +) |
| 57 | + |
| 58 | +scala_specs2_junit_test( |
| 59 | + name = "specs2_example", |
| 60 | + srcs = ["Specs2ExampleTest.scala"], |
| 61 | + suffixes = ["Test"], |
| 62 | +) |
| 63 | + |
| 64 | +# Manufactured based on `docs/phase_scalafmt.md` and `test/scalafmt/BUILD`. |
| 65 | +scalafmt_scala_test( |
| 66 | + name = "ScalafmtTest", |
| 67 | + srcs = ["ScalaTestExampleTest.scala"], |
| 68 | + format = True, |
| 69 | +) |
| 70 | + |
| 71 | +# From: `test/proto/BUILD` |
| 72 | +proto_library( |
| 73 | + name = "standalone_proto", |
| 74 | + srcs = ["standalone.proto"], |
| 75 | +) |
| 76 | + |
| 77 | +scala_proto_library( |
| 78 | + name = "standalone_scala_proto", |
| 79 | + deps = [":standalone_proto"], |
| 80 | +) |
| 81 | + |
| 82 | +default_outputs_test( |
| 83 | + name = "standalone_scala_proto_outs_test", |
| 84 | + expected_outs = [ |
| 85 | + "standalone_proto_scalapb-src.jar", |
| 86 | + "standalone_proto_scalapb.jar", |
| 87 | + ], |
| 88 | + target_under_test = ":standalone_scala_proto", |
| 89 | +) |
| 90 | + |
| 91 | +# From: `test/jmh/BUILD` |
| 92 | +scala_benchmark_jmh( |
| 93 | + name = "test_benchmark", |
| 94 | + srcs = ["TestBenchmark.scala"], |
| 95 | + data = ["data.txt"], |
| 96 | + deps = ["@rules_scala//test/jmh:add_numbers"], |
| 97 | +) |
| 98 | + |
| 99 | +# From: `test/src/main/scala/scalarules/test/twitter_scrooge/BUILD` |
| 100 | + |
| 101 | +thrift_library( |
| 102 | + name = "thrift3", |
| 103 | + srcs = ["Thrift3.thrift"], |
| 104 | + visibility = ["//visibility:public"], |
| 105 | +) |
| 106 | + |
| 107 | +scrooge_scala_library( |
| 108 | + name = "scrooge3", |
| 109 | + visibility = ["//visibility:public"], |
| 110 | + deps = [":thrift3"], |
| 111 | +) |
| 112 | + |
| 113 | +scrooge_java_library( |
| 114 | + name = "scrooge3_java", |
| 115 | + visibility = ["//visibility:public"], |
| 116 | + deps = [":thrift3"], |
| 117 | +) |
| 118 | + |
| 119 | +scrooge_transitive_outputs_test( |
| 120 | + name = "scrooge_test_scala", |
| 121 | + dep = ":scrooge3", |
| 122 | + expected_jars = ["thrift3_scrooge_scala.jar"], |
| 123 | +) |
| 124 | + |
| 125 | +scrooge_transitive_outputs_test( |
| 126 | + name = "scrooge_test_java", |
| 127 | + dep = ":scrooge3_java", |
| 128 | + expected_jars = ["thrift3_scrooge_java.jar"], |
| 129 | +) |
0 commit comments