Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B buck
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 201
    • Issues 201
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 22
    • Merge requests 22
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • buck
  • Issues
  • #594
Closed
Open
Issue created Jan 03, 2016 by Administrator@rootContributor

classpath macro resolution for dependent libraries is broken in cross-cell context

Created by: davido

Given the following cell definition:

[repositories]
  jgit = lib/jgit

The calsspath is correctly resolved with classpath macro:

genrule(
  name = 'dump_correct_classpath',
  cmd = 'echo $(classpath @jgit//:jgit) > $OUT',
  out = 'dump_correct_classpath.txt',
)

The content of the ouput file is correct:

$ cat buck-out/gen/tools/dump_correct_classpath/dump_correct_classpath.txt
/home/davido/projects/gerrit/lib/jgit/buck-out/gen/ewah.jar:/home/davido/projects/gerrit/lib/jgit/buck-out/gen/jgit.jar

The audit classpath command is correct as well. However, when the same cell library is used in transitive dependency, cell path is erroneously re-located to buck root context:

java_library(
  name = 'broken',
  srcs = [],
  deps = ['@jgit//:jgit'],
  visibility = ['PUBLIC']
)

genrule(
  name = 'dump_broken_deps_classpath',
  cmd = 'echo $(classpath :broken) > $OUT',
  out = 'dump_broken_deps_classpath.txt',
)

The output file contains now wrong, non-existing path:

$ cat buck-out/gen/tools/dump_broken_classpath/dump_broken_classpath.txt
/home/davido/projects/gerrit/buck-out/gen/ewah.jar:/home/davido/projects/gerrit/buck-out/gen/jgit.jar

Interestingly, the audit classpath command still reports the correct classpath:

$ buck audit classpath tools:broken
:::
::: '.nobuckcheck' file is present. Not updating buck.
:::
[+] PROCESSING BUCK FILES...0.1s
/home/davido/projects/gerrit/lib/jgit/buck-out/gen/ewah.jar
/home/davido/projects/gerrit/lib/jgit/buck-out/gen/jgit.jar

Note that, I'm using the most recent Buck version with this PR on top: [1].

  • [1] https://github.com/facebook/buck/pull/558
Assignee
Assign to
Time tracking