Add fmt script to admin dir

This commit is contained in:
Dirkjan Ochtman 2021-03-22 14:02:06 +01:00 committed by ctz
parent be6c221271
commit 9ceff5e988
3 changed files with 20 additions and 0 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ target/
*.gcno
*.info
sslkeylogfile.txt
admin/rustfmt

View File

@ -5,3 +5,4 @@ members = [
# tests and example code that depend on mio
"rustls-mio",
]
exclude = ["admin/rustfmt"]

18
admin/fmt Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh
set -xe
ADMIN=$(dirname "$0")
PREV=$(pwd)
if [ ! -d $ADMIN/rustfmt ] ; then
git clone --depth 1 https://github.com/rust-lang/rustfmt $ADMIN/rustfmt
fi
if [ ! -x $ADMIN/rustfmt/target/release/cargo-fmt ] ; then
cd $ADMIN/rustfmt
export CFG_RELEASE=nightly
export CFG_RELEASE_CHANNEL=nightly
cargo build --release --features rustfmt,cargo-fmt
fi
cd $PREV
PATH=$ADMIN/rustfmt/release/:$PATH cargo-fmt