Merge pull request #64 from dreimolo/macos_AS_fix

Macos apple silicon fix, and slight improvements to sample downloader
This commit is contained in:
Viktor 2023-12-18 18:29:14 +01:00 committed by GitHub
commit 5bd3934d22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 5 deletions

View File

@ -44,11 +44,19 @@ dependencies {
protobuf { protobuf {
protoc { protoc {
artifact = "com.google.protobuf:protoc:3.0.2" if (osdetector.os == "osx") {
artifact = "com.google.protobuf:protoc:3.0.2:osx-x86_64"
} else {
artifact = "com.google.protobuf:protoc:3.0.2"
}
} }
plugins { plugins {
grpc { grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.1.2' if (osdetector.os == "osx") {
artifact = "io.grpc:protoc-gen-grpc-java:1.1.2:osx-x86_64"
} else {
artifact = "io.grpc:protoc-gen-grpc-java:1.1.2"
}
} }
} }

View File

@ -2,6 +2,25 @@
set -e set -e
# Check if wget exists
if command -v wget &> /dev/null; then
dl_prg="wget -O"
elif command -v curl &> /dev/null; then
dl_prg="curl -o"
else
echo "Neither wget nor curl found, exiting .."
exit 1
fi
case "$1" in
"s"|"m"|"l"|"xl")
;;
*)
echo "Invalid argument. Must be one of 's', 'm', 'l' or 'xl'."
exit 1
;;
esac
SAMPLE_NAME=crawl-${1:-m} SAMPLE_NAME=crawl-${1:-m}
SAMPLE_DIR="node-1/samples/${SAMPLE_NAME}/" SAMPLE_DIR="node-1/samples/${SAMPLE_NAME}/"
@ -11,7 +30,7 @@ function download_model {
if [ ! -f $model ]; then if [ ! -f $model ]; then
echo "** Downloading $url" echo "** Downloading $url"
wget -O $model $url $dl_prg $model $url
fi fi
} }
@ -23,7 +42,7 @@ fi
mkdir -p node-1/samples/ mkdir -p node-1/samples/
SAMPLE_TARBALL=samples/${SAMPLE_NAME}.tar.gz SAMPLE_TARBALL=samples/${SAMPLE_NAME}.tar.gz
download_model ${SAMPLE_TARBALL} https://downloads.marginalia.nu/${SAMPLE_TARBALL} || rm ${SAMPLE_TARBALL} download_model ${SAMPLE_TARBALL}.tmp https://downloads.marginalia.nu/${SAMPLE_TARBALL} && mv ${SAMPLE_TARBALL}.tmp ${SAMPLE_TARBALL}
if [ ! -f ${SAMPLE_TARBALL} ]; then if [ ! -f ${SAMPLE_TARBALL} ]; then
echo "!! Failed" echo "!! Failed"

View File

@ -12,7 +12,8 @@ function download_model {
if [ ! -f $model ]; then if [ ! -f $model ]; then
echo "** Downloading $url" echo "** Downloading $url"
curl -s -o $model $url curl -s -o $model.tmp $url
mv $model.tmp $model
fi fi
} }