Implement Bazel build

To run the tests:

  bazel test //...

To build the Gerrit plugin API, run:

  bazel build gerrit-plugin-api:plugin-api_deploy.jar

To build the Gerrit extension API, run:

  bazel build gerrit-extension-api:extension-api_deploy.jar

TODOs:

Licenses
Reduce visibility (all public for now)
Generate HTML Documentation
Core plugins
gerrit_plugin() rule to build plugins in tree and standalone modes
GWT UI (only gwt_module() skylark rule is provided, no gwt_binary())
PolyGerrit UI
WAR
Publish artifacts to Maven Central
Ask Bazel team to add Gerrit to their CI on ci.bazel.io

Contributed-By: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I9a86e670882a44a5c966579cdeb8ed79b1590de3
This commit is contained in:
David Ostrovsky 2016-05-21 19:55:01 +02:00
parent 7635765a6d
commit b81b4f75ae
83 changed files with 3365 additions and 9 deletions

1
.bazelrc Normal file
View File

@ -0,0 +1 @@
build --strategy=Javac=worker

View File

@ -22,7 +22,7 @@
src_roots = java, resources, src
[project]
ignore = .git, eclipse-out
ignore = .git, eclipse-out, bazel-gerrit
parallel_parsing = true
[cache]

5
.gitignore vendored
View File

@ -14,6 +14,11 @@
/.buckconfig.local
/.buckjavaargs
/.buckd
/bazel-bin
/bazel-genfiles
/bazel-gerrit
/bazel-out
/bazel-testlogs
/buck-cache
/buck-out
/eclipse-out

699
WORKSPACE Normal file
View File

@ -0,0 +1,699 @@
ANTLR_VERS = '3.5.2'
maven_jar(
name = 'java_runtime',
artifact = 'org.antlr:antlr-runtime:' + ANTLR_VERS,
sha1 = 'cd9cd41361c155f3af0f653009dcecb08d8b4afd',
)
maven_jar(
name = 'stringtemplate',
artifact = 'org.antlr:stringtemplate:4.0.2',
sha1 = 'e28e09e2d44d60506a7bcb004d6c23ff35c6ac08',
)
maven_jar(
name = 'org_antlr',
artifact = 'org.antlr:antlr:' + ANTLR_VERS,
sha1 = 'c4a65c950bfc3e7d04309c515b2177c00baf7764',
)
maven_jar(
name = 'antlr27',
artifact = 'antlr:antlr:2.7.7',
sha1 = '83cd2cd674a217ade95a4bb83a8a14f351f48bd0',
)
GUICE_VERS = '4.0'
maven_jar(
name = 'guice_library',
artifact = 'com.google.inject:guice:' + GUICE_VERS,
sha1 = '0f990a43d3725781b6db7cd0acf0a8b62dfd1649',
)
maven_jar(
name = 'guice_assistedinject',
artifact = 'com.google.inject.extensions:guice-assistedinject:' + GUICE_VERS,
sha1 = '8fa6431da1a2187817e3e52e967535899e2e46ca',
)
maven_jar(
name = 'guice_servlet',
artifact = 'com.google.inject.extensions:guice-servlet:' + GUICE_VERS,
sha1 = '4503da866f4c402b5090579b40c1c4aaefabb164',
)
maven_jar(
name = 'aopalliance',
artifact = 'aopalliance:aopalliance:1.0',
sha1 = '0235ba8b489512805ac13a8f9ea77a1ca5ebe3e8',
)
maven_jar(
name = 'javax_inject',
artifact = 'javax.inject:javax.inject:1',
sha1 = '6975da39a7040257bd51d21a231b76c915872d38',
)
maven_jar(
name = 'servlet_api_3_1',
artifact = 'org.apache.tomcat:tomcat-servlet-api:8.0.24',
sha1 = '5d9e2e895e3111622720157d0aa540066d5fce3a',
)
GWT_VERS = '2.7.0'
maven_jar(
name = 'user',
artifact = 'com.google.gwt:gwt-user:' + GWT_VERS,
sha1 = 'bdc7af42581745d3d79c2efe0b514f432b998a5b',
)
maven_jar(
name = 'dev',
artifact = 'com.google.gwt:gwt-dev:' + GWT_VERS,
sha1 = 'c2c3dd5baf648a0bb199047a818be5e560f48982',
)
maven_jar(
name = 'javax_validation',
artifact = 'javax.validation:validation-api:1.0.0.GA',
sha1 = 'b6bd7f9d78f6fdaa3c37dae18a4bd298915f328e',
)
JGIT_VERS = '4.3.0.201604071810-r.23-gc9b0028'
maven_jar(
name = 'jgit',
repository = 'http://gerrit-maven.storage.googleapis.com/',
artifact = 'org.eclipse.jgit:org.eclipse.jgit:' + JGIT_VERS,
sha1 = 'dc4464c876cbf3815fd6cf6cb9d29d375566d6b1',
)
maven_jar(
name = 'jgit_servlet',
repository = 'http://gerrit-maven.storage.googleapis.com/',
artifact = 'org.eclipse.jgit:org.eclipse.jgit.http.server:' + JGIT_VERS,
sha1 = 'bb01841b74a48abe506c2e44f238e107188e6c8f',
)
# TODO(davido): Remove this hack when maven_jar supports pulling sources
# https://github.com/bazelbuild/bazel/issues/308
http_file(
name = 'jgit_src',
sha256 = '881906cb1e6743cb78df6dd3788cab7e974308fbb98cab4915e6591a62aa9374',
url = 'http://gerrit-maven.storage.googleapis.com/org/eclipse/jgit/org.eclipse.jgit/' +
'%s/org.eclipse.jgit-%s-sources.jar' % (JGIT_VERS, JGIT_VERS),
)
maven_jar(
name = 'ewah',
artifact = 'com.googlecode.javaewah:JavaEWAH:0.7.9',
sha1 = 'eceaf316a8faf0e794296ebe158ae110c7d72a5a',
)
maven_jar(
name = 'jgit_archive',
repository = 'http://gerrit-maven.storage.googleapis.com/',
artifact = 'org.eclipse.jgit:org.eclipse.jgit.archive:' + JGIT_VERS,
sha1 = 'c612e5bd40ebf6226032cb32c14b396d7ebfe036',
)
maven_jar(
name = 'jgit_junit',
repository = 'http://gerrit-maven.storage.googleapis.com/',
artifact = 'org.eclipse.jgit:org.eclipse.jgit.junit:' + JGIT_VERS,
sha1 = '62dddedccdcd67b622d0d35a4bfb15c7eab8e171',
)
maven_jar(
name = 'gwtjsonrpc',
artifact = 'com.google.gerrit:gwtjsonrpc:1.8',
sha1 = 'c264bf2f543cffddceada5cdf031eea06dbd44a0',
)
http_jar(
name = 'gwtjsonrpc_src',
sha256 = '2ef86396861a7c555c404b5a20a72dc6599b541ce2d1370a62f6470eefe7142d',
url = 'http://repo.maven.apache.org/maven2/com/google/gerrit/gwtjsonrpc/1.8/gwtjsonrpc-1.8-sources.jar',
)
maven_jar(
name = 'gson',
artifact = 'com.google.code.gson:gson:2.6.2',
sha1 = 'f1bc476cc167b18e66c297df599b2377131a8947',
)
maven_jar(
name = 'gwtorm_client',
artifact = 'com.google.gerrit:gwtorm:1.15',
sha1 = '26a2459f543ed78977535f92e379dc0d6cdde8bb',
)
http_jar(
name = 'gwtorm_client_src',
sha256 = 'e0cf9382ed8c3cd1f0884ab77dabe634a04546676c4960d8b4c4b64a20132ef6',
url = 'http://repo.maven.apache.org/maven2/com/google/gerrit/gwtorm/1.15/gwtorm-1.15-sources.jar',
)
maven_jar(
name = 'protobuf',
artifact = 'com.google.protobuf:protobuf-java:2.5.0',
sha1 = 'a10732c76bfacdbd633a7eb0f7968b1059a65dfa',
)
maven_jar(
name = 'joda_time',
artifact = 'joda-time:joda-time:2.8',
sha1 = '9f2785d7184b97d005a44241ccaf980f43b9ccdb',
)
maven_jar(
name = 'joda_convert',
artifact = 'org.joda:joda-convert:1.2',
sha1 = '35ec554f0cd00c956cc69051514d9488b1374dec',
)
maven_jar(
name = 'guava',
artifact = 'com.google.guava:guava:19.0',
sha1 = '6ce200f6b23222af3d8abb6b6459e6c44f4bb0e9',
)
maven_jar(
name = 'velocity',
artifact = 'org.apache.velocity:velocity:1.7',
sha1 = '2ceb567b8f3f21118ecdec129fe1271dbc09aa7a',
)
maven_jar(
name = 'jsch',
artifact = 'com.jcraft:jsch:0.1.53',
sha1 = '658b682d5c817b27ae795637dfec047c63d29935',
)
maven_jar(
name = 'juniversalchardet',
artifact = 'com.googlecode.juniversalchardet:juniversalchardet:1.0.3',
sha1 = 'cd49678784c46aa8789c060538e0154013bb421b',
)
SLF4J_VERS = '1.7.7'
maven_jar(
name = 'log_api',
artifact = 'org.slf4j:slf4j-api:' + SLF4J_VERS,
sha1 = '2b8019b6249bb05d81d3a3094e468753e2b21311',
)
maven_jar(
name = 'log_nop',
artifact = 'org.slf4j:slf4j-nop:' + SLF4J_VERS,
sha1 = '6cca9a3b999ff28b7a35ca762b3197cd7e4c2ad1',
)
maven_jar(
name = 'impl_log4j',
artifact = 'org.slf4j:slf4j-log4j12:' + SLF4J_VERS,
sha1 = '58f588119ffd1702c77ccab6acb54bfb41bed8bd',
)
maven_jar(
name = 'jcl_over_slf4j',
artifact = 'org.slf4j:jcl-over-slf4j:' + SLF4J_VERS,
sha1 = '56003dcd0a31deea6391b9e2ef2f2dc90b205a92',
)
maven_jar(
name = 'log4j',
artifact = 'log4j:log4j:1.2.17',
sha1 = '5af35056b4d257e4b64b9e8069c0746e8b08629f',
)
maven_jar(
name = 'jsonevent_layout',
artifact = 'net.logstash.log4j:jsonevent-layout:1.7',
sha1 = '507713504f0ddb75ba512f62763519c43cf46fde',
)
maven_jar(
name = 'json_smart',
artifact = 'net.minidev:json-smart:1.1.1',
sha1 = '24a2f903d25e004de30ac602c5b47f2d4e420a59',
)
maven_jar(
name = 'args4j',
artifact = 'args4j:args4j:2.0.26',
sha1 = '01ebb18ebb3b379a74207d5af4ea7c8338ebd78b',
)
maven_jar(
name = 'commons_codec',
artifact = 'commons-codec:commons-codec:1.4',
sha1 = '4216af16d38465bbab0f3dff8efa14204f7a399a',
)
maven_jar(
name = 'commons_collections',
artifact = 'commons-collections:commons-collections:3.2.2',
sha1 = '8ad72fe39fa8c91eaaf12aadb21e0c3661fe26d5',
)
maven_jar(
name = 'commons_compress',
artifact = 'org.apache.commons:commons-compress:1.7',
sha1 = 'ab365c96ee9bc88adcc6fa40d185c8e15a31410d',
)
maven_jar(
name = 'commons_lang',
artifact = 'commons-lang:commons-lang:2.6',
sha1 = '0ce1edb914c94ebc388f086c6827e8bdeec71ac2',
)
maven_jar(
name = 'commons_dbcp',
artifact = 'commons-dbcp:commons-dbcp:1.4',
sha1 = '30be73c965cc990b153a100aaaaafcf239f82d39',
)
maven_jar(
name = 'commons_pool',
artifact = 'commons-pool:commons-pool:1.5.5',
sha1 = '7d8ffbdc47aa0c5a8afe5dc2aaf512f369f1d19b',
)
maven_jar(
name = 'commons_net',
artifact = 'commons-net:commons-net:2.2',
sha1 = '07993c12f63c78378f8c90de4bc2ee62daa7ca3a',
)
maven_jar(
name = 'commons_oro',
artifact = 'oro:oro:2.0.8',
sha1 = '5592374f834645c4ae250f4c9fbb314c9369d698',
)
maven_jar(
name = 'commons_validator',
artifact = 'commons-validator:commons-validator:1.4.1',
sha1 = '2231238e391057a53f92bde5bbc588622c1956c3',
)
maven_jar(
name = 'automaton',
artifact = 'dk.brics.automaton:automaton:1.11-8',
sha1 = '6ebfa65eb431ff4b715a23be7a750cbc4cc96d0f',
)
maven_jar(
name = 'pegdown',
artifact = 'org.pegdown:pegdown:1.4.2',
sha1 = 'd96db502ed832df867ff5d918f05b51ba3879ea7',
)
maven_jar(
name = 'grappa',
artifact = 'com.github.parboiled1:grappa:1.0.4',
sha1 = 'ad4b44b9c305dad7aa1e680d4b5c8eec9c4fd6f5',
)
maven_jar(
name = 'jitescript',
artifact = 'me.qmx.jitescript:jitescript:0.4.0',
sha1 = '2e35862b0435c1b027a21f3d6eecbe50e6e08d54',
)
OW2_VERS = '5.0.3'
maven_jar(
name = 'ow2_asm',
artifact = 'org.ow2.asm:asm:' + OW2_VERS,
sha1 = 'dcc2193db20e19e1feca8b1240dbbc4e190824fa',
)
maven_jar(
name = 'ow2_asm_analysis',
artifact = 'org.ow2.asm:asm-analysis:' + OW2_VERS,
sha1 = 'c7126aded0e8e13fed5f913559a0dd7b770a10f3',
)
maven_jar(
name = 'ow2_asm_commons',
artifact = 'org.ow2.asm:asm-commons:' + OW2_VERS,
sha1 = 'a7111830132c7f87d08fe48cb0ca07630f8cb91c',
)
maven_jar(
name = 'ow2_asm_tree',
artifact = 'org.ow2.asm:asm-tree:' + OW2_VERS,
sha1 = '287749b48ba7162fb67c93a026d690b29f410bed',
)
maven_jar(
name = 'ow2_asm_util',
artifact = 'org.ow2.asm:asm-util:' + OW2_VERS,
sha1 = '1512e5571325854b05fb1efce1db75fcced54389',
)
maven_jar(
name = 'auto_value',
artifact = 'com.google.auto.value:auto-value:1.2',
sha1 = '6873fed014fe1de1051aae2af68ba266d2934471',
)
maven_jar(
name = 'tukaani_xz',
artifact = 'org.tukaani:xz:1.4',
sha1 = '18a9a2ce6abf32ea1b5fd31dae5210ad93f4e5e3',
)
LUCENE_VERS = '5.4.1'
maven_jar(
name = 'lucene_core',
artifact = 'org.apache.lucene:lucene-core:' + LUCENE_VERS,
sha1 = 'c52b2088e2c30dfd95fd296ab6fb9cf8de9855ab',
)
maven_jar(
name = 'lucene_analyzers_common',
artifact = 'org.apache.lucene:lucene-analyzers-common:' + LUCENE_VERS,
sha1 = 'c2aa2c4e00eb9cdeb5ac00dc0495e70c441f681e',
)
maven_jar(
name = 'backward_codecs',
artifact = 'org.apache.lucene:lucene-backward-codecs:' + LUCENE_VERS,
sha1 = '5273da96380dfab302ad06c27fe58100db4c4e2f',
)
maven_jar(
name = 'lucene_misc',
artifact = 'org.apache.lucene:lucene-misc:' + LUCENE_VERS,
sha1 = '95f433b9d7dd470cc0aa5076e0f233907745674b',
)
maven_jar(
name = 'lucene_queryparser',
artifact = 'org.apache.lucene:lucene-queryparser:' + LUCENE_VERS,
sha1 = 'dccd5279bfa656dec21af444a7a66820eb1cd618',
)
maven_jar(
name = 'mime_util',
artifact = 'eu.medsea.mimeutil:mime-util:2.1.3',
sha1 = '0c9cfae15c74f62491d4f28def0dff1dabe52a47',
)
PROLOG_VERS = '1.4.1'
maven_jar(
name = 'prolog_runtime',
repository = 'http://gerrit-maven.storage.googleapis.com/',
artifact = 'com.googlecode.prolog-cafe:prolog-runtime:' + PROLOG_VERS,
sha1 = 'c5d9f92e49c485969dcd424dfc0c08125b5f8246',
)
maven_jar(
name = 'prolog_compiler',
repository = 'http://gerrit-maven.storage.googleapis.com/',
artifact = 'com.googlecode.prolog-cafe:prolog-compiler:' + PROLOG_VERS,
sha1 = 'ac24044c6ec166fdcb352b78b80d187ead3eff41',
)
maven_jar(
name = 'prolog_io',
repository = 'http://gerrit-maven.storage.googleapis.com/',
artifact = 'com.googlecode.prolog-cafe:prolog-io:' + PROLOG_VERS,
sha1 = 'b072426a4b1b8af5e914026d298ee0358a8bb5aa',
)
maven_jar(
name = 'cafeteria',
repository = 'http://gerrit-maven.storage.googleapis.com/',
artifact = 'com.googlecode.prolog-cafe:prolog-cafeteria:' + PROLOG_VERS,
sha1 = '8cbc3b0c19e7167c42d3f11667b21cb21ddec641',
)
maven_jar(
name = 'guava_retrying',
artifact = 'com.github.rholder:guava-retrying:2.0.0',
sha1 = '974bc0a04a11cc4806f7c20a34703bd23c34e7f4',
)
maven_jar(
name = 'jsr305',
artifact = 'com.google.code.findbugs:jsr305:2.0.2',
sha1 = '516c03b21d50a644d538de0f0369c620989cd8f0',
)
maven_jar(
name = 'blame_cache',
repository = 'http://gerrit-maven.storage.googleapis.com/',
artifact = 'com/google/gitiles:blame-cache:0.1-9',
sha1 = '51d35e6f8bbc2412265066cea9653dd758c95826',
)
maven_jar(
name = 'dropwizard_core',
artifact = 'io.dropwizard.metrics:metrics-core:3.1.2',
sha1 = '224f03afd2521c6c94632f566beb1bb5ee32cf07',
)
# This version must match the version that also appears in
# gerrit-pgm/src/main/resources/com/google/gerrit/pgm/init/libraries.config
BC_VERS = '1.52'
maven_jar(
name = 'bcprov',
artifact = 'org.bouncycastle:bcprov-jdk15on:' + BC_VERS,
sha1 = '88a941faf9819d371e3174b5ed56a3f3f7d73269',
)
maven_jar(
name = 'bcpg',
artifact = 'org.bouncycastle:bcpg-jdk15on:' + BC_VERS,
sha1 = 'ff4665a4b5633ff6894209d5dd10b7e612291858',
)
maven_jar(
name = 'bcpkix',
artifact = 'org.bouncycastle:bcpkix-jdk15on:' + BC_VERS,
sha1 = 'b8ffac2bbc6626f86909589c8cc63637cc936504',
)
maven_jar(
name = 'sshd',
artifact = 'org.apache.sshd:sshd-core:1.2.0',
sha1 = '4bc24a8228ba83dac832680366cf219da71dae8e',
)
maven_jar(
name = 'mina_core',
artifact = 'org.apache.mina:mina-core:2.0.10',
sha1 = 'a1cb1136b104219d6238de886bf5a3ea4554eb58',
)
maven_jar(
name = 'h2',
artifact = 'com.h2database:h2:1.3.176',
sha1 = 'fd369423346b2f1525c413e33f8cf95b09c92cbd',
)
HTTPCOMP_VERS = '4.4.1'
maven_jar(
name = 'fluent_hc',
artifact = 'org.apache.httpcomponents:fluent-hc:' + HTTPCOMP_VERS,
sha1 = '96fb842b68a44cc640c661186828b60590c71261',
)
maven_jar(
name = 'httpclient',
artifact = 'org.apache.httpcomponents:httpclient:' + HTTPCOMP_VERS,
sha1 = '016d0bc512222f1253ee6b64d389c84e22f697f0',
)
maven_jar(
name = 'httpcore',
artifact = 'org.apache.httpcomponents:httpcore:' + HTTPCOMP_VERS,
sha1 = 'f5aa318bda4c6c8d688c9d00b90681dcd82ce636',
)
maven_jar(
name = 'httpmime',
artifact = 'org.apache.httpcomponents:httpmime:' + HTTPCOMP_VERS,
sha1 = '2f8757f5ac5e38f46c794e5229d1f3c522e9b1df',
)
# Test-only dependencies below.
maven_jar(
name = 'jimfs',
artifact = 'com.google.jimfs:jimfs:1.0',
sha1 = 'edd65a2b792755f58f11134e76485a928aab4c97',
)
maven_jar(
name = 'junit',
artifact = 'junit:junit:4.11',
sha1 = '4e031bb61df09069aeb2bffb4019e7a5034a4ee0',
)
maven_jar(
name = 'hamcrest_core',
artifact = 'org.hamcrest:hamcrest-core:1.3',
sha1 = '42a25dc3219429f0e5d060061f71acb49bf010a0',
)
maven_jar(
name = 'truth',
artifact = 'com.google.truth:truth:0.28',
sha1 = '0a388c7877c845ff4b8e19689dda5ac9d34622c4',
)
maven_jar(
name = 'easymock',
artifact = 'org.easymock:easymock:3.4', # When bumping the version
sha1 = '9fdeea183a399f25c2469497612cad131e920fa3',
)
maven_jar(
name = 'cglib_2_2',
artifact = 'cglib:cglib-nodep:2.2.2',
sha1 = '00d456bb230c70c0b95c76fb28e429d42f275941',
)
maven_jar(
name = 'objenesis',
artifact = 'org.objenesis:objenesis:2.2',
sha1 = '3fb533efdaa50a768c394aa4624144cf8df17845',
)
POWERM_VERS = '1.6.4'
maven_jar(
name = 'powermock_module_junit4',
artifact = 'org.powermock:powermock-module-junit4:' + POWERM_VERS,
sha1 = '8692eb1d9bb8eb1310ffe8a20c2da7ee6d1b5994',
)
maven_jar(
name = 'powermock_module_junit4_common',
artifact = 'org.powermock:powermock-module-junit4-common:' + POWERM_VERS,
sha1 = 'b0b578da443794ceb8224bd5f5f852aaf40f1b81',
)
maven_jar(
name = 'powermock_reflect',
artifact = 'org.powermock:powermock-reflect:' + POWERM_VERS,
sha1 = '5532f4e7c42db4bca4778bc9f1afcd4b0ee0b893',
)
maven_jar(
name = 'powermock_api_easymock',
artifact = 'org.powermock:powermock-api-easymock:' + POWERM_VERS,
sha1 = '5c385a0d8c13f84b731b75c6e90319c532f80b45',
)
maven_jar(
name = 'powermock_api_support',
artifact = 'org.powermock:powermock-api-support:' + POWERM_VERS,
sha1 = '314daafb761541293595630e10a3699ebc07881d',
)
maven_jar(
name = 'powermock_core',
artifact = 'org.powermock:powermock-core:' + POWERM_VERS,
sha1 = '85fb32e9ccba748d569fc36aef92e0b9e7f40b87',
)
maven_jar(
name = 'javassist',
artifact = 'org.javassist:javassist:3.20.0-GA',
sha1 = 'a9cbcdfb7e9f86fbc74d3afae65f2248bfbf82a0',
)
maven_jar(
name = 'derby',
artifact = 'org.apache.derby:derby:10.11.1.1',
sha1 = 'df4b50061e8e4c348ce243b921f53ee63ba9bbe1',
)
JETTY_VERS = '9.2.14.v20151106'
maven_jar(
name = 'jetty_servlet',
artifact = 'org.eclipse.jetty:jetty-servlet:' + JETTY_VERS,
sha1 = '3a2cd4d8351a38c5d60e0eee010fee11d87483ef',
)
maven_jar(
name = 'jetty_security',
artifact = 'org.eclipse.jetty:jetty-security:' + JETTY_VERS,
sha1 = '2d36974323fcb31e54745c1527b996990835db67',
)
maven_jar(
name = 'jetty_servlets',
artifact = 'org.eclipse.jetty:jetty-servlets:' + JETTY_VERS,
sha1 = 'a75c78a0ee544073457ca5ee9db20fdc6ed55225',
)
maven_jar(
name = 'jetty_server',
artifact = 'org.eclipse.jetty:jetty-server:' + JETTY_VERS,
sha1 = '70b22c1353e884accf6300093362b25993dac0f5',
)
maven_jar(
name = 'jetty_jmx',
artifact = 'org.eclipse.jetty:jetty-jmx:' + JETTY_VERS,
sha1 = '617edc5e966b4149737811ef8b289cd94b831bab',
)
maven_jar(
name = 'jetty_continuation',
artifact = 'org.eclipse.jetty:jetty-continuation:' + JETTY_VERS,
sha1 = '8909d62fd7e28351e2da30de6fb4105539b949c0',
)
maven_jar(
name = 'jetty_http',
artifact = 'org.eclipse.jetty:jetty-http:' + JETTY_VERS,
sha1 = '699ad1f2fa6fb0717e1b308a8c9e1b8c69d81ef6',
)
maven_jar(
name = 'jetty_io',
artifact = 'org.eclipse.jetty:jetty-io:' + JETTY_VERS,
sha1 = 'dfa4137371a3f08769820138ca1a2184dacda267',
)
maven_jar(
name = 'jetty_util',
artifact = 'org.eclipse.jetty:jetty-util:' + JETTY_VERS,
sha1 = '0057e00b912ae0c35859ac81594a996007706a0b',
)
maven_jar(
name = 'openid_consumer',
artifact = 'org.openid4java:openid4java:0.9.8',
sha1 = 'de4f1b33d3b0f0b2ab1d32834ec1190b39db4160',
)
maven_jar(
name = 'nekohtml',
artifact = 'net.sourceforge.nekohtml:nekohtml:1.9.10',
sha1 = '14052461031a7054aa094f5573792feb6686d3de',
)
maven_jar(
name = 'xerces',
artifact = 'xerces:xercesImpl:2.8.1',
sha1 = '25101e37ec0c907db6f0612cbf106ee519c1aef1',
)

View File

@ -0,0 +1,60 @@
load('//tools/bzl:java.bzl', 'java_library2')
SRCS = glob(['src/test/java/com/google/gerrit/acceptance/*.java'])
DEPS = [
'//gerrit-gpg:gpg',
'//gerrit-launcher:launcher',
'//gerrit-openid:openid',
'//gerrit-pgm:daemon',
'//gerrit-pgm:http-jetty',
'//gerrit-pgm:util-nodep',
'//gerrit-server/src/main/prolog:common',
'//gerrit-server:testutil',
'//lib/auto:auto-value',
'//lib/httpcomponents:fluent-hc',
'//lib/httpcomponents:httpclient',
'//lib/httpcomponents:httpcore',
'//lib/jetty:servlet',
'//lib/jgit/org.eclipse.jgit.junit:junit',
'//lib/log:impl_log4j',
'//lib/log:log4j',
]
PROVIDED = [
'//gerrit-common:annotations',
'//gerrit-common:server',
'//gerrit-extension-api:api',
'//gerrit-httpd:httpd',
'//gerrit-lucene:lucene',
'//gerrit-pgm:init',
'//gerrit-reviewdb:server',
'//gerrit-server:server',
'//lib:gson',
'//lib:jsch',
'//lib/jgit/org.eclipse.jgit:jgit',
'//lib/mina:sshd',
'//lib:servlet-api-3_1',
]
java_binary(
name = 'acceptance-framework',
main_class = 'Dummy',
runtime_deps = [':lib'],
visibility = ['//visibility:public'],
)
java_library2(
name = 'lib',
srcs = SRCS,
exported_deps = DEPS + [
'//lib:truth',
],
deps = PROVIDED + [ # We want these deps to be exported_deps
'//lib:gwtorm',
'//lib/guice:guice',
'//lib/guice:guice-assistedinject',
'//lib/guice:guice-servlet',
],
visibility = ['//visibility:public'],
)

View File

@ -0,0 +1,42 @@
load('//tools/bzl:java.bzl', 'java_library2')
java_library2(
name = 'lib',
srcs = glob(['src/test/java/com/google/gerrit/acceptance/*.java']),
exported_deps = [
'//gerrit-acceptance-framework:lib',
'//gerrit-common:annotations',
'//gerrit-common:server',
'//gerrit-extension-api:api',
'//gerrit-gpg:testutil',
'//gerrit-launcher:launcher',
'//gerrit-lucene:lucene',
'//gerrit-httpd:httpd',
'//gerrit-pgm:init',
'//gerrit-pgm:pgm',
'//gerrit-pgm:util',
'//gerrit-reviewdb:server',
'//gerrit-server:server',
'//gerrit-server:testutil',
'//gerrit-server/src/main/prolog:common',
'//gerrit-sshd:sshd',
'//lib:args4j',
'//lib:gson',
'//lib:gwtjsonrpc',
'//lib:gwtorm',
'//lib:h2',
'//lib:jsch',
'//lib:servlet-api-3_1-without-neverlink',
'//lib/bouncycastle:bcpg',
'//lib/bouncycastle:bcprov',
'//lib/guice:guice',
'//lib/guice:guice-assistedinject',
'//lib/guice:guice-servlet',
'//lib/log:api',
'//lib/jgit/org.eclipse.jgit:jgit',
'//lib/mina:sshd',
],
visibility = ['//visibility:public'],
)

View File

@ -0,0 +1,7 @@
load('//gerrit-acceptance-tests:tests.bzl', 'acceptance_tests')
acceptance_tests(
group = 'api_account',
srcs = glob(['*IT.java']),
labels = ['api'],
)

View File

@ -0,0 +1,7 @@
load('//gerrit-acceptance-tests:tests.bzl', 'acceptance_tests')
acceptance_tests(
group = 'api_change',
srcs = glob(['*IT.java']),
labels = ['api'],
)

View File

@ -0,0 +1,7 @@
load('//gerrit-acceptance-tests:tests.bzl', 'acceptance_tests')
acceptance_tests(
group = 'api_config',
srcs = glob(['*IT.java']),
labels = ['api'],
)

View File

@ -0,0 +1,23 @@
load('//gerrit-acceptance-tests:tests.bzl', 'acceptance_tests')
acceptance_tests(
group = 'api_group',
srcs = glob(['*IT.java']),
deps = [
':util',
'//gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/rest/account:util',
],
labels = ['api'],
)
java_library(
name = 'util',
srcs = ['GroupAssert.java'],
deps = [
'//gerrit-extension-api:api',
'//gerrit-reviewdb:server',
'//gerrit-server:server',
'//lib:gwtorm',
'//lib:truth',
],
)

View File

@ -0,0 +1,7 @@
load('//gerrit-acceptance-tests:tests.bzl', 'acceptance_tests')
acceptance_tests(
group = 'api_project',
srcs = glob(['*IT.java']),
labels = ['api'],
)

View File

@ -0,0 +1,7 @@
load('//gerrit-acceptance-tests:tests.bzl', 'acceptance_tests')
acceptance_tests(
group = 'api_revision',
srcs = glob(['*IT.java']),
labels = ['api'],
)

View File

@ -0,0 +1,11 @@
load('//gerrit-acceptance-tests:tests.bzl', 'acceptance_tests')
acceptance_tests(
group = 'edit',
srcs = ['ChangeEditIT.java'],
deps = [
'//lib/commons:codec',
'//lib/joda:joda-time',
],
labels = ['edit'],
)

View File

@ -0,0 +1,26 @@
load('//gerrit-acceptance-tests:tests.bzl', 'acceptance_tests')
acceptance_tests(
group = 'git',
srcs = glob(['*IT.java']),
deps = [
':submodule_util',
':push_for_review',
],
labels = ['git'],
)
java_library(
name = 'push_for_review',
srcs = ['AbstractPushForReview.java'],
deps = [
'//gerrit-acceptance-tests:lib',
'//lib/joda:joda-time',
],
)
java_library(
name = 'submodule_util',
srcs = ['AbstractSubmoduleSubscription.java',],
deps = ['//gerrit-acceptance-tests:lib',]
)

View File

@ -0,0 +1,8 @@
load('//gerrit-acceptance-tests:tests.bzl', 'acceptance_tests')
acceptance_tests(
group = 'pgm',
srcs = glob(['*IT.java']),
source_under_test = ['//gerrit-pgm:pgm'],
labels = ['pgm'],
)

View File

@ -0,0 +1,23 @@
load('//gerrit-acceptance-tests:tests.bzl', 'acceptance_tests')
acceptance_tests(
group = 'rest_account',
srcs = glob(['*IT.java']),
deps = [':util'],
labels = ['rest']
)
java_library(
name = 'util',
srcs = [
'AccountAssert.java',
'CapabilityInfo.java',
],
deps = [
'//gerrit-acceptance-tests:lib',
'//gerrit-reviewdb:server',
'//lib:gwtorm',
'//lib:junit',
],
visibility = ['//visibility:public'],
)

View File

@ -0,0 +1,36 @@
load('//gerrit-acceptance-tests:tests.bzl', 'acceptance_tests')
SUBMIT_UTIL_SRCS = [
'AbstractSubmit.java',
'AbstractSubmitByMerge.java',
]
SUBMIT_TESTS = glob(['Submit*IT.java'])
OTHER_TESTS = glob(['*IT.java'], exclude = SUBMIT_TESTS)
acceptance_tests(
group = 'rest_change_other',
srcs = OTHER_TESTS,
deps = [
':submit_util',
'//lib/joda:joda-time',
],
labels = ['rest'],
)
acceptance_tests(
group = 'rest_change_submit',
srcs = SUBMIT_TESTS,
deps = [
':submit_util',
],
labels = ['rest'],
)
java_library(
name = 'submit_util',
srcs = SUBMIT_UTIL_SRCS,
deps = [
'//gerrit-acceptance-tests:lib',
],
)

View File

@ -0,0 +1,7 @@
load('//gerrit-acceptance-tests:tests.bzl', 'acceptance_tests')
acceptance_tests(
group = 'rest_config',
srcs = glob(['*IT.java']),
labels = ['rest']
)

View File

@ -0,0 +1,8 @@
load('//gerrit-acceptance-tests:tests.bzl', 'acceptance_tests')
acceptance_tests(
group = 'rest_group',
srcs = glob(['*IT.java']),
labels = ['rest']
)

View File

@ -0,0 +1,37 @@
load('//gerrit-acceptance-tests:tests.bzl', 'acceptance_tests')
acceptance_tests(
group = 'rest_project',
srcs = glob(['*IT.java']),
deps = [
':branch',
':project',
],
labels = ['rest'],
)
java_library(
name = 'branch',
srcs = [
'BranchAssert.java',
],
deps = [
'//lib:truth',
'//gerrit-extension-api:api',
'//gerrit-server:server',
],
)
java_library(
name = 'project',
srcs = [
'ProjectAssert.java',
],
deps = [
'//gerrit-extension-api:api',
'//gerrit-reviewdb:server',
'//gerrit-server:server',
'//lib:gwtorm',
'//lib:truth',
],
)

View File

@ -0,0 +1,7 @@
load('//gerrit-acceptance-tests:tests.bzl', 'acceptance_tests')
acceptance_tests(
group = 'server_change',
srcs = glob(['*IT.java']),
labels = ['server'],
)

View File

@ -0,0 +1,7 @@
load('//gerrit-acceptance-tests:tests.bzl', 'acceptance_tests')
acceptance_tests(
group = 'server_event',
srcs = glob(['*IT.java']),
labels = ['server'],
)

View File

@ -0,0 +1,7 @@
load('//gerrit-acceptance-tests:tests.bzl', 'acceptance_tests')
acceptance_tests(
group = 'server_notedb',
srcs = glob(['*IT.java']),
labels = ['notedb', 'server'],
)

View File

@ -0,0 +1,16 @@
load('//gerrit-acceptance-tests:tests.bzl', 'acceptance_tests')
FLAKY_TEST_CASES=['ProjectWatchIT.java']
acceptance_tests(
group = 'server_project',
srcs = glob(['*IT.java'], exclude=FLAKY_TEST_CASES),
labels = ['server'],
)
acceptance_tests(
group = 'server_project_flaky',
flaky = 1,
srcs = FLAKY_TEST_CASES,
labels = ['server', 'flaky'],
)

View File

@ -0,0 +1,8 @@
load('//gerrit-acceptance-tests:tests.bzl', 'acceptance_tests')
acceptance_tests(
group = 'ssh',
srcs = glob(['*IT.java']),
deps = ['//lib/commons:compress'],
labels = ['ssh'],
)

View File

@ -0,0 +1,28 @@
load('//tools/bzl:junit.bzl', 'junit_tests')
BOUNCYCASTLE = [
'//lib/bouncycastle:bcpkix-without-neverlink',
'//lib/bouncycastle:bcpg-without-neverlink',
]
def acceptance_tests(
group,
srcs,
flaky = 0,
deps = [],
labels = [],
source_under_test = [], #unused
vm_args = ['-Xmx256m']):
junit_tests(
name = group,
srcs = srcs,
flaky = flaky,
deps = deps + BOUNCYCASTLE + [
'//gerrit-acceptance-tests:lib',
],
tags = labels + [
'acceptance',
'slow',
],
jvm_flags = vm_args,
)

32
gerrit-antlr/BUILD Normal file
View File

@ -0,0 +1,32 @@
load('//tools/bzl:genrule2.bzl', 'genrule2')
java_library(
name = 'query_exception',
srcs = ['src/main/java/com/google/gerrit/server/query/QueryParseException.java'],
visibility = ['//visibility:public'],
)
genrule2(
name = 'query_antlr',
srcs = ['src/main/antlr3/com/google/gerrit/server/query/Query.g'],
cmd = ' && '.join([
'$(location //lib/antlr:antlr-tool) -o $$TMP $<',
'cd $$TMP',
'$$ROOT/$(location @bazel_tools//tools/zip:zipper) cC $$ROOT/$@ $$(find .)'
]),
tools = [
'@bazel_tools//tools/zip:zipper',
'//lib/antlr:antlr-tool',
],
out = 'query_antlr.srcjar',
)
java_library(
name = 'query_parser',
srcs = [':query_antlr'],
deps = [
':query_exception',
'//lib/antlr:java_runtime',
],
visibility = ['//visibility:public'],
)

30
gerrit-cache-h2/BUILD Normal file
View File

@ -0,0 +1,30 @@
load('//tools/bzl:junit.bzl', 'junit_tests')
java_library(
name = 'cache-h2',
srcs = glob(['src/main/java/**/*.java']),
deps = [
'//gerrit-common:server',
'//gerrit-extension-api:api',
'//gerrit-server:server',
'//lib:guava',
'//lib:h2',
'//lib/guice:guice',
'//lib/jgit/org.eclipse.jgit:jgit',
'//lib/log:api',
],
visibility = ['//visibility:public'],
)
junit_tests(
name = 'tests',
srcs = glob(['src/test/java/**/*.java']),
deps = [
':cache-h2',
'//gerrit-server:server',
'//lib:guava',
'//lib:h2',
'//lib/guice:guice',
'//lib:junit',
],
)

View File

@ -1,9 +1,11 @@
SRC = 'src/main/java/com/google/gerrit/'
ANNOTATIONS = [
SRC + 'common/Nullable.java',
SRC + 'common/audit/Audit.java',
SRC + 'common/auth/SignInRequired.java',
SRC + x for x in [
'common/Nullable.java',
'common/audit/Audit.java',
'common/auth/SignInRequired.java',
]
]
java_library(

77
gerrit-common/BUILD Normal file
View File

@ -0,0 +1,77 @@
load('//tools/bzl:gwt.bzl', 'gwt_module')
load('//tools/bzl:junit.bzl', 'junit_tests')
SRC = 'src/main/java/com/google/gerrit/'
ANNOTATIONS = [
SRC + x for x in [
'common/Nullable.java',
'common/audit/Audit.java',
'common/auth/SignInRequired.java',
]
]
java_library(
name = 'annotations',
srcs = ANNOTATIONS,
visibility = ['//visibility:public'],
)
gwt_module(
name = 'client',
srcs = glob([SRC + 'common/**/*.java']),
gwt_xml = SRC + 'Common.gwt.xml',
exported_deps = [
'//gerrit-extension-api:api',
'//gerrit-prettify:client',
'//lib:guava',
'//lib:gwtorm_client',
'//lib:servlet-api-3_1',
'//lib/jgit/org.eclipse.jgit:jgit',
'//lib/joda:joda-time',
'//lib/log:api',
],
visibility = ['//visibility:public'],
)
java_library(
name = 'server',
srcs = glob([SRC + 'common/**/*.java'], exclude = ANNOTATIONS),
deps = [
':annotations',
'//gerrit-extension-api:api',
'//gerrit-patch-jgit:server',
'//gerrit-prettify:server',
'//gerrit-reviewdb:server',
'//lib:guava',
'//lib:gwtjsonrpc',
'//lib:gwtorm',
'//lib:servlet-api-3_1',
'//lib/jgit/org.eclipse.jgit:jgit',
'//lib/joda:joda-time',
'//lib/log:api',
],
visibility = ['//visibility:public'],
)
TEST = 'src/test/java/com/google/gerrit/common/'
AUTO_VALUE_TEST_SRCS = [TEST + 'AutoValueTest.java']
junit_tests(
name = 'client_tests',
srcs = glob(['src/test/java/**/*.java'], exclude = AUTO_VALUE_TEST_SRCS),
deps = [
':client',
'//lib:guava',
'//lib:junit',
],
)
junit_tests(
name = 'auto_value_tests',
srcs = AUTO_VALUE_TEST_SRCS,
deps = [
'//lib:truth',
'//lib/auto:auto-value',
],
)

View File

@ -0,0 +1,44 @@
load('//tools/bzl:gwt.bzl', 'gwt_module')
SRC = 'src/main/java/com/google/gerrit/extensions/'
SRCS = glob([SRC + '**/*.java'])
EXT_API_SRCS = glob([SRC + 'client/*.java'])
gwt_module(
name = 'client',
srcs = EXT_API_SRCS,
gwt_xml = SRC + 'Extensions.gwt.xml',
visibility = ['//visibility:public'],
)
java_binary(
name = 'extension-api',
main_class = 'Dummy',
runtime_deps = [':lib'],
visibility = ['//visibility:public'],
)
java_library(
name = 'lib',
exports = [
':api',
'//lib/guice:guice',
'//lib/guice:guice-assistedinject',
'//lib/guice:guice-servlet',
'//lib:servlet-api-3_1',
],
visibility = ['//visibility:public'],
)
#TODO(davido): There is no provided_deps argument to java_library rule
java_library(
name = 'api',
srcs = glob([SRC + '**/*.java']),
deps = [
'//gerrit-common:annotations',
'//lib/guice:guice',
'//lib/guice:guice-assistedinject',
],
visibility = ['//visibility:public'],
)

58
gerrit-gpg/BUILD Normal file
View File

@ -0,0 +1,58 @@
load('//tools/bzl:junit.bzl', 'junit_tests')
DEPS = [
'//gerrit-common:server',
'//gerrit-extension-api:api',
'//gerrit-reviewdb:server',
'//gerrit-server:server',
'//lib:guava',
'//lib:gwtorm',
'//lib/guice:guice',
'//lib/guice:guice-assistedinject',
'//lib/guice:guice-servlet',
'//lib/jgit/org.eclipse.jgit:jgit',
'//lib/log:api',
]
java_library(
name = 'gpg',
srcs = glob(['src/main/java/**/*.java']),
deps = DEPS + [
'//lib/bouncycastle:bcpg',
'//lib/bouncycastle:bcprov',
],
visibility = ['//visibility:public'],
)
TESTUTIL_SRCS = glob(['src/test/**/testutil/**/*.java'])
java_library(
name = 'testutil',
srcs = TESTUTIL_SRCS,
deps = DEPS + [
':gpg',
'//lib/bouncycastle:bcpg-without-neverlink',
'//lib/bouncycastle:bcprov-without-neverlink',
],
visibility = ['//visibility:public'],
)
junit_tests(
name = 'gpg_tests',
srcs = glob(
['src/test/java/**/*.java'],
exclude = TESTUTIL_SRCS,
),
deps = DEPS + [
':gpg',
':testutil',
'//gerrit-cache-h2:cache-h2',
'//gerrit-lucene:lucene',
'//gerrit-server:testutil',
'//lib:truth',
'//lib/jgit/org.eclipse.jgit.junit:junit',
'//lib/bouncycastle:bcpg-without-neverlink',
'//lib/bouncycastle:bcprov-without-neverlink',
],
visibility = ['//visibility:public'],
)

114
gerrit-gwtexpui/BUILD Normal file
View File

@ -0,0 +1,114 @@
load('//tools/bzl:gwt.bzl', 'gwt_module')
load('//tools/bzl:junit.bzl', 'junit_tests')
SRC = 'src/main/java/com/google/gwtexpui/'
gwt_module(
name = 'Clippy',
srcs = glob([SRC + 'clippy/client/*.java']),
gwt_xml = SRC + 'clippy/Clippy.gwt.xml',
resources = [
SRC + 'clippy/client/clippy.css',
SRC + 'clippy/client/clippy.swf',
SRC + 'clippy/client/page_white_copy.png',
SRC + 'clippy/client/CopyableLabelText.properties',
],
deps = [
':SafeHtml',
':UserAgent',
'//lib/gwt:user',
],
visibility = ['//visibility:public'],
)
java_library(
name = 'CSS',
srcs = glob([SRC + 'css/rebind/*.java']),
resources = [SRC + 'css/CSS.gwt.xml'],
deps = ['//lib/gwt:dev'],
visibility = ['//visibility:public'],
)
gwt_module(
name = 'GlobalKey',
srcs = glob([SRC + 'globalkey/client/*.java']),
gwt_xml = SRC + 'globalkey/GlobalKey.gwt.xml',
resources = [
SRC + 'globalkey/client/KeyConstants.properties',
SRC + 'globalkey/client/key.css',
],
deps = [
':SafeHtml',
':UserAgent',
'//lib/gwt:user',
],
visibility = ['//visibility:public'],
)
java_library(
name = 'linker_server',
srcs = glob([SRC + 'linker/server/*.java']),
deps = ['//lib:servlet-api-3_1'],
visibility = ['//visibility:public'],
)
gwt_module(
name = 'Progress',
srcs = glob([SRC + 'progress/client/*.java']),
gwt_xml = SRC + 'progress/Progress.gwt.xml',
resources = [SRC + 'progress/client/progress.css'],
deps = ['//lib/gwt:user'],
visibility = ['//visibility:public'],
)
gwt_module(
name = 'SafeHtml',
srcs = glob([SRC + 'safehtml/client/*.java']),
gwt_xml = SRC + 'safehtml/SafeHtml.gwt.xml',
resources = [SRC + 'safehtml/client/safehtml.css'],
deps = ['//lib/gwt:user'],
visibility = ['//visibility:public'],
)
junit_tests(
name = 'SafeHtml_tests',
srcs = glob([
'src/test/java/com/google/gwtexpui/safehtml/client/**/*.java',
]),
deps = [
':SafeHtml',
'//lib:truth',
'//lib/gwt:user',
'//lib/gwt:dev',
],
)
gwt_module(
name = 'UserAgent',
srcs = glob([SRC + 'user/client/*.java']),
gwt_xml = SRC + 'user/User.gwt.xml',
resources = [SRC + 'user/client/tooltip.css'],
deps = ['//lib/gwt:user'],
visibility = ['//visibility:public'],
)
java_library(
name = 'server',
srcs = glob([SRC + 'server/*.java']),
deps = ['//lib:servlet-api-3_1'],
visibility = ['//visibility:public'],
)
java_library(
name = 'client-src-lib',
srcs = [],
resources = glob(
[SRC + n for n in [
'clippy/**/*',
'globalkey/**/*',
'safehtml/**/*',
'user/**/*',
]]
),
visibility = ['//visibility:public'],
)

72
gerrit-httpd/BUILD Normal file
View File

@ -0,0 +1,72 @@
load('//tools/bzl:junit.bzl', 'junit_tests')
SRCS = glob(
['src/main/java/**/*.java'],
)
RESOURCES = glob(['src/main/resources/**/*'])
java_library(
name = 'httpd',
srcs = SRCS,
resources = RESOURCES,
deps = [
'//gerrit-antlr:query_exception',
'//gerrit-common:annotations',
'//gerrit-common:server',
'//gerrit-extension-api:api',
'//gerrit-gwtexpui:linker_server',
'//gerrit-gwtexpui:server',
'//gerrit-launcher:launcher',
'//gerrit-patch-jgit:server',
'//gerrit-prettify:server',
'//gerrit-reviewdb:server',
'//gerrit-server:server',
'//gerrit-util-cli:cli',
'//gerrit-util-http:http',
'//lib:args4j',
'//lib:gson',
'//lib:guava',
'//lib:gwtjsonrpc',
'//lib:gwtorm',
'//lib:jsch',
'//lib:mime-util',
'//lib:servlet-api-3_1',
'//lib/auto:auto-value',
'//lib/commons:codec',
'//lib/guice:guice',
'//lib/guice:guice-assistedinject',
'//lib/guice:guice-servlet',
'//lib/jgit/org.eclipse.jgit:jgit',
'//lib/jgit/org.eclipse.jgit.http.server:jgit-servlet',
'//lib/log:api',
'//lib/lucene:lucene-core-and-backward-codecs',
],
visibility = ['//visibility:public'],
)
junit_tests(
name = 'httpd_tests',
srcs = glob(['src/test/java/**/*.java']),
deps = [
':httpd',
'//gerrit-common:server',
'//gerrit-extension-api:api',
'//gerrit-reviewdb:server',
'//gerrit-server:server',
'//gerrit-util-http:http',
'//gerrit-util-http:testutil',
'//lib:jimfs',
'//lib:junit',
'//lib:gson',
'//lib:gwtorm',
'//lib:guava',
'//lib:servlet-api-3_1-without-neverlink',
'//lib:truth',
'//lib/easymock:easymock',
'//lib/guice:guice',
'//lib/guice:guice-servlet',
'//lib/jgit/org.eclipse.jgit:jgit',
'//lib/jgit/org.eclipse.jgit.junit:junit',
'//lib/joda:joda-time',
],
)

7
gerrit-launcher/BUILD Normal file
View File

@ -0,0 +1,7 @@
# NOTE: GerritLauncher must be a single, self-contained class. Do not add any
# additional srcs or deps to this rule.
java_library(
name = 'launcher',
srcs = ['src/main/java/com/google/gerrit/launcher/GerritLauncher.java'],
visibility = ['//visibility:public'],
)

41
gerrit-lucene/BUILD Normal file
View File

@ -0,0 +1,41 @@
QUERY_BUILDER = [
'src/main/java/com/google/gerrit/lucene/QueryBuilder.java',
]
java_library(
name = 'query_builder',
srcs = QUERY_BUILDER,
deps = [
'//gerrit-antlr:query_exception',
'//gerrit-reviewdb:server',
'//gerrit-server:server',
'//lib:gwtorm',
'//lib:guava',
'//lib/lucene:lucene-core-and-backward-codecs',
],
visibility = ['//visibility:public'],
)
java_library(
name = 'lucene',
srcs = glob(['src/main/java/**/*.java'], exclude = QUERY_BUILDER),
deps = [
':query_builder',
'//gerrit-antlr:query_exception',
'//gerrit-common:annotations',
'//gerrit-common:server',
'//gerrit-extension-api:api',
'//gerrit-reviewdb:server',
'//gerrit-server:server',
'//lib:guava',
'//lib:gwtorm',
'//lib/guice:guice',
'//lib/guice:guice-assistedinject',
'//lib/jgit/org.eclipse.jgit:jgit',
'//lib/log:api',
'//lib/lucene:lucene-analyzers-common',
'//lib/lucene:lucene-core-and-backward-codecs',
'//lib/lucene:lucene-misc',
],
visibility = ['//visibility:public'],
)

26
gerrit-oauth/BUILD Normal file
View File

@ -0,0 +1,26 @@
SRCS = glob(
['src/main/java/**/*.java'],
)
RESOURCES = glob(['src/main/resources/**/*'])
java_library(
name = 'oauth',
srcs = SRCS,
resources = RESOURCES,
deps = [
'//gerrit-common:annotations',
'//gerrit-extension-api:api',
'//gerrit-httpd:httpd',
'//gerrit-reviewdb:server',
'//gerrit-server:server',
'//lib:gson',
'//lib:guava',
'//lib:gwtorm',
'//lib/commons:codec',
'//lib/guice:guice',
'//lib/guice:guice-servlet',
'//lib/log:api',
'//lib:servlet-api-3_1',
],
visibility = ['//visibility:public'],
)

24
gerrit-openid/BUILD Normal file
View File

@ -0,0 +1,24 @@
java_library(
name = 'openid',
srcs = glob(['src/main/java/**/*.java']),
resources = glob(['src/main/resources/**/*']),
deps = [ # We want all these deps to be provided_deps
'//gerrit-common:annotations',
'//gerrit-common:server',
'//gerrit-extension-api:api',
'//gerrit-gwtexpui:server',
'//gerrit-httpd:httpd',
'//gerrit-reviewdb:server',
'//gerrit-server:server',
'//lib:guava',
'//lib:gwtorm',
'//lib:servlet-api-3_1',
'//lib/commons:codec',
'//lib/guice:guice',
'//lib/guice:guice-servlet',
'//lib/jgit/org.eclipse.jgit:jgit',
'//lib/log:api',
'//lib/openid:consumer',
],
visibility = ['//visibility:public'],
)

View File

@ -0,0 +1,11 @@
java_library(
name = 'commons-net',
srcs = glob(['src/main/java/org/apache/commons/net/**/*.java']),
deps = [
'//gerrit-util-ssl:ssl',
'//lib/commons:codec',
'//lib/commons:net',
'//lib/log:api',
],
visibility = ['//visibility:public'],
)

View File

@ -39,10 +39,12 @@ genrule(
java_library(
name = 'server',
srcs = [
SRC + 'diff/EditDeserializer.java',
SRC + 'diff/ReplaceEdit.java',
SRC + 'internal/storage/file/WindowCacheStatAccessor.java',
SRC + 'lib/ObjectIdSerialization.java',
SRC + x for x in [
'diff/EditDeserializer.java',
'diff/ReplaceEdit.java',
'internal/storage/file/WindowCacheStatAccessor.java',
'lib/ObjectIdSerialization.java',
]
],
deps = [
'//lib:gson',

66
gerrit-patch-jgit/BUILD Normal file
View File

@ -0,0 +1,66 @@
load('//tools/bzl:genrule2.bzl', 'genrule2')
load('//tools/bzl:gwt.bzl', 'gwt_module')
SRC = 'src/main/java/org/eclipse/jgit/'
gwt_module(
name = 'client',
srcs = [
SRC + 'diff/Edit_JsonSerializer.java',
SRC + 'diff/ReplaceEdit.java',
],
gwt_xml = SRC + 'JGit.gwt.xml',
deps = [
':Edit',
'//lib/gwt:user',
'//lib:gwtjsonrpc',
],
visibility = ['//visibility:public'],
)
gwt_module(
name = 'Edit',
srcs = [':jgit_edit_src'],
visibility = ['//visibility:public'],
)
genrule2(
name = 'jgit_edit_src',
cmd = ' && '.join([
'unzip -qd $$TMP $(location @jgit_src//file) ' +
'org/eclipse/jgit/diff/Edit.java',
'cd $$TMP',
'zip -Dq $$ROOT/$@ org/eclipse/jgit/diff/Edit.java',
]),
tools = ['@jgit_src//file'],
out = 'edit.srcjar',
)
java_library(
name = 'server',
srcs = [
SRC + x for x in [
'diff/EditDeserializer.java',
'diff/ReplaceEdit.java',
'internal/storage/file/WindowCacheStatAccessor.java',
'lib/ObjectIdSerialization.java',
]
],
deps = [
'//lib:gson',
'//lib/jgit/org.eclipse.jgit:jgit',
],
visibility = ['//visibility:public'],
)
java_test(
name = 'jgit_patch_tests',
test_class = 'org.eclipse.jgit.diff.EditDeserializerTest',
srcs = glob(['src/test/java/**/*.java']),
deps = [
':server',
'//lib/jgit/org.eclipse.jgit:jgit',
'//lib:junit',
],
visibility = ['//visibility:public'],
)

161
gerrit-pgm/BUILD Normal file
View File

@ -0,0 +1,161 @@
load('//tools/bzl:java.bzl', 'java_library2')
load('//tools/bzl:junit.bzl', 'junit_tests')
SRCS = 'src/main/java/com/google/gerrit/pgm/'
RSRCS = 'src/main/resources/com/google/gerrit/pgm/'
INIT_API_SRCS = glob([SRCS + 'init/api/*.java'])
BASE_JETTY_DEPS = [
'//gerrit-common:server',
'//gerrit-extension-api:api',
'//gerrit-gwtexpui:linker_server',
'//gerrit-gwtexpui:server',
'//gerrit-httpd:httpd',
'//gerrit-server:server',
'//gerrit-sshd:sshd',
'//lib:guava',
'//lib/guice:guice',
'//lib/guice:guice-assistedinject',
'//lib/guice:guice-servlet',
'//lib/jgit/org.eclipse.jgit:jgit',
'//lib/log:api',
'//lib/log:log4j',
]
DEPS = BASE_JETTY_DEPS + [
'//gerrit-reviewdb:server',
'//lib/log:jsonevent-layout',
]
java_library(
name = 'init-api',
srcs = INIT_API_SRCS,
deps = DEPS + ['//gerrit-common:annotations'],
visibility = ['//visibility:public'],
)
java_library(
name = 'init',
srcs = glob([SRCS + 'init/*.java']),
resources = glob([RSRCS + 'init/*']),
deps = DEPS + [
':init-api',
':util',
'//gerrit-common:annotations',
'//gerrit-launcher:launcher', # We want this dep to be provided_deps
'//gerrit-lucene:lucene',
'//lib:args4j',
'//lib:derby',
'//lib:gwtjsonrpc',
'//lib:gwtorm',
'//lib:h2',
'//lib/commons:validator',
'//lib/mina:sshd',
],
visibility = ['//visibility:public'],
)
REST_UTIL_DEPS = [
'//gerrit-cache-h2:cache-h2',
'//gerrit-util-cli:cli',
'//lib:args4j',
'//lib:gwtorm',
'//lib/commons:dbcp',
]
java_library(
name = 'util',
exports = [':util-nodep'],
runtime_deps = DEPS + REST_UTIL_DEPS,
visibility = ['//visibility:public'],
)
java_library(
name = 'util-nodep',
srcs = glob([SRCS + 'util/*.java']),
deps = DEPS + REST_UTIL_DEPS, # We want all these deps to be provided_deps
visibility = ['//visibility:public'],
)
JETTY_DEPS = [
'//lib/jetty:jmx',
'//lib/jetty:server',
'//lib/jetty:servlet',
]
java_library(
name = 'http',
runtime_deps = DEPS + JETTY_DEPS,
exports = [':http-jetty'],
visibility = ['//visibility:public'],
)
java_library(
name = 'http-jetty',
srcs = glob([SRCS + 'http/jetty/*.java']),
deps = JETTY_DEPS + BASE_JETTY_DEPS + [ # We want all these deps to be provided_deps
'//gerrit-launcher:launcher',
'//gerrit-reviewdb:client',
'//lib:servlet-api-3_1',
],
visibility = ['//visibility:public'],
)
REST_PGM_DEPS = [
':http',
':init',
':init-api',
':util',
'//gerrit-cache-h2:cache-h2',
'//gerrit-gpg:gpg',
'//gerrit-lucene:lucene',
'//gerrit-oauth:oauth',
'//gerrit-openid:openid',
'//lib:args4j',
'//lib:gwtorm',
'//lib:protobuf',
'//lib:servlet-api-3_1-without-neverlink',
'//lib/auto:auto-value',
'//lib/prolog:cafeteria',
'//lib/prolog:compiler',
'//lib/prolog:runtime',
]
java_library(
name = 'pgm',
resources = glob([RSRCS + '*']),
runtime_deps = DEPS + REST_PGM_DEPS + [
':daemon',
],
visibility = ['//visibility:public'],
)
# no transitive deps, used for gerrit-acceptance-framework
java_library(
name = 'daemon',
srcs = glob([SRCS + '*.java', SRCS + 'rules/*.java']),
resources = glob([RSRCS + '*']),
deps = DEPS + REST_PGM_DEPS + [ # We want all these deps to be provided_deps
'//gerrit-launcher:launcher',
],
visibility = ['//visibility:public'],
)
junit_tests(
name = 'pgm_tests',
srcs = glob(['src/test/java/**/*.java']),
deps = [
':init',
':init-api',
':pgm',
'//gerrit-common:server',
'//gerrit-server:server',
'//lib:guava',
'//lib:junit',
'//lib/easymock:easymock',
'//lib/guice:guice',
'//lib/jgit/org.eclipse.jgit:jgit',
'//lib/jgit/org.eclipse.jgit.junit:junit',
],
)

51
gerrit-plugin-api/BUILD Normal file
View File

@ -0,0 +1,51 @@
SRCS = [
'gerrit-server/src/main/java/',
'gerrit-httpd/src/main/java/',
'gerrit-sshd/src/main/java/',
]
PLUGIN_API = [
'//gerrit-httpd:httpd',
'//gerrit-pgm:init-api',
'//gerrit-server:server',
'//gerrit-sshd:sshd',
]
java_binary(
name = 'plugin-api',
main_class = 'Dummy',
runtime_deps = [':lib'],
visibility = ['//visibility:public'],
)
java_library(
name = 'lib',
exports = PLUGIN_API + [
'//gerrit-antlr:query_exception',
'//gerrit-antlr:query_parser',
'//gerrit-common:annotations',
'//gerrit-common:server',
'//gerrit-extension-api:api',
'//gerrit-gwtexpui:server',
'//gerrit-reviewdb:server',
'//lib:args4j',
'//lib:blame-cache',
'//lib/dropwizard:dropwizard-core',
'//lib:guava',
'//lib:gwtorm',
'//lib:jsch',
'//lib:mime-util',
'//lib:servlet-api-3_1',
'//lib:velocity',
'//lib/commons:lang',
'//lib/guice:guice',
'//lib/guice:guice-assistedinject',
'//lib/guice:guice-servlet',
'//lib/jgit/org.eclipse.jgit:jgit',
'//lib/jgit/org.eclipse.jgit.http.server:jgit-servlet',
'//lib/joda:joda-time',
'//lib/log:api',
'//lib/mina:sshd',
],
visibility = ['//visibility:public'],
)

35
gerrit-prettify/BUILD Normal file
View File

@ -0,0 +1,35 @@
load('//tools/bzl:gwt.bzl', 'gwt_module')
SRC = 'src/main/java/com/google/gerrit/prettify/'
gwt_module(
name = 'client',
srcs = glob([
SRC + 'common/**/*.java',
]),
gwt_xml = SRC + 'PrettyFormatter.gwt.xml',
deps = ['//lib/gwt:user'],
exported_deps = [
'//gerrit-extension-api:client',
'//gerrit-gwtexpui:SafeHtml',
'//gerrit-patch-jgit:client',
'//gerrit-patch-jgit:Edit',
'//gerrit-reviewdb:client',
'//lib:gwtjsonrpc',
'//lib:gwtjsonrpc_src',
],
visibility = ['//visibility:public'],
)
java_library(
name = 'server',
srcs = glob([SRC + 'common/**/*.java']),
deps = [
'//gerrit-patch-jgit:server',
'//gerrit-reviewdb:server',
'//lib:guava',
'//lib:gwtjsonrpc',
'//lib/jgit/org.eclipse.jgit:jgit',
],
visibility = ['//visibility:public'],
)

39
gerrit-reviewdb/BUILD Normal file
View File

@ -0,0 +1,39 @@
load('//tools/bzl:gwt.bzl', 'gwt_module')
load('//tools/bzl:junit.bzl', 'junit_tests')
SRC = 'src/main/java/com/google/gerrit/reviewdb/'
TESTS = 'src/test/java/com/google/gerrit/reviewdb/'
gwt_module(
name = 'client',
srcs = glob([SRC + 'client/**/*.java']),
gwt_xml = SRC + 'ReviewDB.gwt.xml',
deps = [
'//gerrit-extension-api:client',
'//lib:gwtorm_client',
'//lib:gwtorm_client_src'
],
visibility = ['//visibility:public'],
)
java_library(
name = 'server',
srcs = glob([SRC + '**/*.java']),
resources = glob(['src/main/resources/**/*']),
deps = [
'//gerrit-extension-api:api',
'//lib:guava',
'//lib:gwtorm',
],
visibility = ['//visibility:public'],
)
junit_tests(
name = 'client_tests',
srcs = glob([TESTS + 'client/**/*.java']),
deps = [
':client',
'//lib:gwtorm',
'//lib:truth',
],
)

208
gerrit-server/BUILD Normal file
View File

@ -0,0 +1,208 @@
load('//tools/bzl:junit.bzl', 'junit_tests')
CONSTANTS_SRC = [
'src/main/java/com/google/gerrit/server/documentation/Constants.java',
]
SRCS = glob(
['src/main/java/**/*.java'],
exclude = CONSTANTS_SRC,
)
RESOURCES = glob(['src/main/resources/**/*'])
java_library(
name = 'constants',
srcs = CONSTANTS_SRC,
visibility = ['//visibility:public'],
)
java_library(
name = 'server',
srcs = SRCS,
resources = RESOURCES,
deps = [
':constants',
'//gerrit-antlr:query_exception',
'//gerrit-antlr:query_parser',
'//gerrit-common:annotations',
'//gerrit-common:server',
'//gerrit-extension-api:api',
'//gerrit-patch-commonsnet:commons-net',
'//gerrit-patch-jgit:server',
'//gerrit-prettify:server',
'//gerrit-reviewdb:server',
'//gerrit-util-cli:cli',
'//gerrit-util-ssl:ssl',
'//lib:args4j',
'//lib:automaton',
'//lib:blame-cache',
'//lib:grappa',
'//lib:gson',
'//lib:guava',
'//lib:guava-retrying',
'//lib:gwtjsonrpc',
'//lib:gwtorm',
'//lib:jsch',
'//lib:juniversalchardet',
'//lib:mime-util',
'//lib:pegdown',
'//lib:protobuf',
'//lib:servlet-api-3_1',
'//lib:tukaani-xz',
'//lib:velocity',
'//lib/antlr:java_runtime',
'//lib/auto:auto-value',
'//lib/commons:codec',
'//lib/commons:compress',
'//lib/commons:dbcp',
'//lib/commons:lang',
'//lib/commons:net',
'//lib/commons:validator',
'//lib/dropwizard:dropwizard-core',
'//lib/guice:guice',
'//lib/guice:guice-assistedinject',
'//lib/guice:guice-servlet',
'//lib/jgit/org.eclipse.jgit:jgit',
'//lib/jgit/org.eclipse.jgit.archive:jgit-archive',
'//lib/joda:joda-time',
'//lib/log:api',
'//lib/log:jsonevent-layout',
'//lib/log:log4j',
'//lib/lucene:lucene-analyzers-common',
'//lib/lucene:lucene-core-and-backward-codecs',
'//lib/lucene:lucene-queryparser',
'//lib/ow2:ow2-asm',
'//lib/ow2:ow2-asm-tree',
'//lib/ow2:ow2-asm-util',
'//lib/prolog:runtime',
],
visibility = ['//visibility:public'],
)
TESTUTIL_DEPS = [
':server',
'//gerrit-common:server',
'//gerrit-cache-h2:cache-h2',
'//gerrit-extension-api:api',
'//gerrit-gpg:gpg',
'//gerrit-lucene:lucene',
'//gerrit-reviewdb:server',
'//lib:gwtorm',
'//lib:h2',
'//lib:truth',
'//lib/guice:guice',
'//lib/guice:guice-servlet',
'//lib/jgit/org.eclipse.jgit:jgit',
'//lib/jgit/org.eclipse.jgit.junit:junit',
'//lib/joda:joda-time',
'//lib/log:api',
'//lib/log:impl_log4j',
'//lib/log:log4j',
]
TESTUTIL = glob([
'src/test/java/com/google/gerrit/testutil/**/*.java',
'src/test/java/com/google/gerrit/server/project/Util.java',
])
java_library(
name = 'testutil',
srcs = TESTUTIL,
deps = TESTUTIL_DEPS + [
'//lib/auto:auto-value',
'//lib/easymock:easymock',
'//lib/powermock:powermock-api-easymock',
'//lib/powermock:powermock-api-support',
'//lib/powermock:powermock-core',
'//lib/powermock:powermock-module-junit4',
'//lib/powermock:powermock-module-junit4-common',
],
exports = [
'//lib/easymock:easymock',
'//lib/powermock:powermock-api-easymock',
'//lib/powermock:powermock-api-support',
'//lib/powermock:powermock-core',
'//lib/powermock:powermock-module-junit4',
'//lib/powermock:powermock-module-junit4-common',
],
visibility = ['//visibility:public'],
)
PROLOG_TEST_CASE = [
'src/test/java/com/google/gerrit/rules/PrologTestCase.java',
]
PROLOG_TESTS = glob(
['src/test/java/com/google/gerrit/rules/**/*.java'],
exclude = PROLOG_TEST_CASE,
)
java_library(
name = 'prolog_test_case',
srcs = PROLOG_TEST_CASE,
deps = [
':server',
':testutil',
'//gerrit-common:server',
'//gerrit-extension-api:api',
'//lib:guava',
'//lib:junit',
'//lib:truth',
'//lib/guice:guice',
'//lib/prolog:runtime',
],
)
junit_tests(
name = 'prolog_tests',
srcs = PROLOG_TESTS,
resources = glob(['src/test/resources/com/google/gerrit/rules/**/*']),
deps = TESTUTIL_DEPS + [
':prolog_test_case',
':testutil',
'//gerrit-server/src/main/prolog:common',
'//lib/prolog:runtime',
],
)
QUERY_TESTS = glob(
['src/test/java/com/google/gerrit/server/query/**/*.java'],
)
junit_tests(
name = 'query_tests',
srcs = QUERY_TESTS,
deps = TESTUTIL_DEPS + [
':testutil',
'//gerrit-antlr:query_exception',
'//gerrit-antlr:query_parser',
'//gerrit-common:annotations',
'//gerrit-server/src/main/prolog:common',
'//lib/antlr:java_runtime',
],
visibility = ['//visibility:public'],
)
junit_tests(
name = 'server_tests',
srcs = glob(
['src/test/java/**/*.java'],
exclude = TESTUTIL + PROLOG_TESTS + PROLOG_TEST_CASE + QUERY_TESTS
),
deps = TESTUTIL_DEPS + [
':testutil',
'//gerrit-antlr:query_exception',
'//gerrit-common:annotations',
'//gerrit-patch-jgit:server',
'//gerrit-server/src/main/prolog:common',
'//lib:args4j',
'//lib:grappa',
'//lib:gson',
'//lib:guava',
'//lib:guava-retrying',
'//lib:protobuf',
'//lib/dropwizard:dropwizard-core',
'//lib/guice:guice-assistedinject',
'//lib/prolog:runtime',
],
visibility = ['//visibility:public'],
)

View File

@ -0,0 +1,8 @@
load('//lib/prolog:prolog.bzl', 'prolog_cafe_library')
prolog_cafe_library(
name = 'common',
srcs = ['gerrit_common.pl'],
deps = ['//gerrit-server:server'],
visibility = ['//visibility:public'],
)

View File

@ -29,7 +29,7 @@ import com.google.gwtorm.server.ResultSet;
import org.junit.Ignore;
@Ignore
class FakeChangeIndex implements ChangeIndex {
public class FakeChangeIndex implements ChangeIndex {
static Schema<ChangeData> V1 = new Schema<>(1,
ImmutableList.<FieldDef<ChangeData, ?>> of(
ChangeField.STATUS));

53
gerrit-sshd/BUILD Normal file
View File

@ -0,0 +1,53 @@
load('//tools/bzl:junit.bzl', 'junit_tests')
SRCS = glob(['src/main/java/**/*.java'])
java_library(
name = 'sshd',
srcs = SRCS,
deps = [
'//gerrit-extension-api:api',
'//gerrit-cache-h2:cache-h2',
'//gerrit-common:annotations',
'//gerrit-common:server',
'//gerrit-lucene:lucene',
'//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:servlet-api-3_1',
'//lib/auto:auto-value',
'//lib/bouncycastle:bcprov',
'//lib/commons:codec',
'//lib/dropwizard:dropwizard-core',
'//lib/guice:guice',
'//lib/guice:guice-assistedinject',
'//lib/guice:guice-servlet', # SSH should not depend on servlet
'//lib/jgit/org.eclipse.jgit:jgit',
'//lib/jgit/org.eclipse.jgit.archive:jgit-archive',
'//lib/log:api',
'//lib/log:log4j',
'//lib/mina:core',
'//lib/mina:sshd',
],
visibility = ['//visibility:public'],
)
junit_tests(
name = 'sshd_tests',
srcs = glob(
['src/test/java/**/*.java'],
),
deps = [
':sshd',
'//gerrit-extension-api:api',
'//gerrit-server:server',
'//lib:truth',
'//lib/mina:sshd',
],
)

13
gerrit-util-cli/BUILD Normal file
View File

@ -0,0 +1,13 @@
java_library(
name = 'cli',
srcs = glob(['src/main/java/**/*.java']),
deps = [
'//gerrit-common:annotations',
'//gerrit-common:server',
'//lib:args4j',
'//lib:guava',
'//lib/guice:guice',
'//lib/guice:guice-assistedinject',
],
visibility = ['//visibility:public'],
)

39
gerrit-util-http/BUILD Normal file
View File

@ -0,0 +1,39 @@
load('//tools/bzl:junit.bzl', 'junit_tests')
java_library(
name = 'http',
srcs = glob(['src/main/java/**/*.java']),
deps = ['//lib:servlet-api-3_1'],
visibility = ['//visibility:public'],
)
TESTUTIL_SRCS = glob(['src/test/**/testutil/**/*.java'])
java_library(
name = 'testutil',
srcs = TESTUTIL_SRCS,
deps = [
'//gerrit-extension-api:api',
'//lib:guava',
'//lib:servlet-api-3_1',
'//lib/httpcomponents:httpclient',
'//lib/jgit/org.eclipse.jgit:jgit',
],
visibility = ['//visibility:public'],
)
junit_tests(
name = 'http_tests',
srcs = glob(
['src/test/java/**/*.java'],
exclude = TESTUTIL_SRCS,
),
deps = [
':http',
':testutil',
'//lib:junit',
'//lib:servlet-api-3_1-without-neverlink',
'//lib:truth',
'//lib/easymock:easymock',
],
)

5
gerrit-util-ssl/BUILD Normal file
View File

@ -0,0 +1,5 @@
java_library(
name = 'ssl',
srcs = glob(['src/main/java/**/*.java']),
visibility = ['//visibility:public'],
)

204
lib/BUILD Normal file
View File

@ -0,0 +1,204 @@
java_library(
name = 'servlet-api-3_1',
neverlink = 1,
exports = ['@servlet_api_3_1//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'servlet-api-3_1-without-neverlink',
exports = ['@servlet_api_3_1//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'gwtjsonrpc',
exports = ['@gwtjsonrpc//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'gwtjsonrpc_src',
exports = ['@gwtjsonrpc_src//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'gson',
exports = ['@gson//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'gwtorm_client',
exports = ['@gwtorm_client//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'gwtorm_client_src',
exports = ['@gwtorm_client_src//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'protobuf',
exports = ['@protobuf//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'gwtorm',
exports = [':gwtorm_client'],
runtime_deps = [':protobuf'],
visibility = ['//visibility:public'],
)
java_library(
name = 'guava',
exports = ['@guava//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'velocity',
exports = ['@velocity//jar'],
runtime_deps = [
'//lib/commons:collections',
'//lib/commons:lang',
'//lib/commons:oro',
],
visibility = ['//visibility:public'],
)
java_library(
name = 'jsch',
exports = ['@jsch//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'juniversalchardet',
exports = ['@juniversalchardet//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'args4j',
exports = ['@args4j//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'automaton',
exports = ['@automaton//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'pegdown',
exports = ['@pegdown//jar'],
runtime_deps = [':grappa'],
visibility = ['//visibility:public'],
)
java_library(
name = 'grappa',
exports = ['@grappa//jar'],
runtime_deps = [
':jitescript',
'//lib/ow2:ow2-asm',
'//lib/ow2:ow2-asm-analysis',
'//lib/ow2:ow2-asm-tree',
'//lib/ow2:ow2-asm-util',
],
visibility = ['//visibility:public'],
)
java_library(
name = 'jitescript',
exports = ['@jitescript//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'tukaani-xz',
exports = ['@tukaani_xz//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'mime-util',
exports = ['@mime_util//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'guava-retrying',
exports = ['@guava_retrying//jar'],
runtime_deps = [':jsr305'],
visibility = ['//visibility:public'],
)
java_library(
name = 'jsr305',
exports = ['@jsr305//jar'],
)
java_library(
name = 'blame-cache',
exports = ['@blame_cache//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'h2',
exports = ['@h2//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'jimfs',
exports = ['@jimfs//jar'],
runtime_deps = [':guava'],
visibility = ['//visibility:public'],
)
java_library(
name = 'junit',
exports = [
'@junit//jar',
':hamcrest-core',
],
runtime_deps = [':hamcrest-core'],
visibility = ['//visibility:public'],
)
java_library(
name = 'hamcrest-core',
exports = ['@hamcrest_core//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'truth',
exports = [
'@truth//jar',
':guava',
':junit',
],
visibility = ['//visibility:public'],
)
java_library(
name = 'javassist',
exports = ['@javassist//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'derby',
exports = ['@derby//jar'],
visibility = ['//visibility:public'],
)

31
lib/antlr/BUILD Normal file
View File

@ -0,0 +1,31 @@
[java_library(
name = n,
exports = ['@%s//jar' % n],
) for n in [
'antlr27',
'stringtemplate',
]]
java_library(
name = 'java_runtime',
exports = ['@java_runtime//jar'],
visibility = ['//visibility:public'],
)
java_binary(
name = 'antlr-tool',
main_class = 'org.antlr.Tool',
runtime_deps = [':tool'],
visibility = ['//gerrit-antlr:__pkg__'],
)
java_library(
name = 'tool',
exports = ['@org_antlr//jar'],
runtime_deps = [
':antlr27',
':java_runtime',
':stringtemplate',
],
)

21
lib/auto/BUILD Normal file
View File

@ -0,0 +1,21 @@
java_plugin(
name = 'auto-annotation-plugin',
processor_class = 'com.google.auto.value.processor.AutoAnnotationProcessor',
deps = ['@auto_value//jar'],
)
java_plugin(
name = 'auto-value-plugin',
processor_class = 'com.google.auto.value.processor.AutoValueProcessor',
deps = ['@auto_value//jar'],
)
java_library(
name = 'auto-value',
exported_plugins = [
':auto-annotation-plugin',
':auto-value-plugin',
],
exports = ['@auto_value//jar'],
visibility = ['//visibility:public'],
)

38
lib/bouncycastle/BUILD Normal file
View File

@ -0,0 +1,38 @@
java_library(
name = 'bcprov',
neverlink = 1,
exports = ['@bcprov//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'bcprov-without-neverlink',
exports = ['@bcprov//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'bcpg',
neverlink = 1,
exports = ['@bcpg//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'bcpg-without-neverlink',
exports = ['@bcpg//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'bcpkix',
neverlink = 1,
exports = ['@bcpkix//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'bcpkix-without-neverlink',
exports = ['@bcpkix//jar'],
visibility = ['//visibility:public'],
)

54
lib/commons/BUILD Normal file
View File

@ -0,0 +1,54 @@
java_library(
name = 'codec',
exports = ['@commons_codec//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'collections',
exports = ['@commons_collections//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'compress',
exports = ['@commons_compress//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'lang',
exports = ['@commons_lang//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'net',
exports = ['@commons_net//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'dbcp',
exports = ['@commons_dbcp//jar'],
runtime_deps = [':pool'],
visibility = ['//visibility:public'],
)
java_library(
name = 'pool',
exports = ['@commons_pool//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'oro',
exports = ['@commons_oro//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'validator',
exports = ['@commons_validator//jar'],
visibility = ['//visibility:public'],
)

5
lib/dropwizard/BUILD Normal file
View File

@ -0,0 +1,5 @@
java_library(
name = 'dropwizard-core',
exports = ['@dropwizard_core//jar'],
visibility = ['//visibility:public'],
)

22
lib/easymock/BUILD Normal file
View File

@ -0,0 +1,22 @@
java_library(
name = 'easymock',
exports = ['@easymock//jar'],
runtime_deps = [
':cglib-2_2',
':objenesis',
],
visibility = ['//visibility:public'],
)
java_library(
name = 'cglib-2_2',
exports = ['@cglib_2_2//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'objenesis',
exports = ['@objenesis//jar'],
visibility = ['//visibility:public'],
)

39
lib/guice/BUILD Normal file
View File

@ -0,0 +1,39 @@
java_library(
name = 'guice',
exports = [
':guice_library',
':javax-inject',
],
visibility = ['//visibility:public'],
)
java_library(
name = 'guice_library',
exports = ['@guice_library//jar'],
runtime_deps = ['aopalliance'],
visibility = ['//visibility:public'],
)
java_library(
name = 'guice-assistedinject',
exports = ['@guice_assistedinject//jar'],
runtime_deps = [':guice'],
visibility = ['//visibility:public'],
)
java_library(
name = 'guice-servlet',
exports = ['@guice_servlet//jar'],
runtime_deps = [':guice'],
visibility = ['//visibility:public'],
)
java_library(
name = 'aopalliance',
exports = ['@aopalliance//jar'],
)
java_library(
name = 'javax-inject',
exports = ['@javax_inject//jar'],
)

9
lib/gwt/BUILD Normal file
View File

@ -0,0 +1,9 @@
[java_library(
name = n,
exports = ['@%s//jar' % n.replace("-", "_")],
visibility = ["//visibility:public"],
) for n in [
'javax-validation',
'dev',
'user',
]]

29
lib/httpcomponents/BUILD Normal file
View File

@ -0,0 +1,29 @@
java_library(
name = 'fluent-hc',
exports = ['@fluent_hc//jar'],
runtime_deps = [':httpclient'],
visibility = ['//visibility:public'],
)
java_library(
name = 'httpclient',
exports = ['@httpclient//jar'],
runtime_deps = [
'//lib/commons:codec',
':httpcore',
'//lib/log:jcl-over-slf4j',
],
visibility = ['//visibility:public'],
)
java_library(
name = 'httpcore',
exports = ['@httpcore//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'httpmime',
exports = ['@httpmime//jar'],
visibility = ['//visibility:public'],
)

67
lib/jetty/BUILD Normal file
View File

@ -0,0 +1,67 @@
java_library(
name = 'servlet',
exports = ['@jetty_servlet//jar'],
runtime_deps = [':security'],
visibility = ['//visibility:public'],
)
java_library(
name = 'security',
exports = ['@jetty_security//jar'],
runtime_deps = [':server'],
visibility = ['//visibility:public'],
)
java_library(
name = 'servlets',
exports = ['@jetty_servlets//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'server',
exports = [
'@jetty_server//jar',
':continuation',
':http',
],
visibility = ['//visibility:public'],
)
java_library(
name = 'jmx',
exports = [
'@jetty_jmx//jar',
':continuation',
':http',
],
visibility = ['//visibility:public'],
)
java_library(
name = 'continuation',
exports = ['@jetty_continuation//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'http',
exports = [
'@jetty_http//jar',
':io',
],
visibility = ['//visibility:public'],
)
java_library(
name = 'io',
exports = [
'@jetty_io//jar',
':util',
],
)
java_library(
name = 'util',
exports = ['@jetty_util//jar'],
)

View File

@ -0,0 +1,6 @@
java_library(
name = 'jgit-archive',
exports = ['@jgit_archive//jar'],
runtime_deps = ['//lib/jgit/org.eclipse.jgit:jgit'],
visibility = ['//visibility:public'],
)

View File

@ -0,0 +1,6 @@
java_library(
name = 'jgit-servlet',
exports = ['@jgit_servlet//jar'],
runtime_deps = ['//lib/jgit/org.eclipse.jgit:jgit'],
visibility = ['//visibility:public'],
)

View File

@ -0,0 +1,6 @@
java_library(
name = 'junit',
exports = ['@jgit_junit//jar'],
runtime_deps = ['//lib/jgit/org.eclipse.jgit:jgit'],
visibility = ['//visibility:public'],
)

View File

@ -0,0 +1,12 @@
java_library(
name = 'jgit',
exports = ['@jgit//jar'],
runtime_deps = [':ewah'],
visibility = ['//visibility:public'],
)
java_library(
name = 'ewah',
exports = ['@ewah//jar'],
visibility = ['//visibility:public'],
)

11
lib/joda/BUILD Normal file
View File

@ -0,0 +1,11 @@
java_library(
name = 'joda-time',
exports = ['@joda_time//jar'],
runtime_deps = ['joda-convert'],
visibility = ['//visibility:public'],
)
java_library(
name = 'joda-convert',
exports = ['@joda_convert//jar'],
)

47
lib/log/BUILD Normal file
View File

@ -0,0 +1,47 @@
java_library(
name = 'api',
exports = ['@log_api//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'nop',
exports = ['@log_nop//jar'],
runtime_deps = [':api'],
visibility = ['//visibility:public'],
)
java_library(
name = 'impl_log4j',
exports = ['@impl_log4j//jar'],
runtime_deps = [':log4j'],
visibility = ['//visibility:public'],
)
java_library(
name = 'jcl-over-slf4j',
exports = ['@jcl_over_slf4j//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'log4j',
exports = ['@log4j//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'jsonevent-layout',
exports = ['@jsonevent_layout//jar'],
runtime_deps = [
':json-smart',
'//lib/commons:lang'
],
visibility = ['//visibility:public'],
)
java_library(
name = 'json-smart',
exports = ['@json_smart//jar'],
visibility = ['//visibility:public'],
)

33
lib/lucene/BUILD Normal file
View File

@ -0,0 +1,33 @@
load('//tools/bzl:maven.bzl', 'merge_maven_jars')
# core and backward-codecs both provide
# META-INF/services/org.apache.lucene.codecs.Codec, so they must be merged.
merge_maven_jars(
name = 'lucene-core-and-backward-codecs',
srcs = [
'@backward_codecs//jar',
'@lucene_core//jar',
],
visibility = ['//visibility:public'],
)
java_library(
name = 'lucene-analyzers-common',
exports = ['@lucene_analyzers_common//jar'],
runtime_deps = [':lucene-core-and-backward-codecs'],
visibility = ['//visibility:public'],
)
java_library(
name = 'lucene-misc',
exports = ['@lucene_misc//jar'],
runtime_deps = [':lucene-core-and-backward-codecs'],
visibility = ['//visibility:public'],
)
java_library(
name = 'lucene-queryparser',
exports = ['@lucene_queryparser//jar'],
runtime_deps = [':lucene-core-and-backward-codecs'],
visibility = ['//visibility:public'],
)

12
lib/mina/BUILD Normal file
View File

@ -0,0 +1,12 @@
java_library(
name = 'sshd',
exports = ['@sshd//jar'],
visibility = ['//visibility:public'],
runtime_deps = [':core'],
)
java_library(
name = 'core',
exports = ['@mina_core//jar'],
visibility = ['//visibility:public'],
)

23
lib/openid/BUILD Normal file
View File

@ -0,0 +1,23 @@
java_library(
name = 'consumer',
exports = ['@openid_consumer//jar'],
runtime_deps = [
':nekohtml',
':xerces',
'//lib/httpcomponents:httpclient',
'//lib/log:jcl-over-slf4j',
'//lib/guice:guice',
],
visibility = ['//visibility:public'],
)
java_library(
name = 'nekohtml',
exports = ['@nekohtml//jar'],
runtime_deps = [':xerces'],
)
java_library(
name = 'xerces',
exports = ['@xerces//jar'],
)

30
lib/ow2/BUILD Normal file
View File

@ -0,0 +1,30 @@
java_library(
name = 'ow2-asm',
exports = ['@ow2_asm//jar'],
visibility = ["//visibility:public"],
)
java_library(
name = 'ow2-asm-analysis',
exports = ['@ow2_asm_analysis//jar'],
visibility = ["//visibility:public"],
)
java_library(
name = 'ow2-asm-commons',
exports = ['@ow2_asm_commons//jar'],
runtime_deps = [':ow2-asm-tree'],
visibility = ["//visibility:public"],
)
java_library(
name = 'ow2-asm-tree',
exports = ['@ow2_asm_tree//jar'],
visibility = ["//visibility:public"],
)
java_library(
name = 'ow2-asm-util',
exports = ['@ow2_asm_util//jar'],
visibility = ["//visibility:public"],
)

60
lib/powermock/BUILD Normal file
View File

@ -0,0 +1,60 @@
java_library(
name = 'powermock-module-junit4',
exports = [
'@powermock_module_junit4//jar',
':powermock-module-junit4-common',
'//lib:junit',
],
visibility = ['//visibility:public'],
)
java_library(
name = 'powermock-module-junit4-common',
exports = [
'@powermock_module_junit4_common//jar',
':powermock-reflect',
'//lib:junit',
],
visibility = ['//visibility:public'],
)
java_library(
name = 'powermock-reflect',
exports = [
'@powermock_reflect//jar',
'//lib:junit',
'//lib/easymock:objenesis',
],
visibility = ['//visibility:public'],
)
java_library(
name = 'powermock-api-easymock',
exports = [
'@powermock_api_easymock//jar',
':powermock-api-support',
'//lib/easymock:easymock',
],
visibility = ['//visibility:public'],
)
java_library(
name = 'powermock-api-support',
exports = [
'@powermock_api_support//jar',
':powermock-core',
':powermock-reflect',
'//lib:junit',
],
visibility = ['//visibility:public'],
)
java_library(
name = 'powermock-core',
exports = [
':powermock-reflect',
'//lib:javassist',
'//lib:junit',
],
visibility = ['//visibility:public'],
)

47
lib/prolog/BUILD Normal file
View File

@ -0,0 +1,47 @@
java_library(
name = 'runtime',
exports = ['@prolog_runtime//jar'],
visibility = ['//visibility:public'],
)
java_library(
name = 'compiler',
exports = ['@prolog_compiler//jar'],
runtime_deps = [
':io',
':runtime',
],
visibility = ['//visibility:public'],
)
java_library(
name = 'io',
exports = ['@prolog_io//jar'],
)
java_library(
name = 'cafeteria',
exports = ['@cafeteria//jar'],
runtime_deps = [
'io',
'runtime',
],
visibility = ['//visibility:public'],
)
java_binary(
name = 'compiler_bin',
main_class = 'BuckPrologCompiler',
runtime_deps = [':compiler_lib'],
visibility = ['//visibility:public'],
)
java_library(
name = 'compiler_lib',
srcs = ['java/BuckPrologCompiler.java'],
deps = [
':compiler',
':runtime',
],
visibility = ['//visibility:public'],
)

36
lib/prolog/prolog.bzl Normal file
View File

@ -0,0 +1,36 @@
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
load('//tools/bzl:genrule2.bzl', 'genrule2')
def prolog_cafe_library(
name,
srcs,
deps = [],
visibility = []):
genrule2(
name = name + '__pl2j',
cmd = '$(location //lib/prolog:compiler_bin) ' +
'$$TMP $@ ' +
'$(SRCS)',
srcs = srcs,
tools = ['//lib/prolog:compiler_bin'],
out = name + '.srcjar',
)
native.java_library(
name = name,
srcs = [':' + name + '__pl2j'],
deps = ['//lib/prolog:runtime'] + deps,
visibility = visibility,
)

6
tools/BUILD Normal file
View File

@ -0,0 +1,6 @@
py_binary(
name = 'merge_jars',
srcs = ['merge_jars.py'],
main = 'merge_jars.py',
visibility = ['//visibility:public'],
)

0
tools/bzl/BUILD Normal file
View File

29
tools/bzl/genrule2.bzl Normal file
View File

@ -0,0 +1,29 @@
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Syntactic sugar for native genrule() rule:
# expose ROOT shell variable
# expose TMP shell variable
# accept single output
def genrule2(out, cmd, **kwargs):
cmd = ' && '.join([
'ROOT=$$PWD',
'TMP=$$(mktemp -d)',
'(' + cmd + ')',
])
native.genrule(
cmd = cmd,
outs = [out],
**kwargs)

28
tools/bzl/gwt.bzl Normal file
View File

@ -0,0 +1,28 @@
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# GWT Rules Skylark rules for building [GWT](http://www.gwtproject.org/)
# modules using Bazel.
load('//tools/bzl:java.bzl', 'java_library2')
def gwt_module(gwt_xml=None, resources=[], srcs=[], **kwargs):
if gwt_xml:
resources += [gwt_xml]
if srcs:
resources += srcs
java_library2(
srcs = srcs,
resources = resources,
**kwargs)

25
tools/bzl/java.bzl Normal file
View File

@ -0,0 +1,25 @@
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Syntactic sugar for native java_library() rule:
# accept exported_deps attributes
def java_library2(deps=[], exported_deps=[], exports=[], **kwargs):
if exported_deps:
deps += exported_deps
exports += exported_deps
native.java_library(
deps = deps,
exports = exports,
**kwargs)

73
tools/bzl/junit.bzl Normal file
View File

@ -0,0 +1,73 @@
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Skylark rule to generate a Junit4 TestSuite
# Assumes srcs are all .java Test files
# Assumes junit4 is already added to deps by the user.
# See https://github.com/bazelbuild/bazel/issues/1017 for background.
_OUTPUT = """import org.junit.runners.Suite;
import org.junit.runner.RunWith;
@RunWith(Suite.class)
@Suite.SuiteClasses({%s})
public class %s {}
"""
_PREFIXES = ("org", "com", "edu")
def _SafeIndex(l, val):
for i, v in enumerate(l):
if val == v:
return i
return -1
def _AsClassName(fname):
fname = [x.path for x in fname.files][0]
toks = fname[:-5].split("/")
findex = -1
for s in _PREFIXES:
findex = _SafeIndex(toks, s)
if findex != -1:
break
if findex == -1:
fail("%s does not contain any of %s",
fname, _PREFIXES)
return ".".join(toks[findex:]) + ".class"
def _impl(ctx):
classes = ",".join(
[_AsClassName(x) for x in ctx.attr.srcs])
ctx.file_action(output=ctx.outputs.out, content=_OUTPUT % (
classes, ctx.attr.outname))
_GenSuite = rule(
attrs = {
"srcs": attr.label_list(allow_files = True),
"outname": attr.string(),
},
outputs = {"out": "%{name}.java"},
implementation = _impl,
)
def junit_tests(name, srcs, **kwargs):
s_name = name + "TestSuite"
_GenSuite(name = s_name,
srcs = srcs,
outname = s_name)
native.java_test(name = name,
test_class = s_name,
srcs = srcs + [":"+s_name],
**kwargs)

35
tools/bzl/maven.bzl Normal file
View File

@ -0,0 +1,35 @@
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Merge maven files
def cmd(jars):
return ('$(location //tools:merge_jars) $@ '
+ ' '.join(['$(location %s)' % j for j in jars]))
def merge_maven_jars(
name,
srcs,
visibility = []):
native.genrule(
name = '%s__merged_bin' % name,
cmd = cmd(srcs),
tools = srcs + ['//tools:merge_jars'],
outs = ['%s__merged.jar' % name],
)
native.java_import(
name = name,
jars = [':%s__merged_bin' % name],
visibility = visibility,
)