Skip to content

Commit

Permalink
Use bazel-common's log4j instead of defining our own
Browse files Browse the repository at this point in the history
Also add support to release the flogger-log4j artifact to Maven

This also simplifies some MOE logic.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=196882141
  • Loading branch information
ronshapiro committed May 25, 2018
1 parent 4b459a9 commit 5619bf2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
10 changes: 2 additions & 8 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,10 @@

http_archive(
name = "google_bazel_common",
strip_prefix = "bazel-common-a339ff2d533ad5ba446f4ea0f77c05d10c39f96d",
urls = ["https://github.com/google/bazel-common/archive/a339ff2d533ad5ba446f4ea0f77c05d10c39f96d.zip"],
strip_prefix = "bazel-common-e7580d1db7466e6c8403f7826b7558ea5e99bbfd",
urls = ["https://github.com/google/bazel-common/archive/e7580d1db7466e6c8403f7826b7558ea5e99bbfd.zip"],
)

load("@google_bazel_common//:workspace_defs.bzl", "google_common_workspace_rules")

google_common_workspace_rules()

maven_jar(
name = "log4j",
artifact = "log4j:log4j:1.2.17",
sha1 = "5af35056b4d257e4b64b9e8069c0746e8b08629f",
)
24 changes: 16 additions & 8 deletions log4j/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,47 @@

package(default_visibility = ["//:internal"])

LOG4J_BACKEND_SRCS = glob(["src/main/java/com/google/common/flogger/backend/log4j/**/*.java"])
LOG4J_BACKEND_SRCS = glob(["src/main/java/**/*.java"])

java_library(
name = "log4j_backend",
srcs = LOG4J_BACKEND_SRCS,
javacopts = ["-source 1.6 -target 1.6"],
tags = ["maven_coordinates=com.google.flogger:flogger-log4j-backend:${project.version}"],
deps = [
"//api",
"//api:system_backend",
"@google_bazel_common//third_party/java/guava",
"@google_bazel_common//third_party/java/jsr305_annotations",
"@log4j//jar",
"@google_bazel_common//third_party/java/log4j",
],
)

load("//tools:maven.bzl", "pom_file")

pom_file(
name = "log4j_backend_pom",
artifact_id = "flogger-log4j",
name = "pom",
artifact_id = "flogger-log4j-backend",
artifact_name = "Flogger Log4j Backend",
targets = [":log4j_backend"],
)

load("@google_bazel_common//tools/javadoc:javadoc.bzl", "javadoc_library")

javadoc_library(
name = "javadoc",
srcs = LOG4J_BACKEND_SRCS,
root_packages = ["com.google.common.flogger.backend.log4j"],
deps = [":log4j_backend"],
)

# ---- Unit Tests ----

load("@google_bazel_common//testing:test_defs.bzl", "gen_java_tests")

gen_java_tests(
name = "log4j_tests",
srcs = glob(
["src/test/java/**/*.java"],
),
srcs = glob(["src/test/java/**/*.java"]),
deps = [
":log4j_backend",
"//api",
Expand All @@ -48,8 +56,8 @@ gen_java_tests(
"@google_bazel_common//third_party/java/guava:testlib",
"@google_bazel_common//third_party/java/jsr305_annotations",
"@google_bazel_common//third_party/java/junit",
"@google_bazel_common//third_party/java/log4j",
"@google_bazel_common//third_party/java/mockito",
"@google_bazel_common//third_party/java/truth",
"@log4j//jar",
],
)
6 changes: 6 additions & 0 deletions release/execute-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,9 @@ deploy_library \
google/libflogger-src.jar \
google/flogger_javadoc.jar \
google/google_logger_pom.xml

deploy_library \
log4j/liblog4j_backend.jar \
log4j/liblog4j_backend-src.jar \
log4j/javadoc.jar \
log4j/pom.xml

0 comments on commit 5619bf2

Please sign in to comment.