Skip to content

Commit 3f1b44a

Browse files
committed
No need to support check version: there's only one.
1 parent 80ee525 commit 3f1b44a

File tree

3 files changed

+10
-34
lines changed

3 files changed

+10
-34
lines changed

jscomp/gentype/Config_.ml

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ let rec findProjectRoot ~dir =
9999
assert false)
100100
else findProjectRoot ~dir:parent
101101

102-
let readConfig ~bsVersion ~getBsConfigFile ~namespace =
102+
let readConfig ~getBsConfigFile ~namespace =
103103
let projectRoot = findProjectRoot ~dir:(Sys.getcwd ()) in
104104
let bsbProjectRoot =
105105
match Sys.getenv_opt "BSB_PROJECT_ROOT" with
@@ -145,37 +145,19 @@ let readConfig ~bsVersion ~getBsConfigFile ~namespace =
145145
| Some b -> b
146146
in
147147
let generatedFileExtension = generatedFileExtensionStringOption in
148-
let bsVersion =
149-
match bsVersion with
150-
| None -> (0, 0, 0)
151-
| Some s -> (
152-
match s |> Str.split (Str.regexp (Str.quote ".")) with
153-
| x1 :: x2 :: x3 :: _ ->
154-
let v1 = int_of_string x1 in
155-
let v2 = int_of_string x2 in
156-
let v3 =
157-
match x3 |> Str.split (Str.regexp "-") with
158-
| x3 :: _ -> int_of_string x3
159-
| _ -> 0
160-
in
161-
(v1, v2, v3)
162-
| _ -> (0, 0, 0))
163-
in
164148
let externalStdlib = bsconf |> getStringOption "external-stdlib" in
165-
let v1, v2, v3 = bsVersion in
166149
let platformLib =
167150
match externalStdlib with
168-
| None -> if v1 >= 9 && v2 >= 1 then "rescript" else "bs-platform"
151+
| None -> "rescript"
169152
| Some externalStdlib -> externalStdlib
170153
in
171154
if !Debug.config then (
172155
Log_.item "Project root: %s\n" projectRoot;
173156
if bsbProjectRoot <> projectRoot then
174157
Log_.item "bsb project root: %s\n" bsbProjectRoot;
175-
Log_.item "Config module:%s shims:%d entries bsVersion:%d.%d.%d\n"
158+
Log_.item "Config module:%s shims:%d entries \n"
176159
(match moduleString with None -> "" | Some s -> s)
177-
(shimsMap |> ModuleNameMap.cardinal)
178-
v1 v2 v3);
160+
(shimsMap |> ModuleNameMap.cardinal));
179161
let namespace =
180162
match bsconf |> getOpt "namespace" with
181163
| Some (True _) -> namespace

jscomp/gentype/GenType.ml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ let signFile s = s
44
type cliCommand = Add of string | Clean | NoOp | Rm of string list
55

66
let cli () =
7-
let bsVersion = ref None in
87
let cliCommand = ref NoOp in
9-
let setBsVersion s = bsVersion := Some s in
108
let usage = "genType version " ^ version in
119
let versionAndExit () =
1210
print_endline usage;
@@ -23,7 +21,6 @@ let cli () =
2321
and setClean () = Clean |> setCliCommand
2422
and speclist =
2523
[
26-
("-bs-version", Arg.String setBsVersion, "set the bucklescript version");
2724
("-clean", Arg.Unit setClean, "clean all the generated files");
2825
("-cmt-add", Arg.String setAdd, "compile a .cmt[i] file");
2926
( "-cmt-rm",
@@ -33,7 +30,7 @@ let cli () =
3330
("--version", Arg.Unit versionAndExit, "show version information and exit");
3431
]
3532
in
36-
let executeCliCommand ~bsVersion cliCommand =
33+
let executeCliCommand cliCommand =
3734
match cliCommand with
3835
| Add s ->
3936
Log_.Color.forceColor := true;
@@ -45,14 +42,12 @@ let cli () =
4542
(cmt, mlast)
4643
| _ -> assert false
4744
in
48-
let config =
49-
Paths.readConfig ~bsVersion ~namespace:(cmt |> Paths.findNameSpace)
50-
in
45+
let config = Paths.readConfig ~namespace:(cmt |> Paths.findNameSpace) in
5146
if !Debug.basic then Log_.item "Add %s %s\n" cmt mlast;
5247
cmt |> GenTypeMain.processCmtFile ~signFile ~config;
5348
exit 0
5449
| Clean ->
55-
let config = Paths.readConfig ~bsVersion ~namespace:None in
50+
let config = Paths.readConfig ~namespace:None in
5651
let sourceDirs = ModuleResolver.readSourceDirs ~config in
5752
if !Debug.basic then
5853
Log_.item "Clean %d dirs\n" (sourceDirs.dirs |> List.length);
@@ -83,7 +78,7 @@ let cli () =
8378
(* somehow the CMT hook is passing an absolute path here *)
8479
let cmt = cmtAbsolutePath |> Paths.relativePathFromBsLib in
8580
let config =
86-
Paths.readConfig ~bsVersion ~namespace:(cmt |> Paths.findNameSpace)
81+
Paths.readConfig ~namespace:(cmt |> Paths.findNameSpace)
8782
in
8883
let outputFile = cmt |> Paths.getOutputFile ~config in
8984
if !Debug.basic then Log_.item "Remove %s\n" cmt;
@@ -98,7 +93,7 @@ let cli () =
9893
| _ -> print_endline s
9994
in
10095
Arg.parse speclist anonArg usage;
101-
executeCliCommand ~bsVersion:!bsVersion !cliCommand
96+
executeCliCommand !cliCommand
10297
;;
10398

10499
cli ()

jscomp/gentype/Paths.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,4 @@ let relativePathFromBsLib fileName =
8383
| [] -> fileName
8484
| root :: dirs -> dirs |> List.fold_left concat root
8585

86-
let readConfig ~bsVersion ~namespace =
87-
Config.readConfig ~bsVersion ~getBsConfigFile ~namespace
86+
let readConfig ~namespace = Config.readConfig ~getBsConfigFile ~namespace

0 commit comments

Comments
 (0)