dbuenzli / topkg

The transitory OCaml software packager
http://erratique.ch/software/topkg
ISC License
69 stars 25 forks source link

Automatic support for jbuilder projects #123

Closed ghost closed 6 years ago

ghost commented 6 years ago

Pretty much all jbuilder projects use the same pkg/pkg.ml file, which is:

#use "topfind"
#require "topkg-jbuilder.auto"

Can topkg automatically use this configuration when it detects a jbuilder project and there is no pkg/pkg.ml? This will avoid having to write the same file everywhere.

dbuenzli commented 6 years ago

Can you give me a robust algorithm to detect a jbuilder project ?

ghost commented 6 years ago

Checking if the project contains at least one jbuild file.

dbuenzli commented 6 years ago

Isn't there something more evident ? Tools that start scanning your whole hard drive because you happen to invoke them at the wrong place are not very user friendly and I don't want topkg to be one of these.

ghost commented 6 years ago

Unfortunately no. Maybe we need some toplevel file to mark the root of projects, I guess we can look at this when we rename jbuilder. Looking for a jbuild file at depth 0, 1 and 2 without following symlinks should be enough for most projects, is that acceptable?

dbuenzli commented 6 years ago

Yes seems ok.

dbuenzli commented 6 years ago

I'm not up-to-date with what topkg-jbuilder.auto does but wouldn't the easiest be to upstream what this does in topkg itself and then simply invoke this whenever a jbuilder is detected and it lacks a pkg/pkg.ml files ?

ghost commented 6 years ago

That would be better indeed! /cc @samoht who is now the maintainer of topkg-jbuilder.

samoht commented 6 years ago

yea upstreaming stuff in topkg would definitely makes thing simpler. The code is there: https://github.com/samoht/topkg-jbuilder/blob/master/src/topkg_jbuilder.ml

It's a bit hackish (especially the doc command) but if we put that in topkg-care we could probably remove all the unix stuff and use bos. @dbuenzli where's the best place to copy this in topkg?

dbuenzli commented 6 years ago

If I understand correctly jbuilder users are only interested in the topkg-care aspect (i.e. the topkg tool) so I guess simply into topkg_care_jbuilder.ml and as a submodule in the Topkg_care API.

dbuenzli commented 6 years ago

@samoht is working on brining the topkg release experience to dune via a dedicated tool (https://github.com/samoht/dune-release) so I'm closing this.