Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Cell name is lost in buck audit classpath --dot output #656

Closed
davido opened this issue Feb 15, 2016 · 2 comments
Closed

Cell name is lost in buck audit classpath --dot output #656

davido opened this issue Feb 15, 2016 · 2 comments

Comments

@davido
Copy link
Contributor

davido commented Feb 15, 2016

Am I right in assuming that buck audit classpath --dot output should be able to be used as input to Buck? At least it works like this until cell based targets are used. In this case the cell root is just omitted and the target is rellocated to the cell root.

Note, that the same command without --dot option produces the correct output file name for cell based rules.

Example:

[repositories]
  jgit = lib/jgit

Rule name in jgit cell, that is located under gerrit/lib/jgit:

maven_jar(
  name = 'jgit',
  id = 'org.eclipse.jgit:org.eclipse.jgit:' + VERS,
  bin_sha1 = 'a042910b86546a9d8f8aee745e5f8e80104e386d',
  src_sha1 = '3224099036bc3396f9ad611bc22f72fa1d126685',
  license = 'jgit',
  repository = REPO,
  unsign = True,
  deps = [':ewah'],
  exclude = [
    'META-INF/eclipse.inf',
    'about.html',
    'plugin.properties',
  ],
)

And is consumed by other rules as: @jgit//:jgit. So the output of buck audit is:

  $ buck audit classpath --dot //gerrit-common:server | grep jgit
  "//:jgit" -> "//:ewah";
  [...]

I would expect that the the cell name @JGit either preserved or replaced with its current location, so that it can be feed again to Buck:

  $ buck targets --json //:jgit
  com.facebook.buck.util.HumanReadableException: No rule found when resolving target //:jgit in build file ///BUCK

But:

   $ buck targets --json //lib/jgit:jgit
Using watchman.
[+] PROCESSING BUCK FILES...0.1s
[
{
  "binaryJar" : ":jgit__download_bin",
  "buck.base_path" : "lib/jgit",
  "buck.direct_dependencies" : [ "//lib:LICENSE-jgit", "//lib/jgit:ewah", "//lib/jgit:jgit__download_bin", "//lib/jgit:jgit__download_src" ],
  "buck.type" : "prebuilt_jar",
  "deps" : [ ":ewah", "//lib:LICENSE-jgit" ],
  "gwtJar" : null,
  "javadocUrl" : null,
  "mavenCoords" : null,
  "name" : "jgit",
  "sourceJar" : ":jgit__download_src",
  "visibility" : [ "PUBLIC" ]
}
]
lucamilanesio pushed a commit to GerritCodeReview/gerrit that referenced this issue Feb 16, 2016
Due to Buck bug: [1] root cell name is neither preserved nor resolved
in `buck audit classpath --dot` output and thus cannot be passed to
Buck again. Add a hack and help Buck for now until the bug is fixed.

* [1] facebook/buck#656

Change-Id: I5973c1c7d81e51ba882c1f10658237a4c8e6a642
@mkosiba
Copy link
Contributor

mkosiba commented Feb 19, 2016

Thanks for the detailed report!

The output of the --dot command is intended to be used by the graphviz tool or humans, not fed back into buck. Also, "surprise!" the --dot option does something different than the --json option (look at AuditClasspathCommand, if you pass in --dot it actually inspects the TargetGraph, not the ActionGraph).

The way we handle cells in the two graphs slightly differs but that does look a bit bogus. I don't think anyone will look at this any time soon though.

@davido
Copy link
Contributor Author

davido commented Feb 20, 2016

Thanks for the clarification. Have i got it right, that a diff fixing the output for the same option (--dot) would be accepted, that preserves the cell name?

lucamilanesio pushed a commit to GerritCodeReview/gerrit that referenced this issue Apr 20, 2016
Cross cell support in Buck is considered as experimental feature, with
number of open issues: [1], [2], [3].  Moreover, to make Maven Central
machinery work, it was needed to create symbolic links in source tree.
That broke `buck targets` feature.

Remove it for now, and re-consider to add it later.

[1] facebook/buck#656
[2] facebook/buck#658
[3] facebook/buck#717

Bug: Issue 3954
Change-Id: Ic621a07771f926001df181b46b2169e214ce208a
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants