Skip to content

Commit 76f9e00

Browse files
authored
Remove all leftovers of pinned-dependencies handling (#7686)
* Remove all leftovers of pinned-dependencies handling * Remove transitive_pinned_dependency1 * Rename transitive_pinned_dependency2 * Remove pinned-dependencies from rewatch testrepo * CHANGELOG
1 parent 61911cb commit 76f9e00

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+58
-312
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
- Add rust linting to CI with `clippy`. https://github.com/rescript-lang/rescript/pull/7675
3030
- AST: use `Typ.arrows` for creation, after the refactoring of arrow types. https://github.com/rescript-lang/rescript/pull/7662
3131
- Don't skip Stdlib docstring tests. https://github.com/rescript-lang/rescript/pull/7694
32+
- Remove all leftovers of pinned-dependencies handling. https://github.com/rescript-lang/rescript/pull/7686
3233

3334
#### :bug: Bug fix
3435

analysis/examples/workspace-project/bsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@
77
"in-source": true
88
},
99
"suffix": ".mjs",
10-
"pinned-dependencies": ["common", "myplugin", "app"],
1110
"bs-dependencies": ["common", "myplugin", "app"]
1211
}

compiler/bsb/bsb_build_schemas.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ let ppx_flags = "ppx-flags"
2828
let pp_flags = "pp-flags"
2929
let bs_external_includes = "bs-external-includes"
3030
let bs_dependencies = "bs-dependencies"
31-
let pinned_dependencies = "pinned-dependencies"
3231
let bs_dev_dependencies = "bs-dev-dependencies"
3332
let sources = "sources"
3433
let dir = "dir"

compiler/bsb/bsb_build_util.ml

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ let ( |? ) m (key, cb) = m |> Ext_json.test key cb
132132

133133
type top = Expect_none | Expect_name of string
134134

135-
type package_context = {proj_dir: string; top: top; is_pinned: bool}
135+
type package_context = {proj_dir: string; top: top}
136136

137137
(**
138138
TODO: check duplicate package name
@@ -148,15 +148,8 @@ type package_context = {proj_dir: string; top: top; is_pinned: bool}
148148
let pp_packages_rev ppf lst =
149149
Ext_list.rev_iter lst (fun s -> Format.fprintf ppf "%s " s)
150150

151-
let extract_pinned_dependencies (map : Ext_json_types.t Map_string.t) :
152-
Set_string.t =
153-
match Map_string.find_opt map Bsb_build_schemas.pinned_dependencies with
154-
| None -> Set_string.empty
155-
| Some (Arr {content}) -> Set_string.of_list (get_list_string content)
156-
| Some config -> Bsb_exception.config_error config "expect an array of string"
157-
158151
let rec walk_all_deps_aux (visited : string Hash_string.t) (paths : string list)
159-
~(top : top) (dir : string) (queue : _ Queue.t) ~pinned_dependencies =
152+
~(top : top) (dir : string) (queue : _ Queue.t) =
160153
match
161154
Bsb_config_load.load_json ~per_proj_dir:dir ~warn_legacy_config:false
162155
with
@@ -182,7 +175,7 @@ let rec walk_all_deps_aux (visited : string Hash_string.t) (paths : string list)
182175
if Hash_string.mem visited cur_package_name then
183176
Bsb_log.info "@{<info>Visited before@} %s@." cur_package_name
184177
else
185-
let explore_deps (deps : string) pinned_dependencies =
178+
let explore_deps (deps : string) =
186179
map
187180
|? ( deps,
188181
`Arr
@@ -196,38 +189,20 @@ let rec walk_all_deps_aux (visited : string Hash_string.t) (paths : string list)
196189
in
197190
walk_all_deps_aux visited package_stacks
198191
~top:(Expect_name new_package) package_dir queue
199-
~pinned_dependencies
200192
| _ -> Bsb_exception.errorf ~loc "%s expect an array" deps))
201193
)
202194
|> ignore
203195
in
204-
let is_pinned =
205-
match top with
206-
| Expect_name n when Set_string.mem pinned_dependencies n -> true
207-
| _ -> false
208-
in
209-
let pinned_dependencies =
210-
match is_pinned with
211-
| true ->
212-
let transitive_pinned_dependencies =
213-
extract_pinned_dependencies map
214-
in
215-
Set_string.union transitive_pinned_dependencies pinned_dependencies
216-
| false -> pinned_dependencies
217-
in
218-
explore_deps Bsb_build_schemas.bs_dependencies pinned_dependencies;
196+
explore_deps Bsb_build_schemas.bs_dependencies;
219197
(match top with
220-
| Expect_none ->
221-
explore_deps Bsb_build_schemas.bs_dev_dependencies pinned_dependencies
222-
| Expect_name _ when is_pinned ->
223-
explore_deps Bsb_build_schemas.bs_dev_dependencies pinned_dependencies
198+
| Expect_none -> explore_deps Bsb_build_schemas.bs_dev_dependencies
224199
| Expect_name _ -> ());
225-
Queue.add {top; proj_dir = dir; is_pinned} queue;
200+
Queue.add {top; proj_dir = dir} queue;
226201
Hash_string.add visited cur_package_name dir
227202
| _ -> ()
228203

229-
let walk_all_deps dir ~pinned_dependencies : package_context Queue.t =
204+
let walk_all_deps dir : package_context Queue.t =
230205
let visited = Hash_string.create 0 in
231206
let cb = Queue.create () in
232-
walk_all_deps_aux visited [] ~top:Expect_none dir cb ~pinned_dependencies;
207+
walk_all_deps_aux visited [] ~top:Expect_none dir cb;
233208
cb

compiler/bsb/bsb_build_util.mli

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* but WITHOUT ANY WARRANTY; without even the implied warranty of
1818
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1919
* GNU Lesser General Public License for more details.
20-
*
20+
*
2121
* You should have received a copy of the GNU Lesser General Public License
2222
* along with this program; if not, write to the Free Software
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
@@ -82,9 +82,6 @@ type result = {path: string; checked: bool}
8282
*)
8383
val resolve_bsb_magic_file : cwd:string -> desc:string -> string -> result
8484

85-
type package_context = {proj_dir: string; top: top; is_pinned: bool}
86-
87-
val extract_pinned_dependencies : Ext_json_types.t Map_string.t -> Set_string.t
85+
type package_context = {proj_dir: string; top: top}
8886

89-
val walk_all_deps :
90-
string -> pinned_dependencies:Set_string.t -> package_context Queue.t
87+
val walk_all_deps : string -> package_context Queue.t

compiler/bsb/bsb_clean.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ let clean_bs_garbage proj_dir =
5151
Bsb_log.warn "@{<warning>Failed@} to clean due to %s" (Printexc.to_string e)
5252

5353
let clean_bs_deps proj_dir =
54-
let _, _, pinned_dependencies = Bsb_config_parse.deps_from_bsconfig () in
55-
let queue = Bsb_build_util.walk_all_deps proj_dir ~pinned_dependencies in
54+
let _, _ = Bsb_config_parse.deps_from_bsconfig () in
55+
let queue = Bsb_build_util.walk_all_deps proj_dir in
5656
Queue.iter
5757
(fun (pkg_cxt : Bsb_build_util.package_context) ->
5858
(* whether top or not always do the cleaning *)

compiler/bsb/bsb_config_parse.ml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,11 @@ let interpret_json ~(filename : string) ~(json : Ext_json_types.t)
242242
in
243243
let bs_dev_dependencies =
244244
match package_kind with
245-
| Toplevel | Pinned_dependency _ ->
245+
| Toplevel ->
246246
extract_dependencies map per_proj_dir
247247
Bsb_build_schemas.bs_dev_dependencies
248248
| Dependency _ -> []
249249
in
250-
let pinned_dependencies = Bsb_build_util.extract_pinned_dependencies map in
251250
match map.?(Bsb_build_schemas.sources) with
252251
| Some sources ->
253252
let cut_generators =
@@ -263,12 +262,10 @@ let interpret_json ~(filename : string) ~(json : Ext_json_types.t)
263262
let jsx = Bsb_jsx.from_map map in
264263
let jsx, bsc_flags =
265264
match package_kind with
266-
| Pinned_dependency x | Dependency x ->
267-
({jsx with version = x.jsx.version}, bsc_flags)
265+
| Dependency x -> ({jsx with version = x.jsx.version}, bsc_flags)
268266
| Toplevel -> (jsx, bsc_flags)
269267
in
270268
{
271-
pinned_dependencies;
272269
gentype_config;
273270
package_name;
274271
namespace;
@@ -294,7 +291,7 @@ let interpret_json ~(filename : string) ~(json : Ext_json_types.t)
294291
package_specs =
295292
(match package_kind with
296293
| Toplevel -> Bsb_package_specs.from_map ~cwd:per_proj_dir map
297-
| Pinned_dependency x | Dependency x -> x.package_specs);
294+
| Dependency x -> x.package_specs);
298295
file_groups = groups;
299296
files_to_install = Queue.create ();
300297
jsx;
@@ -311,8 +308,5 @@ let deps_from_bsconfig () =
311308
match
312309
Bsb_config_load.load_json ~per_proj_dir:cwd ~warn_legacy_config:false
313310
with
314-
| _, Obj {map} ->
315-
( Bsb_package_specs.from_map ~cwd map,
316-
Bsb_jsx.from_map map,
317-
Bsb_build_util.extract_pinned_dependencies map )
311+
| _, Obj {map} -> (Bsb_package_specs.from_map ~cwd map, Bsb_jsx.from_map map)
318312
| _, _ -> assert false

compiler/bsb/bsb_config_parse.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* along with this program; if not, write to the Free Software
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424

25-
val deps_from_bsconfig : unit -> Bsb_package_specs.t * Bsb_jsx.t * Set_string.t
25+
val deps_from_bsconfig : unit -> Bsb_package_specs.t * Bsb_jsx.t
2626

2727
val interpret_json :
2828
filename:string ->

compiler/bsb/bsb_config_types.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ type t = {
4141
pp_file: string option;
4242
bs_dependencies: dependencies;
4343
bs_dev_dependencies: dependencies;
44-
pinned_dependencies: Set_string.t;
4544
warning: Bsb_warning.t;
4645
(*TODO: maybe we should always resolve rescript
4746
so that we can calculate correct relative path in

compiler/bsb/bsb_ninja_regen.ml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,7 @@ let regenerate_ninja ~(package_kind : Bsb_package_kind.t) ~forced ~per_proj_dir
8888
Bsb_watcher_gen.generate_sourcedirs_meta
8989
~name:(lib_bs_dir // Literals.sourcedirs_meta)
9090
config.file_groups
91-
| Pinned_dependency _ (* FIXME: seems need to be watched *) | Dependency _
92-
->
93-
());
91+
| Dependency _ -> ());
9492

9593
Bsb_ninja_gen.output_ninja_and_namespace_map ~per_proj_dir ~package_kind
9694
config;

0 commit comments

Comments
 (0)