blob: 4b22a7a36639ca021c445eedfd3e46f061c72afc [file] [log] [blame]
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("@rules_jvm_external//:defs.bzl", "java_export")
load("//:maven.bzl", "JAZZER_API_COORDINATES", "JAZZER_COORDINATES", "JAZZER_JUNIT_COORDINATES")
load("//bazel:compat.bzl", "SKIP_ON_WINDOWS")
bool_flag(
name = "linked_javadoc",
build_setting_default = False,
)
config_setting(
name = "emit_linked_javadoc",
flag_values = {
":linked_javadoc": "True",
},
visibility = ["//:__subpackages__"],
)
sh_binary(
name = "deploy",
srcs = ["deploy.sh"],
args = [JAZZER_COORDINATES],
)
java_export(
name = "jazzer-api",
javadocopts = select({
":emit_linked_javadoc": [
"-link",
"https://docs.oracle.com/en/java/javase/17/docs/api/",
],
"//conditions:default": [],
}),
maven_coordinates = JAZZER_API_COORDINATES,
pom_template = "//deploy:jazzer-api.pom",
visibility = ["//visibility:public"],
runtime_deps = ["//src/main/java/com/code_intelligence/jazzer/api"],
)
java_export(
name = "jazzer",
maven_coordinates = JAZZER_COORDINATES,
pom_template = "jazzer.pom",
# Do not generate an implicit javadocs target - the current target is based on the shaded deploy
# JAR, for which the docs JAR generated by default would be empty.
tags = ["no-javadocs"],
visibility = ["//visibility:public"],
runtime_deps = [
"//src/main/java/com/code_intelligence/jazzer:jazzer_import",
],
)
alias(
name = "jazzer-docs",
actual = "//src/main/java/com/code_intelligence/jazzer:jazzer-docs",
)
alias(
name = "jazzer-sources",
actual = "//src/main/java/com/code_intelligence/jazzer:jazzer-sources",
)
java_export(
name = "jazzer-junit",
# Exclude the unshaded classes comprising com.code-intelligence:jazzer since the java_library
# target comprising jazzer-junit depend on the individual libraries, not the shaded jar.
deploy_env = ["//src/main/java/com/code_intelligence/jazzer:jazzer_lib"],
javadocopts = select({
":emit_linked_javadoc": [
"-link",
"https://docs.oracle.com/en/java/javase/17/docs/api/",
"-link",
"https://codeintelligencetesting.github.io/jazzer-docs/jazzer-api/",
"-link",
"https://codeintelligencetesting.github.io/jazzer-docs/jazzer/",
"-link",
"https://junit.org/junit5/docs/current/api/",
],
"//conditions:default": [],
}),
maven_coordinates = JAZZER_JUNIT_COORDINATES,
pom_template = "jazzer-junit.pom",
visibility = ["//visibility:public"],
runtime_deps = [
# These deps' only effect is to include a dependency on the 'jazzer' and 'jazzer-api' Maven artifacts in the
# POM.
"//deploy:jazzer",
"//deploy:jazzer-api",
"//src/main/java/com/code_intelligence/jazzer/junit",
],
)
[
sh_test(
name = artifact + "_artifact_test",
srcs = [artifact + "_artifact_test.sh"],
args = [
"$(rootpath :%s)" % artifact,
],
data = [
":" + artifact,
"@local_jdk//:bin/jar",
],
tags = [
# Coverage instrumentation necessarily adds files to the jar that we
# wouldn't want to release and thus causes this test to fail.
"no-coverage",
],
target_compatible_with = SKIP_ON_WINDOWS,
)
for artifact in [
"jazzer-api",
"jazzer",
"jazzer-junit",
]
]