]> source.dussan.org Git - jgit.git/commitdiff
bazel: Add explicit targets for library dependencies 93/93393/4
authorJonathan Nieder <jrn@google.com>
Mon, 20 Mar 2017 00:41:26 +0000 (17:41 -0700)
committerJonathan Nieder <jrn@google.com>
Mon, 20 Mar 2017 01:51:03 +0000 (18:51 -0700)
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

lib/BUILD [new file with mode: 0644]
org.eclipse.jgit.archive/BUILD
org.eclipse.jgit.http.apache/BUILD
org.eclipse.jgit.http.server/BUILD
org.eclipse.jgit.junit/BUILD
org.eclipse.jgit.lfs.server/BUILD
org.eclipse.jgit/BUILD

diff --git a/lib/BUILD b/lib/BUILD
new file mode 100644 (file)
index 0000000..2a1d910
--- /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"],
+)
index e15fcfaceaa1e492ed504b862a31d0793ae3617f..dfdbfdccba3342eb186df5f9167299d641cb90c0 100644 (file)
@@ -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",
     ],
 )
index 0814537a665854a154133be7f1e16299292b0952..c1538ab1c6fb5ca7fb05ed206f5b9d8ce3f35e6c 100644 (file)
@@ -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",
     ],
 )
index 19992086bd97ee74aece4262b98b3939abca25ec..876c5fa85f4382fcbc19071c913212b2f5187ece 100644 (file)
@@ -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",
     ],
 )
index 6d6462d27d1d02c875eddf15e52a0af31df8df71..15a39c7cd730a3a2675d5281c63700863106bd99 100644 (file)
@@ -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",
     ],
 )
index 5f1e12a7c49ba22a9bb888d4aa7c4dc5212b3e37..fa14e8a206a18b32d535399bf5301f7b7fac204b 100644 (file)
@@ -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",
     ],
 )
index ed0fbf0650e8b3e32fbc5973d9f52bd0284465b9..75f4fe69c151972988c9afce6b9fa1ac84200e0b 100644 (file)
@@ -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",
     ],
 )