Skip to content

Commit 4d182e7

Browse files
authored
Reanalyze: remove support for legacy build system (#8212)
1 parent 928c831 commit 4d182e7

2 files changed

Lines changed: 27 additions & 52 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#### :boom: Breaking Change
1616

17-
- Remove the legacy build system. Going forward, only the modern build system is supported, and the `rescript-legacy` command is not available anymore. https://github.com/rescript-lang/rescript/pull/8186
17+
- Remove the legacy build system. Going forward, only the modern build system is supported, and the `rescript-legacy` command is not available anymore. https://github.com/rescript-lang/rescript/pull/8186 https://github.com/rescript-lang/rescript/pull/8212
1818
- Remove support for `bsconfig.json`. https://github.com/rescript-lang/rescript/pull/8187
1919
- `Int.fromString` and `Float.fromString` use stricter number parsing and no longer uses an explicit radix argument, but instead supports parsing hexadecimal, binary and exponential notation.
2020
- Remove the deprecated module system names `es6` and `es6-global` (superseded by `esmodule`). https://github.com/rescript-lang/rescript/pull/8205

analysis/reanalyze/src/Reanalyze.ml

Lines changed: 26 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -105,58 +105,33 @@ let collectCmtFilePaths ~cmtRoot : string list =
105105
(* Prefer explicit scan plan emitted by rewatch (v2 `.sourcedirs.json`).
106106
This supports monorepos without reanalyze-side package resolution. *)
107107
let scan_plan = Paths.readCmtScan () in
108-
if scan_plan <> [] then
109-
let seen = Hashtbl.create 256 in
110-
let add_dir (absDir : string) =
111-
let files =
112-
match Sys.readdir absDir |> Array.to_list with
113-
| files -> files
114-
| exception Sys_error _ -> []
115-
in
116-
files
117-
|> List.filter (fun x ->
118-
Filename.check_suffix x ".cmt" || Filename.check_suffix x ".cmti")
119-
|> List.sort String.compare
120-
|> List.iter (fun f ->
121-
let p = Filename.concat absDir f in
122-
if not (Hashtbl.mem seen p) then (
123-
Hashtbl.add seen p ();
124-
paths := p :: !paths))
125-
in
126-
scan_plan
127-
|> List.iter (fun (entry : Paths.cmt_scan_entry) ->
128-
let build_root_abs =
129-
Filename.concat runConfig.projectRoot entry.build_root
130-
in
131-
(* Scan configured subdirs. *)
132-
entry.scan_dirs
133-
|> List.iter (fun d -> add_dir (Filename.concat build_root_abs d));
134-
(* Optionally scan build root itself for namespace/mlmap `.cmt`s. *)
135-
if entry.also_scan_build_root then add_dir build_root_abs)
136-
else
137-
(* Legacy behavior: scan `<projectRoot>/lib/bs/<sourceDir>` based on source dirs. *)
138-
let lib_bs = runConfig.projectRoot +++ ("lib" +++ "bs") in
139-
let sourceDirs =
140-
Paths.readSourceDirs ~configSources:None |> List.sort String.compare
108+
let seen = Hashtbl.create 256 in
109+
let add_dir (absDir : string) =
110+
let files =
111+
match Sys.readdir absDir |> Array.to_list with
112+
| files -> files
113+
| exception Sys_error _ -> []
141114
in
142-
sourceDirs
143-
|> List.iter (fun sourceDir ->
144-
let libBsSourceDir = Filename.concat lib_bs sourceDir in
145-
let files =
146-
match Sys.readdir libBsSourceDir |> Array.to_list with
147-
| files -> files
148-
| exception Sys_error _ -> []
149-
in
150-
let cmtFiles =
151-
files
152-
|> List.filter (fun x ->
153-
Filename.check_suffix x ".cmt"
154-
|| Filename.check_suffix x ".cmti")
155-
in
156-
cmtFiles |> List.sort String.compare
157-
|> List.iter (fun cmtFile ->
158-
let cmtFilePath = Filename.concat libBsSourceDir cmtFile in
159-
paths := cmtFilePath :: !paths)));
115+
files
116+
|> List.filter (fun x ->
117+
Filename.check_suffix x ".cmt" || Filename.check_suffix x ".cmti")
118+
|> List.sort String.compare
119+
|> List.iter (fun f ->
120+
let p = Filename.concat absDir f in
121+
if not (Hashtbl.mem seen p) then (
122+
Hashtbl.add seen p ();
123+
paths := p :: !paths))
124+
in
125+
scan_plan
126+
|> List.iter (fun (entry : Paths.cmt_scan_entry) ->
127+
let build_root_abs =
128+
Filename.concat runConfig.projectRoot entry.build_root
129+
in
130+
(* Scan configured subdirs. *)
131+
entry.scan_dirs
132+
|> List.iter (fun d -> add_dir (Filename.concat build_root_abs d));
133+
(* Optionally scan build root itself for namespace/mlmap `.cmt`s. *)
134+
if entry.also_scan_build_root then add_dir build_root_abs));
160135
!paths |> List.rev
161136

162137
(** Process files sequentially *)

0 commit comments

Comments
 (0)