@@ -90,48 +90,26 @@ let extract_package_name_and_namespace
9090 - the running bsb and vendoring bsb is the same
9191 - the running bsb need delete stale build artifacts
9292 (kinda check npm upgrade)
93- *)
94- let check_version_exit (map : json_map ) stdlib_path =
95- match Map_string. find_exn map Bsb_build_schemas. version with
96- | Str {str } ->
97- if str <> Bs_version. version then
98- begin
99- Format. fprintf Format. err_formatter
100- " @{<error>bs-platform version mismatch@} Running bsb @{<info>%s@} (%s) vs vendored @{<info>%s@} (%s)@."
101- Bs_version. version
102- (Filename. dirname (Filename. dirname Sys. executable_name))
103- str
104- stdlib_path
105- ;
106- exit 2
107- end
108- | _ -> assert false
109-
110- let check_stdlib (map : json_map ) cwd (* built_in_package*) =
93+
94+ Note if the setup is correct:
95+ the running compiler and node_modules/bs-platform
96+ should be the same version,
97+ The exact check is that the running compiler should have a
98+ compatible runtime version installed, the location of the
99+ compiler is actually not relevant.
100+ We disable the check temporarily
101+ e.g,
102+ ```
103+ bsc -runtime runtime_dir@version
104+ ```
105+ *)
106+ let check_stdlib (map : json_map ) (* built_in_package*) : bool =
111107 match map.?( Bsb_build_schemas. use_stdlib) with
112- | Some (False _ ) -> None
108+ | Some (False _ ) -> false
113109 | None
114- | Some _ ->
115- begin
116- let current_package : Bsb_pkg_types.t = Global ! Bs_version. package_name in
117- if Sys. getenv_opt " RES_SKIP_STDLIB_CHECK" = None then begin
118- let stdlib_path =
119- Bsb_pkg. resolve_bs_package ~cwd current_package in
120- let json_spec =
121- Ext_json_parse. parse_json_from_file
122- (* No exn raised: stdlib has package.json *)
123- (Filename. concat stdlib_path Literals. package_json) in
124- match json_spec with
125- | Obj {map} ->
126- check_version_exit map stdlib_path;
127-
128- | _ -> assert false
129- end ;
130- Some {
131- Bsb_config_types. package_name = current_package;
132- package_install_path = Filename. dirname Bsb_global_paths. bsc_dir // Bsb_config. lib_ocaml;
133- }
134- end
110+ | Some _ ->
111+ true
112+
135113
136114
137115
@@ -355,7 +333,7 @@ let interpret_json
355333 array from the bsconfig and set the backend_ref to the first entry, if any. *)
356334
357335 (* The default situation is empty *)
358- let built_in_package = check_stdlib map per_proj_dir in
336+ let built_in_package : bool = check_stdlib map in
359337
360338 let pp_flags : string option =
361339 extract_string map Bsb_build_schemas. pp_flags (fun p ->
0 commit comments