java_library: provide a way to specify non transitive dependencies
Created by: davido
When building a plugin (P) for an existing system (S) which exposes an API in form of library (A) the following idiom is used:
P depends on A but java_binary P must not contain the content of A. That's because P is deployed in S and all artifacts from A are obviously exist.
Currently it is not possible to express that idiom with Buck's native java_library.
Sugestion: extend java_library with new parameter: compiled_deps.
Alternatively provide a new finction java_library2 that exposes that parameter.
Working use case: java_library2()
that exposes compile_deps parameter in:
https://github.com/davido/gerrit-reviewers-plugin/blob/master/lib/build.defs
To see the difference between call to java_library2 and java_library try to replace it on line 61: in gerrit_plugin()
definition:
java_library( name = name + '__plugin', srcs = srcs, resources = resources, deps = deps + ['//:%s-lib' % type], )
With the outcome that reviewers.jar would contain the whole gerrit-plugin-api.jar and not only 4 classes it adds.