Bazel: Build core plugins
Change-Id: Ic8ed6fcdb8cdab9cb7eaba436c5fdffc6670d1b4
This commit is contained in:
		@@ -6,7 +6,6 @@ Bazel build is experimental. Major missing parts:
 | 
			
		||||
* Documentation index
 | 
			
		||||
* License tracking
 | 
			
		||||
* Version stamping
 | 
			
		||||
* Core plugins
 | 
			
		||||
* Custom plugins
 | 
			
		||||
* Eclipse project generation.
 | 
			
		||||
* Publishing to maven.
 | 
			
		||||
 
 | 
			
		||||
@@ -784,3 +784,9 @@ maven_jar(
 | 
			
		||||
  artifact = 'org.webjars:google-diff-match-patch:20121119-1',
 | 
			
		||||
  sha1 = '0cf1782dbcb8359d95070da9176059a5a9d37709',
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
maven_jar(
 | 
			
		||||
  name = 'commons_io',
 | 
			
		||||
  artifact = 'commons-io:commons-io:1.4',
 | 
			
		||||
  sha1 = 'a8762d07e76cfde2395257a5da47ba7c1dbd3dce',
 | 
			
		||||
)
 | 
			
		||||
 
 | 
			
		||||
@@ -11,6 +11,45 @@ PLUGIN_API = [
 | 
			
		||||
  '//gerrit-sshd:sshd',
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
EXPORTS = [
 | 
			
		||||
  '//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/commons:lang',
 | 
			
		||||
  '//lib/dropwizard:dropwizard-core',
 | 
			
		||||
  '//lib/guice:guice',
 | 
			
		||||
  '//lib/guice:guice-assistedinject',
 | 
			
		||||
  '//lib/guice:guice-servlet',
 | 
			
		||||
  '//lib/guice:javax-inject',
 | 
			
		||||
  '//lib/guice:multibindings',
 | 
			
		||||
  '//lib/jgit/org.eclipse.jgit.http.server:jgit-servlet',
 | 
			
		||||
  '//lib/jgit/org.eclipse.jgit:jgit',
 | 
			
		||||
  '//lib/joda:joda-time',
 | 
			
		||||
  '//lib/log:api',
 | 
			
		||||
  '//lib/log:log4j',
 | 
			
		||||
  '//lib/mina:sshd',
 | 
			
		||||
  '//lib/ow2:ow2-asm',
 | 
			
		||||
  '//lib/ow2:ow2-asm-analysis',
 | 
			
		||||
  '//lib/ow2:ow2-asm-commons',
 | 
			
		||||
  '//lib/ow2:ow2-asm-util',
 | 
			
		||||
  '//lib:args4j',
 | 
			
		||||
  '//lib:blame-cache',
 | 
			
		||||
  '//lib:guava',
 | 
			
		||||
  '//lib:gson',
 | 
			
		||||
  '//lib:gwtorm',
 | 
			
		||||
  '//lib:icu4j',
 | 
			
		||||
  '//lib:jsch',
 | 
			
		||||
  '//lib:mime-util',
 | 
			
		||||
  '//lib:protobuf',
 | 
			
		||||
  '//lib:servlet-api-3_1',
 | 
			
		||||
  '//lib:soy',
 | 
			
		||||
  '//lib:velocity',
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
java_binary(
 | 
			
		||||
  name = 'plugin-api',
 | 
			
		||||
  main_class = 'Dummy',
 | 
			
		||||
@@ -20,42 +59,14 @@ java_binary(
 | 
			
		||||
 | 
			
		||||
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/commons:lang',
 | 
			
		||||
    '//lib/dropwizard:dropwizard-core',
 | 
			
		||||
    '//lib/guice:guice',
 | 
			
		||||
    '//lib/guice:guice-assistedinject',
 | 
			
		||||
    '//lib/guice:guice-servlet',
 | 
			
		||||
    '//lib/guice:javax-inject',
 | 
			
		||||
    '//lib/guice:multibindings',
 | 
			
		||||
    '//lib/jgit/org.eclipse.jgit.http.server:jgit-servlet',
 | 
			
		||||
    '//lib/jgit/org.eclipse.jgit:jgit',
 | 
			
		||||
    '//lib/joda:joda-time',
 | 
			
		||||
    '//lib/log:api',
 | 
			
		||||
    '//lib/mina:sshd',
 | 
			
		||||
    '//lib/ow2:ow2-asm',
 | 
			
		||||
    '//lib/ow2:ow2-asm-analysis',
 | 
			
		||||
    '//lib/ow2:ow2-asm-commons',
 | 
			
		||||
    '//lib/ow2:ow2-asm-util',
 | 
			
		||||
    '//lib:args4j',
 | 
			
		||||
    '//lib:blame-cache',
 | 
			
		||||
    '//lib:guava',
 | 
			
		||||
    '//lib:gwtorm',
 | 
			
		||||
    '//lib:icu4j',
 | 
			
		||||
    '//lib:jsch',
 | 
			
		||||
    '//lib:mime-util',
 | 
			
		||||
    '//lib:protobuf',
 | 
			
		||||
    '//lib:servlet-api-3_1',
 | 
			
		||||
    '//lib:soy',
 | 
			
		||||
    '//lib:velocity',
 | 
			
		||||
  ],
 | 
			
		||||
  exports = PLUGIN_API + EXPORTS,
 | 
			
		||||
  visibility = ['//visibility:public'],
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
java_library(
 | 
			
		||||
  name = 'lib-neverlink',
 | 
			
		||||
  neverlink = 1,
 | 
			
		||||
  exports = PLUGIN_API + EXPORTS,
 | 
			
		||||
  visibility = ['//visibility:public'],
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -243,3 +243,9 @@ java_library(
 | 
			
		||||
  exports = ['@postgresql//jar'],
 | 
			
		||||
  visibility = ['//visibility:public'],
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
java_library(
 | 
			
		||||
  name = 'commons-io',
 | 
			
		||||
  exports = ['@commons_io//jar'],
 | 
			
		||||
  visibility = ['//visibility:public'],
 | 
			
		||||
)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										34
									
								
								tools/bzl/plugin.bzl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								tools/bzl/plugin.bzl
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
 | 
			
		||||
def gerrit_plugin(
 | 
			
		||||
    name,
 | 
			
		||||
    deps = [],
 | 
			
		||||
    srcs = [],
 | 
			
		||||
    resources = [],
 | 
			
		||||
    manifest_entries = []):
 | 
			
		||||
  # TODO(davido): Fix stamping: run git describe in plugin directory
 | 
			
		||||
  # https://github.com/bazelbuild/bazel/issues/1758
 | 
			
		||||
  manifest_lines = [
 | 
			
		||||
    "Gerrit-ApiType: plugin",
 | 
			
		||||
    "Implementation-Version: 1.0",
 | 
			
		||||
    "Implementation-Vendor: Gerrit Code Review",
 | 
			
		||||
  ]
 | 
			
		||||
  for line in manifest_entries:
 | 
			
		||||
    manifest_lines.append(line.replace('$', '\$'))
 | 
			
		||||
 | 
			
		||||
  native.java_library(
 | 
			
		||||
    name = name + '__plugin',
 | 
			
		||||
    srcs = srcs,
 | 
			
		||||
    resources = resources,
 | 
			
		||||
    deps = deps + ['//gerrit-plugin-api:lib-neverlink'],
 | 
			
		||||
    visibility = ['//visibility:public'],
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
  native.java_binary(
 | 
			
		||||
    name = name,
 | 
			
		||||
    deploy_manifest_lines = manifest_lines,
 | 
			
		||||
    main_class = 'Dummy',
 | 
			
		||||
    runtime_deps = [
 | 
			
		||||
      ':%s__plugin' % name,
 | 
			
		||||
    ],
 | 
			
		||||
    visibility = ['//visibility:public'],
 | 
			
		||||
  )
 | 
			
		||||
		Reference in New Issue
	
	Block a user