-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Dont build and run swagger for release builds
* This is due to mixing CGO and Go builds (swag) during cross compiling. There is no added value in running swagger for release builds, so disable them Signed-off-by: Mahendra Paipuri <[email protected]>
- Loading branch information
1 parent
a2dae34
commit 7b2fc9c
Showing
1 changed file
with
7 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,14 +181,15 @@ common-unused: | |
$(GO) mod tidy | ||
@git diff --exit-code -- go.sum go.mod | ||
|
||
# Dont bother updating swagger docs for release builds | ||
.PHONY: common-build | ||
common-build: promu swag | ||
ifeq ($(RELEASE_BUILD), 0) | ||
ifeq ($(CGO_BUILD), 1) | ||
@echo ">> updating swagger docs" | ||
$(SWAG) init -d $(SWAGGER_DIR) -g $(SWAGGER_MAIN) -o $(SWAGGER_DIR)/docs --pd --quiet | ||
$(SWAG) fmt -d $(SWAGGER_DIR) -g $(SWAGGER_MAIN) | ||
endif | ||
ifeq ($(RELEASE_BUILD), 0) | ||
@echo ">> building test binaries" | ||
$(PROMU_TEST) build --prefix $(PREFIX) $(PROMU_BINARIES) | ||
endif | ||
|
@@ -239,14 +240,15 @@ $(PROMU): | |
cp $(PROMU_TMP)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM)/promu $(FIRST_GOPATH)/bin/promu | ||
rm -r $(PROMU_TMP) | ||
|
||
# Set CC and CXX vars here else during cross compilation swag will be built in ARCH | ||
# specific bin folder like $(GOPATH)/bin/linux_386/swag. By setting CC and CXX we are | ||
# explicitly saying it to build as default arch and bin will be placed in $(GOPATH)/bin | ||
# Dont run swagger for release builds. This is due to cross compiling with GOARCH set | ||
# to different archs and swag will be built in arch specific bin folder. | ||
.PHONY: swag | ||
swag: $(SWAG) | ||
$(SWAG): | ||
ifeq ($(RELEASE_BUILD), 0) | ||
ifeq ($(CGO_BUILD), 1) | ||
cc='gcc' cxx='g++' GOARCH='amd64' $(GO) install github.com/swaggo/swag/cmd/[email protected] | ||
$(GO) install github.com/swaggo/swag/cmd/[email protected] | ||
endif | ||
endif | ||
|
||
.PHONY: proto | ||
|