Skip to content

Commit

Permalink
ci: Build sources and docs jar for jazzer-api and jazzer-junit for ma…
Browse files Browse the repository at this point in the history
…ven deployment
  • Loading branch information
zgtm committed Dec 20, 2024
1 parent 6352db6 commit 0f6979e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
7 changes: 5 additions & 2 deletions deploy/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ java_export(
],
maven_coordinates = "com.code-intelligence:jazzer-api:$(JAZZER_VERSION)",
pom_template = "//deploy:jazzer-api.pom",
tags = ["no-sources"],
toolchains = [":jazzer_version"],
visibility = ["//visibility:public"],
runtime_deps = ["//src/main/java/com/code_intelligence/jazzer/api"],
Expand Down Expand Up @@ -71,6 +70,11 @@ alias(
actual = "//src/main/java/com/code_intelligence/jazzer:jazzer-sources",
)

alias(
name = "jazzer-junit-docs",
actual = "//src/main/java/com/code_intelligence/jazzer/junit:jazzer-junit-docs",
)

java_export(
name = "jazzer-junit",
# Exclude the unshaded classes comprising com.code-intelligence:jazzer since the java_library
Expand All @@ -90,7 +94,6 @@ java_export(
maven_coordinates = "com.code-intelligence:jazzer-junit:$(JAZZER_VERSION)",
pom_template = "jazzer-junit.pom",
tags = [
"no-sources",
# Generating javadocs breaks the build due to weird dependency issues.
# Deactivate it for now.
"no-javadocs",
Expand Down
14 changes: 11 additions & 3 deletions deploy/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,20 @@ JAZZER_DOCS_PATH=$PWD/$(bazel cquery --output=files //deploy:jazzer-docs)
JAZZER_SOURCES_PATH=$PWD/$(bazel cquery --output=files //deploy:jazzer-sources)
JAZZER_POM_PATH=$PWD/$(bazel cquery --output=files //deploy:jazzer-pom)

## For Junit we currently have to do similar tricks because the docs will not build automatically
bazel build //deploy:jazzer-junit //deploy:jazzer-junit-docs //deploy:jazzer-junit-sources //deploy:jazzer-junit-pom

JAZZER_JUNIT_JAR_PATH=$PWD/$(bazel cquery --output=files //deploy:jazzer-junit-maven-artifact)
JAZZER_JUNIT_DOCS_PATH=$PWD/$(bazel cquery --output=files //deploy:jazzer-junit-docs)
JAZZER_JUNIT_SOURCES_PATH=$PWD/$(bazel cquery --output=files //deploy:jazzer-junit-maven-source)
JAZZER_JUNIT_POM_PATH=$PWD/$(bazel cquery --output=files //deploy:jazzer-junit-pom)

bazel run --define "maven_repo=${MAVEN_REPO}" --define "maven_user=${MAVEN_USER}" \
--define "maven_password=${MAVEN_PASSWORD}" --define gpg_sign=true \
//deploy:jazzer-api.publish
MAVEN_REPO="$MAVEN_REPO" GPG_SIGN="true" MAVEN_USER="$MAVEN_USER" MAVEN_PASSWORD="$MAVEN_PASSWORD" \
bazel run @rules_jvm_external//private/tools/java/com/github/bazelbuild/rules_jvm_external/maven:MavenPublisher -- \
"$JAZZER_COORDINATES" "$JAZZER_POM_PATH" "$JAZZER_JAR_PATH" "sources=${JAZZER_SOURCES_PATH},javadoc=${JAZZER_DOCS_PATH}"
bazel run --define "maven_repo=${MAVEN_REPO}" --define "maven_user=${MAVEN_USER}" \
--define "maven_password=${MAVEN_PASSWORD}" --define gpg_sign=true \
//deploy:jazzer-junit.publish
MAVEN_REPO="$MAVEN_REPO" GPG_SIGN="true" MAVEN_USER="$MAVEN_USER" MAVEN_PASSWORD="$MAVEN_PASSWORD" \
bazel run @rules_jvm_external//private/tools/java/com/github/bazelbuild/rules_jvm_external/maven:MavenPublisher -- \
"$JAZZER_COORDINATES" "$JAZZER_JUNIT_POM_PATH" "$JAZZER_JUNIT_JAR_PATH" "sources=${JAZZER_JUNIT_SOURCES_PATH},javadoc=${JAZZER_JUNIT_DOCS_PATH}"
13 changes: 13 additions & 0 deletions src/main/java/com/code_intelligence/jazzer/junit/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@rules_jni//jni:defs.bzl", "java_jni_library")
load("@rules_jvm_external//:defs.bzl", "javadoc")

java_library(
name = "junit",
Expand Down Expand Up @@ -174,3 +175,15 @@ java_library(
"@maven//:org_junit_jupiter_junit_jupiter_params",
],
)

javadoc(
name = "jazzer-junit-docs",
doc_deps = ["//deploy:jazzer-api-docs"],
doc_url = "https://codeintelligencetesting.github.io/jazzer-docs/jazzer-junit/",
javadocopts = [
"-link",
"https://docs.oracle.com/en/java/javase/17/docs/api/",
],
visibility = ["//deploy:__pkg__"],
deps = [":fuzz_test"],
)

0 comments on commit 0f6979e

Please sign in to comment.