Skip to content

Commit 725b213

Browse files
committed
toplevel pinned dependencies should trigger the build of dev dependencies
1 parent e6305a3 commit 725b213

File tree

6 files changed

+294
-264
lines changed

6 files changed

+294
-264
lines changed

jscomp/bsb/bsb_build_util.ml

+14-5
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ let rec walk_all_deps_aux
182182
(paths : string list)
183183
~(top : top)
184184
(dir : string)
185-
(queue : _ Queue.t) =
185+
(queue : _ Queue.t)
186+
~pinned_dependencies =
186187
let bsconfig_json = dir // Literals.bsconfig_json in
187188
match Ext_json_parse.parse_json_from_file bsconfig_json with
188189
| Obj {map; loc} ->
@@ -223,7 +224,8 @@ let rec walk_all_deps_aux
223224
let package_dir =
224225
Bsb_pkg.resolve_bs_package ~cwd:dir
225226
(Bsb_pkg_types.string_as_package new_package) in
226-
walk_all_deps_aux visited package_stacks ~top:(Expect_name new_package) package_dir queue ;
227+
walk_all_deps_aux visited package_stacks ~top:(Expect_name new_package) package_dir queue
228+
~pinned_dependencies ;
227229
| _ ->
228230
Bsb_exception.errorf ~loc
229231
"%s expect an array"
@@ -232,15 +234,22 @@ let rec walk_all_deps_aux
232234
|> ignore in
233235
begin
234236
explore_deps Bsb_build_schemas.bs_dependencies;
235-
if top = Expect_none then explore_deps Bsb_build_schemas.bs_dev_dependencies;
237+
begin match top with
238+
| Expect_none ->
239+
explore_deps Bsb_build_schemas.bs_dev_dependencies
240+
| Expect_name n when
241+
Set_string.mem pinned_dependencies n ->
242+
explore_deps Bsb_build_schemas.bs_dev_dependencies
243+
| Expect_name _ -> ()
244+
end;
236245
Queue.add {top ; proj_dir = dir} queue;
237246
Hash_string.add visited cur_package_name dir;
238247
end
239248
| _ -> ()
240249

241250

242-
let walk_all_deps dir : package_context Queue.t =
251+
let walk_all_deps dir ~pinned_dependencies : package_context Queue.t =
243252
let visited = Hash_string.create 0 in
244253
let cb = Queue.create () in
245-
walk_all_deps_aux visited [] ~top:Expect_none dir cb ;
254+
walk_all_deps_aux visited [] ~top:Expect_none dir cb ~pinned_dependencies;
246255
cb

jscomp/bsb/bsb_build_util.mli

+1
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,6 @@ type package_context = {
109109

110110
val walk_all_deps :
111111
string ->
112+
pinned_dependencies:Set_string.t ->
112113
package_context Queue.t
113114

jscomp/bsb/bsb_clean.ml

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ let clean_bs_garbage proj_dir =
5555

5656

5757
let clean_bs_deps proj_dir =
58+
let _, pinned_dependencies = Bsb_config_parse.package_specs_from_bsconfig () in
5859
let queue =
59-
Bsb_build_util.walk_all_deps proj_dir in
60+
Bsb_build_util.walk_all_deps proj_dir ~pinned_dependencies in
6061
Queue.iter (fun (pkg_cxt : Bsb_build_util.package_context )->
6162
(* whether top or not always do the cleaning *)
6263
clean_bs_garbage pkg_cxt.proj_dir

jscomp/bsb/bsb_world.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ let make_world_deps cwd (config : Bsb_config_types.t option) (ninja_args : strin
4444
in
4545
let lib_artifacts_dir = Bsb_config.lib_bs in
4646
let queue =
47-
Bsb_build_util.walk_all_deps cwd in
47+
Bsb_build_util.walk_all_deps cwd ~pinned_dependencies in
4848
(* let oc = open_out_bin ".deps.log" in
4949
queue |> Queue.iter (fun ({top; proj_dir} : Bsb_build_util.package_context) ->
5050
match top with

0 commit comments

Comments
 (0)