Skip to content

Installing the ocamllsp dev tool rebuilds the compiler unnecessarily #12491

@gridbugs

Description

@gridbugs

If the compiler is already installed as a dependency of the current project, installing ocamllsp should not require building the compiler a second time. Instead it should re-use the compiler that was installed as a dependency of the current project.

However currently installing ocamllsp as a dev tool causes the compiler to be rebuilt:


$ dune init proj foo . 
Success: initialized project component named foo
$ ls
_build          bin             dune-project    foo.opam        lib             test
$ dune pkg lock 
Solution for dune.lock:                                              
- arch-x86_64.1
- conf-mingw-w64-gcc-i686.1
...
- ocaml-env-mingw64.1
- system-mingw.1
$ dune build 
 Downloading ocaml-compiler.5.3.0
    Building ocaml-compiler.5.3.0
    Building ocaml-base-compiler.5.3.0
$ dune build

# We have to rebuild the whole compiler from scratch, even tho we are using the same compiler
$ dune tools install ocamllsp
Solution for dev-tools.locks/ocaml-lsp-server:                                              
- astring.0.8.5
- base.v0.17.3
...
- uutf.1.0.4
- xdg.3.20.2
- yojson.2.2.2
    Building base-unix.base                         
    Building ocaml-compiler.5.3.0 
    Building ocaml-base-compiler.5.3.0
    Building ocaml-config.3       
    Building ocaml.5.3.0          
    Building seq.base              
...           
    Building dune-rpc.3.20.2       
    Building ocaml-lsp-server.1.23.0

(copied from #12244 (comment))

This happens when using portable lockdirs and non-portable lockdirs. I've reproduced this on 3.20.2 and also the latest nightly build at the time of writing (d9fc1d3).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions