-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (53 loc) · 1.54 KB
/
Makefile
File metadata and controls
63 lines (53 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Sky-Server Makefile
.PHONY: help init build run test clean tidy swagger metadata-init
# 显示帮助信息
help:
@echo "Sky-Server Makefile Commands:"
@echo " make init - 初始化项目(安装依赖)"
@echo " make build - 编译项目"
@echo " make run - 运行项目"
@echo " make test - 运行测试"
@echo " make clean - 清理编译产物"
@echo " make tidy - 整理依赖"
@echo " make swagger - 生成Swagger文档"
@echo " make metadata-init - 从数据库初始化元数据"
# 初始化项目
init:
@echo "Installing dependencies..."
go mod download
go install github.com/swaggo/swag/cmd/swag@latest
@echo "Dependencies installed successfully!"
# 编译项目
build:
@echo "Building Sky-Server..."
go build -o bin/sky-server cmd/server/main.go
@echo "Build completed: bin/sky-server"
# 运行项目
run:
@echo "Starting Sky-Server..."
go run cmd/server/main.go
# 运行测试
test:
@echo "Running tests..."
go test -v ./...
# 清理编译产物
clean:
@echo "Cleaning..."
rm -rf bin/
rm -rf dist/
@echo "Clean completed!"
# 整理依赖
tidy:
@echo "Tidying dependencies..."
go mod tidy
@echo "Dependencies tidied!"
# 生成Swagger文档
swagger:
@echo "Generating Swagger documentation..."
swag init -g cmd/server/main.go -o api/swagger
@echo "Swagger documentation generated!"
# 从数据库初始化元数据
metadata-init:
@echo "Initializing metadata from database..."
go run cmd/metadata-init/main.go
@echo "Metadata initialization completed!"