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:
		
							
								
								
									
										85
									
								
								BUCK
									
									
									
									
									
								
							
							
						
						
									
										85
									
								
								BUCK
									
									
									
									
									
								
							| @@ -7,12 +7,15 @@ gerrit_war(name = 'withdocs', docs = True) | |||||||
| gerrit_war(name = 'release',  docs = True, context = ['//plugins:core.zip']) | gerrit_war(name = 'release',  docs = True, context = ['//plugins:core.zip']) | ||||||
|  |  | ||||||
| API_DEPS = [ | API_DEPS = [ | ||||||
|   ':extension-api', |   '//gerrit-extension-api:extension-api', | ||||||
|   ':extension-api-src', |   '//gerrit-extension-api:extension-api-src', | ||||||
|   ':plugin-api', |   '//gerrit-extension-api:extension-api-javadoc', | ||||||
|   ':plugin-api-src', |   '//gerrit-plugin-api:plugin-api', | ||||||
|   ':plugin-gwtui', |   '//gerrit-plugin-api:plugin-api-src', | ||||||
|   ':plugin-gwtui-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( | genrule( | ||||||
| @@ -24,73 +27,3 @@ genrule( | |||||||
|   deps = API_DEPS, |   deps = API_DEPS, | ||||||
|   out = 'api.zip', |   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:'], |  | ||||||
| ) |  | ||||||
|   | |||||||
| @@ -1,4 +1,5 @@ | |||||||
| SRC = 'src/main/java/com/google/gerrit/extensions/' | SRC = 'src/main/java/com/google/gerrit/extensions/' | ||||||
|  | SRCS = glob([SRC + '**/*.java']) | ||||||
|  |  | ||||||
| gwt_module( | gwt_module( | ||||||
|   name = 'client', |   name = 'client', | ||||||
| @@ -7,6 +8,24 @@ gwt_module( | |||||||
|   visibility = ['PUBLIC'], |   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( | java_library2( | ||||||
|   name = 'api', |   name = 'api', | ||||||
|   srcs = glob([SRC + '**/*.java']), |   srcs = glob([SRC + '**/*.java']), | ||||||
| @@ -15,7 +34,20 @@ java_library2( | |||||||
| ) | ) | ||||||
|  |  | ||||||
| java_sources( | java_sources( | ||||||
|   name = 'api-src', |   name = 'extension-api-src', | ||||||
|   srcs = glob([SRC + '**/*.java']), |   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'], |   visibility = ['PUBLIC'], | ||||||
| ) | ) | ||||||
|   | |||||||
							
								
								
									
										47
									
								
								gerrit-plugin-api/BUCK
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								gerrit-plugin-api/BUCK
									
									
									
									
									
										Normal 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'], | ||||||
|  | ) | ||||||
| @@ -1,20 +1,33 @@ | |||||||
| SRC = 'src/main/java/com/google/gerrit/' | SRC = 'src/main/java/com/google/gerrit/' | ||||||
|  | SRCS = glob([SRC + '**/*.java']) | ||||||
|  |  | ||||||
| gwt_module( | DEPS = [ | ||||||
|   name = 'client', |  | ||||||
|   srcs = glob([SRC + '**/*.java']), |  | ||||||
|   gwtxml = SRC + 'Plugin.gwt.xml', |  | ||||||
|   resources = glob(['src/main/resources/**/*']), |  | ||||||
|   deps = [ |  | ||||||
|   '//lib/gwt:user', |   '//lib/gwt:user', | ||||||
|   '//lib/gwt:dev', |   '//lib/gwt:dev', | ||||||
|   ], | ] | ||||||
|  |  | ||||||
|  | gwt_module( | ||||||
|  |   name = 'gwtui-api', | ||||||
|  |   srcs = SRCS, | ||||||
|  |   gwtxml = SRC + 'Plugin.gwt.xml', | ||||||
|  |   resources = glob(['src/main/resources/**/*']), | ||||||
|  |   deps = DEPS, | ||||||
|   visibility = ['PUBLIC'], |   visibility = ['PUBLIC'], | ||||||
| ) | ) | ||||||
|  |  | ||||||
| java_library( | java_library( | ||||||
|   name = 'src', |   name = 'gwtui-api-src', | ||||||
|   srcs = [], |   srcs = [], | ||||||
|   resources = glob(['src/main/**/*']), |   resources = glob(['src/main/**/*']), | ||||||
|   visibility = ['PUBLIC'], |   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'], | ||||||
|  | ) | ||||||
|   | |||||||
| @@ -58,7 +58,7 @@ maven_jar( | |||||||
|     'javax/annotation/WillCloseWhenClosed.java', |     'javax/annotation/WillCloseWhenClosed.java', | ||||||
|     'javax/annotation/WillNotClose.java', |     'javax/annotation/WillNotClose.java', | ||||||
|   ], |   ], | ||||||
|   visibility = [], |   visibility = ['PUBLIC'], | ||||||
| ) | ) | ||||||
|  |  | ||||||
| maven_jar( | maven_jar( | ||||||
| @@ -92,5 +92,5 @@ maven_jar( | |||||||
|   id = 'javax.inject:javax.inject:1', |   id = 'javax.inject:javax.inject:1', | ||||||
|   sha1 = '6975da39a7040257bd51d21a231b76c915872d38', |   sha1 = '6975da39a7040257bd51d21a231b76c915872d38', | ||||||
|   license = 'Apache2.0', |   license = 'Apache2.0', | ||||||
|   visibility = ['//lib/guice:guice'], |   visibility = ['PUBLIC'], | ||||||
| ) | ) | ||||||
|   | |||||||
| @@ -206,3 +206,36 @@ def java_sources( | |||||||
|     resources = srcs, |     resources = srcs, | ||||||
|     visibility = visibility, |     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, | ||||||
|  | ) | ||||||
|   | |||||||
| @@ -8,14 +8,19 @@ maven_package( | |||||||
|   url = 's3://gerrit-api@commondatastorage.googleapis.com/%s' % TYPE, |   url = 's3://gerrit-api@commondatastorage.googleapis.com/%s' % TYPE, | ||||||
|   version = GERRIT_VERSION, |   version = GERRIT_VERSION, | ||||||
|   jar = { |   jar = { | ||||||
|     'gerrit-extension-api': '//:extension-api', |     'gerrit-extension-api': '//gerrit-extension-api:extension-api', | ||||||
|     'gerrit-plugin-api': '//:plugin-api', |     'gerrit-plugin-api': '//gerrit-plugin-api:plugin-api', | ||||||
|     'gerrit-plugin-gwtui': '//:plugin-gwtui', |     'gerrit-plugin-gwtui': '//gerrit-plugin-gwtui:gwtui-api', | ||||||
|   }, |   }, | ||||||
|   src = { |   src = { | ||||||
|     'gerrit-extension-api': '//:extension-api-src', |     'gerrit-extension-api': '//gerrit-extension-api:extension-api-src', | ||||||
|     'gerrit-plugin-api': '//:plugin-api-src', |     'gerrit-plugin-api': '//gerrit-plugin-api:plugin-api-src', | ||||||
|     'gerrit-plugin-gwtui': '//:plugin-gwtui-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', | ||||||
|   }, |   }, | ||||||
| ) | ) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -17,11 +17,12 @@ def maven_package( | |||||||
|     repository = None, |     repository = None, | ||||||
|     url = None, |     url = None, | ||||||
|     jar = {}, |     jar = {}, | ||||||
|     src = {}): |     src = {}, | ||||||
|  |     doc = {}): | ||||||
|   cmd = ['$(exe //tools/maven:mvn)', '-v', version, '-o', '$OUT'] |   cmd = ['$(exe //tools/maven:mvn)', '-v', version, '-o', '$OUT'] | ||||||
|   dep = [] |   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(): |     for a,t in d.iteritems(): | ||||||
|       cmd.append('-s %s:%s:$(location %s)' % (a,type,t)) |       cmd.append('-s %s:%s:$(location %s)' % (a,type,t)) | ||||||
|       dep.append(t) |       dep.append(t) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 David Ostrovsky
					David Ostrovsky