Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 33 additions & 10 deletions analysis/src/BuildSystem.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,42 @@ let namespacedName namespace name =

let ( /+ ) = Filename.concat

(*
Here is the real problem:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zth I would use an environment variable here to avoid breaking all the analysis commands.
Thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's fine, we use env variables for other stuff as well. So go for it!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, ready for review.


For pnpm it needs to figure out

"/Users/nojaf/Projects/test-stdlib/node_modules/.pnpm/@[email protected]/node_modules/@rescript/runtime"
*)

let getRuntimeDir rootPath =
match !Cfg.isDocGenFromCompiler with
| false -> (
let result =
ModuleResolution.resolveNodeModulePath ~startPath:rootPath
"@rescript/runtime"
in
match result with
| Some path -> Some path
| None ->
let message = "@rescript/runtime could not be found" in
Log.log message;
None)
(* First check RESCRIPT_RUNTIME environment variable, like bsc does *)
match Sys.getenv_opt "RESCRIPT_RUNTIME" with
| Some envPath ->
if Debug.verbose () then
Printf.printf "[getRuntimeDir] Using RESCRIPT_RUNTIME=%s\n" envPath;
Some envPath
| None -> (
let result =
ModuleResolution.resolveNodeModulePath ~startPath:rootPath
"@rescript/runtime"
in
match result with
| Some path ->
if Debug.verbose () then
Printf.printf "[getRuntimeDir] Resolved via node_modules: %s\n" path;
Some path
| None ->
let message = "@rescript/runtime could not be found" in
Log.log message;
if Debug.verbose () then
Printf.printf
"[getRuntimeDir] Failed to resolve @rescript/runtime from \
rootPath=%s\n"
rootPath;
None))
| true -> Some rootPath

let getLibBs path = Files.ifExists (path /+ "lib" /+ "bs")
Expand Down
Loading