Skip to content
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

add conditonal compilation #820

Merged
merged 2 commits into from Oct 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/Manual.html
Expand Up @@ -3570,6 +3570,20 @@ <h2 id="_faq"><a class="anchor" href="#_faq"></a>FAQ</h2>
<p>BuckleScript targets <strong>ES5</strong>.</p>
</li>
<li>
<p><em>Does BuckleScript work with merlin?</em></p>
<p>Yes, you need edit your <code>.merlin</code> file:</p>
<div class="listingblock">
<div class="content">
<pre class="pygments highlight"><code>B node_modules/bs-platform/lib/ocaml
S node_modules/bs-platform/lib/ocaml
FLG -ppx node_modules/bs-platform/bin/bsppx.exe</code></pre>
</div>
</div>
<div class="paragraph">
<p>Note there is a <a href="https://github.com/the-lambda-church/merlin/issues/568">upstream fix</a> in Merlin, make sure your merlin is updated</p>
</div>
</li>
<li>
<p><em>What polyfills does BuckleScript need?</em></p>
<div class="ulist">
<ul>
Expand Down
11 changes: 6 additions & 5 deletions jscomp/bin/compiler.ml
Expand Up @@ -34838,6 +34838,9 @@ let buckle_script_flags =
Arg.Rest collect_file,
" Provide batch of files, the compiler will sort it before compiling"
)
(* :: *)
(* ("-bs-list-directives", *)
(* ) *)
:: Ocaml_options.mk_impl impl
:: Ocaml_options.mk_intf intf
:: Ocaml_options.mk__ anonymous
Expand All @@ -34849,11 +34852,9 @@ let buckle_script_flags =
let _ =
Clflags.unsafe_string := false;
Clflags.debug := true;
Lexer.replace_directive_built_in_value "bs" (Dir_bool true);
let major, minor, patch, add = Lexer.semantic_version_parse Js_config.version in
Lexer.replace_directive_built_in_value "bs_major" (Dir_int major);
Lexer.replace_directive_built_in_value "bs_minor" (Dir_int minor);
Lexer.replace_directive_built_in_value "bs_patch" (Dir_int minor);

Lexer.replace_directive_built_in_value "BS" (Dir_bool true);
Lexer.replace_directive_built_in_value "BS_VERSION" (Dir_string Js_config.version);
try
Compenv.readenv ppf Before_args;
Arg.parse buckle_script_flags anonymous usage;
Expand Down
2 changes: 1 addition & 1 deletion jscomp/bin/config_bspack.ml
Expand Up @@ -21,7 +21,7 @@


(* The main OCaml version string has moved to ../VERSION *)
let version = Sys.ocaml_version
let version = "4.02.3+BS"

let standard_library_default = "/usr/local/lib/ocaml/lib/ocaml" (* does not matter *)

Expand Down
2 changes: 1 addition & 1 deletion jscomp/bin/config_bsppx.ml
Expand Up @@ -21,7 +21,7 @@


(* The main OCaml version string has moved to ../VERSION *)
let version = Sys.ocaml_version
let version = "4.02.3+BS"

let standard_library_default = "/usr/local/lib/ocaml/lib/ocaml" (* does not matter *)

Expand Down
2 changes: 1 addition & 1 deletion jscomp/bin/config_whole_compiler.ml
Expand Up @@ -21,7 +21,7 @@


(* The main OCaml version string has moved to ../VERSION *)
let version = Sys.ocaml_version
let version = "4.02.3+BS"

let standard_library_default = "%%LIBDIR%%"

Expand Down