Skip to content

Commit a97c016

Browse files
committed
make sure filenames are unique across the project
1 parent 05aa0f9 commit a97c016

37 files changed

+248
-242
lines changed

jscomp/bin/whole_compiler.ml

+6-6
Original file line numberDiff line numberDiff line change
@@ -63271,14 +63271,14 @@ let string_of_module_id
6327163271
| Ml ->
6327263272
let id = x.id in
6327363273
let js_file = Ext_namespace.js_name_of_basename id.name in
63274-
let rebase different_package package_dir dep =
63274+
let rebase ~dependency ~different_package package_dir=
6327563275
let current_unit_dir =
6327663276
`Dir (get_output_dir
6327763277
~pkg_dir:package_dir module_system
6327863278
~hint_output_dir
6327963279
current_package_info
6328063280
) in
63281-
Ext_filename.node_relative_path different_package current_unit_dir dep
63281+
Ext_filename.node_relative_path different_package current_unit_dir dependency
6328263282
in
6328363283
let cmj_path, dependency_pkg_info =
6328463284
match get_package_path_from_cmj x with
@@ -63313,7 +63313,7 @@ let string_of_module_id
6331363313
Package_found(current_package, path) ->
6331463314
if current_package = package_name then
6331563315
let package_dir = Lazy.force Ext_filename.package_dir in
63316-
rebase false package_dir (`File (package_dir // x // js_file))
63316+
rebase ~different_package:false package_dir ~dependency:(`File (package_dir // x // js_file))
6331763317
else
6331863318
begin match module_system with
6331963319
| AmdJS | NodeJS | Es6 ->
@@ -63343,7 +63343,7 @@ let string_of_module_id
6334363343
->
6334463344
if current_package = package_name then
6334563345
let package_dir = Lazy.force Ext_filename.package_dir in
63346-
rebase false package_dir (`File (
63346+
rebase ~different_package:false package_dir ~dependency:(`File (
6334763347
package_dir // x // js_file))
6334863348
else
6334963349
package_name // x // js_file
@@ -63357,7 +63357,7 @@ let string_of_module_id
6335763357
begin match Config_util.find_opt js_file with
6335863358
| Some file ->
6335963359
let package_dir = Lazy.force Ext_filename.package_dir in
63360-
rebase true package_dir (`File file)
63360+
rebase ~different_package:true package_dir ~dependency:(`File file)
6336163361
(* Code path: when dependency is commonjs
6336263362
while depedent is Empty or PackageScript
6336363363
*)
@@ -70194,7 +70194,7 @@ type t = {
7019470194
npm_package_path : Js_packages_info.t ;
7019570195
}
7019670196

70197-
let cmj_magic_number = "BUCKLE20170811"
70197+
let cmj_magic_number = "BUCKLE20170901"
7019870198
let cmj_magic_number_length =
7019970199
String.length cmj_magic_number
7020070200

jscomp/core/js_cmj_format.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ type t = {
5050
npm_package_path : Js_packages_info.t ;
5151
}
5252

53-
let cmj_magic_number = "BUCKLE20170811"
53+
let cmj_magic_number = "BUCKLE20170901"
5454
let cmj_magic_number_length =
5555
String.length cmj_magic_number
5656

jscomp/core/js_packages_info.ml

+5-5
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,14 @@ let string_of_module_id
204204
| Ml ->
205205
let id = x.id in
206206
let js_file = Ext_namespace.js_name_of_basename id.name in
207-
let rebase different_package package_dir dep =
207+
let rebase ~dependency ~different_package package_dir=
208208
let current_unit_dir =
209209
`Dir (get_output_dir
210210
~pkg_dir:package_dir module_system
211211
~hint_output_dir
212212
current_package_info
213213
) in
214-
Ext_filename.node_relative_path different_package current_unit_dir dep
214+
Ext_filename.node_relative_path different_package current_unit_dir dependency
215215
in
216216
let cmj_path, dependency_pkg_info =
217217
match get_package_path_from_cmj x with
@@ -246,7 +246,7 @@ let string_of_module_id
246246
Package_found(current_package, path) ->
247247
if current_package = package_name then
248248
let package_dir = Lazy.force Ext_filename.package_dir in
249-
rebase false package_dir (`File (package_dir // x // js_file))
249+
rebase ~different_package:false package_dir ~dependency:(`File (package_dir // x // js_file))
250250
else
251251
begin match module_system with
252252
| AmdJS | NodeJS | Es6 ->
@@ -276,7 +276,7 @@ let string_of_module_id
276276
->
277277
if current_package = package_name then
278278
let package_dir = Lazy.force Ext_filename.package_dir in
279-
rebase false package_dir (`File (
279+
rebase ~different_package:false package_dir ~dependency:(`File (
280280
package_dir // x // js_file))
281281
else
282282
package_name // x // js_file
@@ -290,7 +290,7 @@ let string_of_module_id
290290
begin match Config_util.find_opt js_file with
291291
| Some file ->
292292
let package_dir = Lazy.force Ext_filename.package_dir in
293-
rebase true package_dir (`File file)
293+
rebase ~different_package:true package_dir ~dependency:(`File file)
294294
(* Code path: when dependency is commonjs
295295
while depedent is Empty or PackageScript
296296
*)

jscomp/test/.depend

+22-20
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ config2_test.cmi : ../runtime/js.cmi
99
const_block_test.cmi :
1010
demo_int_map.cmi :
1111
derive_projector_test.cmi :
12-
ext_pervasives.cmi : ../stdlib/int32.cmi ../stdlib/format.cmi
13-
ext_sys.cmi :
12+
ext_pervasives_test.cmi : ../stdlib/int32.cmi ../stdlib/format.cmi
13+
ext_sys_test.cmi :
1414
float_record.cmi :
1515
flow_parser_reg_test.cmi :
1616
gpr_405_test.cmi :
@@ -42,11 +42,11 @@ ui_defs.cmi :
4242
unsafe_this.cmi : ../runtime/js.cmi
4343
a.cmj : test_order.cmj ../stdlib/string.cmj ../stdlib/set.cmj \
4444
../stdlib/list.cmj
45-
a_filename_test.cmj : mt.cmj ext_filename.cmj ../stdlib/array.cmj
46-
a_list_test.cmj : mt.cmj ext_list.cmj
45+
a_filename_test.cmj : mt.cmj ext_filename_test.cmj ../stdlib/array.cmj
46+
a_list_test.cmj : mt.cmj ext_list_test.cmj
4747
a_recursive_type.cmj : a_recursive_type.cmi
4848
a_scope_bug.cmj :
49-
a_string_test.cmj : mt.cmj ../stdlib/list.cmj ext_string.cmj
49+
a_string_test.cmj : mt.cmj ../stdlib/list.cmj ext_string_test.cmj
5050
abstract_type.cmj : abstract_type.cmi
5151
alias_test.cmj : ../stdlib/string.cmj alias_test.cmi
5252
and_or_tailcall_test.cmj : mt.cmj
@@ -137,7 +137,7 @@ derive_dyntype.cmj : ../others/bs_dyn.cmj
137137
derive_projector_test.cmj : derive_projector_test.cmi
138138
derive_type_test.cmj :
139139
digest_test.cmj : ../stdlib/string.cmj ../stdlib/printf.cmj mt.cmj \
140-
ext_array.cmj ../stdlib/digest.cmj ../stdlib/array.cmj
140+
ext_array_test.cmj ../stdlib/digest.cmj ../stdlib/array.cmj
141141
div_by_zero_test.cmj : mt.cmj ../stdlib/int64.cmj ../stdlib/int32.cmj
142142
dollar_escape_test.cmj : mt.cmj
143143
earger_curry_test.cmj : mt.cmj ../runtime/js.cmj ../stdlib/array.cmj
@@ -158,20 +158,22 @@ exception_repr_test.cmj : ../stdlib/printexc.cmj mt.cmj ../stdlib/format.cmj \
158158
exception_value_test.cmj : ../runtime/js.cmj
159159
exn_error_pattern.cmj :
160160
export_keyword.cmj :
161-
ext_array.cmj : ../stdlib/list.cmj ../stdlib/array.cmj
162-
ext_bytes.cmj : ../stdlib/pervasives.cmj ../stdlib/bytes.cmj
163-
ext_filename.cmj : ../stdlib/sys.cmj ../stdlib/string.cmj literals.cmj \
161+
ext_array_test.cmj : ../stdlib/list.cmj ../stdlib/array.cmj
162+
ext_bytes_test.cmj : ../stdlib/pervasives.cmj ../stdlib/bytes.cmj
163+
ext_filename_test.cmj : ../stdlib/sys.cmj ../stdlib/string.cmj literals.cmj \
164164
../stdlib/list.cmj ../stdlib/lazy.cmj ../stdlib/filename.cmj \
165-
ext_string.cmj ext_pervasives.cmj
166-
ext_list.cmj : ../stdlib/list.cmj ext_string.cmj ../stdlib/array.cmj
167-
ext_log.cmj : ../stdlib/format.cmj
168-
ext_pervasives.cmj : ../stdlib/string.cmj ../stdlib/printf.cmj \
165+
ext_string_test.cmj ext_pervasives_test.cmj
166+
ext_list_test.cmj : ../stdlib/list.cmj ext_string_test.cmj \
167+
../stdlib/array.cmj
168+
ext_log_test.cmj : ../stdlib/format.cmj
169+
ext_pervasives_test.cmj : ../stdlib/string.cmj ../stdlib/printf.cmj \
169170
../stdlib/obj.cmj ../stdlib/list.cmj ../stdlib/int32.cmj \
170171
../stdlib/format.cmj ../stdlib/char.cmj ../stdlib/array.cmj \
171-
../stdlib/arg.cmj ext_pervasives.cmi
172-
ext_string.cmj : ../stdlib/string.cmj ../stdlib/list.cmj ext_bytes.cmj \
173-
../stdlib/char.cmj ../stdlib/bytes.cmj ../stdlib/array.cmj
174-
ext_sys.cmj : ../stdlib/sys.cmj ext_sys.cmi
172+
../stdlib/arg.cmj ext_pervasives_test.cmi
173+
ext_string_test.cmj : ../stdlib/string.cmj ../stdlib/list.cmj \
174+
ext_bytes_test.cmj ../stdlib/char.cmj ../stdlib/bytes.cmj \
175+
../stdlib/array.cmj
176+
ext_sys_test.cmj : ../stdlib/sys.cmj ext_sys_test.cmi
175177
extensible_variant_test.cmj : mt.cmj
176178
external_ppx.cmj :
177179
fail_comp.cmj :
@@ -285,12 +287,12 @@ inner_unused.cmj : ../stdlib/set.cmj ../runtime/js.cmj
285287
installation_test.cmj : ../others/node.cmj mt.cmj ../runtime/js.cmj \
286288
app_root_finder.cmj
287289
int32_test.cmj : mt.cmj ../stdlib/int32.cmj ../stdlib/format.cmj \
288-
ext_array.cmj ../stdlib/array.cmj
290+
ext_array_test.cmj ../stdlib/array.cmj
289291
int64_mul_div_test.cmj : ../stdlib/printf.cmj mt.cmj ../stdlib/list.cmj \
290292
../stdlib/int64.cmj ../stdlib/array.cmj
291293
int64_test.cmj : ../stdlib/pervasives.cmj ../stdlib/nativeint.cmj mt.cmj \
292294
../runtime/js_int64.cmj ../stdlib/int64.cmj ../stdlib/int32.cmj \
293-
../stdlib/format.cmj ext_array.cmj ../stdlib/array.cmj
295+
../stdlib/format.cmj ext_array_test.cmj ../stdlib/array.cmj
294296
int_hashtbl_test.cmj : mt.cmj ../stdlib/list.cmj ../stdlib/hashtbl.cmj \
295297
../stdlib/array.cmj
296298
int_map.cmj : ../stdlib/map.cmj
@@ -495,7 +497,7 @@ string_set.cmj : ../stdlib/string.cmj set_gen.cmj ../stdlib/list.cmj \
495497
../stdlib/array.cmj
496498
string_set_test.cmj : string_set.cmj mt.cmj
497499
string_test.cmj : ../stdlib/string.cmj mt.cmj ../stdlib/list.cmj \
498-
ext_string.cmj ../stdlib/bytes.cmj
500+
ext_string_test.cmj ../stdlib/bytes.cmj
499501
string_unicode_test.cmj : ../runtime/js.cmj
500502
stringmatch_test.cmj : ../stdlib/string.cmj
501503
submodule.cmj : ../runtime/js.cmj

jscomp/test/Makefile

+10-6
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ OTHERS := literals a test_ari test_export2 test_internalOO test_obj_simple_ffi t
2222
test_simple_ref test_incr_ref ocaml_array ticker test_filename test_alias mt\
2323
mock_mt array_test test_nullary test_for_map2 int_map test_tuple\
2424
list_test map_test lexer_test google_closure_test boolean_test equal_exception_test\
25-
lazy_test ext_string ext_bytes a_string_test ext_filename a_filename_test test_nested_print\
26-
a_scope_bug a_recursive_type test_array_append ext_list a_list_test test_type_based_arity\
25+
lazy_test ext_string_test\
26+
ext_bytes_test a_string_test \
27+
ext_filename_test a_filename_test test_nested_print\
28+
a_scope_bug a_recursive_type test_array_append ext_list_test\
29+
a_list_test test_type_based_arity\
2730
abstract_type curry test_formatter test_cps test_closure test_for_loop test_while_closure\
2831
test_while_side_effect for_side_effect_test cps_test for_loop_test queue_test libqueue_test\
2932
libarg_test loop_suites_test const_block_test stack_test test_stack\
@@ -35,17 +38,18 @@ OTHERS := literals a test_ari test_export2 test_internalOO test_obj_simple_ffi t
3538
regression_print global_exception_regression_test printf_test format_regression loop_regression_test\
3639
and_or_tailcall_test const_defs const_defs_test genlex_test cross_module_inline_test runtime_encoding_test\
3740
obj_magic_test caml_compare_test rec_module_test guide_for_ext local_exception_test js_obj_test extensible_variant_test\
38-
ext_log lam_current_unit test_zero_nullable int64_test string_literal_print_test js_bool_test class_type_ffi_test unsafe_ppx_test\
41+
ext_log_test lam_current_unit test_zero_nullable int64_test string_literal_print_test js_bool_test class_type_ffi_test unsafe_ppx_test\
3942
js_date js_date_test es6_module_test int_overflow_test float_test bigarray_test float_of_bits_test swap_test int64_mul_div_test\
4043
ffi_test shift_test debugger_test caml_format_test js_val epsilon_test io_test random_test ffi_js_test\
41-
stringmatch_test printf_sim test_external_unit ext_array int32_test hamming_test pr_regression_test\
44+
stringmatch_test printf_sim test_external_unit \
45+
ext_array_test int32_test hamming_test pr_regression_test\
4246
to_string_test print_alpha_test ffi_arity_test digest_test string_get_set_test exception_raise_test\
4347
class_test debug_keep_test demo_int_map const_test class3_test class4_test class5_test class6_test\
4448
class7_test class8_test class_repr pq_test mt_global event_ffi hash_test exception_value_test sprintf_reg_test\
4549
scanf_test testing tscanf_test scanf_reference_error_regression_test sprintf_reg_test scanf_io fail_comp\
4650
stack_comp_test float_array float_record tfloat_record_test basic_module_test offset\
47-
pr6726 undef_regression_test tuple_alloc test_unsupported_primitive module_alias ext_pervasives\
48-
test_const_propogate limits_test ext_sys test_unsafe_obj_ffi module_missing_conversion\
51+
pr6726 undef_regression_test tuple_alloc test_unsupported_primitive module_alias ext_pervasives_test\
52+
test_const_propogate limits_test ext_sys_test test_unsafe_obj_ffi module_missing_conversion\
4953
ocaml_proto_test test_unsafe_obj_ffi_ppx ppx_apply_test test_http_server\
5054
http_types ignore_test test_index obj_literal_ppx_test obj_literal_ppx\
5155
gpr_405_test attr_test uncurry_glob_test nested_obj_test nested_obj_literal\

jscomp/test/a_filename_test.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
'use strict';
22

3-
var Mt = require("./mt.js");
4-
var $$Array = require("../../lib/js/array.js");
5-
var Block = require("../../lib/js/block.js");
6-
var Ext_filename = require("./ext_filename.js");
3+
var Mt = require("./mt.js");
4+
var $$Array = require("../../lib/js/array.js");
5+
var Block = require("../../lib/js/block.js");
6+
var Ext_filename_test = require("./ext_filename_test.js");
77

88
var suites = [/* [] */0];
99

@@ -27,13 +27,13 @@ function eq(loc, x, y) {
2727
}
2828

2929
function test(param, param$1) {
30-
return Ext_filename.node_relative_path(/* true */1, param, param$1);
30+
return Ext_filename_test.node_relative_path(/* true */1, param, param$1);
3131
}
3232

3333
eq("File \"a_filename_test.ml\", line 10, characters 5-12", /* tuple */[
34-
Ext_filename.combine("/tmp", "subdir/file.txt"),
35-
Ext_filename.combine("/tmp", "/a/tmp.txt"),
36-
Ext_filename.combine("/a/tmp.txt", "subdir/file.txt")
34+
Ext_filename_test.combine("/tmp", "subdir/file.txt"),
35+
Ext_filename_test.combine("/tmp", "/a/tmp.txt"),
36+
Ext_filename_test.combine("/a/tmp.txt", "subdir/file.txt")
3737
], /* tuple */[
3838
"/tmp/subdir/file.txt",
3939
"/a/tmp.txt",
@@ -96,13 +96,13 @@ eq("File \"a_filename_test.ml\", line 55, characters 5-12", test(/* `Dir */[
9696
"./a/b.js"
9797
]), "./b.js");
9898

99-
eq("File \"a_filename_test.ml\", line 60, characters 5-12", Ext_filename.get_extension("a.txt"), ".txt");
99+
eq("File \"a_filename_test.ml\", line 60, characters 5-12", Ext_filename_test.get_extension("a.txt"), ".txt");
100100

101-
eq("File \"a_filename_test.ml\", line 64, characters 5-12", Ext_filename.get_extension("a"), "");
101+
eq("File \"a_filename_test.ml\", line 64, characters 5-12", Ext_filename_test.get_extension("a"), "");
102102

103-
eq("File \"a_filename_test.ml\", line 68, characters 5-12", Ext_filename.get_extension(".txt"), ".txt");
103+
eq("File \"a_filename_test.ml\", line 68, characters 5-12", Ext_filename_test.get_extension(".txt"), ".txt");
104104

105-
eq("File \"a_filename_test.ml\", line 73, characters 5-12", $$Array.map(Ext_filename.normalize_absolute_path, /* array */[
105+
eq("File \"a_filename_test.ml\", line 73, characters 5-12", $$Array.map(Ext_filename_test.normalize_absolute_path, /* array */[
106106
"/gsho/./..",
107107
"/a/b/../c../d/e/f",
108108
"/a/b/../c/../d/e/f",

jscomp/test/a_filename_test.ml

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ let eq loc x y =
55
suites :=
66
(loc ^" id " ^ (string_of_int !test_id), (fun _ -> Mt.Eq(x,y))) :: !suites
77

8-
let test = Ext_filename.node_relative_path true
8+
let test = Ext_filename_test.node_relative_path true
99
let () =
1010
eq __LOC__
11-
(let (//) = Ext_filename.combine in
11+
(let (//) = Ext_filename_test.combine in
1212
("/tmp"// "subdir/file.txt",
1313
"/tmp"// "/a/tmp.txt",
1414
"/a/tmp.txt" // "subdir/file.txt"
@@ -58,20 +58,20 @@ let () =
5858
(`File "./a/b.js"))
5959
"./b.js";
6060
eq __LOC__
61-
(Ext_filename.get_extension "a.txt"
61+
(Ext_filename_test.get_extension "a.txt"
6262
)
6363
".txt";
6464
eq __LOC__
65-
(Ext_filename.get_extension "a"
65+
(Ext_filename_test.get_extension "a"
6666
)
6767
"";
6868
eq __LOC__
69-
(Ext_filename.get_extension ".txt"
69+
(Ext_filename_test.get_extension ".txt"
7070
)
7171
".txt";
7272

7373
eq __LOC__
74-
(Array.map Ext_filename.normalize_absolute_path
74+
(Array.map Ext_filename_test.normalize_absolute_path
7575
[|
7676
"/gsho/./..";
7777
"/a/b/../c../d/e/f";

jscomp/test/a_list_test.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use strict';
22

3-
var Mt = require("./mt.js");
4-
var Block = require("../../lib/js/block.js");
5-
var Ext_list = require("./ext_list.js");
3+
var Mt = require("./mt.js");
4+
var Block = require("../../lib/js/block.js");
5+
var Ext_list_test = require("./ext_list_test.js");
66

77
var suites_000 = /* tuple */[
88
"drop",
99
(function () {
1010
return /* Eq */Block.__(0, [
11-
Ext_list.drop(3, /* :: */[
11+
Ext_list_test.drop(3, /* :: */[
1212
0,
1313
/* :: */[
1414
1,
@@ -28,7 +28,7 @@ var suites_001 = /* :: */[
2828
"drop1",
2929
(function () {
3030
return /* Eq */Block.__(0, [
31-
Ext_list.drop(2, /* :: */[
31+
Ext_list_test.drop(2, /* :: */[
3232
0,
3333
/* :: */[
3434
1,
@@ -66,7 +66,7 @@ var suites_001 = /* :: */[
6666
]
6767
]
6868
],
69-
Ext_list.flat_map((function (x) {
69+
Ext_list_test.flat_map((function (x) {
7070
if (x % 2) {
7171
return /* :: */[
7272
1,

jscomp/test/a_list_test.ml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
let suites = Mt.[
44
"drop", (fun _ ->
5-
Eq (Ext_list.drop 3 [0;1;2], []));
5+
Eq (Ext_list_test.drop 3 [0;1;2], []));
66
"drop1", (fun _ ->
7-
Eq (Ext_list.drop 2 [0;1;2], [2]));
7+
Eq (Ext_list_test.drop 2 [0;1;2], [2]));
88
"flat_map", (fun _ ->
99
Eq( [0; 0; 1; 1; 0],
10-
Ext_list.flat_map (fun x -> if x mod 2 ==0 then [0] else [1;1]) [0;0;3;0]
10+
Ext_list_test.flat_map (fun x -> if x mod 2 ==0 then [0] else [1;1]) [0;0;3;0]
1111
))
1212
]
1313

0 commit comments

Comments
 (0)