Update buck build for strict dependencies

java_library() targets must now list every dependency they need for
an import. This permits buck to run more targets in parallel as it
has a better view of the dependency graph, and opens the door for
buck to make even more optimizations in the future.

Change-Id: I132bf47a725e44ba5950ba6ca76bfa72c3876906
This commit is contained in:
Shawn Pearce 2013-05-15 14:36:29 -07:00 committed by Gerrit Code Review
parent be0e5c698f
commit bd5629718f
20 changed files with 194 additions and 64 deletions

1
.buckversion Normal file
View File

@ -0,0 +1 @@
c4df74bef4e101a7e5d0176831825b7946ea64a3

2
BUCK
View File

@ -26,6 +26,7 @@ java_library(
'//lib/guice:guice-servlet',
'//lib:servlet-api-3_0',
],
export_deps = True,
visibility = ['PUBLIC'],
)
@ -37,6 +38,7 @@ java_library(
'//gerrit-sshd:sshd',
'//gerrit-httpd:httpd',
],
export_deps = True,
visibility = ['PUBLIC'],
)

View File

@ -8,13 +8,27 @@ java_test(
name = 'acceptance_tests',
srcs = glob(['src/test/java/**/*.java']),
deps = TEST + [
'//gerrit-common:server',
'//gerrit-extension-api:api',
'//gerrit-launcher:launcher',
'//gerrit-pgm:pgm',
'//lib:servlet-api-3_0',
'//gerrit-reviewdb:server',
'//lib:args4j',
'//lib:gson',
'//lib:guava',
'//lib:gwtorm',
'//lib:h2',
'//lib:jsch',
'//lib:jsr305',
'//lib:junit',
'//lib:servlet-api-3_0',
'//lib/guice:guice',
'//lib/jgit:jgit',
'//lib/jgit:junit',
'//lib/openid:httpclient',
'//lib/openid:httpcore',
],
source_under_test = TEST,
labels = ['slow'],

View File

@ -2,16 +2,16 @@ ANTLR_OUTS = [
'QueryLexer.java',
'QueryParser.java',
]
java_library(
name = 'antlr',
deps = [':query'],
visibility = ['PUBLIC'],
)
PARSER_DEPS = [
':query_antlr',
':query_exception',
'//lib/antlr:java_runtime',
]
java_library(
name = 'query_exception',
srcs = ['src/main/java/com/google/gerrit/server/query/QueryParseException.java'],
visibility = ['PUBLIC'],
)
genantlr(
@ -20,14 +20,11 @@ genantlr(
outs = ANTLR_OUTS,
)
# Hack necessary to expose ANTLR generated code as JAR to Eclipse.
java_library(
name = 'lib',
srcs = [genfile(f) for f in ANTLR_OUTS],
deps = [
':query_antlr',
':query_exception',
'//lib/antlr:java_runtime',
],
deps = PARSER_DEPS,
)
genrule(
@ -35,15 +32,12 @@ genrule(
cmd = 'ln -s $SRCS $OUT',
srcs = [genfile('lib__lib__output/lib.jar')],
deps = [':lib'],
out = 'query.jar',
out = 'query_parser.jar',
)
prebuilt_jar(
name = 'query',
binary_jar = genfile('query.jar'),
deps = [
':query_link',
':query_exception',
'//lib/antlr:java_runtime',
],
name = 'query_parser',
binary_jar = genfile('query_parser.jar'),
deps = PARSER_DEPS + [':query_link'],
visibility = ['PUBLIC'],
)

View File

@ -2,9 +2,13 @@ java_library(
name = 'cache-h2',
srcs = glob(['src/main/java/**/*.java']),
deps = [
'//gerrit-extension-api:api',
'//gerrit-server:server',
'//lib:guava',
'//lib:h2',
'//lib/guice:guice',
'//lib/jgit:jgit',
'//lib/log:api',
],
visibility = ['PUBLIC'],
)

View File

@ -9,7 +9,10 @@ gwt_module(
'//gerrit-patch-jgit:client',
'//gerrit-prettify:client',
'//gerrit-reviewdb:client',
'//lib:gwtjsonrpc',
'//lib:gwtorm',
'//lib:jsr305',
'//lib/jgit:jgit',
],
visibility = ['PUBLIC'],
)
@ -21,7 +24,10 @@ java_library(
'//gerrit-patch-jgit:server',
'//gerrit-prettify:server',
'//gerrit-reviewdb:server',
'//lib:gwtjsonrpc',
'//lib:gwtorm',
'//lib:jsr305',
'//lib/jgit:jgit',
],
visibility = ['PUBLIC'],
)

View File

@ -1,10 +1,6 @@
java_library2(
name = 'api',
srcs = glob(['src/main/java/com/google/gerrit/extensions/**/*.java']),
compile_deps = [
'//lib/guice:guice',
'//lib/guice:guice-servlet',
'//lib:servlet-api-3_0',
],
compile_deps = ['//lib/guice:guice'],
visibility = ['PUBLIC'],
)

View File

@ -72,7 +72,10 @@ gwt_module(
'//gerrit-reviewdb:client',
'//lib:gwtjsonrpc',
'//lib:gwtjsonrpc_src',
'//lib:gwtorm',
'//lib:jsr305',
'//lib/gwt:user',
'//lib/jgit:jgit',
],
visibility = [
'//tools/eclipse:classpath',
@ -87,6 +90,7 @@ java_test(
':ui_module',
'//lib:junit',
'//lib/gwt:dev',
'//lib/jgit:jgit',
],
source_under_test = [':ui_module'],
)

View File

@ -3,16 +3,33 @@ java_library2(
srcs = glob(['src/main/java/**/*.java']),
resources = glob(['src/main/resources/**/*']),
deps = [
'//gerrit-antlr:query_exception',
'//gerrit-common:server',
'//gerrit-extension-api:api',
'//gerrit-gwtexpui:linker_server',
'//gerrit-gwtexpui:server',
'//gerrit-patch-jgit:server',
'//gerrit-prettify:server',
'//gerrit-reviewdb:server',
'//gerrit-server:server',
'//gerrit-util-cli:cli',
'//lib:args4j',
'//lib:gson',
'//lib:guava',
'//lib:gwtjsonrpc',
'//lib:gwtorm',
'//lib:jsch',
'//lib:jsr305',
'//lib:mime-util',
'//lib:servlet-api-3_0',
'//lib/commons:codec',
'//lib/guice:guice',
'//lib/guice:guice-assistedinject',
'//lib/guice:guice-servlet',
'//lib/jgit:jgit',
'//lib/jgit:jgit-servlet',
'//lib/log:api',
],
compile_deps = ['//lib:servlet-api-3_0'],
visibility = ['PUBLIC'],
)
@ -21,9 +38,18 @@ java_test(
srcs = glob(['src/test/java/**/*.java']),
deps = [
':httpd',
'//gerrit-common:server',
'//gerrit-extension-api:api',
'//gerrit-reviewdb:server',
'//gerrit-server:server',
'//lib:easymock',
'//lib:junit',
'//lib:gson',
'//lib:gwtorm',
'//lib:guava',
'//lib:servlet-api-3_0',
'//lib/guice:guice',
'//lib/jgit:jgit',
'//lib/jgit:junit',
],
source_under_test = [':httpd'],

View File

@ -1,17 +1,23 @@
java_library(
java_library2(
name = 'openid',
srcs = glob(['src/main/java/**/*.java']),
resources = glob(['src/main/resources/**/*']),
deps = [
'//gerrit-common:server',
'//gerrit-extension-api:api',
'//gerrit-gwtexpui:server',
'//gerrit-httpd:httpd',
'//gerrit-reviewdb:server',
'//gerrit-server:server',
'//lib:guava',
'//lib:gwtorm',
'//lib:jsr305',
'//lib:servlet-api-3_0',
'//lib/guice:guice',
'//lib/guice:guice-servlet',
'//lib/jgit:jgit',
'//lib/log:api',
'//lib/openid:consumer',
],
compile_deps = ['//lib:servlet-api-3_0'],
visibility = ['PUBLIC'],
)

View File

@ -3,21 +3,36 @@ java_library2(
srcs = glob(['src/main/java/**/*.java']),
resources = glob(['src/main/resources/**/*']),
deps = [
'//gerrit-server:common_rules',
'//gerrit-server:server',
'//gerrit-httpd:httpd',
'//gerrit-sshd:sshd',
'//gerrit-cache-h2:cache-h2',
'//gerrit-common:server',
'//gerrit-extension-api:api',
'//gerrit-httpd:httpd',
'//gerrit-openid:openid',
'//gerrit-server:common_rules',
'//gerrit-reviewdb:server',
'//gerrit-server:server',
'//gerrit-sshd:sshd',
'//gerrit-util-cli:cli',
'//lib:args4j',
'//lib:guava',
'//lib:gwtorm',
'//lib:gwtjsonrpc',
'//lib:h2',
'//lib:jsr305',
'//lib:servlet-api-3_0',
'//lib/commons:dbcp',
'//lib/guice:guice',
'//lib/guice:guice-assistedinject',
'//lib/guice:guice-servlet',
'//lib/jetty:server',
'//lib/jetty:servlet',
'//lib/jgit:jgit',
'//lib/log:api',
'//lib/log:log4j',
'//lib/mina:sshd',
'//lib/prolog:prolog-cafe',
],
compile_deps = [
'//gerrit-launcher:launcher',
],
compile_deps = ['//gerrit-launcher:launcher'],
visibility = [
'//:',
'//gerrit-acceptance-tests:',

View File

@ -1,18 +1,26 @@
include_defs('//lib/prolog/DEFS')
# TODO(sop) break up gerrit-server java_library(), its too big
java_library2(
name = 'server',
srcs = glob(['src/main/java/**/*.java']),
resources = glob(['src/main/resources/**/*']),
deps = [
'//gerrit-antlr:antlr',
'//gerrit-antlr:query_exception',
'//gerrit-antlr:query_parser',
'//gerrit-common:server',
'//gerrit-extension-api:api',
'//gerrit-patch-commonsnet:commons-net',
'//gerrit-patch-jgit:server',
'//gerrit-reviewdb:server',
'//gerrit-util-cli:cli',
'//gerrit-util-ssl:ssl',
'//gerrit-patch-commonsnet:commons-net',
'//lib:args4j',
'//lib:automaton',
'//lib:gson',
'//lib:guava',
'//lib:gwtjsonrpc',
'//lib:gwtorm',
'//lib:jsch',
'//lib:jsr305',
'//lib:juniversalchardet',
@ -20,8 +28,11 @@ java_library2(
'//lib:ow2-asm',
'//lib:ow2-asm-tree',
'//lib:ow2-asm-util',
'//lib:parboiled-core',
'//lib:pegdown',
'//lib:velocity',
'//lib/antlr:java_runtime',
'//lib/commons:codec',
'//lib/commons:dbcp',
'//lib/commons:lang',
'//lib/commons:net',
@ -33,6 +44,7 @@ java_library2(
'//lib/prolog:prolog-cafe',
],
compile_deps = [
'//lib/bouncycastle:bcprov',
'//lib/bouncycastle:bcpg',
],
visibility = ['PUBLIC'],
@ -52,10 +64,21 @@ java_test(
deps = [
':server',
':common_rules',
'//gerrit-antlr:query_exception',
'//gerrit-antlr:query_parser',
'//gerrit-common:server',
'//gerrit-extension-api:api',
'//gerrit-reviewdb:server',
'//lib:easymock',
'//lib:guava',
'//lib:gwtorm',
'//lib:h2',
'//lib:junit',
'//lib:easymock',
'//lib/antlr:java_runtime',
'//lib/guice:guice',
'//lib/jgit:jgit',
'//lib/jgit:junit',
'//lib/prolog:prolog-cafe',
],
source_under_test = [':server'],
)

View File

@ -2,13 +2,27 @@ java_library2(
name = 'sshd',
srcs = glob(['src/main/java/**/*.java']),
deps = [
'//gerrit-extension-api:api',
'//gerrit-cache-h2:cache-h2',
'//gerrit-common:server',
'//gerrit-patch-jgit:server',
'//gerrit-reviewdb:server',
'//gerrit-server:server',
'//gerrit-util-cli:cli',
'//lib:args4j',
'//lib:gson',
'//lib:guava',
'//lib:gwtorm',
'//lib:jsch',
'//lib/commons:codec',
'//lib/guice:guice',
'//lib/guice:guice-assistedinject',
'//lib/guice:guice-servlet', # SSH should not depend on servlet
'//lib/log:api',
'//lib/log:log4j',
'//lib/mina:core',
'//lib/mina:sshd',
'//lib/jgit:jgit',
],
compile_deps = [
'//lib/bouncycastle:bcprov',

View File

@ -16,7 +16,6 @@ package com.google.gerrit.sshd;
import com.google.inject.Key;
import org.apache.commons.lang.StringUtils;
import org.apache.sshd.server.Command;
import java.lang.annotation.Annotation;
@ -124,7 +123,7 @@ public class Commands {
NestedCommandNameImpl(final CommandName parent, final String name) {
this.parent = parent;
this.name = name;
this.descr = StringUtils.EMPTY;
this.descr = "";
}
NestedCommandNameImpl(final CommandName parent, final String name,

View File

@ -1,14 +1,22 @@
java_library(
java_library2(
name = 'init',
srcs = glob(['src/main/java/**/*.java']),
deps = [
'//gerrit-cache-h2:cache-h2',
'//gerrit-extension-api:api',
'//gerrit-httpd:httpd',
'//gerrit-openid:openid',
'//gerrit-reviewdb:server',
'//gerrit-server:common_rules',
'//gerrit-server:server',
'//gerrit-httpd:httpd',
'//gerrit-sshd:sshd',
'//gerrit-cache-h2:cache-h2',
'//gerrit-openid:openid',
'//lib:gwtorm',
'//lib/guice:guice',
'//lib/guice:guice-servlet',
'//lib/log:api',
'//lib/jgit:jgit',
],
compile_deps = ['//lib:servlet-api-3_0'],
visibility = [
'//:',
'//gerrit-gwtdebug:gwtdebug',

View File

@ -169,7 +169,6 @@ maven_jar(
sha1 = '3fc3013adf98701efcc594a1ea99a3f841dc81bb',
license = 'Apache2.0',
attach_source = False,
visibility = [],
)
maven_jar(

View File

@ -7,16 +7,24 @@ EXCLUDE = [
'META-INF/NOTICE',
]
maven_jar(
java_library(
name = 'guice',
deps = [
':guice_library',
':javax-inject',
],
export_deps = True,
visibility = ['PUBLIC'],
)
maven_jar(
name = 'guice_library',
id = 'com.google.inject:guice:' + VERSION,
sha1 = '9d84f15fe35e2c716a02979fb62f50a29f38aefa',
license = 'Apache2.0',
deps = [
':javax-inject',
':aopalliance',
],
deps = [':aopalliance'],
exclude = EXCLUDE,
visibility = [],
)
maven_jar(
@ -37,7 +45,6 @@ maven_jar(
exclude = EXCLUDE,
)
maven_jar(
name = 'aopalliance',
id = 'aopalliance:aopalliance:1.0',

View File

@ -34,8 +34,8 @@ maven_jar(
':continuation',
':http',
],
export_deps = True,
exclude = EXCLUDE,
visibility = [],
)
maven_jar(
@ -44,7 +44,6 @@ maven_jar(
sha1 = 'f60cfe6267038000b459508529c88737601081e4',
license = 'Apache2.0',
exclude = EXCLUDE,
visibility = [],
)
maven_jar(
@ -54,7 +53,6 @@ maven_jar(
license = 'Apache2.0',
deps = [':io'],
exclude = EXCLUDE,
visibility = [],
)
maven_jar(

View File

@ -35,6 +35,7 @@ def maven_jar(
sha1 = '', bin_sha1 = '', src_sha1 = '',
repository = MAVEN_CENTRAL,
attach_source = True,
export_deps = False,
visibility = ['PUBLIC']):
from os import path
@ -101,10 +102,24 @@ def maven_jar(
out = '__' + name + '__no_src',
)
prebuilt_jar(
name = name,
deps = deps + license + [':' + name + '__download_bin'],
binary_jar = genfile(binjar),
source_jar = genfile(srcjar) if srcjar else None,
visibility = visibility,
)
if export_deps:
prebuilt_jar(
name = name + '__jar',
deps = deps + license + [':' + name + '__download_bin'],
binary_jar = genfile(binjar),
source_jar = genfile(srcjar) if srcjar else None,
)
java_library(
name = name,
deps = [':' + name + '__jar'],
export_deps = True,
visibility = visibility,
)
else:
prebuilt_jar(
name = name,
deps = deps + license + [':' + name + '__download_bin'],
binary_jar = genfile(binjar),
source_jar = genfile(srcjar) if srcjar else None,
visibility = visibility,
)

View File

@ -60,5 +60,4 @@ maven_jar(
'META-INF/LICENSE.txt',
'META-INF/NOTICE.txt',
],
visibility = [],
)