Skip to content

Commit 2207eb1

Browse files
Rename extension otherlibs (#2564)
* Use Dune 3.15.2 in CI * Update docs * Fix typo * Bump Dune language version to 3.11 * `glob_files` in beta * `glob_files` in alpha * `glob_files` in stable * `glob_files` in upstream_compatible * Move directories * Rename files * Some makefile changes * Revert * Clone libraries under old names * Fix makefile * Export new libraries in tests * Tests * Fix indentation * Fix indentation * Move files to `stdlib_stable` from `stdlib` --------- Co-authored-by: Diana Kalinichenko <[email protected]>
1 parent 5dfa476 commit 2207eb1

40 files changed

+309
-37
lines changed

ocaml/Makefile.common-jst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,15 +251,15 @@ install_for_test: _install
251251
ln -s . lex; ln -s . yacc; \
252252
ln -s _install/lib/ocaml/compiler-libs compilerlibs; \
253253
mkdir -p otherlibs/{unix,dynlink/native,str,bigarray,runtime_events}; \
254-
mkdir -p otherlibs/{upstream_compatible,stable,beta,alpha}; \
255254
ln -s ../stdlib/threads otherlibs/systhreads$(RUNTIME_SUFFIX); \
256255
$(cpl) stdlib/unix/{lib,}unix* otherlibs/unix; \
257256
$(cpl) stdlib/dynlink/dynlink* otherlibs/dynlink; \
258257
$(cpl) stdlib/str/{lib,}str* otherlibs/str; \
259-
$(cpl) stdlib/upstream_compatible/* otherlibs/upstream_compatible; \
260-
$(cpl) stdlib/stable/* otherlibs/stable; \
261-
$(cpl) stdlib/beta/* otherlibs/beta; \
262-
$(cpl) stdlib/alpha/* otherlibs/alpha; \
258+
for universe in upstream_compatible stable beta alpha ; do \
259+
mkdir -p otherlibs/{stdlib_,}$${universe}; \
260+
$(cpl) stdlib/stdlib_$${universe}/* otherlibs/stdlib_$${universe}; \
261+
$(cpl) stdlib/$${universe}/* otherlibs/$${universe}; \
262+
done; \
263263
if [[ x"$(RUNTIME_DIR)" = x"runtime" ]]; then \
264264
$(cpl) stdlib/runtime_events/{lib,}runtime_events* otherlibs/runtime_events; \
265265
fi; \

ocaml/ocamltest/ocaml_modifiers.ml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,6 @@ let dynlink =
9393
let str = make_library_modifier
9494
"str" [compiler_subdir ["otherlibs"; "str"]]
9595

96-
let upstream_compatible = make_library_modifier
97-
"upstream_compatible" [compiler_subdir ["otherlibs"; "upstream_compatible"]]
98-
99-
let stable = make_library_modifier
100-
"stable" [compiler_subdir ["otherlibs"; "stable"]]
101-
102-
let beta = make_library_modifier
103-
"beta" [compiler_subdir ["otherlibs"; "beta"]]
104-
105-
let alpha = make_library_modifier
106-
"alpha" [compiler_subdir ["otherlibs"; "alpha"]]
107-
10896
let systhreads =
10997
unix @
11098
(make_library_modifier
@@ -140,17 +128,28 @@ let runtime_suffix = if Config.runtime5 then "" else "4"
140128

141129
let debugger = [add_compiler_subdir ("debugger" ^ runtime_suffix)]
142130

131+
let extension_universe_lib name =
132+
make_library_modifier name [compiler_subdir ["otherlibs"; name]]
133+
143134
let _ =
144135
register_modifiers "principal" principal;
145136
register_modifiers "config" config;
146137
register_modifiers "testing" testing;
147138
register_modifiers "unix" unix;
148139
register_modifiers "dynlink" dynlink;
149140
register_modifiers "str" str;
150-
register_modifiers "upstream_compatible" upstream_compatible;
151-
register_modifiers "stable" stable;
152-
register_modifiers "beta" beta;
153-
register_modifiers "alpha" alpha;
141+
List.iter
142+
(fun old_name ->
143+
let new_name = "stdlib_" ^ old_name in
144+
register_modifiers old_name (extension_universe_lib old_name);
145+
register_modifiers new_name (extension_universe_lib new_name);
146+
)
147+
[
148+
"upstream_compatible";
149+
"stable";
150+
"beta";
151+
"alpha";
152+
];
154153
List.iter
155154
(fun archive -> register_modifiers archive (compilerlibs_archive archive))
156155
[

ocaml/otherlibs/alpha/dune

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
;* *
1313
;**************************************************************************
1414

15+
;; [alpha] was renamed to [stdlib_alpha]. This library clones [stdlib_alpha]
16+
;; until we move all existing uses of [alpha] to [stdlib_alpha].
17+
1518
(library
1619
(name alpha)
1720
(wrapped false)
@@ -34,6 +37,17 @@
3437
(library_flags
3538
(:standard -linkall)))
3639

40+
;; We clone files from [stdlib_alpha] instead of re-exporting the library
41+
;; to avoid adding a new transitive dependency to builds.
42+
43+
(rule
44+
(deps
45+
(glob_files ../stdlib_alpha/*.{ml,mli}))
46+
(targets alpha.ml alpha.mli)
47+
(action
48+
(bash
49+
"cp ../stdlib_alpha/*.{ml,mli} .; mv stdlib_alpha.ml alpha.ml; mv stdlib_alpha.mli alpha.mli")))
50+
3751
(install
3852
(files
3953
(glob_files

ocaml/otherlibs/beta/dune

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
;* *
1313
;**************************************************************************
1414

15+
;; [beta] was renamed to [stdlib_beta]. This library clones [stdlib_beta]
16+
;; until we move all existing uses of [beta] to [stdlib_beta].
17+
1518
(library
1619
(name beta)
1720
(wrapped false)
@@ -34,6 +37,17 @@
3437
(library_flags
3538
(:standard -linkall)))
3639

40+
;; We clone files from [stdlib_beta] instead of re-exporting the library
41+
;; to avoid adding a new transitive dependency to builds.
42+
43+
(rule
44+
(deps
45+
(glob_files ../stdlib_beta/*.{ml,mli}))
46+
(targets float32.ml float32.mli float32_u.ml float32_u.mli beta.ml beta.mli)
47+
(action
48+
(bash
49+
"cp ../stdlib_beta/*.{ml,mli} .; mv stdlib_beta.ml beta.ml; mv stdlib_beta.mli beta.mli")))
50+
3751
(install
3852
(files
3953
(glob_files

ocaml/otherlibs/stable/dune

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
;* *
1313
;**************************************************************************
1414

15+
;; [stable] was renamed to [stdlib_stable]. This library clones [stdlib_stable]
16+
;; until we move all existing uses of [stable] to [stdlib_stable].
17+
1518
(library
1619
(name stable)
1720
(wrapped false)
@@ -34,6 +37,27 @@
3437
(library_flags
3538
(:standard -linkall)))
3639

40+
;; We clone files from [stdlib_stable] instead of re-exporting the library
41+
;; to avoid adding a new transitive dependency to builds.
42+
43+
(rule
44+
(deps
45+
(glob_files ../stdlib_stable/*.{ml,mli}))
46+
(targets
47+
float_u.ml
48+
float_u.mli
49+
int32_u.ml
50+
int32_u.mli
51+
int64_u.ml
52+
int64_u.mli
53+
nativeint_u.ml
54+
nativeint_u.mli
55+
stable.ml
56+
stable.mli)
57+
(action
58+
(bash
59+
"cp ../stdlib_stable/*.{ml,mli} .; mv stdlib_stable.ml stable.ml; mv stdlib_stable.mli stable.mli")))
60+
3761
(install
3862
(files
3963
(glob_files

ocaml/otherlibs/stdlib_alpha/dune

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
;**************************************************************************
2+
;* *
3+
;* OCaml *
4+
;* *
5+
;* Diana Kalinichenko, Jane Street, New York *
6+
;* *
7+
;* Copyright 2024 Jane Street Group LLC *
8+
;* *
9+
;* All rights reserved. This file is distributed under the terms of *
10+
;* the GNU Lesser General Public License version 2.1, with the *
11+
;* special exception on linking described in the file LICENSE. *
12+
;* *
13+
;**************************************************************************
14+
15+
(library
16+
(name stdlib_alpha)
17+
(wrapped false)
18+
(modes byte native)
19+
(flags
20+
(-strict-sequence
21+
-principal
22+
-absname
23+
-w
24+
+a-4-9-40-41-42-44-45-48-66
25+
-warn-error
26+
A
27+
-bin-annot
28+
-safe-string
29+
-strict-formats
30+
-extension-universe
31+
alpha))
32+
(ocamlopt_flags
33+
(:include %{project_root}/ocamlopt_flags.sexp))
34+
(library_flags
35+
(:standard -linkall)))
36+
37+
(install
38+
(files
39+
(glob_files
40+
(*.{cmxa,a,cmxs,cma,mli} with_prefix stdlib_alpha))
41+
(glob_files
42+
(.stdlib_alpha.objs/byte/*.{cmi,cmt,cmti} with_prefix stdlib_alpha))
43+
(glob_files
44+
(.stdlib_alpha.objs/native/*.cmx with_prefix stdlib_alpha)))
45+
(section lib)
46+
(package ocaml))

ocaml/otherlibs/stdlib_beta/dune

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
;**************************************************************************
2+
;* *
3+
;* OCaml *
4+
;* *
5+
;* Diana Kalinichenko, Jane Street, New York *
6+
;* *
7+
;* Copyright 2024 Jane Street Group LLC *
8+
;* *
9+
;* All rights reserved. This file is distributed under the terms of *
10+
;* the GNU Lesser General Public License version 2.1, with the *
11+
;* special exception on linking described in the file LICENSE. *
12+
;* *
13+
;**************************************************************************
14+
15+
(library
16+
(name stdlib_beta)
17+
(wrapped false)
18+
(modes byte native)
19+
(flags
20+
(-strict-sequence
21+
-principal
22+
-absname
23+
-w
24+
+a-4-9-40-41-42-44-45-48-66
25+
-warn-error
26+
A
27+
-bin-annot
28+
-safe-string
29+
-strict-formats
30+
-extension-universe
31+
beta))
32+
(ocamlopt_flags
33+
(:include %{project_root}/ocamlopt_flags.sexp))
34+
(library_flags
35+
(:standard -linkall)))
36+
37+
(install
38+
(files
39+
(glob_files
40+
(*.{cmxa,a,cmxs,cma,mli} with_prefix stdlib_beta))
41+
(glob_files
42+
(.stdlib_beta.objs/byte/*.{cmi,cmt,cmti} with_prefix stdlib_beta))
43+
(glob_files
44+
(.stdlib_beta.objs/native/*.cmx with_prefix stdlib_beta)))
45+
(section lib)
46+
(package ocaml))

ocaml/otherlibs/stdlib_stable/dune

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
;**************************************************************************
2+
;* *
3+
;* OCaml *
4+
;* *
5+
;* Diana Kalinichenko, Jane Street, New York *
6+
;* *
7+
;* Copyright 2024 Jane Street Group LLC *
8+
;* *
9+
;* All rights reserved. This file is distributed under the terms of *
10+
;* the GNU Lesser General Public License version 2.1, with the *
11+
;* special exception on linking described in the file LICENSE. *
12+
;* *
13+
;**************************************************************************
14+
15+
(library
16+
(name stdlib_stable)
17+
(wrapped false)
18+
(modes byte native)
19+
(flags
20+
(-strict-sequence
21+
-principal
22+
-absname
23+
-w
24+
+a-4-9-40-41-42-44-45-48-66
25+
-warn-error
26+
A
27+
-bin-annot
28+
-safe-string
29+
-strict-formats
30+
-extension-universe
31+
stable))
32+
(ocamlopt_flags
33+
(:include %{project_root}/ocamlopt_flags.sexp))
34+
(library_flags
35+
(:standard -linkall)))
36+
37+
(install
38+
(files
39+
(glob_files
40+
(*.{cmxa,a,cmxs,cma,mli} with_prefix stdlib_stable))
41+
(glob_files
42+
(.stdlib_stable.objs/byte/*.{cmi,cmt,cmti} with_prefix stdlib_stable))
43+
(glob_files
44+
(.stdlib_stable.objs/native/*.cmx with_prefix stdlib_stable)))
45+
(section lib)
46+
(package ocaml))
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
;**************************************************************************
2+
;* *
3+
;* OCaml *
4+
;* *
5+
;* Diana Kalinichenko, Jane Street, New York *
6+
;* *
7+
;* Copyright 2024 Jane Street Group LLC *
8+
;* *
9+
;* All rights reserved. This file is distributed under the terms of *
10+
;* the GNU Lesser General Public License version 2.1, with the *
11+
;* special exception on linking described in the file LICENSE. *
12+
;* *
13+
;**************************************************************************
14+
15+
(library
16+
(name stdlib_upstream_compatible)
17+
(wrapped false)
18+
(modes byte native)
19+
(flags
20+
(-strict-sequence
21+
-principal
22+
-absname
23+
-w
24+
+a-4-9-40-41-42-44-45-48-66
25+
-warn-error
26+
A
27+
-bin-annot
28+
-safe-string
29+
-strict-formats
30+
-extension-universe
31+
upstream_compatible))
32+
(ocamlopt_flags
33+
(:include %{project_root}/ocamlopt_flags.sexp))
34+
(library_flags
35+
(:standard -linkall)))
36+
37+
(install
38+
(files
39+
(glob_files
40+
(*.{cmxa,a,cmxs,cma,mli} with_prefix stdlib_upstream_compatible))
41+
(glob_files
42+
(.stdlib_upstream_compatible.objs/byte/*.{cmi,cmt,cmti}
43+
with_prefix
44+
stdlib_upstream_compatible))
45+
(glob_files
46+
(.stdlib_upstream_compatible.objs/native/*.cmx
47+
with_prefix
48+
stdlib_upstream_compatible)))
49+
(section lib)
50+
(package ocaml))

ocaml/otherlibs/upstream_compatible/dune

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
;* *
1313
;**************************************************************************
1414

15+
;; [upstream_compatible] was renamed to [stdlib_upstream_compatible].
16+
;; This library clones [stdlib_upstream_compatible] until we move all
17+
;; existing uses of [upstream_compatible] to [stdlib_upstream_compatible].
18+
1519
(library
1620
(name upstream_compatible)
1721
(wrapped false)
@@ -34,6 +38,17 @@
3438
(library_flags
3539
(:standard -linkall)))
3640

41+
;; We clone files from [stdlib_upstream_compatible] instead of re-exporting the library
42+
;; to avoid adding a new transitive dependency to builds.
43+
44+
(rule
45+
(deps
46+
(glob_files ../stdlib_upstream_compatible/*.{ml,mli}))
47+
(targets upstream_compatible.ml upstream_compatible.mli)
48+
(action
49+
(bash
50+
"cp ../stdlib_upstream_compatible/*.{ml,mli} .; mv stdlib_upstream_compatible.ml upstream_compatible.ml; mv stdlib_upstream_compatible.mli upstream_compatible.mli")))
51+
3752
(install
3853
(files
3954
(glob_files

0 commit comments

Comments
 (0)