Skip to content

Commit b2dffb3

Browse files
mrochMarshall Roch
authored andcommitted
don't run js_of_ocaml when flow_parser hasn't changed
Summary: `make -C src/parser js` runs ocamlbuild to build flow_parser.js's bytecode, then calls js_of_ocaml. if the inputs haven't changed, then ocamlbuild doesn't `touch` flow_parser_dot_js.byte, which we can use to skip running js_of_ocaml when the inputs haven't changed. this is similar to using the js_of_ocaml-ocamlbuild plugin, but doesn't require an ocamlbuild plugin. Reviewed By: gabelevi Differential Revision: D7519542 fbshipit-source-id: 8b12494bf0dec6456bdd2517ff6d26f1a2925ca3
1 parent 42d2dbf commit b2dffb3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/parser/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ dist/libflowparser.zip: \
8383

8484
js:
8585
cd $(TOP); \
86-
$(OCB) -pkgs js_of_ocaml $(REL_DIR)/flow_parser_dot_js.byte; \
87-
js_of_ocaml --opt 3 \
88-
-o $(REL_DIR)/flow_parser.js \
89-
_build/$(REL_DIR)/flow_parser_dot_js.byte; \
90-
rm flow_parser_dot_js.byte
86+
$(OCB) -no-links -pkgs js_of_ocaml $(REL_DIR)/flow_parser_dot_js.byte; \
87+
[ -e "$(REL_DIR)/flow_parser.js" -a "$(REL_DIR)/flow_parser.js" -nt "_build/$(REL_DIR)/flow_parser_dot_js.byte" ] || \
88+
js_of_ocaml --opt 3 \
89+
-o $(REL_DIR)/flow_parser.js \
90+
_build/$(REL_DIR)/flow_parser_dot_js.byte
9191

9292
test-js: js
9393
cd $(TOP)/packages/flow-parser; npm test

0 commit comments

Comments
 (0)