github.com/yoogoc/kratos-scaffold@v0.0.0-20240402032722-a538b3c18955/project_generator/resources/Makefile.example (about)

     1  modules = $(shell ls app)
     2  
     3  migrate-modules := $(addprefix migrate-, $(modules))
     4  rollup-modules := $(addprefix rollup-, $(modules))
     5  wire-modules := $(addprefix wire-, $(modules))
     6  config-modules := $(addprefix config-, $(modules))
     7  ent-modules := $(addprefix ent-, $(modules))
     8  proto-modules := $(addprefix proto-, $(modules))
     9  
    10  API_PROTO_FILES=$(shell find api -name *.proto)
    11  
    12  $(migrate-modules):
    13  	go run ./app/$(patsubst migrate-%,%,$@)/cmd migrate up -c ./configs/$(patsubst migrate-%,%,$@) --dir ./app/$(patsubst migrate-%,%,$@)/db/migration
    14  
    15  $(rollup-modules):
    16  	go run ./app/$(patsubst rollup-%,%,$@)/cmd migrate down -c ./configs/$(patsubst rollup-%,%,$@) --dir ./app/$(patsubst rollup-%,%,$@)/db/migration
    17  
    18  $(wire-modules):
    19  	wire ./app/$(patsubst wire-%,%,$@)/cmd
    20  
    21  $(ent-modules):
    22  	go generate ./app/$(patsubst ent-%,%,$@)/internal/data/ent/generate.go
    23  
    24  $(config-modules):
    25  	protoc --proto_path=./app/$(patsubst config-%,%,$@)/internal/conf \
    26  	       --proto_path=./third_party \
    27   	       --go_out=paths=source_relative:./app/$(patsubst config-%,%,$@)/internal/conf \
    28  	       $(shell find ./app/$(patsubst config-%,%,$@)/internal/conf -name *.proto)
    29  
    30  $(proto-modules):
    31  	kratos proto client ./api/$(patsubst proto-%,%,$@)
    32  
    33  .PHONY: api
    34  api:
    35  	protoc --proto_path=. \
    36  	       --proto_path=./third_party \
    37   	       --go_out=paths=source_relative:. \
    38   	       --go-http_out=paths=source_relative:. \
    39   	       --go-grpc_out=paths=source_relative:. \
    40             --openapiv2_out . \
    41  	       $(API_PROTO_FILES)