From 859d82fcd176a0cbb7f172795b59530b72b496dc Mon Sep 17 00:00:00 2001 From: "Xinwei Xiong(cubxxw-openim)" <3293172751nss@gmail.com> Date: Tue, 4 Jul 2023 18:25:51 +0800 Subject: [PATCH] feat: add makefile bug Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com> --- pkg/common/db/controller/storage.go | 1 - scripts/common.sh | 14 ++++++++++++++ scripts/make-rules/swagger.mk | 12 ++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 scripts/make-rules/swagger.mk diff --git a/pkg/common/db/controller/storage.go b/pkg/common/db/controller/storage.go index ab20e7da8..c383eb8ec 100644 --- a/pkg/common/db/controller/storage.go +++ b/pkg/common/db/controller/storage.go @@ -14,7 +14,6 @@ package controller -import "C" import ( "bytes" "context" diff --git a/scripts/common.sh b/scripts/common.sh index a254412de..3a2090b6f 100755 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -1,4 +1,18 @@ #!/usr/bin/env bash +# Copyright © 2023 OpenIM. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # shellcheck disable=SC2034 # Variables sourced in other scripts. diff --git a/scripts/make-rules/swagger.mk b/scripts/make-rules/swagger.mk new file mode 100644 index 000000000..0598813c3 --- /dev/null +++ b/scripts/make-rules/swagger.mk @@ -0,0 +1,12 @@ +# ============================================================================== +# Makefile helper functions for swagger +# + +.PHONY: swagger.run +swagger.run: tools.verify.swagger + @echo "===========> Generating swagger API docs" + @swagger generate spec --scan-models -w $(ROOT_DIR)/cmd/genswaggertypedocs -o $(ROOT_DIR)/api/swagger/swagger.yaml + +.PHONY: swagger.serve +swagger.serve: tools.verify.swagger + @swagger serve -F=redoc --no-open --port 36666 $(ROOT_DIR)/api/swagger/swagger.yaml