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
  • Merge requests
  • !478

Include PrebuiltJar in transitive deps to allow running inside inttelij

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/strangemonad/shawn/prebuild_jar_deps into master Oct 24, 2015
  • Overview 10
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: strangemonad

NOTE: this is just a sketch of the fix but has issues. There are no tests and the generated IJModule includes the transitive jars (IjLibraries) as compile time dependencies rather than runtime dependencies. I've tested that this allows running main() and junit tests from inside Ij on a moderate size personal project (~70 buck targets, ~140 mvn dependencies, ~60k lines of .java excluding comments and 1k lines of .proto)

Summary: The classpath Ij generates when trying to run a module is incorrect because the IjModule doesn't include runtime dependencies of the libraries it depends on.

Prebuilt jars are often not fat (shaded) jars. The build targets listed in the 'deps' option of the 'prebuilt_jar' must be jars included on the runtime classpath. For example, imagine a java_app 'myapp' that depends on jetcd (https://github.com/justinsb/jetcd) a java / netty client for etcd. The jar might look something like:

    prebuilt_jar(
      name = 'jetcd',
      deps = [
        '//lib:jackson-core',
        '//lib:jackson-databind',
        '//lib:netty-all',
        '//lib:slf4j-api',
      ],
      binary_jar = ':jetcd_lib',
      visibility = ['PUBLIC'],
    )

Both buck run and buck audit classpath produce the correct result, including jackson, netty and slf4j on the classpath.

Bug: ExportedDepsClosureResolver#getExportedDepsClosure called by IjModuleGraph.from doesn't handle the PrebuildJar node type.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/strangemonad/shawn/prebuild_jar_deps