add gitignore for '.so' share-objects files + add script to build default types

This commit is contained in:
Adrien Marquès 2018-05-24 15:17:24 +02:00
parent 5ae2554fba
commit 6025b637ed
2 changed files with 33 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.so
/types

31
install-default-types.sh Normal file
View File

@ -0,0 +1,31 @@
#!/bin/bash
# (1) Get default path #
DEFAULT_PATH="`realpath $GOPATH`/src/git.xdrm.io/gfw/checker/default";
# fail if do not exist
test -d $DEFAULT_PATH || (echo "$DEFAULT_PATH does not exists.. aborting"; exit 1) || exit 1;
# (2) List go files #
GO_FILES="`ls $DEFAULT_PATH/**/*.go`"
# (3) Create target directory #
mkdir -p ./types;
# (4) Build each file #
d=1
for Type in $GO_FILES; do
plugin_name="`basename $(dirname $Type)`"
echo -e "($d) Building \e[33m$plugin_name\e[0m";
go build -buildmode=plugin -o "./types/$plugin_name.so" $Type;
# Manage failure
if [ "$?" -ne "0" ]; then
echo -e "\e[31m/!\\ \e[0merror building \e[33m$plugin_name\e[0m\n"
fi
d=""`expr $d + 1`""
done;
# (5) ACK #
echo -e "\n[ \e[32mfinished\e[0m ]\n"
echo -e "files are located inside the relative \e[33m./types\e[0m directory"