Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming to Dune #721

Merged
15 commits merged into from
May 2, 2018
Merged

Renaming to Dune #721

15 commits merged into from
May 2, 2018

Conversation

ghost
Copy link

@ghost ghost commented Apr 24, 2018

This is the first step in renaming Jbuilder to Dune.

This PR implements the minimum required from #461 to do the switch: it adds support for dune-project files. The current version of the dune language is 0.1 and is exactly the same as jbuilder. This means that to convert a project to dune, one just needs to add a dune-project file with:

(lang dune 0.1)

as we implement the other features of #461, we will increase this version number.

This PR builds and installs both dune and jbuilder binaries. The only difference between the two is the doc and the fact that dune no longer looks for jbuild-workspace* files.

@ghost ghost changed the title [WIP] renaming to Dune Renaming to Dune Apr 25, 2018
@ghost
Copy link
Author

ghost commented Apr 25, 2018

Ok, there are still a few things to do, but I think this PR is big enough already. What it does is the following:

  • Rename the package to dune
  • Rename the libraries from jbuilder.X to dune.X
  • Build and install two binaries: dune and jbuilder
  • Build and install two sets of man pages
  • Add support for dune-project files

The two commands behaves exactly in the same way, except that jbuilder looks for jbuild-workspace file and dune looks for dune-workspace files to find the root of the workspace. Additionally dune ignores files prefixed with dune-workspace, while jbuilder still treat files prefixed with jbuild-workspace as root markers. Both commands accepts dune-project files, in order to keep the code simpler.

dune-project files as used as root markers when no dune-workspace file is found. Additionally they are used to mark the root of scopes. So currently we have two ways of defining a scope:

  • by having at least one <package>.opam file in a directory
  • by having a dune-project file

Having both is acceptable as well. In a distant future, the first way will go away and it will be required to have a dune-project file.

What is missing in this PR and will be done in separate PRs:

  • update the manual
  • accept dune files in addition to jbuild files, so that users can start renaming their jbuild files
  • add support for dune-fs files

@ghost ghost requested a review from rgrinberg April 25, 2018 16:57
@ghost
Copy link
Author

ghost commented Apr 25, 2018

I'm not sure what is the best way to fix the CI BTW, given that the script uses opam and that many packages rely on the package name being jbuilder. @rgrinberg @dra27 any idea?

@rgrinberg
Copy link
Member

Is it possible to leave the old jbuilder.opam file and just make it depend on dune? We might need to make a first release with the dune package to make this work however.

@ghost
Copy link
Author

ghost commented Apr 26, 2018

I'll try that

@rauanmayemir
Copy link

Pardon my nitpicking, but are you dead set on using dune-project as filename? Even if it's only one 'dune-project' file per project, one 'dune-workspace', and one 'dune-ignore' - those dashes are somewhat pain to deal with in terminal.

I wonder if it would be possible to solve this with same dune file in the top level and project stanza. Dunefile would look cool, too. 🙈

(OTOH, same dune name for both command and config filename might turn out to be inconvenient)

@ghost
Copy link
Author

ghost commented Apr 30, 2018

Now is indeed a good time to raise such questions :)

There is no strong technical reason to have separate files. However, when you create a workspace composed of several projects, dune-project files are used to partition the source tree into independent parts. This partitioning is used to limit the visibility of private libraries, to allow using different versions of the specification in different parts, etc... Somehow it feels more natural if this partitioning is clear by just looking at the files, without looking at their contents.

For jbuild-ignore, the plan is to replace them by dune-fs files. I suppose we could merge them into dune files directly, to remove one configuration file.

Regarding dune-workspace, these shouldn't be committed in repositories, they are only for local development.

In practice, one should only have one dune-project file at the root of their project.

those dashes are somewhat pain to deal with in terminal.

What do you mean by that? dashes are easy to type in all terminals, I believe that's why command line arguments starts with dashes.

@rauanmayemir
Copy link

Understood the reasoning for special project files.

For multi-project setups:

  1. Do we need to have a separate dune-fs file per project?
  2. Will dune-fs have responsibilities other than ignoring dirs?

Somehow it feels more natural if this partitioning is clear by just looking at the files, without looking at their contents.

On this, I agree. Having separate non-project related config files also makes it more flexible to build workflows on top of dune (e.g with esy).

What do you mean by that? dashes are easy to type in all terminals, I believe that's why command line arguments starts with dashes.

I misspoke. What I meant is the autocomplete nuisance when you have multiple similarly prefixed filenames and you want, for example, to quickly nano dun[press tab] in terminal. Ignoring the actual naming, something like this might be more convenient:

% root
.duneignore
Duneproject
dune-workspace

@ghost
Copy link
Author

ghost commented Apr 30, 2018

  1. Do we need to have a separate dune-fs file per project?
  2. Will dune-fs have responsibilities other than ignoring dirs?

A project might have, 0, 1, or more dune-fs files. They are described in #461, in the section dune-fs files. They are mostly just for ignoring files and directories, however they is a small difference between things that are completely ignored and things that are "raw data". Since they describe how dune should interpret the file system, it feels like they should be separate as well. They basically come before the rest. Using a dot file seems good though.

I misspoke. What I meant is the autocomplete nuisance when you have multiple similarly prefixed filenames and you want, for example, to quickly nano dun[press tab] in terminal. Ignoring the actual naming, something like this might be more convenient:

Ok, that makes sense. I find this annoying as well for program names. In general, I would expect that dune-workspace files are written outside of the project in a parent directory. If dune-fs files start with a dot, that leaves us with only one dune-project files. There might also be one dune file, however most projects put their sources in sub-directories, so it's likely the only file needed at the root will be a dune-project file. At which point we don't have the completion problem anymore.

Regarding the naming, Duneproject/dune-project/... and dune/Dunefile/.... I tend to find capital letters annoying for filenames. I also thinks that it's good to follow a naming convention for the various files. That's why I proposed this naming. But until the next release, these names are still open to discussion.

In light of this discussion, my current proposal is the following:

  • dune-workspace for worpskace files
  • dune-project for project files
  • dune for describing libraries, executables, etc...
  • .dune-fs for FS description files

@rauanmayemir
Copy link

Sounds great!

@ghost ghost force-pushed the rename branch 2 times, most recently from d1db14d to 14f620b Compare May 1, 2018 11:14
@ghost
Copy link
Author

ghost commented May 1, 2018

@rgrinberg tests are passing in Travis now. This PR is ready for review :)

@ghost ghost force-pushed the rename branch from 14f620b to d6e8786 Compare May 1, 2018 16:25
@ghost
Copy link
Author

ghost commented May 1, 2018

BTW, I simplified this PR a bit. Thinking about it, it's going to be painful to have to maintain several binaries with distinct behaviors. Plus it's going to make it harder for users to switch.

So instead the two commands dune and jbuilder are now exactly the same. This means that they both recognize the old and new files. To move away from files such as jbuild-workspace, we can proceed as follow with a few releases between each step:

  • accept them just as before
  • accept them but display a waninng
  • ignore them and display a warning
  • ignore them entirely

@rgrinberg
Copy link
Member

Looks good. Why not rename jbuild to dune for the project too?

@ghost
Copy link
Author

ghost commented May 2, 2018

There is no support for dune files yet, but once there is we should do it indeed

@ghost ghost merged commit 325584a into master May 2, 2018
@rgrinberg
Copy link
Member

Hmm, I think we should support for such files before the release. Otherwise this adds unnecessary confusion to users who would expect that dune is valid wherever jbuild is.

@ghost
Copy link
Author

ghost commented May 2, 2018

Indeed, I was planning to do it in this PR originally but it was becoming too big. I think the following needs to be done before the release as well:

  • update the manual to talk about dune rather than jbuilder
  • add support for .dune-fs files (so that users can convert all their jbuild* files at once)

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants