Skip to content

Commit bc32037

Browse files
authored
Enable support for Jane Street's internal Merlin configuration (#64)
* Enable support for Jane Street's internal Merlin configuration Now Jane Street internal developers can get Merlin within the compiler when building with `dune`. Once we improve the internal tooling in a couple of ways (see comments) we can simplify some of the way this is done. * Use `ocamlc -where` * Support `.local-merlin-binaries` * Add `.local-merlin-*` files to `.gitignore`
1 parent d1a8d03 commit bc32037

File tree

5 files changed

+38
-0
lines changed

5 files changed

+38
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,3 +291,9 @@ _build
291291

292292
/otherlibs/dynlink/natdynlinkops
293293

294+
# Jane Street Merlin support
295+
/.for-jane-street-merlin/
296+
/.merlin-binaries
297+
/.ocaml-lib
298+
/.local-merlin-binaries
299+
/.local-ocaml-lib

.ocaml-bin

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Stub for Jane Street .merlin-binaries search

Makefile.common-jst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# Build rules common to ocaml-jst and flambda-backend
33
#
44

5+
# Get Merlin along with any Dune command
6+
dune := '$(CURDIR)/jane-street-merlin-setup.sh' ; '$(dune)'
7+
58
ws_boot = --root=. --workspace=duneconf/boot.ws
69
ws_runstd = --root=. --workspace=duneconf/runtime_stdlib.ws
710
ws_main = --root=. --workspace=duneconf/main.ws

jane-street-merlin-setup.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
cd "$(dirname "$0")"
4+
5+
ocamlmerlin="$(which ocamlmerlin 2>&-)"
6+
ocamlmerlin_status=$?
7+
if [[ $ocamlmerlin_status -ne 0 ]]; then
8+
echo >&2 'No ocamlmerlin on $PATH'
9+
exit $ocamlmerlin_status
10+
fi
11+
12+
set -e
13+
14+
merlin_dir="$(dirname "$ocamlmerlin")"
15+
echo "$merlin_dir" > .local-merlin-binaries
16+
ocamlc -where > .local-ocaml-lib
17+
18+
# When `.local-merlin-binaries` is fully supported (rather than just supported
19+
# in dev Emacs), we can drop the extra directory `.for-jane-street-merlin` as
20+
# well as the stub `jenga.conf` file.
21+
22+
mkdir -p .for-jane-street-merlin
23+
ln -sfn "$merlin_dir" .for-jane-street-merlin/dev
24+
ln -sfn "$merlin_dir" .for-jane-street-merlin/prod
25+
26+
echo "$PWD/.for-jane-street-merlin" > .merlin-binaries
27+
cp .local-ocaml-lib .ocaml-lib

jenga.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Stub for Jane Street .merlin-binaries search

0 commit comments

Comments
 (0)