aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Nieder <jrn@google.com>2017-03-19 17:41:26 -0700
committerJonathan Nieder <jrn@google.com>2017-03-19 18:51:03 -0700
commitbc5014faec917b08e665e6292b6279fc90ddc50d (patch)
tree5f211949c39543f505855bbc571dbeba08949271
parent5e5fbb6035b4bcee6717d8a7417e8f8905d1b563 (diff)
downloadjgit-bc5014faec917b08e665e6292b6279fc90ddc50d.tar.gz
jgit-bc5014faec917b08e665e6292b6279fc90ddc50d.zip
bazel: Add explicit targets for library dependencies
This provides a place to declare visibility restrictions and transitive dependencies for each library. Other targets should only declare dependencies on what they directly use, making dependencies easier to maintain. Trim the dependencies of org.eclipse.jgit:jgit to follow that rule. It declares dependencies on Apache httpcomponents and the servlet API but doesn't use them. Tested: * 'bazel build //...' succeeds * applying the change https://gerrit-review.googlesource.com/90843 to a copy of Gerrit, following the instructions there, and running 'bazel test //...' in that copy of Gerrit still succeeds Change-Id: I3ab958ce8b3227019cdbe4cc81e0f042e1541034
-rw-r--r--lib/BUILD60
-rw-r--r--org.eclipse.jgit.archive/BUILD2
-rw-r--r--org.eclipse.jgit.http.apache/BUILD4
-rw-r--r--org.eclipse.jgit.http.server/BUILD2
-rw-r--r--org.eclipse.jgit.junit/BUILD2
-rw-r--r--org.eclipse.jgit.lfs.server/BUILD8
-rw-r--r--org.eclipse.jgit/BUILD8
7 files changed, 72 insertions, 14 deletions
diff --git a/lib/BUILD b/lib/BUILD
new file mode 100644
index 0000000000..2a1d9104a6
--- /dev/null
+++ b/lib/BUILD
@@ -0,0 +1,60 @@
+java_library(
+ name = "commons-compress",
+ visibility = ["//org.eclipse.jgit.archive:__pkg__"],
+ exports = ["@commons_compress//jar"],
+)
+
+java_library(
+ name = "gson",
+ visibility = ["//org.eclipse.jgit.lfs.server:__pkg__"],
+ exports = ["@gson//jar"],
+)
+
+java_library(
+ name = "httpclient",
+ visibility = ["//org.eclipse.jgit.http.apache:__pkg__"],
+ exports = ["@httpclient//jar"],
+)
+
+java_library(
+ name = "httpcore",
+ visibility = [
+ "//org.eclipse.jgit.http.apache:__pkg__",
+ "//org.eclipse.jgit.lfs.server:__pkg__",
+ ],
+ exports = ["@httpcore//jar"],
+)
+
+java_library(
+ name = "javaewah",
+ visibility = ["//visibility:public"],
+ exports = ["@javaewah//jar"],
+)
+
+java_library(
+ name = "jsch",
+ visibility = ["//org.eclipse.jgit:__pkg__"],
+ exports = ["@jsch//jar"],
+)
+
+java_library(
+ name = "junit",
+ visibility = ["//org.eclipse.jgit.junit:__pkg__"],
+ exports = ["@junit//jar"],
+)
+
+java_library(
+ name = "servlet-api",
+ visibility = [
+ "//org.eclipse.jgit.http.apache:__pkg__",
+ "//org.eclipse.jgit.http.server:__pkg__",
+ "//org.eclipse.jgit.lfs.server:__pkg__",
+ ],
+ exports = ["@servlet_api_3_1//jar"],
+)
+
+java_library(
+ name = "slf4j-api",
+ visibility = ["//visibility:public"],
+ exports = ["@log_api//jar"],
+)
diff --git a/org.eclipse.jgit.archive/BUILD b/org.eclipse.jgit.archive/BUILD
index e15fcfacea..dfdbfdccba 100644
--- a/org.eclipse.jgit.archive/BUILD
+++ b/org.eclipse.jgit.archive/BUILD
@@ -9,8 +9,8 @@ java_library(
resource_strip_prefix = "org.eclipse.jgit.archive/resources",
resources = glob(["resources/**"]),
deps = [
+ "//lib:commons-compress",
# We want these deps to be provided_deps
"//org.eclipse.jgit:jgit",
- "@commons_compress//jar",
],
)
diff --git a/org.eclipse.jgit.http.apache/BUILD b/org.eclipse.jgit.http.apache/BUILD
index 0814537a66..c1538ab1c6 100644
--- a/org.eclipse.jgit.http.apache/BUILD
+++ b/org.eclipse.jgit.http.apache/BUILD
@@ -6,8 +6,8 @@ java_library(
resource_strip_prefix = "org.eclipse.jgit.http.apache/resources",
resources = glob(["resources/**"]),
deps = [
+ "//lib:httpclient",
+ "//lib:httpcore",
"//org.eclipse.jgit:jgit",
- "@httpclient//jar",
- "@httpcore//jar",
],
)
diff --git a/org.eclipse.jgit.http.server/BUILD b/org.eclipse.jgit.http.server/BUILD
index 19992086bd..876c5fa85f 100644
--- a/org.eclipse.jgit.http.server/BUILD
+++ b/org.eclipse.jgit.http.server/BUILD
@@ -6,8 +6,8 @@ java_library(
resource_strip_prefix = "org.eclipse.jgit.http.server/resources",
resources = glob(["resources/**"]),
deps = [
+ "//lib:servlet-api",
# We want these deps to be provided_deps
"//org.eclipse.jgit:jgit",
- "@servlet_api_3_1//jar",
],
)
diff --git a/org.eclipse.jgit.junit/BUILD b/org.eclipse.jgit.junit/BUILD
index 6d6462d27d..15a39c7cd7 100644
--- a/org.eclipse.jgit.junit/BUILD
+++ b/org.eclipse.jgit.junit/BUILD
@@ -6,8 +6,8 @@ java_library(
resource_strip_prefix = "org.eclipse.jgit.junit/resources",
resources = glob(["resources/**"]),
deps = [
+ "//lib:junit",
# We want these deps to be provided_deps
"//org.eclipse.jgit:jgit",
- "@junit//jar",
],
)
diff --git a/org.eclipse.jgit.lfs.server/BUILD b/org.eclipse.jgit.lfs.server/BUILD
index 5f1e12a7c4..fa14e8a206 100644
--- a/org.eclipse.jgit.lfs.server/BUILD
+++ b/org.eclipse.jgit.lfs.server/BUILD
@@ -6,12 +6,12 @@ java_library(
resource_strip_prefix = "org.eclipse.jgit.lfs.server/resources",
resources = glob(["resources/**"]),
deps = [
+ "//lib:gson",
+ "//lib:httpcore",
+ "//lib:servlet-api",
+ "//lib:slf4j-api",
"//org.eclipse.jgit.http.apache:http-apache",
"//org.eclipse.jgit:jgit",
"//org.eclipse.jgit.lfs:jgit-lfs",
- "@gson//jar",
- "@httpcore//jar",
- "@log_api//jar",
- "@servlet_api_3_1//jar",
],
)
diff --git a/org.eclipse.jgit/BUILD b/org.eclipse.jgit/BUILD
index ed0fbf0650..75f4fe69c1 100644
--- a/org.eclipse.jgit/BUILD
+++ b/org.eclipse.jgit/BUILD
@@ -18,11 +18,9 @@ java_library(
resources = RESOURCES,
deps = [
":insecure_cipher_factory",
- "@httpclient//jar",
- "@javaewah//jar",
- "@jsch//jar",
- "@log_api//jar",
- "@servlet_api_3_1//jar",
+ "//lib:javaewah",
+ "//lib:jsch",
+ "//lib:slf4j-api",
],
)