| 1 |
# Copyright 2011 Google Inc. All rights reserved. |
| 2 |
# Author: [email protected] (Sam Berlin) |
| 3 |
load("@rules_java//java:defs.bzl", "java_library") |
| 4 |
load("//:test_defs.bzl", "guice_test_suites") |
| 5 |
|
| 6 |
package(default_testonly = 1) |
| 7 |
|
| 8 |
TEST_SUPPORT_SRCS = [ |
| 9 |
"Asserts.java", |
| 10 |
"internal/WeakKeySetUtils.java", |
| 11 |
] |
| 12 |
|
| 13 |
# Files that are shared by extensions also. |
| 14 |
# Typically this would go in a java/../testing package, |
| 15 |
# but we need to work with the open-source code structure, |
| 16 |
# so it is here. |
| 17 |
java_library( |
| 18 |
name = "testsupport", |
| 19 |
srcs = TEST_SUPPORT_SRCS, |
| 20 |
javacopts = ["-Xep:BetaApi:OFF"], |
| 21 |
visibility = [ |
| 22 |
"//:src", |
| 23 |
], |
| 24 |
deps = [ |
| 25 |
"//core/src/com/google/inject", |
| 26 |
"//third_party/java/guava/base", |
| 27 |
"//third_party/java/guava/collect", |
| 28 |
"//third_party/java/guava/testing", |
| 29 |
"//third_party/java/junit", |
| 30 |
"//third_party/java/truth", |
| 31 |
], |
| 32 |
) |
| 33 |
|
| 34 |
# All the actual XTest classes & friends. |
| 35 |
java_library( |
| 36 |
name = "tests", |
| 37 |
srcs = glob( |
| 38 |
["**/*.java"], # glob ignores subfolder that has its own BUILD files |
| 39 |
exclude = TEST_SUPPORT_SRCS + [ |
| 40 |
"AllTests.java", |
| 41 |
], |
| 42 |
), |
| 43 |
javacopts = ["-Xep:BetaApi:OFF"], |
| 44 |
plugins = [ |
| 45 |
], |
| 46 |
deps = [ |
| 47 |
":testsupport", |
| 48 |
"//core/src/com/google/inject", |
| 49 |
"//third_party/java/aopalliance", |
| 50 |
"//third_party/java/asm", |
| 51 |
"//third_party/java/guava/base", |
| 52 |
"//third_party/java/guava/collect", |
| 53 |
"//third_party/java/guava/testing", |
| 54 |
"//third_party/java/guava/util/concurrent", |
| 55 |
"//third_party/java/jsr330_inject", |
| 56 |
"//third_party/java/junit", |
| 57 |
"//third_party/java/truth", |
| 58 |
], |
| 59 |
) |
| 60 |
|
| 61 |
# This target is unused, but exists so that we can more easily |
| 62 |
# ensure the opensource build maintains compiling code. |
| 63 |
java_library( |
| 64 |
name = "AllTests", |
| 65 |
srcs = ["AllTests.java"], |
| 66 |
deps = [ |
| 67 |
":tests", |
| 68 |
"//core/test/com/googlecode/guice:tests", |
| 69 |
"//third_party/java/junit", |
| 70 |
], |
| 71 |
) |
| 72 |
|
| 73 |
guice_test_suites( |
| 74 |
name = "gen_tests", |
| 75 |
jvm_flags = [ |
| 76 |
# those 2 options are required for some tests that checks stack traces |
| 77 |
"-XX:+UnlockDiagnosticVMOptions", |
| 78 |
"-XX:+ShowHiddenFrames", |
| 79 |
], |
| 80 |
sizes = [ |
| 81 |
"small", |
| 82 |
"medium", |
| 83 |
], |
| 84 |
deps = [":tests"], |
| 85 |
) |
| 86 |
|
| 87 |
[guice_test_suites( |
| 88 |
name = "gen_tests_stack_trace_%s" % include_stack_trace_option, |
| 89 |
args = [ |
| 90 |
"--guice_include_stack_traces=%s" % include_stack_trace_option, |
| 91 |
], |
| 92 |
jvm_flags = [ |
| 93 |
# those 2 options are required for some tests that checks stack traces |
| 94 |
"-XX:+UnlockDiagnosticVMOptions", |
| 95 |
"-XX:+ShowHiddenFrames", |
| 96 |
], |
| 97 |
sizes = [ |
| 98 |
"small", |
| 99 |
"medium", |
| 100 |
], |
| 101 |
suffix = "_stack_trace_%s" % include_stack_trace_option, |
| 102 |
deps = [":tests"], |
| 103 |
) for include_stack_trace_option in [ |
| 104 |
"OFF", |
| 105 |
]] |
| 106 |
|
| 107 |
[guice_test_suites( |
| 108 |
name = "gen_tests_class_loading_%s" % custom_class_loading_option, |
| 109 |
args = [ |
| 110 |
"--guice_custom_class_loading=%s" % custom_class_loading_option, |
| 111 |
], |
| 112 |
jvm_flags = [ |
| 113 |
# those 2 options are required for some tests that checks stack traces |
| 114 |
"-XX:+UnlockDiagnosticVMOptions", |
| 115 |
"-XX:+ShowHiddenFrames", |
| 116 |
], |
| 117 |
sizes = [ |
| 118 |
"small", |
| 119 |
"medium", |
| 120 |
], |
| 121 |
suffix = "_custom_class_loading_%s" % custom_class_loading_option, |
| 122 |
deps = [":tests"], |
| 123 |
) for custom_class_loading_option in [ |
| 124 |
"OFF", |
| 125 |
"CHILD", |
| 126 |
"ANONYMOUS", |
| 127 |
]] |