Makefile 550 B

12345678910111213141516171819202122
  1. # protobuf文件列表
  2. API_PROTO_FILES=$(shell find api -name "*.proto")
  3. # protoc-gen-openapiv2插件的位置
  4. OPEN_API_V2_PLUGIN_FILE=./bin/protoc-gen-openapiv2.exe
  5. # swagger生成的目录
  6. SWAGGER_OUT_DIR=./gen/swagger/
  7. .PHONY: swagger
  8. # generate swagger file
  9. swagger:
  10. rm -rf $(SWAGGER_OUT_DIR)*
  11. ./bin/protoc/protoc.exe \
  12. --proto_path=. \
  13. --plugin=protoc-gen-openapiv2=$(OPEN_API_V2_PLUGIN_FILE) \
  14. --openapiv2_out $(SWAGGER_OUT_DIR) \
  15. --openapiv2_opt json_names_for_fields=false \
  16. $(API_PROTO_FILES)
  17. .PHONY: all
  18. all:
  19. make swagger;