blob: 3a57a5b4f75ddca5cdda1843f31cc3e8a5d74e2b [file] [log] [blame]
package(
default_visibility = ["//visibility:legacy_public"],
)
licenses(["notice"])
filegroup(
name = "bazel-srcs",
testonly = 0,
srcs = glob(
["**"],
exclude = ["BUILD"],
),
visibility = ["//third_party/bazel:__subpackages__"],
)
filegroup(
name = "srcs",
srcs = glob(["**"]),
)
filegroup(
name = "embedded_tools",
srcs = [
"JacocoCoverage_jarjar_deploy.jar",
],
)
filegroup(
name = "jacoco_coverage_runtime",
srcs = ["JacocoCoverage_deploy.jar"],
)
# Bazel custom Jacoco runner used to provide proper initialization and lcov
# report generation when using offline Jacoco instrumentation.
# This target should not be used as a dependency (except when writing tests for
# it).
#
# An implicit dependency of all "java_binary" rules.
java_binary(
name = "JacocoCoverage",
srcs = [
"BranchCoverageDetail.java",
"BranchDetailAnalyzer.java",
"BranchExp.java",
"ClassProbesMapper.java",
"CovExp.java",
"JacocoCoverageRunner.java",
"JacocoLCOVFormatter.java",
"MethodProbesMapper.java",
"ProbeExp.java",
],
deps = [
":bitfield",
"//third_party/java/jacoco:blaze-agent",
"//third_party/java/jacoco:core",
"//third_party/java/jacoco:report",
],
)
java_library(
name = "bitfield",
srcs = [
"BitField.java",
"IllegalStringException.java",
],
deps = [
"//third_party:apache_commons_lang",
],
)
genrule(
name = "Jacoco_jarjar",
srcs = [
":JacocoCoverage_deploy.jar",
":JacocoCoverage.jarjar",
],
outs = ["JacocoCoverage_jarjar_deploy.jar"],
cmd = "\n".join([
# Bazel 0.4.3 contains two bugs: a quoting bug in the Java cmd.exe
# wrapper script that makes it unable to handle $ signs in paths (#2306)
# and one that makes it occasionally put $ signs in the output base
# (#2342).
#
# These two collude to make it impossible to run built Java binaries on
# Windows if the output base happens to contain a $ sign.
#
# Thus, don't call jarjar when on Windows. This makes Java coverage not
# work if the code under test uses libraries the test runner also does
# (e.g. ASM).
#
# TODO(lberki): Remove this once a Bazel version with a fix to either of
# these bugs is out.
"if [[ $$(uname -a) =~ MSYS ]]; then",
" cp \"$(location :JacocoCoverage_deploy.jar)\" \"$@\";",
"else",
" \"$(location //third_party/java/jarjar:jarjar_bin)\" process \"$(location :JacocoCoverage.jarjar)\" \"$(location :JacocoCoverage_deploy.jar)\" \"$@\"",
"fi",
]),
tools = ["//third_party/java/jarjar:jarjar_bin"],
)