Skip to content

remove special support for mll files #1664

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions docs/Manual.html
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@ <h1><a href="https://github.com/bloomberg/bucklescript">BuckleScript</a> User Ma
</li>
<li><a href="#_a_real_world_example_of_using_code_bsb_code">A real world example of using <code>bsb</code></a></li>
<li><a href="#_build_using_make">Build using Make</a></li>
<li><a href="#_customize_rules_generators_support_since_1_7_4">Customize rules (generators support, @since 1.7.4)</a></li>
</ul>
</li>
<li><a href="#_faq">FAQ</a></li>
Expand Down Expand Up @@ -5086,6 +5087,61 @@ <h3 id="_build_using_make"><a class="anchor" href="#_build_using_make"></a>Build
<p>Now in your working directory, type <code>watchman -j &lt; build.json</code> and enjoy the lightning build speed.</p>
</div>
</div>
<div class="sect2">
<h3 id="_customize_rules_generators_support_since_1_7_4"><a class="anchor" href="#_customize_rules_generators_support_since_1_7_4"></a>Customize rules (generators support, @since 1.7.4)</h3>
<div class="paragraph">
<p>It is quite common that programmers use some pre-processors to generate some bolierpolate code during developement.</p>
</div>
<div class="paragraph">
<p>Note pre-processors can be classified as two categories, one is system-dependent which should be delayed until running on user machines, the other is system-indepdent , lex, yacc, m4, re2c, etc, which could be executed anytime.</p>
</div>
<div class="paragraph">
<p>BuckleScript has built in support for conditional compilation, this section is about the second part, since it is system-indepdent, we ask users to always generate such code and check in before shipping, this would help cut the dependencies for end users.</p>
</div>
<div class="paragraph">
<p>A typical example would be like this</p>
</div>
<div class="listingblock">
<div class="title">Bsb using ocamlyacc</div>
<div class="content">
<pre class="pygments highlight"><code data-lang="js"><span class="tok-p">{</span>
<span class="tok-s2">&quot;generators&quot;</span> <span class="tok-o">:</span> <span class="tok-p">[</span>
<span class="tok-p">{</span> <span class="tok-s2">&quot;name&quot;</span> <span class="tok-o">:</span> <span class="tok-s2">&quot;ocamlyacc&quot;</span> <span class="tok-p">,</span>
<span class="tok-s2">&quot;command&quot;</span> <span class="tok-o">:</span> <span class="tok-s2">&quot;ocamlyacc $in&quot;</span> <span class="tok-p">}</span>
<span class="tok-p">],</span>
<span class="tok-p">...,</span>
<span class="tok-s2">&quot;sources&quot;</span> <span class="tok-o">:</span> <span class="tok-p">{</span>
<span class="tok-s2">&quot;dir&quot;</span> <span class="tok-o">:</span> <span class="tok-s2">&quot;src&quot;</span><span class="tok-p">,</span>
<span class="tok-s2">&quot;generators&quot;</span> <span class="tok-o">:</span> <span class="tok-p">[</span>
<span class="tok-p">{</span>
<span class="tok-s2">&quot;name&quot;</span> <span class="tok-o">:</span> <span class="tok-s2">&quot;ocamlyacc&quot;</span><span class="tok-p">,</span>
<span class="tok-s2">&quot;edge&quot;</span> <span class="tok-o">:</span> <span class="tok-p">[</span><span class="tok-s2">&quot;test.ml&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;test.mli&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;:&quot;</span><span class="tok-p">,</span> <span class="tok-s2">&quot;test.mly&quot;</span><span class="tok-p">]</span>
<span class="tok-p">}</span>
<span class="tok-p">]</span>
<span class="tok-p">}</span>
<span class="tok-p">}</span></code></pre>
</div>
</div>
<div class="paragraph">
<p>Note <code>ocamlyacc</code> will generate in <code>test.ml</code> and <code>test.mli</code> in the same directory with <code>test.mly</code>, user should check in generated file since then users would not need run ocamlyacc again, this would apply to <code>menhir</code> as well.</p>
</div>
<div class="paragraph">
<p>When users are developing current project, <code>bsb</code> will track the dependencies between <code>test.ml</code> and <code>test.mly</code> properly, when released
as a package, <code>bsb</code> will cut such dependency, so that users will
only need the generated <code>test.ml</code>, to help test such behavior in development mode, users could set it manually</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code data-lang="js"><span class="tok-p">{</span>
<span class="tok-p">...,</span>
<span class="tok-s2">&quot;cut-generators&quot;</span> <span class="tok-o">:</span> <span class="tok-kc">true</span>
<span class="tok-p">}</span></code></pre>
</div>
</div>
<div class="paragraph">
<p>Then <code>bsb</code> will not re-generate <code>test.ml</code> whenever <code>test.mly</code> changes.</p>
</div>
</div>
</div>
</div>
<div class="sect1">
Expand Down
4 changes: 4 additions & 0 deletions docs/docson/build-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,10 @@
},
"description": "(WIP) Pre defined rules"
},
"cut-generators" : {
"type": "boolean",
"description": "Ignore generators, cut the dependency on generator tools"
},
"reason": {
"$ref": "#/definitions/reason-specs",
"description": "BuckleScript comes with [Reason](http://facebook.github.io/reason/) by default. Specific configurations here."
Expand Down
1 change: 1 addition & 0 deletions jscomp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ EXT_SRCS = ext_util\
ext_sexp\
ext_json_types\
ext_json_parse\
ext_json_write\
ext_json\
ident_hash_set\
hash_set_poly\
Expand Down
42 changes: 24 additions & 18 deletions jscomp/all.depend
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ ext/ext_sexp.cmx : ext/ext_sexp.cmi
ext/ext_json_types.cmx : ext/string_map.cmx
ext/ext_json_parse.cmx : ext/string_map.cmx ext/ext_position.cmx \
ext/ext_json_types.cmx ext/ext_array.cmx ext/ext_json_parse.cmi
ext/ext_json_write.cmx : ext/string_map.cmx ext/ext_json_types.cmx \
ext/ext_json_write.cmi
ext/ext_json.cmx : ext/string_map.cmx ext/ext_json_types.cmx \
ext/ext_json.cmi
ext/ext_array.cmx ext/ext_json.cmi
ext/ident_hash_set.cmx : ext/hash_set_gen.cmx ext/ext_ident.cmx \
stubs/bs_hash_stubs.cmx ext/ident_hash_set.cmi
ext/hash_set_poly.cmx : ext/hash_set_gen.cmx ext/hash_set_poly.cmi
Expand Down Expand Up @@ -138,6 +140,7 @@ ext/ext_pp_scope.cmi : ext/ident_set.cmi
ext/ext_io.cmi :
ext/ext_sexp.cmi :
ext/ext_json_parse.cmi : ext/ext_json_types.cmx
ext/ext_json_write.cmi : ext/ext_json_types.cmx
ext/ext_json.cmi : ext/string_map.cmi ext/ext_position.cmi \
ext/ext_json_types.cmx
ext/ident_hash_set.cmi : ext/hash_set_gen.cmx
Expand All @@ -154,8 +157,8 @@ common/bs_warnings.cmx : ext/literals.cmx common/js_config.cmx \
common/bs_warnings.cmi
common/lam_methname.cmx : ext/string_hash_set.cmx ext/ext_string.cmx \
common/lam_methname.cmi
common/binary_cache.cmx : ext/string_map.cmx ext/ext_filename.cmx \
common/binary_cache.cmi
common/binary_cache.cmx : ext/string_map.cmx ext/ext_string.cmx \
ext/ext_filename.cmx common/binary_cache.cmi
common/bs_version.cmi :
common/js_config.cmi :
common/ext_log.cmi :
Expand Down Expand Up @@ -655,7 +658,8 @@ ounit_tests/ounit_scc_tests.cmx : ext/string_hashtbl.cmx ounit/oUnit.cmx \
ext/int_vec_vec.cmx ext/int_vec.cmx ext/ext_string.cmx ext/ext_scc.cmx
ounit_tests/ounit_hashtbl_tests.cmx : ext/string_hashtbl.cmx ounit/oUnit.cmx
ounit_tests/ounit_json_tests.cmx : ext/string_map.cmx ounit/oUnit.cmx \
ext/ext_json_types.cmx ext/ext_json_parse.cmx ext/ext_json.cmx
ext/ext_pervasives.cmx ext/ext_json_write.cmx ext/ext_json_types.cmx \
ext/ext_json_parse.cmx ext/ext_json.cmx
ounit_tests/ounit_map_tests.cmx : ounit/oUnit.cmx ext/int_map.cmx
ounit_tests/ounit_ordered_hash_set_tests.cmx : \
ext/ordered_hash_set_string.cmx ounit/oUnit.cmx ext/ext_util.cmx \
Expand Down Expand Up @@ -706,8 +710,8 @@ bsb/bsb_build_schemas.cmx :
bsb/bsb_build_ui.cmx : ext/string_vec.cmx ext/string_set.cmx \
ext/string_map.cmx ext/ext_string.cmx ext/ext_json_types.cmx \
ext/ext_json.cmx ext/ext_filename.cmx ext/ext_file_pp.cmx \
bsb/bsb_exception.cmx bsb/bsb_build_util.cmx bsb/bsb_build_schemas.cmx \
common/binary_cache.cmx bsb/bsb_build_ui.cmi
ext/ext_array.cmx bsb/bsb_exception.cmx bsb/bsb_build_util.cmx \
bsb/bsb_build_schemas.cmx common/binary_cache.cmx bsb/bsb_build_ui.cmi
bsb/bsb_build_util.cmx : ext/string_map.cmx ext/string_hashtbl.cmx \
ext/literals.cmx ext/ext_sys.cmx ext/ext_string.cmx ext/ext_list.cmx \
ext/ext_json_types.cmx ext/ext_json_parse.cmx ext/ext_json.cmx \
Expand All @@ -720,11 +724,12 @@ bsb/bsb_config_parse.cmx : ext/string_set.cmx ext/string_map.cmx \
ext/string_hash_set.cmx ext/literals.cmx ext/ext_string.cmx \
ext/ext_json_types.cmx ext/ext_json_parse.cmx ext/ext_json.cmx \
ext/ext_filename.cmx ext/ext_file_pp.cmx ext/ext_array.cmx \
bsb/bsb_pkg.cmx bsb/bsb_default.cmx bsb/bsb_config_types.cmx \
bsb/bsb_config.cmx bsb/bsb_build_util.cmx bsb/bsb_build_ui.cmx \
bsb/bsb_build_schemas.cmx common/bs_version.cmx bsb/bsb_config_parse.cmi
bsb/bsb_config_types.cmx : ext/string_hash_set.cmx bsb/bsb_config.cmx \
bsb/bsb_build_ui.cmx
bsb/bsb_pkg.cmx bsb/bsb_exception.cmx bsb/bsb_default.cmx \
bsb/bsb_config_types.cmx bsb/bsb_config.cmx bsb/bsb_build_util.cmx \
bsb/bsb_build_ui.cmx bsb/bsb_build_schemas.cmx common/bs_version.cmx \
bsb/bsb_config_parse.cmi
bsb/bsb_config_types.cmx : ext/string_map.cmx ext/string_hash_set.cmx \
bsb/bsb_config.cmx bsb/bsb_build_ui.cmx
bsb/bsb_default.cmx : ext/string_set.cmx ext/literals.cmx \
bsb/bsb_config_types.cmx bsb/bsb_default.cmi
bsb/bsb_dep_infos.cmx : common/bs_version.cmx bsb/bsb_dep_infos.cmi
Expand Down Expand Up @@ -760,14 +765,15 @@ bsb/bsb_main.cmx : ext/string_hash_set.cmx ext/literals.cmx ext/ext_sys.cmx \
bsb/bsb_main.cmi
bsb/bsb_ninja.cmx : ext/string_set.cmx ext/string_map.cmx \
ext/string_hash_set.cmx ext/literals.cmx ext/ext_string.cmx \
ext/ext_filename.cmx bsb/bsb_rule.cmx bsb/bsb_config.cmx \
bsb/bsb_build_util.cmx bsb/bsb_build_ui.cmx bsb/bsb_build_schemas.cmx \
common/binary_cache.cmx bsb/bsb_ninja.cmi
ext/ext_pervasives.cmx ext/ext_filename.cmx bsb/bsb_rule.cmx \
bsb/bsb_config.cmx bsb/bsb_build_util.cmx bsb/bsb_build_ui.cmx \
bsb/bsb_build_schemas.cmx common/binary_cache.cmx bsb/bsb_ninja.cmi
bsb/bsb_os_dependent.cmx :
bsb/bsb_pkg.cmx : ext/string_hashtbl.cmx ext/literals.cmx \
bsb/bsb_exception.cmx bsb/bsb_pkg.cmi
bsb/bsb_regex.cmx : bsb/bsb_regex.cmi
bsb/bsb_rule.cmx : ext/string_set.cmx ext/ext_sys.cmx bsb/bsb_rule.cmi
bsb/bsb_rule.cmx : ext/string_set.cmx ext/string_map.cmx ext/ext_sys.cmx \
bsb/bsb_rule.cmi
bsb/bsb_templates.cmx : bsb/oCamlRes.cmx bsb/bsb_templates.cmi
bsb/bsb_unix.cmx : ext/ext_sys.cmx ext/ext_string.cmx bsb/bsb_unix.cmi
bsb/oCamlRes.cmx :
Expand All @@ -789,11 +795,11 @@ bsb/bsb_helper_main.cmi :
bsb/bsb_helper_packer.cmi :
bsb/bsb_init.cmi :
bsb/bsb_main.cmi :
bsb/bsb_ninja.cmi : ext/string_hash_set.cmi bsb/bsb_rule.cmi \
bsb/bsb_config.cmi bsb/bsb_build_ui.cmi
bsb/bsb_ninja.cmi : ext/string_map.cmi ext/string_hash_set.cmi \
bsb/bsb_rule.cmi bsb/bsb_config.cmi bsb/bsb_build_ui.cmi
bsb/bsb_pkg.cmi :
bsb/bsb_regex.cmi :
bsb/bsb_rule.cmi :
bsb/bsb_rule.cmi : ext/string_map.cmi
bsb/bsb_templates.cmi : bsb/oCamlRes.cmx
bsb/bsb_unix.cmi :
jscmj_main.cmx : common/js_config.cmx core/js_cmj_format.cmx \
Expand Down
2 changes: 2 additions & 0 deletions jscomp/bin/all_ounit_tests.d
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ bin/all_ounit_tests.ml : ext/resize_array.mli
bin/all_ounit_tests.ml : ounit/oUnitLogger.ml
bin/all_ounit_tests.ml : ext/ext_json_parse.ml
bin/all_ounit_tests.ml : ext/ext_json_types.ml
bin/all_ounit_tests.ml : ext/ext_json_write.ml
bin/all_ounit_tests.ml : ext/ext_pervasives.ml
bin/all_ounit_tests.ml : ext/hash_set_poly.mli
bin/all_ounit_tests.ml : ext/string_hashtbl.ml
bin/all_ounit_tests.ml : ounit/oUnitChooser.ml
bin/all_ounit_tests.ml : ext/ext_json_parse.mli
bin/all_ounit_tests.ml : ext/ext_json_write.mli
bin/all_ounit_tests.ml : ext/ext_pervasives.mli
bin/all_ounit_tests.ml : ext/string_hash_set.ml
bin/all_ounit_tests.ml : ext/string_hashtbl.mli
Expand Down
Loading