3 # Hacky way of disabling fbmake's pre_command.
4 if [ ! -z "${FBMAKE_PRE_COMMAND_OUTDIR}" ]; then
8 if echo $1 |
grep -q -e 'install_dir=' -e 'fbcode_dir=' ; then
9 # Skip --install_dir and --fbcode_dir.
15 if git rev-parse
--show-toplevel >& /dev
/null
; then
16 root
=$
(git rev-parse
--show-toplevel)
17 compiler
="git describe --all --long --abbrev=40 --always"
18 find_files
="git ls-files -- hphp"
19 elif hg root
>& /dev
/null
; then
21 if [ -f "$root/fbcode/.projectid" ]; then
24 compiler
="hg --config trusted.users='*' log -l1 -r'reverse(::.) & file(\"$root/**\")' -T'{branch}-0-g{sub(r\"^\$\",node,mirrornode(\"fbcode\",\"git\"))}\n' 2> /dev/null"
25 find_files
="hg files -I hphp/"
28 # Building outside of a git repo, use system time instead. This will make the
29 # sha appear to change constantly, but without any insight into file state,
30 # it's the safest fallback
31 compiler
='date +%s_%N'
32 find_files
='find hphp \( -type f -o -type l \) \! -iregex ".*\(~\|#.*\|\.swp\|/tags\|/.bash_history\|/out\)" | LC_ALL=C sort'
35 ################################################################################
40 if [ -z "${COMPILER_ID}" ]; then
41 COMPILER_ID
=$
(sh
-c "$compiler")
44 ################################################################################
46 # Compute a hash that can be used as a unique repo schema identifier. The
47 # identifier incorporates the current git revision and local modifications to
48 # managed files, but it intentionally ignores unmanaged files (even though they
49 # could conceivably contain source code that meaningfully changes the repo
50 # schema), because for some work flows the added instability of schema IDs is a
51 # cure worse than the disease.
52 if [ -z "${HHVM_REPO_SCHEMA}" ] ; then
53 HHVM_REPO_SCHEMA
=$
(sh
-c "$find_files" | \
54 grep -v '^hphp/\(benchmarks\|bin\|hack\|hphp\|neo\|public_tld\|test\|tools\|util\|vixl\|zend\)' | \
55 tr '\n' '\0' |
xargs -0 cat |
sha1sum | cut
-b-40)
58 ################################################################################
60 if [ -z "${INSTALL_DIR}" ]; then
64 COMPILER_FILE
="${INSTALL_DIR}/generated-compiler-id.txt"
65 REPO_SCHEMA_FILE
="${INSTALL_DIR}/generated-repo-schema-id.txt"
68 OUTPUT
="${INSTALL_DIR}/hhvm"
70 echo -n "${COMPILER_ID}" > "${COMPILER_FILE}"
71 echo -n "${HHVM_REPO_SCHEMA}" > "${REPO_SCHEMA_FILE}"