diff --git a/CHANGELOG.md b/CHANGELOG.md index 98947a6679..34b4bfb252 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ # 12.0.0-beta.2 (Unreleased) +#### :house: Internal + +- Remove internal/unused `-bs-v` flag. https://github.com/rescript-lang/rescript/pull/7627 + # 12.0.0-beta.1 #### :rocket: New Feature diff --git a/cli/rescript.js b/cli/rescript.js index 731b33143a..64f0ca982e 100755 --- a/cli/rescript.js +++ b/cli/rescript.js @@ -17,8 +17,7 @@ try { if ( subcommand === "build" || subcommand === "watch" || - subcommand === "clean" || - subcommand === "compiler-args" + subcommand === "clean" ) { child_process.execFileSync( rescript_exe, diff --git a/compiler/bsb/bsb_ninja_gen.ml b/compiler/bsb/bsb_ninja_gen.ml index 4d48d676a3..d6dbe62b8a 100644 --- a/compiler/bsb/bsb_ninja_gen.ml +++ b/compiler/bsb/bsb_ninja_gen.ml @@ -66,7 +66,7 @@ let output_static_resources (static_resources : string list) copy_rule oc = (* FIXME: check if the trick still works - phony build.ninja : | resources + phony build.ninja : | resources *) let mark_rescript oc = output_string oc "rescript = 1\n" @@ -197,7 +197,7 @@ let output_ninja_and_namespace_map ~per_proj_dir ~package_kind ~dpkg_incls (* dev dependencies *) ~lib_incls (* its own libs *) ~dev_incls (* its own devs *) - ~bs_dependencies ~bs_dev_dependencies generators + generators in let oc = open_out_bin (cwd_lib_bs // Literals.build_ninja) in diff --git a/compiler/bsb/bsb_ninja_rule.ml b/compiler/bsb/bsb_ninja_rule.ml index 2146cb49b5..f28dd5b53c 100644 --- a/compiler/bsb/bsb_ninja_rule.ml +++ b/compiler/bsb/bsb_ninja_rule.ml @@ -91,8 +91,8 @@ let make_custom_rules ~(gentype_config : Bsb_config_types.gentype_config) ~(jsx : Bsb_jsx.t) ~(digest : string) ~(package_specs : Bsb_package_specs.t) ~(namespace : string option) ~package_name ~warnings ~(ppx_files : Bsb_config_types.ppx list) ~bsc_flags ~(dpkg_incls : string) - ~(lib_incls : string) ~(dev_incls : string) ~bs_dependencies - ~bs_dev_dependencies (custom_rules : command Map_string.t) : builtin = + ~(lib_incls : string) ~(dev_incls : string) + (custom_rules : command Map_string.t) : builtin = let bs_dep = Ext_filename.maybe_quote Bsb_global_paths.vendor_bsdep in let bsc = Ext_filename.maybe_quote Bsb_global_paths.vendor_bsc in (* FIXME: We don't need set [-o ${out}] when building ast @@ -127,11 +127,6 @@ let make_custom_rules ~(gentype_config : Bsb_config_types.gentype_config) Ext_buffer.add_string buf (Bsb_package_specs.package_flag_of_package_specs package_specs ~dirname:"$in_d")); - (match (bs_dependencies, bs_dev_dependencies) with - | [], [] -> () - | _, _ -> - Ext_buffer.add_string buf " -bs-v"; - Ext_buffer.add_ninja_prefix_var buf Bsb_ninja_global_vars.g_finger); Ext_buffer.add_string buf " $i"; (match postbuild with | None -> () @@ -145,8 +140,6 @@ let make_custom_rules ~(gentype_config : Bsb_config_types.gentype_config) Ext_buffer.clear buf; Ext_buffer.add_string buf bsc; Ext_buffer.add_char_string buf ' ' warnings; - Ext_buffer.add_string buf " -bs-v "; - Ext_buffer.add_string buf Bs_version.version; (match ppx_files with | [] -> () | _ -> diff --git a/compiler/bsb/bsb_ninja_rule.mli b/compiler/bsb/bsb_ninja_rule.mli index 9562c57acc..b7678e0c93 100644 --- a/compiler/bsb/bsb_ninja_rule.mli +++ b/compiler/bsb/bsb_ninja_rule.mli @@ -54,7 +54,7 @@ type builtin = { (***********************************************************) (** rules are generally composed of built-in rules and customized rules, there are two design choices: - 1. respect custom rules with the same name, then we need adjust our built-in + 1. respect custom rules with the same name, then we need adjust our built-in rules dynamically in case the conflict. 2. respect our built-in rules, then we only need re-load custom rules for each rescript.json *) @@ -79,7 +79,5 @@ val make_custom_rules : dpkg_incls:string -> lib_incls:string -> dev_incls:string -> - bs_dependencies:Bsb_config_types.dependencies -> - bs_dev_dependencies:Bsb_config_types.dependencies -> command Map_string.t -> builtin diff --git a/compiler/bsc/rescript_compiler_main.ml b/compiler/bsc/rescript_compiler_main.ml index 3cd66e9e3b..8fd209796d 100644 --- a/compiler/bsc/rescript_compiler_main.ml +++ b/compiler/bsc/rescript_compiler_main.ml @@ -302,7 +302,6 @@ let buckle_script_flags : (string * Bsc_args.spec * string) array = Js_config.debug := true; Pp.replace_directive_bool "DEBUG" true), "Debug mode" ); - ("-bs-v", string_call ignore, "*internal* version check to force a rebuild"); ( "-bs-package-name", string_call Js_packages_state.set_package_name, "*internal* Set package name, useful when you want to produce npm \ diff --git a/rewatch/src/build.rs b/rewatch/src/build.rs index dc844a8092..aa3b3a7fd0 100644 --- a/rewatch/src/build.rs +++ b/rewatch/src/build.rs @@ -58,8 +58,6 @@ pub struct CompilerArgs { pub fn get_compiler_args( path: &Path, - rescript_version: Option, - bsc_path: Option, build_dev_deps: bool, ) -> Result { let filename = &helpers::get_abs_path(path); @@ -69,15 +67,6 @@ pub fn get_compiler_args( let root_rescript_config = packages::read_config(&workspace_root.to_owned().unwrap_or(package_root.to_owned()))?; let rescript_config = packages::read_config(&package_root)?; - let rescript_version = if let Some(rescript_version) = rescript_version { - rescript_version - } else { - let bsc_path = match bsc_path { - Some(bsc_path) => helpers::get_abs_path(&bsc_path), - None => helpers::get_bsc(&package_root, &workspace_root), - }; - helpers::get_rescript_version(&bsc_path) - }; // make PathBuf from package root and get the relative path for filename let relative_filename = filename.strip_prefix(PathBuf::from(&package_root)).unwrap(); @@ -89,7 +78,6 @@ pub fn get_compiler_args( &rescript_config, &root_rescript_config, &relative_filename, - &rescript_version, &workspace_root, workspace_root.as_ref().unwrap_or(&package_root), &contents, @@ -106,7 +94,6 @@ pub fn get_compiler_args( &rescript_config, &root_rescript_config, &ast_path, - &rescript_version, &relative_filename, is_interface, has_interface, @@ -141,7 +128,6 @@ pub fn initialize_build( None => helpers::get_bsc(&project_root, &workspace_root), }; let root_config_name = packages::read_package_name(&project_root)?; - let rescript_version = helpers::get_rescript_version(&bsc_path); if !snapshot_output && show_progress { print!("{} {}Building package tree...", style("[1/7]").bold().dim(), TREE); @@ -190,7 +176,6 @@ pub fn initialize_build( root_config_name, packages, workspace_root, - rescript_version, bsc_path, ); packages::parse_packages(&mut build_state); diff --git a/rewatch/src/build/build_types.rs b/rewatch/src/build/build_types.rs index 956cc5e159..da1d976648 100644 --- a/rewatch/src/build/build_types.rs +++ b/rewatch/src/build/build_types.rs @@ -94,7 +94,6 @@ pub struct BuildState { pub project_root: PathBuf, pub root_config_name: String, pub deleted_modules: AHashSet, - pub rescript_version: String, pub bsc_path: PathBuf, pub workspace_root: Option, pub deps_initialized: bool, @@ -113,7 +112,6 @@ impl BuildState { root_config_name: String, packages: AHashMap, workspace_root: Option, - rescript_version: String, bsc_path: PathBuf, ) -> Self { Self { @@ -124,7 +122,6 @@ impl BuildState { root_config_name, deleted_modules: AHashSet::new(), workspace_root, - rescript_version, bsc_path, deps_initialized: false, } diff --git a/rewatch/src/build/clean.rs b/rewatch/src/build/clean.rs index 8a09bef035..bfa7419f9b 100644 --- a/rewatch/src/build/clean.rs +++ b/rewatch/src/build/clean.rs @@ -354,7 +354,6 @@ pub fn clean( None => helpers::get_bsc(&project_root, &workspace_root), }; - let rescript_version = helpers::get_rescript_version(&bsc_path); let timing_clean_compiler_assets = Instant::now(); if !snapshot_output && show_progress { @@ -412,7 +411,6 @@ pub fn clean( root_config_name, packages, workspace_root, - rescript_version, bsc_path, ); packages::parse_packages(&mut build_state); diff --git a/rewatch/src/build/compile.rs b/rewatch/src/build/compile.rs index 5ee1ff9425..6f8f8e9327 100644 --- a/rewatch/src/build/compile.rs +++ b/rewatch/src/build/compile.rs @@ -165,7 +165,6 @@ pub fn compile( root_package, &helpers::get_ast_path(&path), module, - &build_state.rescript_version, true, &build_state.bsc_path, &build_state.packages, @@ -182,7 +181,6 @@ pub fn compile( root_package, &helpers::get_ast_path(&source_file.implementation.path), module, - &build_state.rescript_version, false, &build_state.bsc_path, &build_state.packages, @@ -354,7 +352,6 @@ pub fn compiler_args( config: &config::Config, root_config: &config::Config, ast_path: &Path, - version: &str, file_path: &Path, is_interface: bool, has_interface: bool, @@ -475,7 +472,6 @@ pub fn compiler_args( // "-I".to_string(), // abs_node_modules_path.to_string() + "/rescript/ocaml", // ], - vec!["-bs-v".to_string(), format!("{}", version)], vec![ast_path.to_string_lossy().to_string()], ] .concat() @@ -568,7 +564,6 @@ fn compile_file( root_package: &packages::Package, ast_path: &Path, module: &Module, - version: &str, is_interface: bool, bsc_path: &Path, packages: &AHashMap, @@ -592,7 +587,6 @@ fn compile_file( &package.config, &root_package.config, ast_path, - version, implementation_file_path, is_interface, has_interface, diff --git a/rewatch/src/build/parse.rs b/rewatch/src/build/parse.rs index 65ea9b771b..696c7655bb 100644 --- a/rewatch/src/build/parse.rs +++ b/rewatch/src/build/parse.rs @@ -52,7 +52,6 @@ pub fn generate_asts( package.to_owned(), root_package.to_owned(), &source_file.implementation.path.to_owned(), - &build_state.rescript_version, &build_state.bsc_path, &build_state.workspace_root, ); @@ -62,7 +61,6 @@ pub fn generate_asts( package.to_owned(), root_package.to_owned(), &interface_file_path.to_owned(), - &build_state.rescript_version, &build_state.bsc_path, &build_state.workspace_root, ) @@ -249,7 +247,6 @@ pub fn parser_args( config: &config::Config, root_config: &config::Config, filename: &Path, - version: &str, workspace_root: &Option, root_path: &Path, contents: &str, @@ -276,7 +273,6 @@ pub fn parser_args( ( ast_path.to_owned(), [ - vec!["-bs-v".to_string(), format!("{}", version)], ppx_flags, jsx_args, jsx_module_args, @@ -299,7 +295,6 @@ fn generate_ast( package: packages::Package, root_package: packages::Package, filename: &Path, - version: &str, bsc_path: &PathBuf, workspace_root: &Option, ) -> Result<(PathBuf, Option), String> { @@ -311,7 +306,6 @@ fn generate_ast( &package.config, &root_package.config, filename, - version, workspace_root, &root_package.path, &contents, diff --git a/rewatch/src/cli.rs b/rewatch/src/cli.rs index d588c1243c..8661b0ff1b 100644 --- a/rewatch/src/cli.rs +++ b/rewatch/src/cli.rs @@ -180,13 +180,6 @@ pub enum Command { #[command(flatten)] dev: DevArg, - - /// To be used in conjunction with compiler_args - #[arg(long)] - rescript_version: Option, - - #[command(flatten)] - bsc_path: BscPathArg, }, /// Use the legacy build system. /// diff --git a/rewatch/src/helpers.rs b/rewatch/src/helpers.rs index c1322d3bdb..ce75919e7b 100644 --- a/rewatch/src/helpers.rs +++ b/rewatch/src/helpers.rs @@ -5,7 +5,6 @@ use std::fs::File; use std::io::Read; use std::io::{self, BufRead}; use std::path::{Component, Path, PathBuf}; -use std::process::Command; use std::time::{SystemTime, UNIX_EPOCH}; pub type StdErr = String; @@ -408,18 +407,6 @@ pub fn get_nearest_config(path_buf: &Path) -> Option { } } -pub fn get_rescript_version(bsc_path: &Path) -> String { - let version_cmd = Command::new(bsc_path) - .args(["-v"]) - .output() - .expect("failed to find version"); - - std::str::from_utf8(&version_cmd.stdout) - .expect("Could not read version from rescript") - .replace('\n', "") - .replace("ReScript ", "") -} - pub fn read_file(path: &Path) -> Result { let mut file = File::open(path).expect("file not found"); let mut contents = String::new(); diff --git a/rewatch/src/main.rs b/rewatch/src/main.rs index 211d60ae96..f6379ceeaf 100644 --- a/rewatch/src/main.rs +++ b/rewatch/src/main.rs @@ -30,15 +30,11 @@ fn main() -> Result<()> { cli::Command::CompilerArgs { path, dev, - rescript_version, - bsc_path, } => { println!( "{}", build::get_compiler_args( Path::new(&path), - rescript_version, - bsc_path.as_ref().map(PathBuf::from), *dev )? );