2 set -u # terminate upon read of uninitalized variable
3 set -e # terminate upon non-zero-exit-codes (in case of pipe, only checks at end of pipe)
4 set -o pipefail
# in a pipe, the whole pipe runs, but its exit code is that of the first failure
5 trap 'echo "exit code $? at line $LINENO" >&2' ERR
20 echo -e "$BOLD$CYAN==>$WHITE ${1}$RESET"
23 # Try to get the path of this script relative to fbcode/.
24 #set -x # echo every statement in the script
26 FBCODE_ROOT
="$(dirname "${BASH_SOURCE[0]}")/../../.."
27 REGEN_COMMAND
="$(realpath --relative-to="${FBCODE_ROOT}" "${BASH_SOURCE[0]}")"
30 # rustfmt is committed at fbsource/tools/third-party/rustfmt/rustfmt
31 RUSTFMT_PATH
="${RUSTFMT_PATH:-"$(realpath ../tools/third-party/rustfmt/rustfmt)"}"
33 BUILD_AND_RUN
="hphp/hack/scripts/build_and_run.sh"
35 summary
"Write oxidized/gen/"
36 "${BUILD_AND_RUN}" src
/hh_oxidize hh_oxidize \
37 --out-dir hphp
/hack
/src
/oxidized
/gen \
38 --regen-command "$REGEN_COMMAND" \
39 --rustfmt-path "$RUSTFMT_PATH" \
40 hphp
/hack
/src
/annotated_ast
/aast_defs.ml \
41 hphp
/hack
/src
/annotated_ast
/aast.ml \
42 hphp
/hack
/src
/annotated_ast
/namespace_env.ml \
43 hphp
/hack
/src
/ast
/ast_defs.ml \
44 hphp
/hack
/src
/decl
/pos
/pos_or_decl.ml \
45 hphp
/hack
/src
/deps
/fileInfo.ml \
46 hphp
/hack
/src
/deps
/typing_deps_mode.ml \
47 hphp
/hack
/src
/errors
/errors.ml \
48 hphp
/hack
/src
/errors
/error_codes.ml \
49 hphp
/hack
/src
/naming
/naming_types.ml \
50 hphp
/hack
/src
/naming
/nast.ml \
51 hphp
/hack
/src
/options
/globalOptions.ml \
52 hphp
/hack
/src
/options
/parserOptions.ml \
53 hphp
/hack
/src
/options
/typecheckerOptions.ml \
54 hphp
/hack
/src
/parser
/full_fidelity_parser_env.ml \
55 hphp
/hack
/src
/utils
/core
/prim_defs.ml \
56 hphp
/hack
/src
/utils
/decl_reference.ml \
57 hphp
/hack
/src
/parser
/scoured_comments.ml \
59 # Add exports in oxidized/lib.rs from oxidized/gen/mod.rs.
60 # BSD sed doesn't have -i
61 sed "/^pub use gen::/d" hphp
/hack
/src
/oxidized
/lib.rs
> hphp
/hack
/src
/oxidized
/lib.rs.tmp
62 mv hphp
/hack
/src
/oxidized
/lib.rs.tmp hphp
/hack
/src
/oxidized
/lib.rs
63 grep "^pub mod " hphp
/hack
/src
/oxidized
/gen
/mod.rs |
sed 's/^pub mod /pub use gen::/' >> hphp
/hack
/src
/oxidized
/lib.rs
65 summary
"Write oxidized/impl_gen/"
66 "${BUILD_AND_RUN}" src
/hh_codegen hh_codegen \
67 --regen-cmd "$REGEN_COMMAND" \
68 --rustfmt "$RUSTFMT_PATH" \
70 --input "hphp/hack/src/oxidized/gen/aast.rs|crate::ast_defs|crate::aast::*|crate::LocalIdMap" \
71 --input "hphp/hack/src/oxidized/gen/aast_defs.rs|crate::aast_defs::*" \
72 --input "hphp/hack/src/oxidized/gen/ast_defs.rs|crate::ast_defs::*" \
73 --output "hphp/hack/src/oxidized/impl_gen/" \
75 summary
"Write oxidized/aast_visitor/"
76 "${BUILD_AND_RUN}" src
/hh_codegen hh_codegen \
77 --regen-cmd "$REGEN_COMMAND" \
78 --rustfmt "$RUSTFMT_PATH" \
80 --input "hphp/hack/src/oxidized/gen/aast.rs" \
81 --input "hphp/hack/src/oxidized/gen/aast_defs.rs" \
82 --input "hphp/hack/src/oxidized/gen/ast_defs.rs" \
83 --input "hphp/hack/src/oxidized/manual/doc_comment.rs" \
84 --output "hphp/hack/src/oxidized/aast_visitor/" \
87 summary
"Write oxidized_by_ref/gen/"
88 "${BUILD_AND_RUN}" src
/hh_oxidize hh_oxidize \
89 --out-dir hphp
/hack
/src
/oxidized_by_ref
/gen \
90 --regen-command "$REGEN_COMMAND" \
91 --rustfmt-path "$RUSTFMT_PATH" \
92 --extern-types-file hphp
/hack
/src
/oxidized_by_ref
/extern_types.txt \
93 --owned-types-file hphp
/hack
/src
/oxidized_by_ref
/owned_types.txt \
94 --copy-types-file hphp
/hack
/src
/oxidized_by_ref
/copy_types.txt \
96 hphp
/hack
/src
/annotated_ast
/aast_defs.ml \
97 hphp
/hack
/src
/annotated_ast
/aast.ml \
98 hphp
/hack
/src
/annotated_ast
/namespace_env.ml \
99 hphp
/hack
/src
/ast
/ast_defs.ml \
100 hphp
/hack
/src
/decl
/decl_defs.ml \
101 hphp
/hack
/src
/decl
/pos
/pos_or_decl.ml \
102 hphp
/hack
/src
/decl
/shallow_decl_defs.ml \
103 hphp
/hack
/src
/deps
/fileInfo.ml \
104 hphp
/hack
/src
/errors
/error_codes.ml \
105 hphp
/hack
/src
/errors
/errors.ml \
106 hphp
/hack
/src
/naming
/naming_types.ml \
107 hphp
/hack
/src
/naming
/nast.ml \
108 hphp
/hack
/src
/options
/declParserOptions.ml \
109 hphp
/hack
/src
/options
/globalOptions.ml \
110 hphp
/hack
/src
/options
/parserOptions.ml \
111 hphp
/hack
/src
/options
/typecheckerOptions.ml \
112 hphp
/hack
/src
/parser
/scoured_comments.ml \
113 hphp
/hack
/src
/typing
/tast.ml \
114 hphp
/hack
/src
/typing
/type_parameter_env.ml \
115 hphp
/hack
/src
/typing
/typing_cont_key.ml \
116 hphp
/hack
/src
/typing
/typing_defs_core.ml \
117 hphp
/hack
/src
/typing
/typing_defs.ml \
118 hphp
/hack
/src
/typing
/typing_env_return_info.ml \
119 hphp
/hack
/src
/typing
/typing_env_types.ml \
120 hphp
/hack
/src
/typing
/typing_fake_members.ml \
121 hphp
/hack
/src
/typing
/typing_inference_env.ml \
122 hphp
/hack
/src
/typing
/typing_kinding_defs.ml \
123 hphp
/hack
/src
/typing
/typing_local_types.ml \
124 hphp
/hack
/src
/typing
/typing_per_cont_env.ml \
125 hphp
/hack
/src
/typing
/typing_reason.ml \
126 hphp
/hack
/src
/typing
/typing_tyvar_occurrences.ml \
127 hphp
/hack
/src
/utils
/decl_reference.ml \
128 hphp
/hack
/src
/utils
/core
/prim_defs.ml \
130 # Add exports in oxidized_by_ref/lib.rs from oxidized_by_ref/gen/mod.rs.
131 # BSD sed doesn't have -i
132 sed "/^pub use gen::/d" hphp
/hack
/src
/oxidized_by_ref
/lib.rs
> hphp
/hack
/src
/oxidized_by_ref
/lib.rs.tmp
133 mv hphp
/hack
/src
/oxidized_by_ref
/lib.rs.tmp hphp
/hack
/src
/oxidized_by_ref
/lib.rs
134 grep "^pub mod " hphp
/hack
/src
/oxidized_by_ref
/gen
/mod.rs |
sed 's/^pub mod /pub use gen::/' >> hphp
/hack
/src
/oxidized_by_ref
/lib.rs
136 summary
"Write oxidized_by_ref/decl_visitor/"
137 "${BUILD_AND_RUN}" src
/hh_codegen hh_codegen \
138 --regen-cmd "$REGEN_COMMAND" \
139 --rustfmt "$RUSTFMT_PATH" \
140 by-ref-decl-visitor \
141 --input "hphp/hack/src/oxidized_by_ref/gen/aast_defs.rs" \
142 --input "hphp/hack/src/oxidized_by_ref/gen/ast_defs.rs" \
143 --input "hphp/hack/src/oxidized_by_ref/gen/shallow_decl_defs.rs" \
144 --input "hphp/hack/src/oxidized_by_ref/gen/typing_defs_core.rs" \
145 --input "hphp/hack/src/oxidized_by_ref/gen/typing_defs.rs" \
146 --input "hphp/hack/src/oxidized_by_ref/gen/typing_reason.rs" \
147 --input "hphp/hack/src/oxidized_by_ref/manual/direct_decl_parser.rs" \
148 --input "hphp/hack/src/oxidized_by_ref/manual/t_shape_map.rs" \
149 --extern-input "hphp/hack/src/oxidized/gen/aast_defs.rs" \
150 --extern-input "hphp/hack/src/oxidized/gen/ast_defs.rs" \
151 --output "hphp/hack/src/oxidized_by_ref/decl_visitor/" \
154 summary
"Write oxidized_by_ref/nast_visitor/"
155 "${BUILD_AND_RUN}" src
/hh_codegen hh_codegen \
156 --regen-cmd "$REGEN_COMMAND" \
157 --rustfmt "$RUSTFMT_PATH" \
158 by-ref-nast-visitor \
159 --input "hphp/hack/src/oxidized_by_ref/gen/aast.rs" \
160 --input "hphp/hack/src/oxidized_by_ref/gen/aast_defs.rs" \
161 --input "hphp/hack/src/oxidized_by_ref/gen/ast_defs.rs" \
162 --input "hphp/hack/src/oxidized_by_ref/gen/namespace_env.rs" \
163 --input "hphp/hack/src/oxidized_by_ref/manual/doc_comment.rs" \
164 --extern-input "hphp/hack/src/oxidized/gen/aast_defs.rs" \
165 --extern-input "hphp/hack/src/oxidized/gen/aast.rs" \
166 --extern-input "hphp/hack/src/oxidized/gen/ast_defs.rs" \
167 --output "hphp/hack/src/oxidized_by_ref/nast_visitor/" \