forked from infobloxopen/atlas-gentool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (44 loc) · 1.59 KB
/
Makefile
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
# Utility docker image to generate Go files from .proto definition.
# https://github.com/infobloxopen/atlas-gentool
IMAGE_NAME := infoblox/atlas-gentool
GO_PATH := /go
SRCROOT_ON_HOST := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
SRCROOT_IN_CONTAINER := $(GO_PATH)/src/github.com/infobloxopen/atlas-gentool
IMAGE_VERSION ?= $(shell git describe --tags --dirty=-dev --always)
PGGVersion ?= $(shell cat ProtocGenGorm.version)
AATVersion ?= $(shell cat AtlasAppToolkit.version)
.PHONY: all
all: latest
# Create the Docker image with the latest tag.
.PHONY: latest
latest:
docker build -f Dockerfile -t $(IMAGE_NAME):latest .
.PHONY: versioned
versioned:
docker build -f Dockerfile --build-arg PGG_VERSION=$(PGGVersion) --build-arg AAT_VERSION=$(AATVersion) -t $(IMAGE_NAME):$(IMAGE_VERSION) .
.PHONY: clean
clean:
docker rmi -f $(IMAGE_NAME)
docker rmi `docker images --filter "label=intermediate=true" -q`
.PHONY: test test-gen test-check test-clean
test: test-gen test-check test-clean
test-gen:
@docker run --rm -v $(SRCROOT_ON_HOST):$(SRCROOT_IN_CONTAINER) \
infoblox/atlas-gentool:latest \
--go_out=plugins=grpc:. \
--grpc-gateway_out=logtostderr=true:. \
--validate_out="lang=go:." \
--gorm_out=. \
--swagger_out=:. github.com/infobloxopen/atlas-gentool/testdata/test.proto
test-check:
test -e testdata/test.pb.go
test -e testdata/test.pb.gw.go
test -e testdata/test.pb.gorm.go
test -e testdata/test.pb.validate.go
test -e testdata/test.swagger.json
test-clean:
rm -f testdata/*.go
rm -f testdata/*.json
.PHONY: version
version:
@echo $(IMAGE_VERSION)