Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3267496
D3906.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D3906.diff
View Options
diff --git a/services/backup/Dockerfile b/services/backup/Dockerfile
--- a/services/backup/Dockerfile
+++ b/services/backup/Dockerfile
@@ -13,10 +13,10 @@
WORKDIR /transferred
COPY native/cpp/CommonCpp/grpc/protos/backup.proto native/cpp/CommonCpp/grpc/protos/blob.proto protos/
-COPY services/backup/docker/ scripts/
COPY services/lib/ .
+COPY services/lib/docker/ scripts/
COPY services/backup/ .
-RUN scripts/build_server.sh
+RUN scripts/build_service.sh
-CMD if [ "$COMM_TEST_SERVICES" -eq 1 ]; then scripts/run_tests.sh; else scripts/run_server.sh; fi
+CMD if [ "$COMM_TEST_SERVICES" -eq 1 ]; then scripts/run_tests.sh; else scripts/run_service.sh; fi
diff --git a/services/backup/docker/generate.sh b/services/backup/docker/generate.sh
deleted file mode 100755
--- a/services/backup/docker/generate.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-
-set -e
-
-echo "generating files from protos..."
-
-protoc -I=./protos --cpp_out=_generated --grpc_out=_generated --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` ./protos/backup.proto
-protoc -I=./protos --cpp_out=_generated --grpc_out=_generated --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` ./protos/blob.proto
-
-echo "success - code generated from protos"
diff --git a/services/backup/docker/run_server.sh b/services/backup/docker/run_server.sh
deleted file mode 100755
--- a/services/backup/docker/run_server.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-set -e
-
-cmake/build/bin/backup
diff --git a/services/blob/Dockerfile b/services/blob/Dockerfile
--- a/services/blob/Dockerfile
+++ b/services/blob/Dockerfile
@@ -7,8 +7,8 @@
WORKDIR /transferred
COPY native/cpp/CommonCpp/grpc/protos/blob.proto protos/blob.proto
-COPY services/blob/docker/ scripts/
COPY services/lib/ .
+COPY services/lib/docker/ scripts/
COPY services/blob/ .
ARG COMM_SERVICES_DEV_MODE
@@ -17,6 +17,6 @@
ARG COMM_TEST_SERVICES
ENV COMM_TEST_SERVICES=${COMM_TEST_SERVICES}
-RUN scripts/build_server.sh
+RUN scripts/build_service.sh
-CMD if [ "$COMM_TEST_SERVICES" -eq 1 ]; then scripts/run_tests.sh; else scripts/run_server.sh; fi
+CMD if [ "$COMM_TEST_SERVICES" -eq 1 ]; then scripts/run_tests.sh; else scripts/run_service.sh; fi
diff --git a/services/blob/docker/build.sh b/services/blob/docker/build.sh
deleted file mode 100755
--- a/services/blob/docker/build.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-
-set -e
-
-NPROC=0
-
-NPROC=$(nproc 2> /dev/null || echo 1)
-if [[ $NPROC -eq 1 ]]; then
- NPROC=$(sysctl -n hw.physicalcpu 2> /dev/null || echo 1)
-fi
-
-echo "building the server (nproc=$NPROC)..."
-
-pushd cmake/build
-cmake ../..
-make -j $NPROC
-
-popd
-
-echo "success - server built"
diff --git a/services/blob/docker/build_server.sh b/services/blob/docker/build_server.sh
old mode 100755
new mode 100644
--- a/services/blob/docker/build_server.sh
+++ b/services/blob/docker/build_server.sh
@@ -19,5 +19,5 @@
rm -rf cmake/build
mkdir -p cmake/build
-scripts/generate.sh
+scripts/proto_codegen.sh
scripts/build.sh
diff --git a/services/blob/docker/generate.sh b/services/blob/docker/generate.sh
deleted file mode 100755
--- a/services/blob/docker/generate.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-set -e
-
-echo "generating files from protos..."
-
-protoc -I=./protos --cpp_out=_generated --grpc_out=_generated --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` ./protos/blob.proto
-
-echo "success - code generated from protos"
diff --git a/services/blob/docker/run_server.sh b/services/blob/docker/run_server.sh
deleted file mode 100755
--- a/services/blob/docker/run_server.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-set -e
-
-cmake/build/bin/blob
diff --git a/services/blob/docker/run_tests.sh b/services/blob/docker/run_tests.sh
deleted file mode 100755
--- a/services/blob/docker/run_tests.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-set -e
-
-pushd cmake/build
-make test ARGS="-V"
-popd # cmake/build
diff --git a/services/backup/docker/build_server.sh b/services/lib/docker/build_service.sh
rename from services/backup/docker/build_server.sh
rename to services/lib/docker/build_service.sh
--- a/services/backup/docker/build_server.sh
+++ b/services/lib/docker/build_service.sh
@@ -19,5 +19,5 @@
rm -rf cmake/build
mkdir -p cmake/build
-scripts/generate.sh
-scripts/build.sh
+scripts/proto_codegen.sh
+scripts/build_sources.sh
diff --git a/services/backup/docker/build.sh b/services/lib/docker/build_sources.sh
rename from services/backup/docker/build.sh
rename to services/lib/docker/build_sources.sh
diff --git a/services/lib/docker/proto_codegen.sh b/services/lib/docker/proto_codegen.sh
new file mode 100755
--- /dev/null
+++ b/services/lib/docker/proto_codegen.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -e
+
+echo "generating files from protos..."
+
+for PROTO_FILE in $(ls ./protos); do
+ protoc -I=./protos --cpp_out=_generated --grpc_out=_generated --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` ./protos/$PROTO_FILE
+done
+
+echo "success - code generated from protos"
diff --git a/services/lib/docker/run_service.sh b/services/lib/docker/run_service.sh
new file mode 100755
--- /dev/null
+++ b/services/lib/docker/run_service.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+set -e
+
+EXE_PATH="./cmake/build/bin"
+
+EXE=`ls $EXE_PATH`
+EXES=`ls $EXE_PATH | wc -l`
+
+if [[ $EXES -ne 1 ]]; then
+ echo "there should be exactly one executable of a service, $EXES found";
+ exit 1;
+fi
+
+$EXE_PATH/$EXE
diff --git a/services/backup/docker/run_tests.sh b/services/lib/docker/run_tests.sh
rename from services/backup/docker/run_tests.sh
rename to services/lib/docker/run_tests.sh
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 17, 2:48 AM (16 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2511259
Default Alt Text
D3906.diff (5 KB)
Attached To
Mode
D3906: [services] Lib - Add scripts to lib
Attached
Detach File
Event Timeline
Log In to Comment