Buck: generate javadocs for plugin and extension API

buck build api

generates now javadocs.

  buck build api_install

installs all plugin/extension related artifacts with javadocs in the
local Maven repository.

Change-Id: Ifa6a8eb469f388e16449576ff2bff01a5dce67dd
This commit is contained in:
David Ostrovsky 2013-11-23 22:28:05 +01:00
parent ca80447775
commit bb360ebe06
8 changed files with 159 additions and 95 deletions

85
BUCK
View File

@ -7,12 +7,15 @@ gerrit_war(name = 'withdocs', docs = True)
gerrit_war(name = 'release', docs = True, context = ['//plugins:core.zip'])
API_DEPS = [
':extension-api',
':extension-api-src',
':plugin-api',
':plugin-api-src',
':plugin-gwtui',
':plugin-gwtui-src',
'//gerrit-extension-api:extension-api',
'//gerrit-extension-api:extension-api-src',
'//gerrit-extension-api:extension-api-javadoc',
'//gerrit-plugin-api:plugin-api',
'//gerrit-plugin-api:plugin-api-src',
'//gerrit-plugin-api:plugin-api-javadoc',
'//gerrit-plugin-gwtui:gwtui-api',
'//gerrit-plugin-gwtui:gwtui-api-src',
'//gerrit-plugin-gwtui:gwtui-api-javadoc',
]
genrule(
@ -24,73 +27,3 @@ genrule(
deps = API_DEPS,
out = 'api.zip',
)
java_binary(
name = 'extension-api',
deps = [':extension-lib'],
visibility = ['//tools/maven:'],
)
java_library(
name = 'extension-lib',
deps = [
'//gerrit-extension-api:api',
'//lib/guice:guice',
'//lib/guice:guice-servlet',
'//lib:servlet-api-3_0',
],
export_deps = True,
visibility = ['PUBLIC'],
)
genrule(
name = 'extension-api-src',
cmd = 'ln -s $(location //gerrit-extension-api:api-src) $OUT',
deps = ['//gerrit-extension-api:api-src'],
out = 'extension-api-src.jar',
visibility = ['//tools/maven:'],
)
PLUGIN_API = [
'//gerrit-server:server',
'//gerrit-pgm:init-api',
'//gerrit-sshd:sshd',
'//gerrit-httpd:httpd',
]
java_binary(
name = 'plugin-api',
deps = [':plugin-lib'],
visibility = ['//tools/maven:'],
)
java_library(
name = 'plugin-lib',
deps = PLUGIN_API + ['//lib:servlet-api-3_0'],
export_deps = True,
visibility = ['PUBLIC'],
)
java_binary(
name = 'plugin-api-src',
deps = [
'//gerrit-extension-api:api-src',
] + [d + '-src' for d in PLUGIN_API],
visibility = ['//tools/maven:'],
)
genrule(
name = 'plugin-gwtui',
cmd = 'ln -s $(location //gerrit-plugin-gwtui:client) $OUT',
deps = ['//gerrit-plugin-gwtui:client'],
out = 'plugin-gwtui.jar',
visibility = ['//tools/maven:'],
)
genrule(
name = 'plugin-gwtui-src',
cmd = 'ln -s $(location //gerrit-plugin-gwtui:src) $OUT',
deps = ['//gerrit-plugin-gwtui:src'],
out = 'plugin-gwtui-src.jar',
visibility = ['//tools/maven:'],
)

View File

@ -1,4 +1,5 @@
SRC = 'src/main/java/com/google/gerrit/extensions/'
SRCS = glob([SRC + '**/*.java'])
gwt_module(
name = 'client',
@ -7,6 +8,24 @@ gwt_module(
visibility = ['PUBLIC'],
)
java_binary(
name = 'extension-api',
deps = [':extension-lib'],
visibility = ['PUBLIC'],
)
java_library(
name = 'extension-lib',
deps = [
':api',
'//lib/guice:guice',
'//lib/guice:guice-servlet',
'//lib:servlet-api-3_0',
],
export_deps = True,
visibility = [],
)
java_library2(
name = 'api',
srcs = glob([SRC + '**/*.java']),
@ -15,7 +34,20 @@ java_library2(
)
java_sources(
name = 'api-src',
srcs = glob([SRC + '**/*.java']),
name = 'extension-api-src',
srcs = SRCS,
visibility = ['PUBLIC'],
)
java_doc(
name = 'extension-api-javadoc',
title = 'Gerrit Review Extension API Documentation',
pkg = 'com.google.gerrit.extensions',
paths = ['$SRCDIR/src/main/java'],
srcs = SRCS,
deps = [
'//lib/guice:javax-inject',
'//lib/guice:guice_library'
],
visibility = ['PUBLIC'],
)

47
gerrit-plugin-api/BUCK Normal file
View File

@ -0,0 +1,47 @@
SRCS = [
'gerrit-server/src/main/java/',
'gerrit-httpd/src/main/java/',
'gerrit-sshd/src/main/java/'
]
PLUGIN_API = [
'//gerrit-server:server',
'//gerrit-pgm:init-api',
'//gerrit-sshd:sshd',
'//gerrit-httpd:httpd',
]
java_binary(
name = 'plugin-api',
deps = [':lib'],
visibility = ['PUBLIC'],
)
java_library(
name = 'lib',
deps = PLUGIN_API + ['//lib:servlet-api-3_0'],
export_deps = True,
visibility = [],
)
java_binary(
name = 'plugin-api-src',
deps = [
'//gerrit-extension-api:extension-api-src',
] + [d + '-src' for d in PLUGIN_API],
visibility = ['PUBLIC'],
)
java_doc(
name = 'plugin-api-javadoc',
title = 'Gerrit Review Plugin API Documentation',
pkg = 'com.google.gerrit',
paths = [n for n in SRCS],
srcs = glob([n + '**/*.java' for n in SRCS]),
deps = [
':plugin-api',
'//lib/bouncycastle:bcprov',
'//lib/bouncycastle:bcpg',
],
visibility = ['PUBLIC'],
)

View File

@ -1,20 +1,33 @@
SRC = 'src/main/java/com/google/gerrit/'
SRCS = glob([SRC + '**/*.java'])
DEPS = [
'//lib/gwt:user',
'//lib/gwt:dev',
]
gwt_module(
name = 'client',
srcs = glob([SRC + '**/*.java']),
name = 'gwtui-api',
srcs = SRCS,
gwtxml = SRC + 'Plugin.gwt.xml',
resources = glob(['src/main/resources/**/*']),
deps = [
'//lib/gwt:user',
'//lib/gwt:dev',
],
deps = DEPS,
visibility = ['PUBLIC'],
)
java_library(
name = 'src',
name = 'gwtui-api-src',
srcs = [],
resources = glob(['src/main/**/*']),
visibility = ['PUBLIC'],
)
java_doc(
name = 'gwtui-api-javadoc',
title = 'Gerrit Review GWT Extension API Documentation',
pkg = 'com.google.gerrit.plugin',
paths = ['$SRCDIR/src/main/java'],
srcs = SRCS,
deps = DEPS,
visibility = ['PUBLIC'],
)

View File

@ -58,7 +58,7 @@ maven_jar(
'javax/annotation/WillCloseWhenClosed.java',
'javax/annotation/WillNotClose.java',
],
visibility = [],
visibility = ['PUBLIC'],
)
maven_jar(
@ -92,5 +92,5 @@ maven_jar(
id = 'javax.inject:javax.inject:1',
sha1 = '6975da39a7040257bd51d21a231b76c915872d38',
license = 'Apache2.0',
visibility = ['//lib/guice:guice'],
visibility = ['PUBLIC'],
)

View File

@ -206,3 +206,36 @@ def java_sources(
resources = srcs,
visibility = visibility,
)
def java_doc(
name,
title,
pkg,
paths,
srcs = [],
deps = [],
visibility = []
):
genrule(
name = name,
cmd = ' '.join([
'javadoc',
'-quiet',
'-protected',
'-encoding UTF-8',
'-charset UTF-8',
'-notimestamp',
'-windowtitle "' + title + '"',
'-link http://docs.oracle.com/javase/7/docs/api',
'-subpackages ' + pkg,
'-sourcepath ',
':'.join([n for n in paths]),
' -classpath ',
':'.join(['$(location %s)' % n for n in deps]),
'-d $TMP',
]) + ';jar cf $OUT -C $TMP .',
srcs = srcs,
deps = deps,
out = name + '.jar',
visibility = visibility,
)

View File

@ -8,14 +8,19 @@ maven_package(
url = 's3://gerrit-api@commondatastorage.googleapis.com/%s' % TYPE,
version = GERRIT_VERSION,
jar = {
'gerrit-extension-api': '//:extension-api',
'gerrit-plugin-api': '//:plugin-api',
'gerrit-plugin-gwtui': '//:plugin-gwtui',
'gerrit-extension-api': '//gerrit-extension-api:extension-api',
'gerrit-plugin-api': '//gerrit-plugin-api:plugin-api',
'gerrit-plugin-gwtui': '//gerrit-plugin-gwtui:gwtui-api',
},
src = {
'gerrit-extension-api': '//:extension-api-src',
'gerrit-plugin-api': '//:plugin-api-src',
'gerrit-plugin-gwtui': '//:plugin-gwtui-src',
'gerrit-extension-api': '//gerrit-extension-api:extension-api-src',
'gerrit-plugin-api': '//gerrit-plugin-api:plugin-api-src',
'gerrit-plugin-gwtui': '//gerrit-plugin-gwtui:gwtui-api-src',
},
doc = {
'gerrit-extension-api': '//gerrit-extension-api:extension-api-javadoc',
'gerrit-plugin-api': '//gerrit-plugin-api:plugin-api-javadoc',
'gerrit-plugin-gwtui': '//gerrit-plugin-gwtui:gwtui-api-javadoc',
},
)

View File

@ -17,11 +17,12 @@ def maven_package(
repository = None,
url = None,
jar = {},
src = {}):
src = {},
doc = {}):
cmd = ['$(exe //tools/maven:mvn)', '-v', version, '-o', '$OUT']
dep = []
for type,d in [('jar', jar), ('java-source', src)]:
for type,d in [('jar', jar), ('java-source', src), ('javadoc', doc)]:
for a,t in d.iteritems():
cmd.append('-s %s:%s:$(location %s)' % (a,type,t))
dep.append(t)