gerrit/gerrit-acceptance-framework/BUCK
David Ostrovsky 29f95395d5 Plugin API: Provide custom manifest file
If no manifest file is specified, Buck's java_binary() rule merges the
content of manifest files from the dependant JARs into output
META/MANIFEST.MF. Normally we wouldn't care that it ends up with a lot
of mess, but unfortunately, it breaks the plugin-api.jar, with sealed
package exception, so we do care.

This happens because we provide the same package in multiple JARs, e.g.

  com.gerrit.server.project

is shipped with plugin-api.jar, obviously, but it happens that one file
Util.class, from the same package is shipped in the

  gerrit-acceptance-framework.jar

artifact. Normally it doesn't matter, unless a JAR is defined as sealed
in which case security violation exception is thrown during unit tests
execution.

To rectify this, we use the combination of custom manifest_file
attribute of java_binary() rule and passing non documented option from
this issue: [1] to ask Buck to not merge manifest files from the
dependant JARs.

With this fix, plugin unit tests executions in standalone build mode
work again.

* [1] https://github.com/facebook/buck/issues/86

Change-Id: I7b7571c20dcf6b54210b73760eccc8e699e6f1f6
2016-08-22 03:15:05 +00:00

103 lines
2.5 KiB
Python

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',
merge_manifests = False,
manifest_file = ':manifest',
deps = [':lib'],
visibility = ['PUBLIC'],
)
genrule(
name = 'manifest',
cmd = 'echo "Manifest-Version: 1.0" >$OUT;' +
'echo "Implementation-Title: Gerrit Acceptance Test Framework" >>$OUT;' +
'echo "Implementation-Vendor: Gerrit Code Review Project" >>$OUT',
out = 'manifest.txt',
)
java_library(
name = 'lib',
srcs = SRCS,
exported_deps = DEPS + [
'//lib:truth',
],
provided_deps = PROVIDED + [
'//lib:gwtorm',
'//lib/guice:guice',
'//lib/guice:guice-assistedinject',
'//lib/guice:guice-servlet',
],
visibility = ['PUBLIC'],
)
java_sources(
name = 'src',
srcs = SRCS,
visibility = ['PUBLIC'],
)
# The above java_sources produces a .jar somewhere in the depths of
# buck-out, but it does not bring it to
# buck-out/gen/gerrit-acceptance-framework/gerrit-acceptance-framework-src.jar.
# We fix that by the following java_binary.
java_binary(
name = 'acceptance-framework-src',
deps = [ ':src' ],
visibility = ['PUBLIC'],
)
java_doc(
name = 'acceptance-framework-javadoc',
title = 'Gerrit Acceptance Test Framework Documentation',
pkgs = [' com.google.gerrit.acceptance'],
paths = ['src/test/java'],
srcs = SRCS,
deps = DEPS + PROVIDED + [
'//lib:guava',
'//lib/guice:guice-assistedinject',
'//lib/guice:guice_library',
'//lib/guice:guice-servlet',
'//lib/guice:javax-inject',
'//lib:gwtorm_client',
'//lib:junit',
'//lib:truth',
],
visibility = ['PUBLIC'],
)