update embedding interfaces mod.rs generator script to add MPL

also use better zsh syntax
This commit is contained in:
Mike Blumenkrantz 2015-05-06 12:17:13 -04:00
parent ad91db7224
commit ff6667f564

16
ports/cef/regen_interface_mod_rs.sh Normal file → Executable file
View file

@ -1,7 +1,19 @@
#!/bin/zsh
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
setopt extended_glob
echo -e $(cat << END_MPL
/* This Source Code Form is subject to the terms of the Mozilla Public\n
* License, v. 2.0. If a copy of the MPL was not distributed with this\n
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */\n
END_MPL) >>| interfaces_mod.rs
# loop all files in interfaces dir
for x in interfaces/^*mod.rs
for x in $(print interfaces/*.rs~interfaces/mod.rs)
do
# open the use statement
echo -n "pub use interfaces::$(basename $x .rs)::{" >>| interfaces_mod.rs
@ -26,7 +38,7 @@ grep -E '^pub struct Cef' types.rs|sed 's/pub struct \([^ ]*\) .*/pub use types:
# newline separators
echo -e '\n\n' >>| interfaces_mod.rs
# loop all files in interfaces dir again
for x in interfaces/^*mod.rs
for x in $(print interfaces/*.rs~interfaces/mod.rs)
do
# add mod statements for all interfaces
echo "pub mod $(basename $x .rs);" >>| interfaces_mod.rs