js/src/frontend/binast/build.sh
author Tooru Fujisawa <arai_a@mac.com>
Wed, 13 Mar 2019 04:29:44 +0000
changeset 521653 123ecc5c9586
parent 521651 js/src/frontend/binsource/build.sh@7cbe3fbc4b7f
child 521654 976e93ae2dbc
permissions -rwxr-xr-x
Bug 1505343 - Part 1: Rename binsource => binast. r=Yoric Differential Revision: https://phabricator.services.mozilla.com/D23097

#!/bin/sh

cargo run -- \
      ../BinAST.webidl_ \
      ../BinAST.yaml \
      --out-class ../BinASTParser-tmp.h    \
      --out-impl ../BinASTParser-tmp.cpp   \
      --out-enum ../BinASTEnum-tmp.h    \
      --out-token ../BinToken-tmp.h

MACH=../../../../mach

${MACH} clang-format --path \
        ../BinASTParser-tmp.h \
        ../BinASTParser-tmp.cpp \
        ../BinASTEnum-tmp.h \
        ../BinToken-tmp.h

# Usage: update SRC DST
#
# If SRC file and DST file have different content, move SRC file to DST file.
# If not, remove SRC file.
update() {
  SRC=$1
  DST=$2

  if diff -q ${SRC} ${DST} > /dev/null; then
      echo "SKIPPED: ${DST} was not modified"
      rm ${SRC}
  else
      echo "UPDATED: ${DST} was modified"
      mv ${SRC} ${DST}
  fi
}

update ../BinASTParser-tmp.h ../BinASTParser.h
update ../BinASTParser-tmp.cpp ../BinASTParser.cpp
update ../BinASTEnum-tmp.h ../BinASTEnum.h
update ../BinToken-tmp.h ../BinToken.h