aboutsummaryrefslogtreecommitdiff
path: root/agent/BUILD.bazel
blob: aedbe424604e1d22f0f53100452895fdb663f44a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
load("@com_github_johnynek_bazel_jar_jar//:jar_jar.bzl", "jar_jar")
load("//bazel:compat.bzl", "SKIP_ON_WINDOWS")
load("//bazel:jar.bzl", "strip_jar")
load("//sanitizers:sanitizers.bzl", "SANITIZER_CLASSES")

java_binary(
    name = "jazzer_agent_unshaded",
    create_executable = False,
    deploy_manifest_lines = [
        "Premain-Class: com.code_intelligence.jazzer.agent.Agent",
        "Can-Retransform-Classes: true",
        "Jazzer-Hook-Classes: ",
    ] + [" {}:".format(c) for c in SANITIZER_CLASSES],
    runtime_deps = [
        "//agent/src/main/java/com/code_intelligence/jazzer/agent:agent_lib",
        "//driver/src/main/java/com/code_intelligence/jazzer/driver",
        "//sanitizers",
    ],
)

strip_jar(
    name = "jazzer_agent_deploy",
    out = "jazzer_agent_deploy.jar",
    jar = ":jazzer_agent_shaded_deploy",
    paths_to_strip = [
        "module-info.class",
    ],
    visibility = ["//visibility:public"],
)

jar_jar(
    name = "jazzer_agent_shaded_deploy",
    input_jar = "jazzer_agent_unshaded_deploy.jar",
    rules = "agent_shade_rules",
)

sh_test(
    name = "jazzer_agent_shading_test",
    srcs = ["verify_shading.sh"],
    args = [
        "$(rootpath :jazzer_agent_deploy)",
    ],
    data = [
        ":jazzer_agent_deploy",
        "@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,
)

java_binary(
    name = "jazzer_api",
    create_executable = False,
    visibility = ["//visibility:public"],
    runtime_deps = ["//agent/src/main/java/com/code_intelligence/jazzer/api"],
)

java_import(
    name = "jazzer_api_compile_only",
    jars = [
        ":jazzer_api_deploy.jar",
    ],
    neverlink = True,
    visibility = ["//visibility:public"],
    deps = [],
)