Merge "Bazel: add support for unsigning jar files"

This commit is contained in:
David Pursehouse 2016-09-23 13:54:33 +00:00 committed by Gerrit Code Review
commit 68f897e8df
4 changed files with 43 additions and 3 deletions

View File

@ -1,6 +1,14 @@
load('//tools/bzl:unsign.bzl', 'unsign_jars')
java_library(
name = 'jgit-servlet',
name = 'jgit-servlet-signed',
exports = ['@jgit_servlet//jar'],
runtime_deps = ['//lib/jgit/org.eclipse.jgit:jgit'],
visibility = ['//visibility:public'],
)
unsign_jars(
name = 'jgit-servlet',
deps = [':jgit-servlet-signed'],
visibility = ['//visibility:public'],
)

View File

@ -1,6 +1,14 @@
load('//tools/bzl:unsign.bzl', 'unsign_jars')
java_library(
name = 'junit',
name = 'junit-signed',
exports = ['@jgit_junit//jar'],
runtime_deps = ['//lib/jgit/org.eclipse.jgit:jgit'],
visibility = ['//visibility:public'],
)
unsign_jars(
name = 'junit',
deps = [':junit-signed'],
visibility = ['//visibility:public'],
)

View File

@ -1,5 +1,7 @@
load('//tools/bzl:unsign.bzl', 'unsign_jars')
java_library(
name = 'jgit',
name = 'jgit-signed',
exports = ['@jgit//jar'],
runtime_deps = [':ewah'],
visibility = ['//visibility:public'],
@ -10,3 +12,9 @@ java_library(
exports = ['@ewah//jar'],
visibility = ['//visibility:public'],
)
unsign_jars(
name = 'jgit',
deps = [':jgit-signed'],
visibility = ['//visibility:public'],
)

16
tools/bzl/unsign.bzl Normal file
View File

@ -0,0 +1,16 @@
def unsign_jars(name, deps, **kwargs):
"""unsign_jars collects its dependencies into a single java_import.
As a side effect, the signature is removed.
"""
native.java_binary(
name = name + '-unsigned-binary',
runtime_deps = deps,
main_class = 'dummy'
)
native.java_import(
name = name,
jars = [ name + '-unsigned-binary_deploy.jar' ],
**kwargs)