Problem with consuming cross-cell dependencies
Created by: davido
When replacing a cell with command line config option, dependencies are not seen in primary cell:
$ buck build --config repositories.jgit=../jgit gerrit-pgm:http
com/google/gerrit/pgm/http/jetty/JettyServer.java:58: error:
package org.eclipse.jgit.lib does not exist
import org.eclipse.jgit.lib.Config;
This is strange, as the dependency is set correctly and is wokring, when internal jgit cell (inside gerrit) is used, without routing the jgit cell through standalone JGit development tree:
$ buck targets --json gerrit-pgm:http
[+] PROCESSING BUCK FILES...0,6s
[
{
"annotationProcessorDeps" : [ ],
"annotationProcessorOnly" : null,
"annotationProcessorParams" : [ ],
"annotationProcessors" : [ ],
"buck.base_path" : "gerrit-pgm",
"buck.direct_dependencies" : [ "//:jgit", "//gerrit-common:server", "//gerrit-extension-api:api", "//gerrit-gwtexpui:linker_server", "//gerrit-gwtexpui:server", "//gerrit-httpd:httpd", "//gerrit-reviewdb:server", "//gerrit-server:server", "//gerrit-sshd:sshd", "//lib:guava", "//lib/guice:guice", "//lib/guice:guice-assistedinject", "//lib/guice:guice-servlet", "//lib/jetty:jmx", "//lib/jetty:server", "//lib/jetty:servlet", "//lib/log:api", "//lib/log:jsonevent-layout", "//lib/log:log4j", "//gerrit-pgm:http-jetty" ],
"buck.type" : "java_library",
"compiler" : null,
"deps" : [ "//gerrit-common:server", "//gerrit-extension-api:api", "//gerrit-gwtexpui:linker_server", "//gerrit-gwtexpui:server", "//gerrit-httpd:httpd", "//gerrit-server:server", "//gerrit-sshd:sshd", "//lib:guava", "//lib/guice:guice", "//lib/guice:guice-assistedinject", "//lib/guice:guice-servlet", "//lib/log:api", "//lib/log:log4j", "@jgit//:jgit", "//gerrit-reviewdb:server", "//lib/log:jsonevent-layout", "//lib/jetty:jmx", "//lib/jetty:server", "//lib/jetty:servlet" ],
"exportedDeps" : [ ":http-jetty" ],
"extraArguments" : [ "-encoding", "UTF-8" ],
"javaVersion" : null,
"javac" : null,
"javacJar" : null,
"mavenCoords" : null,
"name" : "http",
"postprocessClassesCommands" : [ ],
"proguardConfig" : null,
"providedDeps" : [ ],
"resources" : [ ],
"resourcesRoot" : null,
"source" : null,
"srcs" : [ ],
"target" : null,
"tests" : [ ],
"visibility" : [ "//gerrit-war:" ]
}
]
Note, that //:jgit is java_library()
in JGit cell:
java_library(
name = 'jgit',
exported_deps = ['//org.eclipse.jgit:jgit'],
visibility = ['PUBLIC'],
)
And the actual build implementation is in jgit cell in org.eclipse.jgit/BUCK
:
SRCS = glob(['src/**'])
RESOURCES = glob(['resources/**'])
java_library(
name = 'jgit',
srcs = SRCS,
resources = RESOURCES,
deps = [
'//lib:javaewah',
'//lib:jsch',
'//lib:httpcomponents',
'//lib:slf4j-api',
],
visibility = ['PUBLIC'],
)
To reproduce, fetch JGit Buck build implementation: [1] and Gerrit cross-cell support patch for JGit: [2], and issue:
$ cd gerrit
$ buck build gerrit-pgm:http
[-] PROCESSING BUCK FILES...FINISHED 0,2s [100%]
$ buck build --config repositories.jgit=../jgit gerrit-pgm:http
<error: jgit content from secondary cell is not available>
[1] https://git.eclipse.org/r/61938 [2] https://gerrit-review.googlesource.com/73000