mirror of
https://github.com/gusaul/grpcox.git
synced 2024-12-26 02:40:10 +00:00
Windows path fix and build script
This commit is contained in:
parent
30fef12ac9
commit
dac544efe4
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
grpcox
|
grpcox
|
||||||
log
|
log
|
||||||
*.out
|
*.out
|
||||||
|
dist/
|
||||||
|
|
|
@ -49,7 +49,7 @@ func (r *Resource) openDescriptor() error {
|
||||||
return nil
|
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
|
// make list of protos name to be used as descriptor
|
||||||
protos := make([]string, 0, len(r.protos))
|
protos := make([]string, 0, len(r.protos))
|
||||||
|
@ -288,7 +288,7 @@ func (r *Resource) exit(code int) {
|
||||||
// proto files will be persisted in /tmp/grpcox/127.0.0.1:8888
|
// proto files will be persisted in /tmp/grpcox/127.0.0.1:8888
|
||||||
// if the directory is already there, remove it first
|
// if the directory is already there, remove it first
|
||||||
func (r *Resource) AddProtos(protos []Proto) error {
|
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)
|
err := os.MkdirAll(protoPath, 0777)
|
||||||
if os.IsExist(err) {
|
if os.IsExist(err) {
|
||||||
os.RemoveAll(protoPath)
|
os.RemoveAll(protoPath)
|
||||||
|
|
32
go-executable-build.sh
Executable file
32
go-executable-build.sh
Executable file
|
@ -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
|
Loading…
Reference in New Issue
Block a user