diff --git a/jscomp/bsb/bsb_build_util.ml b/jscomp/bsb/bsb_build_util.ml index 581fb271e8..acb043deb5 100644 --- a/jscomp/bsb/bsb_build_util.ml +++ b/jscomp/bsb/bsb_build_util.ml @@ -54,9 +54,6 @@ let include_dirs_by dirs fn = (Ext_list.flat_map dirs (fun x -> ["-I"; Ext_filename.maybe_quote (fn x)])) -(* we use lazy $src_root_dir *) - - (* It does several conversion: First, it will convert unix path to windows backward on windows platform. diff --git a/jscomp/bsb/bsb_config.ml b/jscomp/bsb/bsb_config.ml index 7fdccd802f..d246acf4a2 100644 --- a/jscomp/bsb/bsb_config.ml +++ b/jscomp/bsb/bsb_config.ml @@ -52,8 +52,8 @@ let rev_lib_bs_prefix p = rev_lib_bs // p let ocaml_bin_install_prefix p = lib_ocaml // p -let lazy_src_root_dir = "$src_root_dir" -let proj_rel path = lazy_src_root_dir // path + +let proj_rel path = rev_lib_bs // path (** it may not be a bad idea to hard code the binary path of bsb in configuration time diff --git a/jscomp/bsb/bsb_ninja_gen.ml b/jscomp/bsb/bsb_ninja_gen.ml index d2bbcb3c56..5e417dd9c7 100644 --- a/jscomp/bsb/bsb_ninja_gen.ml +++ b/jscomp/bsb/bsb_ninja_gen.ml @@ -146,7 +146,6 @@ let output_ninja_and_namespace_map Bsb_ninja_targets.output_kvs [| Bsb_ninja_global_vars.g_pkg_flg, g_pkg_flg ; - Bsb_ninja_global_vars.src_root_dir, per_proj_dir (* TODO: need check its integrity -- allow relocate or not? *); (* The path to [bsc.exe] independent of config *) Bsb_ninja_global_vars.bsc, (Ext_filename.maybe_quote Bsb_global_paths.vendor_bsc); (* The path to [bsb_heler.exe] *) diff --git a/jscomp/bsb/bsb_ninja_global_vars.ml b/jscomp/bsb/bsb_ninja_global_vars.ml index c0c6f2a548..b483deb35c 100644 --- a/jscomp/bsb/bsb_ninja_global_vars.ml +++ b/jscomp/bsb/bsb_ninja_global_vars.ml @@ -28,7 +28,6 @@ let g_pkg_flg = "g_pkg_flg" let bsc = "bsc" -let src_root_dir = "src_root_dir" let bsdep = "bsdep" let bsc_flags = "bsc_flags" @@ -37,7 +36,6 @@ let ppx_flags = "ppx_flags" let pp_flags = "pp_flags" - let g_dpkg_incls = "g_dpkg_incls" let refmt = "refmt" diff --git a/jscomp/core/bs_conditional_initial.ml b/jscomp/core/bs_conditional_initial.ml index 17dd59a486..48092c7c1e 100644 --- a/jscomp/core/bs_conditional_initial.ml +++ b/jscomp/core/bs_conditional_initial.ml @@ -32,6 +32,7 @@ let setup_env () = Clflags.no_std_include := true; Warnings.parse_options false Bsc_warnings.defaults_w; Warnings.parse_options true Bsc_warnings.defaults_warn_error; + Location.absname := true; Clflags.dump_location := false; Clflags.compile_only := true; Config.bs_only := true; diff --git a/jscomp/snapshot.ninja b/jscomp/snapshot.ninja index 7baab70887..46ad5cf400 100644 --- a/jscomp/snapshot.ninja +++ b/jscomp/snapshot.ninja @@ -17,48 +17,45 @@ SNAP=../lib/$snapshot_path build snapshot: phony $SNAP/whole_compiler.ml $SNAP/bsb_helper.ml $SNAP/bsb.ml $SNAP/bspp.ml $SNAP/unstable/all_ounit_tests.ml -build $SNAP/whole_compiler.ml: bspack | ./bin/bspack.exe +build $SNAP/whole_compiler.ml: bspack | ./bin/bspack.exe $LTO flags = ${releaseMode} -bs-MD -module-alias Config=Config_whole_compiler -bs-exclude-I config -I $OCAML_SRC_UTILS -I $OCAML_SRC_PARSING -I $OCAML_SRC_TYPING -I $OCAML_SRC_BYTECOMP -I $OCAML_SRC_DRIVER ${includes} main = Js_main post_process = && node $LTO $SNAP/whole_compiler.ml - - -build $SNAP/bsb_helper.ml: bspack | ./bin/bspack.exe +build $SNAP/bsb_helper.ml: bspack | ./bin/bspack.exe $LTO flags = -bs-MD ${releaseMode} -I stubs -I common -I ext -I syntax -I depends -I bsb_helper -I main main = Bsb_helper_main -build $SNAP/bsb.ml: bspack | ./bin/bspack.exe +build $SNAP/bsb.ml: bspack | ./bin/bspack.exe $LTO flags = -D BS_MIN_LEX_DEPS=true -bs-MD ${releaseMode} -I $OCAML_SRC_UTILS -I $OCAML_SRC_PARSING -I stubs -I common -I ext -I syntax -I depends -I bsb -I ext -I main main = Bsb_main - -build $SNAP/bspp.ml: bspack | ./bin/bspack.exe +build $SNAP/bspp.ml: bspack | ./bin/bspack.exe $LTO flags = -D BS_MIN_LEX_DEPS=true ${releaseMode} -bs-MD -module-alias Config=Config_whole_compiler -I $OCAML_SRC_UTILS -I $OCAML_SRC_PARSING?parser -I common -I ext -I syntax -I depends -I bspp -I core -I main main = Bspp_main -build $SNAP/unstable/bsb_native.ml: bspack | ./bin/bspack.exe +build $SNAP/unstable/bsb_native.ml: bspack | ./bin/bspack.exe $LTO flags = -D BS_MIN_LEX_DEPS=true -D BS_NATIVE=true -bs-MD ${releaseMode} -I $OCAML_SRC_UTILS -I $OCAML_SRC_PARSING -I stubs -I common -I ext -I syntax -I depends -I bsb -I ext -I main main = Bsb_main -build $SNAP/unstable/native_ppx.ml: bspack | ./bin/bspack.exe +build $SNAP/unstable/native_ppx.ml: bspack | ./bin/bspack.exe $LTO flags = -module-alias Config=Config_whole_compiler -D BS_MIN_LEX_DEPS=true -D BS_NATIVE=true -bs-MD ${releaseMode} -I $OCAML_SRC_UTILS -I $OCAML_SRC_PARSING -I stubs -I common -I ext -I syntax -I depends -I bsb -I ext -I core -I main main = Native_ppx_main -build $SNAP/unstable/all_ounit_tests.ml: bspack | ./bin/bspack.exe +build $SNAP/unstable/all_ounit_tests.ml: bspack | ./bin/bspack.exe $LTO flags = -bs-MD -I ounit -I ounit_tests -I stubs -I bsb -I bsb_helper -I common -I ext -I syntax -I depends -I bspp -I core -I main main = Ounit_tests_main -build $SNAP/unstable/bspack.ml: bspack | ./bin/bspack.exe +build $SNAP/unstable/bspack.ml: bspack | ./bin/bspack.exe $LTO flags = -bs-MD -module-alias Config=Config_whole_compiler -I $OCAML_SRC_PARSING -I $OCAML_SRC_UTILS -I stubs -I ext -I common -I depends -I core -I main -bs-main Bspack_main main = Bspack_main -build $SNAP/unstable/js_compiler.ml: bspack | ./bin/bspack.exe +build $SNAP/unstable/js_compiler.ml: bspack | ./bin/bspack.exe $LTO flags = -D BS_BROWSER=true -bs-MD -module-alias Config=Config_whole_compiler -bs-exclude-I config -I $OCAML_SRC_UTILS -I $OCAML_SRC_PARSING -I $OCAML_SRC_TYPING -I $OCAML_SRC_BYTECOMP -I $OCAML_SRC_DRIVER -I stubs -I ext -I syntax -I depends -I common -I core -I super_errors -I bsb -I outcome_printer -I js_parser -I main main = Jsoo_main -build $SNAP/unstable/js_refmt_compiler.ml: bspack | ./bin/bspack.exe +build $SNAP/unstable/js_refmt_compiler.ml: bspack | ./bin/bspack.exe $LTO flags = -D BS_BROWSER=true -bs-MD -module-alias Config=Config_whole_compiler -bs-exclude-I config -I $OCAML_SRC_UTILS -I $OCAML_SRC_PARSING -I $OCAML_SRC_TYPING -I $OCAML_SRC_BYTECOMP -I $OCAML_SRC_DRIVER -I js_parser -I stubs -I ext -I syntax -I depends -I common -I core -I super_errors -I bsb -I outcome_printer -I js_parser -I main -I refmt main = Jsoo_refmt_main diff --git a/lib/4.06.1/bsb.ml b/lib/4.06.1/bsb.ml index 5ea8aaab80..f094e42e5b 100644 --- a/lib/4.06.1/bsb.ml +++ b/lib/4.06.1/bsb.ml @@ -5187,8 +5187,8 @@ let rev_lib_bs_prefix p = rev_lib_bs // p let ocaml_bin_install_prefix p = lib_ocaml // p -let lazy_src_root_dir = "$src_root_dir" -let proj_rel path = lazy_src_root_dir // path + +let proj_rel path = rev_lib_bs // path (** it may not be a bad idea to hard code the binary path of bsb in configuration time @@ -9754,9 +9754,6 @@ let include_dirs_by dirs fn = (Ext_list.flat_map dirs (fun x -> ["-I"; Ext_filename.maybe_quote (fn x)])) -(* we use lazy $src_root_dir *) - - (* It does several conversion: First, it will convert unix path to windows backward on windows platform. @@ -12590,7 +12587,6 @@ let g_pkg_flg = "g_pkg_flg" let bsc = "bsc" -let src_root_dir = "src_root_dir" let bsdep = "bsdep" let bsc_flags = "bsc_flags" @@ -12599,7 +12595,6 @@ let ppx_flags = "ppx_flags" let pp_flags = "pp_flags" - let g_dpkg_incls = "g_dpkg_incls" let refmt = "refmt" @@ -13688,7 +13683,6 @@ let output_ninja_and_namespace_map Bsb_ninja_targets.output_kvs [| Bsb_ninja_global_vars.g_pkg_flg, g_pkg_flg ; - Bsb_ninja_global_vars.src_root_dir, per_proj_dir (* TODO: need check its integrity -- allow relocate or not? *); (* The path to [bsc.exe] independent of config *) Bsb_ninja_global_vars.bsc, (Ext_filename.maybe_quote Bsb_global_paths.vendor_bsc); (* The path to [bsb_heler.exe] *) diff --git a/lib/4.06.1/refmt_main3.ml b/lib/4.06.1/refmt_main3.ml index 19a00af1ed..bf76f8c3cf 100644 --- a/lib/4.06.1/refmt_main3.ml +++ b/lib/4.06.1/refmt_main3.ml @@ -161685,7 +161685,7 @@ let refmt_t = $ heuristics_file $ in_place $ input - +let () = Location.absname := true let () = match Term.eval ((Term.ret refmt_t), top_level_info) with | `Error _ -> exit 1 diff --git a/lib/4.06.1/unstable/bsb_native.ml b/lib/4.06.1/unstable/bsb_native.ml index ffecd150af..4cd9fb9720 100644 --- a/lib/4.06.1/unstable/bsb_native.ml +++ b/lib/4.06.1/unstable/bsb_native.ml @@ -5193,8 +5193,8 @@ let rev_lib_bs_prefix p = rev_lib_bs // p let ocaml_bin_install_prefix p = lib_ocaml // p -let lazy_src_root_dir = "$src_root_dir" -let proj_rel path = lazy_src_root_dir // path + +let proj_rel path = rev_lib_bs // path (** it may not be a bad idea to hard code the binary path of bsb in configuration time @@ -9760,9 +9760,6 @@ let include_dirs_by dirs fn = (Ext_list.flat_map dirs (fun x -> ["-I"; Ext_filename.maybe_quote (fn x)])) -(* we use lazy $src_root_dir *) - - (* It does several conversion: First, it will convert unix path to windows backward on windows platform. @@ -12739,7 +12736,6 @@ let g_pkg_flg = "g_pkg_flg" let bsc = "bsc" -let src_root_dir = "src_root_dir" let bsdep = "bsdep" let bsc_flags = "bsc_flags" @@ -12748,7 +12744,6 @@ let ppx_flags = "ppx_flags" let pp_flags = "pp_flags" - let g_dpkg_incls = "g_dpkg_incls" let refmt = "refmt" @@ -13837,7 +13832,6 @@ let output_ninja_and_namespace_map Bsb_ninja_targets.output_kvs [| Bsb_ninja_global_vars.g_pkg_flg, g_pkg_flg ; - Bsb_ninja_global_vars.src_root_dir, per_proj_dir (* TODO: need check its integrity -- allow relocate or not? *); (* The path to [bsc.exe] independent of config *) Bsb_ninja_global_vars.bsc, (Ext_filename.maybe_quote Bsb_global_paths.vendor_bsc); (* The path to [bsb_heler.exe] *) diff --git a/lib/4.06.1/unstable/js_compiler.ml b/lib/4.06.1/unstable/js_compiler.ml index 302178f613..a6dcdf73a8 100644 --- a/lib/4.06.1/unstable/js_compiler.ml +++ b/lib/4.06.1/unstable/js_compiler.ml @@ -78368,6 +78368,7 @@ let setup_env () = Clflags.no_std_include := true; Warnings.parse_options false Bsc_warnings.defaults_w; Warnings.parse_options true Bsc_warnings.defaults_warn_error; + Location.absname := true; Clflags.dump_location := false; Clflags.compile_only := true; Config.bs_only := true; diff --git a/lib/4.06.1/unstable/js_refmt_compiler.ml b/lib/4.06.1/unstable/js_refmt_compiler.ml index 9a21d43c35..1418d68d28 100644 --- a/lib/4.06.1/unstable/js_refmt_compiler.ml +++ b/lib/4.06.1/unstable/js_refmt_compiler.ml @@ -78368,6 +78368,7 @@ let setup_env () = Clflags.no_std_include := true; Warnings.parse_options false Bsc_warnings.defaults_w; Warnings.parse_options true Bsc_warnings.defaults_warn_error; + Location.absname := true; Clflags.dump_location := false; Clflags.compile_only := true; Config.bs_only := true; diff --git a/lib/4.06.1/whole_compiler.ml b/lib/4.06.1/whole_compiler.ml index ac6b1b9c25..9afa4fe794 100644 --- a/lib/4.06.1/whole_compiler.ml +++ b/lib/4.06.1/whole_compiler.ml @@ -4589,7 +4589,7 @@ let absolute_path s = (* This function could go into Filename *) aux s let show_filename file = - if !absname then absolute_path file else file + if true then absolute_path file else file let print_filename ppf file = Format.fprintf ppf "%s" (show_filename file) @@ -361937,6 +361937,7 @@ let setup_env () = Clflags.no_std_include := true; Warnings.parse_options false Bsc_warnings.defaults_w; Warnings.parse_options true Bsc_warnings.defaults_warn_error; + Location.absname := true; Clflags.dump_location := false; Clflags.compile_only := true; Config.bs_only := true; @@ -362623,7 +362624,7 @@ let read_one_param ppf position name v = set "remove-unused-arguments" [ remove_unused_arguments ] v | "inlining-report" -> - if !native_code then + if false then set "inlining-report" [ inlining_report ] v | "flambda-verbose" -> @@ -362679,7 +362680,7 @@ let read_one_param ppf position name v = | "cmo" | "cma" -> - if not !native_code then + if not false then begin match position with | Before_link | Before_compile _ -> @@ -362689,7 +362690,7 @@ let read_one_param ppf position name v = end | "cmx" | "cmxa" -> - if !native_code then + if false then begin match position with | Before_link | Before_compile _ -> @@ -362699,7 +362700,7 @@ let read_one_param ppf position name v = end | "pic" -> - if !native_code then + if false then set "pic" [ pic_code ] v | "can-discard" -> @@ -362886,7 +362887,7 @@ let process_action else if Filename.check_suffix name Config.ext_obj || Filename.check_suffix name Config.ext_lib then ccobjs := name :: !ccobjs - else if not !native_code && Filename.check_suffix name Config.ext_dll then + else if not false && Filename.check_suffix name Config.ext_dll then dllibs := name :: !dllibs else raise(Arg.Bad("don't know what to do with " ^ name)) diff --git a/scripts/buckle_lto.js b/scripts/buckle_lto.js index 29137af348..ac7d27528a 100644 --- a/scripts/buckle_lto.js +++ b/scripts/buckle_lto.js @@ -7,15 +7,29 @@ var pairs = [ ["Clflags.unsafe_string", "false"], ["Clflags.record_event_when_debug", "false"], ["Clflags.no_std_include", "true"], - ["no_std_include", "true"], ["Clflags.use_threads", "false"], ["Clflags.use_vmthreads", "false"], ["Clflags.no_implicit_current_dir", "true"], ["Clflags.strict_sequence", "true"], ["Clflags.strict_formats", "true"], + ["Location.absname", "true"], ]; -var regexp = RegExp(`${pairs.map((x) => "!" + x[0]).join("|")}`, "g"); +var regexp = RegExp( + `${pairs + .map((x) => { + let result = []; + result.push("!" + x[0]); + let xs = x[0].split("."); + if (xs.length === 2 && xs[1]) { + result.push("!" + xs[1]); + } + return result; + }) + .flat() + .join("|")}`, + "g" +); /** * @@ -24,7 +38,8 @@ var regexp = RegExp(`${pairs.map((x) => "!" + x[0]).join("|")}`, "g"); function transform(s) { return s.replace(regexp, (s) => { for (let [k, v] of pairs) { - if (s.includes(k)) { + if (s.includes(k.split(".")[1])) { + // "bs_only" instead of "Clflags.bs_only" return v; } } @@ -33,7 +48,7 @@ function transform(s) { } // transform('!Config.bs_only && Clflags.native && !Clflags.native') var file = process.argv[2]; -console.log(`post processing file`, file); +console.log(`POST-PROCESSING-FILE:`, file); fs.writeFileSync( file,