aboutsummaryrefslogtreecommitdiff
path: root/test_defs.bzl
diff options
context:
space:
mode:
authorronshapiro <ronshapiro@google.com>2017-04-14 09:22:17 -0700
committerRon Shapiro <shapiro.rd@gmail.com>2017-04-19 14:40:39 -0400
commit3a179ec55332ad1c08bfe4c2bd8addbc8e4fa6da (patch)
tree5dcfab23bd73ae0a8396bc12ba7abc72c0983650 /test_defs.bzl
parent9eb3a928afbcc14fb2e235f160180555376440ac (diff)
downloaddagger2-3a179ec55332ad1c08bfe4c2bd8addbc8e4fa6da.tar.gz
Move prod compiler code and guava/jdk Optional tests from their previous maven structure (src/{main,test}/) to the {java,javatest}/ model typical to bazel
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=153174049
Diffstat (limited to 'test_defs.bzl')
-rw-r--r--test_defs.bzl21
1 files changed, 16 insertions, 5 deletions
diff --git a/test_defs.bzl b/test_defs.bzl
index bd81669a9..59c1e826c 100644
--- a/test_defs.bzl
+++ b/test_defs.bzl
@@ -12,15 +12,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-def GenJavaTests(name, srcs, deps, plugins = None, javacopts = None):
- _GenTests(native.java_library, native.java_test, name, srcs, deps, plugins, javacopts)
+def GenJavaTests(name, srcs, deps, test_only_deps = None, plugins = None, javacopts = None):
+ _GenTests(
+ native.java_library, native.java_test, name, srcs, deps, test_only_deps, plugins, javacopts)
-def GenRobolectricTests(name, srcs, deps, plugins = None, javacopts = None):
+def GenRobolectricTests(name, srcs, deps, test_only_deps = None, plugins = None, javacopts = None):
# TODO(ronshapiro): enable these when Bazel supports robolectric tests
pass
def _GenTests(
- library_rule_type, test_rule_type, name, srcs, deps, plugins = None, javacopts = None):
+ library_rule_type,
+ test_rule_type,
+ name,
+ srcs,
+ deps,
+ test_only_deps = None,
+ plugins = None,
+ javacopts = None):
test_files = []
supporting_files = []
for src in srcs:
@@ -29,7 +37,10 @@ def _GenTests(
else:
supporting_files.append(src)
- test_deps = [] + deps
+ if not test_only_deps:
+ test_only_deps = []
+
+ test_deps = test_only_deps + deps
if len(supporting_files) > 0:
supporting_files_name = name + "_lib"
test_deps.append(":" + supporting_files_name)