[refmt] wrap refmt into scripts/refmt.sh

Summary: Avoids code duplication.

Reviewed By: jberdine

Differential Revision: D4658689

fbshipit-source-id: b34797c
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent a8ba910c69
commit f30a26f02c

@ -250,10 +250,10 @@ rei:
# convert to reason # convert to reason
%.re : %.ml %.re : %.ml
refmt -assume-explicit-arity -heuristics-file unary.txt -parse ml -print re $< > $*.re $(SCRIPT_DIR)/refmt.sh -parse ml -print re $< > $*.re
%.rei : %.mli %.rei : %.mli
refmt -assume-explicit-arity -heuristics-file unary.txt -parse ml -print re $< > $*.rei $(SCRIPT_DIR)/refmt.sh -parse ml -print re $< > $*.rei
roots:=Infer InferAnalyzeExe InferClang InferPrintExe StatsAggregator roots:=Infer InferAnalyzeExe InferClang InferPrintExe StatsAggregator
clusters:=base clang java IR clusters:=base clang java IR

@ -0,0 +1,22 @@
#!/bin/bash
# Copyright (c) 2016 - present Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
# refmt with infer options
set -e
set -o pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
refmt \
-assume-explicit-arity \
-print-width 100 \
-heuristics-file "$SCRIPT_DIR/unary.txt" \
"$@"

@ -1,4 +1,4 @@
#/bin/bash #!/bin/bash
# Copyright (c) 2016 - present Facebook, Inc. # Copyright (c) 2016 - present Facebook, Inc.
# All rights reserved. # All rights reserved.
@ -10,7 +10,13 @@
# re-format reason code # re-format reason code
set -e
set -o pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
base=`basename $0` base=`basename $0`
TMPFILE=`mktemp -t ${base}` || exit 1 tmpfile=`mktemp -t "${base}.XXXX"`
refmt -print-width 100 -heuristics-file unary.txt -parse re -print re $1 > $TMPFILE
mv $TMPFILE $1 "$SCRIPT_DIR/refmt.sh" -parse re -print re "$@" > "$tmpfile"
mv "$tmpfile" "${@: -1}"

Loading…
Cancel
Save