]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Move proto generation code block out of if(WITH_MGR_DASHBOARD_FRONTEND). 61089/head
authorPaulo E. Castro <pecastro@wormholenet.com>
Fri, 7 Feb 2025 22:04:53 +0000 (22:04 +0000)
committerPaulo E. Castro <pecastro@wormholenet.com>
Sat, 8 Feb 2025 11:28:58 +0000 (11:28 +0000)
- This ensures protos are built during the RPM build process.
- gitignore the sourced gateway.proto file.

Signed-off-by: Paulo E. Castro <pecastro@wormholenet.com>
.gitignore
src/pybind/mgr/dashboard/CMakeLists.txt

index e4aadc53315d5809914007d2ceaae953047dfcbb..9b18809ae32a5055681deb3774cb1e7807e6fe32 100644 (file)
@@ -99,5 +99,6 @@ src/pybind/rgw/rgw.c
 src/pybind/rgw/rgw.egg-info/
 
 # GRPC protobuff file generation #PR 61089
+src/pybind/mgr/dashboard/services/proto/gateway.proto
 src/pybind/mgr/dashboard/services/proto/gateway_pb2.py
 src/pybind/mgr/dashboard/services/proto/gateway_pb2_grpc.py
\ No newline at end of file
index 9dc4ecc4a274cd79a1cdd2abda7607ff02bf37ae..02990971ebcda36a2f44a3b9e80a8904519d3ba9 100644 (file)
@@ -1,3 +1,32 @@
+# Required for building the dashboard grpc protos at build time
+set(CEPH_GRPC_VIRTUALENV ${CEPH_BUILD_VIRTUALENV}/ceph-grpc-virtualenv)
+set(CEPH_NVME_GATEWAY_PROTO_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/nvmeof/gateway/control/proto)
+
+add_custom_command(
+  OUTPUT ${CEPH_GRPC_VIRTUALENV}/lib/python*/site-packages/grpc_tools
+  COMMAND ${CMAKE_SOURCE_DIR}/src/tools/setup-virtualenv.sh --python=${Python3_EXECUTABLE} ${CEPH_GRPC_VIRTUALENV}
+  COMMAND ${CEPH_GRPC_VIRTUALENV}/bin/pip install grpcio-tools
+  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+  COMMENT "grpcio-tools is being installed")
+
+# protobuffer files generation
+add_custom_command(
+  OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/services/proto/gateway_pb2.py" "${CMAKE_CURRENT_SOURCE_DIR}/services/proto/gateway_pb2_grpc.py"
+  COMMAND cp ${CEPH_NVME_GATEWAY_PROTO_DIR}/gateway.proto dashboard/services/proto/gateway.proto
+  COMMAND . ${CEPH_GRPC_VIRTUALENV}/bin/activate && ${CEPH_GRPC_VIRTUALENV}/bin/python -m grpc_tools.protoc --proto_path=. --python_out=. --grpc_python_out=. dashboard/services/proto/gateway.proto && deactivate
+  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
+  DEPENDS ${CEPH_NVME_GATEWAY_PROTO_DIR}/gateway.proto ${CEPH_GRPC_VIRTUALENV}/lib/python*/site-packages/grpc_tools
+  COMMENT "proto generation for grpc deps")
+add_custom_target(mgr-dashboard-services-deps
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/services/proto/gateway_pb2.py ${CMAKE_CURRENT_SOURCE_DIR}/services/proto/gateway_pb2_grpc.py
+  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+add_custom_target(mgr-dashboard-services-build
+  ALL
+  DEPENDS mgr-dashboard-services-deps)
+
+add_dependencies(tests mgr-dashboard-services-build)
+
 install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
   DESTINATION ${CEPH_INSTALL_DATADIR}/mgr
   ${mgr_module_install_excludes}
@@ -15,35 +44,6 @@ if(WITH_MGR_DASHBOARD_FRONTEND)
     add_tox_test(mgr-dashboard-openapi TOX_ENVS openapi-check)
   endif()
 
-  # Required for building the dashboard grpc protos at build time
-  set(CEPH_GRPC_VIRTUALENV ${CEPH_BUILD_VIRTUALENV}/ceph-grpc-virtualenv)
-  set(CEPH_NVME_GATEWAY_PROTO_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/nvmeof/gateway/control/proto)
-
-  add_custom_command(
-    OUTPUT ${CEPH_GRPC_VIRTUALENV}/lib/python*/site-packages/grpc_tools
-    COMMAND ${CMAKE_SOURCE_DIR}/src/tools/setup-virtualenv.sh --python=${Python3_EXECUTABLE} ${CEPH_GRPC_VIRTUALENV}
-    COMMAND ${CEPH_GRPC_VIRTUALENV}/bin/pip install grpcio-tools
-    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-    COMMENT "grpcio-tools is being installed")
-
-  # protobuffer files generation
-  add_custom_command(
-    OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/services/proto/gateway_pb2.py" "${CMAKE_CURRENT_SOURCE_DIR}/services/proto/gateway_pb2_grpc.py"
-    COMMAND cp ${CEPH_NVME_GATEWAY_PROTO_DIR}/gateway.proto dashboard/services/proto/gateway.proto
-    COMMAND . ${CEPH_GRPC_VIRTUALENV}/bin/activate && ${CEPH_GRPC_VIRTUALENV}/bin/python -m grpc_tools.protoc --proto_path=. --python_out=. --grpc_python_out=. dashboard/services/proto/gateway.proto && deactivate
-    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
-    DEPENDS ${CEPH_NVME_GATEWAY_PROTO_DIR}/gateway.proto ${CEPH_GRPC_VIRTUALENV}/lib/python*/site-packages/grpc_tools
-    COMMENT "proto generation for grpc deps")
-  add_custom_target(mgr-dashboard-services-deps
-    DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/services/proto/gateway_pb2.py ${CMAKE_CURRENT_SOURCE_DIR}/services/proto/gateway_pb2_grpc.py
-    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
-
-  add_custom_target(mgr-dashboard-services-build
-    ALL
-    DEPENDS mgr-dashboard-services-deps)
-
-  add_dependencies(tests mgr-dashboard-services-build)
-
 else()
   if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/frontend/dist)
     # prebuilt