Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
grpcox
log
*.out
*.out
dist/
4 changes: 2 additions & 2 deletions core/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (r *Resource) openDescriptor() error {
return nil
}

protoPath := filepath.Join(BasePath, r.clientConn.Target())
protoPath := strings.ReplaceAll(filepath.Join(BasePath, r.clientConn.Target()),":", "_")

// make list of protos name to be used as descriptor
protos := make([]string, 0, len(r.protos))
Expand Down Expand Up @@ -288,7 +288,7 @@ func (r *Resource) exit(code int) {
// proto files will be persisted in /tmp/grpcox/127.0.0.1:8888
// if the directory is already there, remove it first
func (r *Resource) AddProtos(protos []Proto) error {
protoPath := filepath.Join(BasePath, r.clientConn.Target())
protoPath := strings.ReplaceAll(filepath.Join(BasePath, r.clientConn.Target()),":", "_")
err := os.MkdirAll(protoPath, 0777)
if os.IsExist(err) {
os.RemoveAll(protoPath)
Expand Down
32 changes: 32 additions & 0 deletions go-executable-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

package_name=grpcox
version=1.0.0

platforms=("windows/amd64" "windows/386" "darwin/amd64" "linux/amd64")
mkdir -p dist/log
rm -fr dist/index && cp -r index dist/index
rm -fr dist/LICENSE && cp -r LICENSE dist/LICENSE

for platform in "${platforms[@]}"
do
platform_split=(${platform//\// })
GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}
output_name=$package_name'-'$version'-'$GOOS'-'$GOARCH
ext=""
if [ $GOOS = "windows" ]; then
ext='.exe'
fi

env GOOS=$GOOS GOARCH=$GOARCH go build -o dist/$package_name$ext
if [ $? -ne 0 ]; then
echo 'An error has occurred! Aborting the script execution...'
exit 1
fi
(cd dist; rm -f $output_name.zip; zip -r $output_name.zip $package_name$ext log index LICENSE)
rm -f dist/$package_name$ext
done

rm -fr dist/index
rm -fr dist/LICENSE