@@ -11,21 +11,26 @@ let makePathsForModule ~projectFilesAndPaths ~dependenciesFilesAndPaths =
1111 Hashtbl. replace pathsForModule modName paths);
1212 pathsForModule
1313
14+ let overrideRescriptVersion = ref None
15+
1416let getReScriptVersion () =
15- (* TODO: Include patch stuff when needed *)
16- let defaultVersion = (11 , 0 ) in
17- try
18- let value = Sys. getenv " RESCRIPT_VERSION" in
19- let version =
20- match value |> String. split_on_char '.' with
21- | major :: minor :: _rest -> (
22- match (int_of_string_opt major, int_of_string_opt minor) with
23- | Some major , Some minor -> (major, minor)
24- | _ -> defaultVersion)
25- | _ -> defaultVersion
26- in
27- version
28- with Not_found -> defaultVersion
17+ match ! overrideRescriptVersion with
18+ | Some overrideRescriptVersion -> overrideRescriptVersion
19+ | None -> (
20+ (* TODO: Include patch stuff when needed *)
21+ let defaultVersion = (11 , 0 ) in
22+ try
23+ let value = Sys. getenv " RESCRIPT_VERSION" in
24+ let version =
25+ match value |> String. split_on_char '.' with
26+ | major :: minor :: _rest -> (
27+ match (int_of_string_opt major, int_of_string_opt minor) with
28+ | Some major , Some minor -> (major, minor)
29+ | _ -> defaultVersion)
30+ | _ -> defaultVersion
31+ in
32+ version
33+ with Not_found -> defaultVersion)
2934
3035let newBsPackage ~rootPath =
3136 let rescriptJson = Filename. concat rootPath " rescript.json" in
0 commit comments