Update Buck
java_library() now accepts provided_deps argument which replaces
our custom use of java_library2().
This change replaces compile_deps with provided_deps parameter in
gerrit_{plugin,extension} rules. Plugins that are using it must be
updated.
Change-Id: I16d53793da567c958267f91ca203e9cae6c4d02f
diff --git a/.buckversion b/.buckversion
index cec726d..2c9f529 100644
--- a/.buckversion
+++ b/.buckversion
@@ -1 +1 @@
-1ba4496a782b40dec33a42e69a74837afee06177
+021695d5e68cde7457c9849fd0a2397f91e6491e
diff --git a/Documentation/gen_licenses.py b/Documentation/gen_licenses.py
index d67b2a5..912c4c5 100755
--- a/Documentation/gen_licenses.py
+++ b/Documentation/gen_licenses.py
@@ -22,9 +22,14 @@
import re
from shutil import copyfileobj
from subprocess import Popen, PIPE
-from sys import stdout
+from sys import stdout, stderr
MAIN = ['//gerrit-pgm:pgm', '//gerrit-gwtui:ui_module']
+KNOWN_PROVIDED_DEPS = [
+ '//lib/bouncycastle:bcpg',
+ '//lib/bouncycastle:bcpkix',
+ '//lib/bouncycastle:bcprov',
+]
def parse_graph():
graph = defaultdict(list)
@@ -38,7 +43,14 @@
if not m:
continue
target, dep = m.group(1), m.group(2)
- if not target.endswith('__compile'):
+ # Dependencies included in provided_deps set are contained in audit
+ # classpath and must be sorted out. That's safe thing to do because
+ # they are not included in the final artifact.
+ if "DO_NOT_DISTRIBUTE" in dep:
+ if not target in KNOWN_PROVIDED_DEPS:
+ print('DO_NOT_DISTRIBUTE license for tagret: %s' % target, file=stderr)
+ exit(1)
+ else:
graph[target].append(dep)
r = p.wait()
if r != 0:
diff --git a/gerrit-extension-api/BUCK b/gerrit-extension-api/BUCK
index 6ce24b3..3870736 100644
--- a/gerrit-extension-api/BUCK
+++ b/gerrit-extension-api/BUCK
@@ -31,10 +31,10 @@
visibility = ['PUBLIC'],
)
-java_library2(
+java_library(
name = 'api',
srcs = glob([SRC + '**/*.java']),
- compile_deps = ['//lib/guice:guice'],
+ provided_deps = ['//lib/guice:guice'],
visibility = ['PUBLIC'],
)
diff --git a/gerrit-gwtexpui/BUCK b/gerrit-gwtexpui/BUCK
index 76d0741..028b34e 100644
--- a/gerrit-gwtexpui/BUCK
+++ b/gerrit-gwtexpui/BUCK
@@ -43,10 +43,10 @@
visibility = ['PUBLIC'],
)
-java_library2(
+java_library(
name = 'linker_server',
srcs = glob([SRC + 'linker/server/*.java']),
- compile_deps = ['//lib:servlet-api-3_1'],
+ provided_deps = ['//lib:servlet-api-3_1'],
visibility = ['PUBLIC'],
)
@@ -90,9 +90,9 @@
visibility = ['PUBLIC'],
)
-java_library2(
+java_library(
name = 'server',
srcs = glob([SRC + 'server/*.java']),
- compile_deps = ['//lib:servlet-api-3_1'],
+ provided_deps = ['//lib:servlet-api-3_1'],
visibility = ['PUBLIC'],
)
diff --git a/gerrit-gwtui-common/BUCK b/gerrit-gwtui-common/BUCK
index 76f2db8..debad476 100644
--- a/gerrit-gwtui-common/BUCK
+++ b/gerrit-gwtui-common/BUCK
@@ -14,11 +14,11 @@
visibility = ['PUBLIC'],
)
-java_library2(
+java_library(
name = 'client-lib2',
srcs = glob(['src/main/**/*.java']),
resources = glob(['src/main/**/*']),
- compile_deps = ['//lib/gwt:user'],
+ provided_deps = ['//lib/gwt:user'],
visibility = ['PUBLIC'],
)
diff --git a/gerrit-httpd/BUCK b/gerrit-httpd/BUCK
index 6005e4a..f2c0232 100644
--- a/gerrit-httpd/BUCK
+++ b/gerrit-httpd/BUCK
@@ -3,7 +3,7 @@
)
RESOURCES = glob(['src/main/resources/**/*'])
-java_library2(
+java_library(
name = 'httpd',
srcs = SRCS,
resources = RESOURCES,
@@ -34,7 +34,7 @@
'//lib/log:api',
'//lib/lucene:core',
],
- compile_deps = ['//lib:servlet-api-3_1'],
+ provided_deps = ['//lib:servlet-api-3_1'],
visibility = ['PUBLIC'],
)
diff --git a/gerrit-openid/BUCK b/gerrit-openid/BUCK
index 90d0d48..8761d34 100644
--- a/gerrit-openid/BUCK
+++ b/gerrit-openid/BUCK
@@ -1,4 +1,4 @@
-java_library2(
+java_library(
name = 'openid',
srcs = glob(['src/main/java/**/*.java']),
resources = glob(['src/main/resources/**/*']),
@@ -18,6 +18,6 @@
'//lib/log:api',
'//lib/openid:consumer',
],
- compile_deps = ['//lib:servlet-api-3_1'],
+ provided_deps = ['//lib:servlet-api-3_1'],
visibility = ['PUBLIC'],
)
diff --git a/gerrit-pgm/BUCK b/gerrit-pgm/BUCK
index f76fa4c..a968ef4 100644
--- a/gerrit-pgm/BUCK
+++ b/gerrit-pgm/BUCK
@@ -50,7 +50,7 @@
INIT_BASE_RSRCS = ['src/main/resources/com/google/gerrit/pgm/libraries.config']
-java_library2(
+java_library(
name = 'init-base',
srcs = INIT_BASE_SRCS,
resources = INIT_BASE_RSRCS,
@@ -73,14 +73,14 @@
'//lib:gwtorm',
'//lib/log:api',
],
- compile_deps = ['//gerrit-launcher:launcher'],
+ provided_deps = ['//gerrit-launcher:launcher'],
visibility = [
'//gerrit-war:',
'//gerrit-acceptance-tests/...',
],
)
-java_library2(
+java_library(
name = 'pgm',
srcs = glob(
['src/main/java/**/*.java'],
@@ -122,7 +122,7 @@
'//lib/lucene:core',
'//lib/prolog:prolog-cafe',
],
- compile_deps = ['//gerrit-launcher:launcher'],
+ provided_deps = ['//gerrit-launcher:launcher'],
visibility = [
'//:',
'//gerrit-acceptance-tests/...',
diff --git a/gerrit-plugin-gwtui/BUCK b/gerrit-plugin-gwtui/BUCK
index d256049..911016c 100644
--- a/gerrit-plugin-gwtui/BUCK
+++ b/gerrit-plugin-gwtui/BUCK
@@ -22,12 +22,12 @@
visibility = ['PUBLIC'],
)
-java_library2(
+java_library(
name = 'gwtui-api-lib2',
srcs = SRCS,
resources = glob(['src/main/**/*']),
deps = ['//gerrit-gwtui-common:client-lib2'],
- compile_deps = DEPS,
+ provided_deps = DEPS,
visibility = ['PUBLIC'],
)
diff --git a/gerrit-server/BUCK b/gerrit-server/BUCK
index a75967a..a6a13ef 100644
--- a/gerrit-server/BUCK
+++ b/gerrit-server/BUCK
@@ -8,14 +8,14 @@
)
RESOURCES = glob(['src/main/resources/**/*'])
-java_library2(
+java_library(
name = 'constants',
srcs = CONSTANTS_SRC,
visibility = ['PUBLIC'],
)
# TODO(sop) break up gerrit-server java_library(), its too big
-java_library2(
+java_library(
name = 'server',
srcs = SRCS,
resources = RESOURCES,
@@ -67,7 +67,7 @@
'//lib/lucene:core',
'//lib/lucene:query-parser',
],
- compile_deps = [
+ provided_deps = [
'//lib/bouncycastle:bcprov',
'//lib/bouncycastle:bcpg',
'//lib/bouncycastle:bcpkix',
diff --git a/gerrit-sshd/BUCK b/gerrit-sshd/BUCK
index 3028968..4c59bcf 100644
--- a/gerrit-sshd/BUCK
+++ b/gerrit-sshd/BUCK
@@ -1,6 +1,6 @@
SRCS = glob(['src/main/java/**/*.java'])
-java_library2(
+java_library(
name = 'sshd',
srcs = SRCS,
deps = [
@@ -27,7 +27,7 @@
'//lib/mina:sshd',
'//lib/jgit:jgit',
],
- compile_deps = [
+ provided_deps = [
'//lib/bouncycastle:bcprov',
],
visibility = ['PUBLIC'],
diff --git a/gerrit-war/BUCK b/gerrit-war/BUCK
index a96d095..7e11aea 100644
--- a/gerrit-war/BUCK
+++ b/gerrit-war/BUCK
@@ -1,6 +1,6 @@
include_defs('//tools/git.defs')
-java_library2(
+java_library(
name = 'init',
srcs = glob(['src/main/java/**/*.java']),
deps = [
@@ -23,7 +23,7 @@
'//lib/log:api',
'//lib/jgit:jgit',
],
- compile_deps = ['//lib:servlet-api-3_1'],
+ provided_deps = ['//lib:servlet-api-3_1'],
visibility = [
'//:',
'//gerrit-gwtdebug:gwtdebug',
diff --git a/tools/build.defs b/tools/build.defs
index af39c2a..5c01e8f 100644
--- a/tools/build.defs
+++ b/tools/build.defs
@@ -33,7 +33,7 @@
deps = []
for n in os.listdir('plugins'):
if os.path.exists(os.path.join('plugins', n, 'BUCK')):
- deps.append('//plugins/%s:%s__plugin__compile' % (n, n))
+ deps.append('//plugins/%s:%s__plugin' % (n, n))
return deps
def war(
diff --git a/tools/default.defs b/tools/default.defs
index fcc8d99..a550a47 100644
--- a/tools/default.defs
+++ b/tools/default.defs
@@ -74,47 +74,10 @@
visibility = visibility,
)
-# Compiles a Java library with additional compile-time dependencies
-# that do not show up as transitive dependencies to java_library()
-# or java_binary() rule that depends on this library.
-def java_library2(
- name,
- srcs = [],
- resources = [],
- deps = [],
- compile_deps = [],
- visibility = []):
- c = name + '__compile'
- t = name + '__link'
- j = 'lib__%s__output/%s.jar' % (c, c)
- o = 'lib__%s__output/%s.jar' % (name, name)
- java_library(
- name = c,
- srcs = srcs,
- resources = resources,
- deps = deps + compile_deps,
- visibility = ['//tools/eclipse:classpath'],
- )
- # Break the dependency chain by passing the newly built
- # JAR to consumers through a prebuilt_jar().
- genrule(
- name = t,
- cmd = 'mkdir -p $(dirname $OUT);ln -s $SRCS $OUT',
- srcs = [genfile(j)],
- deps = [':' + c],
- out = o,
- )
- prebuilt_jar(
- name = name,
- binary_jar = genfile(o),
- deps = deps + [':' + t],
- visibility = visibility,
- )
-
def gerrit_extension(
name,
deps = [],
- compile_deps = [],
+ provided_deps = [],
srcs = [],
resources = [],
manifest_file = None,
@@ -123,7 +86,7 @@
gerrit_plugin(
name = name,
deps = deps,
- compile_deps = compile_deps,
+ provided_deps = provided_deps,
srcs = srcs,
resources = resources,
manifest_file = manifest_file,
@@ -135,7 +98,7 @@
def gerrit_plugin(
name,
deps = [],
- compile_deps = [],
+ provided_deps = [],
srcs = [],
resources = [],
gwt_module = None,
@@ -167,12 +130,13 @@
if gwt_module:
gwt_deps = GWT_PLUGIN_DEPS
static_jars = [':%s-static-jar' % name]
- java_library2(
+ java_library(
name = name + '__plugin',
srcs = srcs,
resources = resources,
deps = deps,
- compile_deps = ['//gerrit-%s-api:lib' % type] + compile_deps + gwt_deps,
+ provided_deps = ['//gerrit-%s-api:lib' % type] + provided_deps + gwt_deps,
+ visibility = ['//tools/eclipse:classpath'],
)
if gwt_module:
prebuilt_jar(
diff --git a/tools/eclipse/BUCK b/tools/eclipse/BUCK
index ca92f50..4e76b029 100644
--- a/tools/eclipse/BUCK
+++ b/tools/eclipse/BUCK
@@ -10,11 +10,14 @@
'//gerrit-httpd:httpd_tests',
'//gerrit-main:main_lib',
'//gerrit-patch-jgit:jgit_patch_tests',
- '//gerrit-plugin-gwtui:gwtui-api',
- '//gerrit-server:server__compile',
+ '//gerrit-plugin-gwtui:gwtui-api-lib',
+ '//gerrit-server:server',
'//gerrit-server:server_tests',
'//lib/asciidoctor:asciidoc_lib',
'//lib/asciidoctor:doc_indexer_lib',
+ '//lib/bouncycastle:bcprov',
+ '//lib/bouncycastle:bcpg',
+ '//lib/bouncycastle:bcpkix',
'//lib/jetty:webapp',
'//lib/prolog:compiler_lib',
'//Documentation:index_lib',