Skip to content

Diagnose missing target errors #265

@timbertson

Description

@timbertson

I've been converting a few of my own libraries to use jbuilder. It's gone fairly well so far, so thanks :) (and sorry for the influx of issues, I'll quiet down soon I promise ;))

But a number of times I've hit a wall when jbuilder says "nope", but I can't find a way to get more information about what it tried or why it couldn't do what I asked. Here's an example:

$ jbuilder build _build/default/examples/todomvc/main.bc.js
Don't know how to build _build/default/examples/todomvc/main.bc.js

Well.. there should be a build target there. In these sorts of cases I'd love some flags which enable logging about:

  • what jbuild files it's loading
  • what targets are defined in the given directory
  • if I'm getting really desperate, what targets are defined in the entire workspace

In this case, the only troubleshooting I could do was:

  • ls examples/todomvc/main.ml (yep, it's there)
  • cat examples/todomvc/jbuild (yep, it defines an executable called "main")

At which point I'm pretty much out of ideas.

In the end, I figured out that I had created a bad jbuild-workspace - it was empty (which is documented as equivalent to (context default), but maybe that's not implemented in beta12?). I expect doing any sort of dump of "which targets are defined" would have more quickly pointed to a project-wide issue, as it would have been empty.

I eventually figured it out by trying other targets which had previously worked, and they could no longer be found. This process wasn't obvious either though, since top-level targets still seemed to kind of work (until I did a clean, then they became suspicious):

  • jbuilder build vdoml.install - successfully built the install file, but didn't build any of the files it depends on
  • jbuilder build @install - didn't appear to build anything (but didn't fail either)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issueGood for contributing for the first time to the Dune codebase

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions