diff options
Diffstat (limited to 'deploy/BUILD.bazel')
-rw-r--r-- | deploy/BUILD.bazel | 117 |
1 files changed, 110 insertions, 7 deletions
diff --git a/deploy/BUILD.bazel b/deploy/BUILD.bazel index 7cceeae5..4b22a7a3 100644 --- a/deploy/BUILD.bazel +++ b/deploy/BUILD.bazel @@ -1,13 +1,116 @@ +load("@bazel_skylib//rules:common_settings.bzl", "bool_flag") load("@rules_jvm_external//:defs.bzl", "java_export") -load("//:maven.bzl", "JAZZER_API_COORDINATES") +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], +) -# To publish a new release of the Jazzer API to Maven, run: -# bazel run --config=maven --define "maven_user=..." --define "maven_password=..." --define gpg_sign=true //deploy:api.publish -# Build //deploy:api-docs to generate javadocs for the API. java_export( - name = "api", + 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 = "//:jazzer-api.pom", + 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 = ["//agent/src/main/java/com/code_intelligence/jazzer/api"], + 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", + ] +] |