Skip to content

Remove unused -no-stdlib and use-stdlib #6778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 0 additions & 4 deletions docs/docson/build-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,6 @@
"$ref": "#/definitions/package-specs",
"description": "ReScript can currently output to [Commonjs](https://en.wikipedia.org/wiki/CommonJS), and [ES6 modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import)"
},
"use-stdlib": {
"type": "boolean",
"description": "(Experimental) whether to use the OCaml standard library. Default: true"
},
"external-stdlib": {
"type": "string",
"description": "Use the external stdlib library instead of the one shipped with the compiler package"
Expand Down
1 change: 0 additions & 1 deletion jscomp/bsb/bsb_build_schemas.ml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ let package_specs = "package-specs"
let type_ = "type"
let export_all = "all"
let export_none = "none"
let use_stdlib = "use-stdlib"
let external_stdlib = "external-stdlib"
let reason = "reason"
let react_jsx = "react-jsx"
Expand Down
10 changes: 0 additions & 10 deletions jscomp/bsb/bsb_config_parse.ml
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,6 @@ let extract_package_name_and_namespace (map : json_map) : string * string option
bsc -runtime runtime_dir@version
```
*)
let check_stdlib (map : json_map) : bool =
(*built_in_package*)
match map.?(Bsb_build_schemas.use_stdlib) with
| Some (False _) -> false
| None | Some _ -> true

let extract_gentype_config (map : json_map) : Bsb_config_types.gentype_config =
match map.?(Bsb_build_schemas.gentypeconfig) with
| None -> false
Expand Down Expand Up @@ -266,9 +260,6 @@ let interpret_json
(* This line has to be before any calls to Bsb_global_backend.backend, because it'll read the entries
array from the bsconfig and set the backend_ref to the first entry, if any. *)

(* The default situation is empty *)
let built_in_package : bool = check_stdlib map in

let pp_flags : string option =
extract_string map Bsb_build_schemas.pp_flags (fun p ->
if p = "" then
Expand Down Expand Up @@ -343,7 +334,6 @@ let interpret_json
| Pinned_dependency x | Dependency x -> x.package_specs);
file_groups = groups;
files_to_install = Queue.create ();
built_in_dependency = built_in_package;
reason_react_jsx;
jsx;
generators = extract_generators map;
Expand Down
1 change: 0 additions & 1 deletion jscomp/bsb/bsb_config_types.ml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ type t = {
bs_dependencies : dependencies;
bs_dev_dependencies : dependencies;
pinned_dependencies : Set_string.t;
built_in_dependency : bool;
warning : Bsb_warning.t;
(*TODO: maybe we should always resolve rescript
so that we can calculate correct relative path in
Expand Down
3 changes: 1 addition & 2 deletions jscomp/bsb/bsb_ninja_gen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ let output_ninja_and_namespace_map ~per_proj_dir ~package_kind
package_specs;
file_groups = { files = bs_file_groups };
files_to_install;
built_in_dependency;
reason_react_jsx;
jsx;
uncurried;
Expand Down Expand Up @@ -205,7 +204,7 @@ let output_ninja_and_namespace_map ~per_proj_dir ~package_kind
in
let rules : Bsb_ninja_rule.builtin =
Bsb_ninja_rule.make_custom_rules ~gentype_config
~has_postbuild:js_post_build_cmd ~pp_file ~has_builtin:built_in_dependency
~has_postbuild:js_post_build_cmd ~pp_file
~reason_react_jsx ~jsx ~uncurried ~package_specs ~namespace ~digest ~package_name
~warnings ~ppx_files ~bsc_flags ~dpkg_incls (* dev dependencies *)
~lib_incls (* its own libs *)
Expand Down
2 changes: 0 additions & 2 deletions jscomp/bsb/bsb_ninja_rule.ml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ type builtin = {

let make_custom_rules ~(gentype_config : Bsb_config_types.gentype_config)
~(has_postbuild : string option) ~(pp_file : string option)
~(has_builtin : bool)
~(reason_react_jsx : Bsb_config_types.reason_react_jsx option)
~(jsx : Bsb_jsx.t) ~(uncurried: bool) ~(digest : string) ~(package_specs : Bsb_package_specs.t)
~(namespace : string option) ~package_name ~warnings
Expand All @@ -114,7 +113,6 @@ let make_custom_rules ~(gentype_config : Bsb_config_types.gentype_config)
if is_dev then Ext_buffer.add_char_string buf ' ' dev_incls;
Ext_buffer.add_char_string buf ' ' lib_incls;
if is_dev then Ext_buffer.add_char_string buf ' ' dpkg_incls;
if not has_builtin then Ext_buffer.add_string buf " -nostdlib";
Ext_buffer.add_char_string buf ' ' bsc_flags;
Ext_buffer.add_char_string buf ' ' warnings;
(* we need "-w a" in the end position to take effect
Expand Down
1 change: 0 additions & 1 deletion jscomp/bsb/bsb_ninja_rule.mli
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ val make_custom_rules :
gentype_config:Bsb_config_types.gentype_config ->
has_postbuild:string option ->
pp_file:string option ->
has_builtin:bool ->
reason_react_jsx:Bsb_config_types.reason_react_jsx option ->
jsx:Bsb_jsx.t ->
uncurried:bool ->
Expand Down
3 changes: 0 additions & 3 deletions jscomp/bsc/rescript_compiler_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,6 @@ let buckle_script_flags : (string * Bsc_args.spec * string) array =
"-bs-unsafe-empty-array", set Config.unsafe_empty_array,
"*internal* Allow [||] to be polymorphic";

"-nostdlib", set Js_config.no_stdlib,
"*internal* Don't use stdlib";

"-color", string_call set_color_option,
"*internal* Enable or disable colors in compiler messages\n\
The following settings are supported:\n\
Expand Down
1 change: 0 additions & 1 deletion jscomp/common/js_config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ let jsx_module = ref React
let jsx_mode = ref Automatic
let js_stdout = ref true
let all_module_aliases = ref false
let no_stdlib = ref false
let no_export = ref false
let as_ppx = ref false

Expand Down
2 changes: 0 additions & 2 deletions jscomp/common/js_config.mli
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ val js_stdout : bool ref

val all_module_aliases : bool ref

val no_stdlib : bool ref

val no_export : bool ref

val as_ppx : bool ref
Expand Down
2 changes: 1 addition & 1 deletion jscomp/others/release.ninja
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

bsc_primitive_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A
bsc_primitive_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A
bsc_flags = $bsc_primitive_flags -open Belt_internals

rule cc
Expand Down
4 changes: 2 additions & 2 deletions jscomp/runtime/release.ninja
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

bsc_no_open_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A
bsc_no_open_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -bs-cross-module-opt -make-runtime -nopervasives -unsafe -w +50 -warn-error A
bsc_flags = $bsc_no_open_flags -open Bs_stdlib_mini

rule cc
Expand All @@ -10,7 +10,7 @@ rule cc_cmi
description = $in -> $out

o runtime/bs_stdlib_mini.cmi : cc runtime/bs_stdlib_mini.resi
bsc_flags = -nostdlib -nopervasives
bsc_flags = -nopervasives
o runtime/js.cmj runtime/js.cmi : cc runtime/js.ml
bsc_flags = $bsc_no_open_flags
o runtime/caml.cmj : cc_cmi runtime/caml.res | runtime/caml.cmi runtime/caml_int64_extern.cmj
Expand Down
2 changes: 1 addition & 1 deletion jscomp/stdlib-406/release.ninja
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

bsc_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -w -9-3-106 -warn-error A -I others
bsc_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -bs-cross-module-opt -make-runtime -w -9-3-106 -warn-error A -I others

rule cc
command = $bsc -bs-cmi -bs-cmj $bsc_flags -I stdlib-406 $in
Expand Down
4 changes: 2 additions & 2 deletions scripts/ninja.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var runtimeMliFiles = runtimeFiles.filter(
var runtimeSourceFiles = runtimeMlFiles.concat(runtimeMliFiles);
var runtimeJsFiles = [...new Set(runtimeSourceFiles.map(baseName))];

var commonBsFlags = `-no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib `;
var commonBsFlags = `-no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero `;
var js_package = pseudoTarget("js_pkg");
var runtimeTarget = pseudoTarget("runtime");
var othersTarget = pseudoTarget("others");
Expand Down Expand Up @@ -842,7 +842,7 @@ ${ninjaQuickBuildList([
"bs_stdlib_mini.resi",
"cc",
ninjaCwd,
[["bsc_flags", "-nostdlib -nopervasives"]],
[["bsc_flags", "-nopervasives"]],
[],
externalDeps,
],
Expand Down
Loading