Skip to content

Commit

Permalink
build: local build improvements [DET-5118] (#2060)
Browse files Browse the repository at this point in the history
- improved build dependency for webui/react
- add an option for concurrent download of some dependencies
- fix an issue with a missing agent build dependency
- fix parallel golint-ci check
  • Loading branch information
hamidzr authored Mar 23, 2021
1 parent 202c485 commit b531bda
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 26 deletions.
44 changes: 32 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@ all:
$(MAKE) build

.PHONY: get-deps
get-deps:
get-deps: get-deps-pip get-deps-go get-deps-bindings get-deps-webui

.PHONY: get-deps-%
get-deps-%:
$(MAKE) -C $(subst -,/,$*) get-deps

.PHONY: get-deps-pip
get-deps-pip:
pip install -r requirements.txt
$(MAKE) -C master $@
$(MAKE) -C agent $@
$(MAKE) -C proto $@
$(MAKE) -C bindings $@
$(MAKE) -C webui $@

.PHONY: get-deps-go
get-deps-go:
$(MAKE) get-deps-master
$(MAKE) get-deps-agent
$(MAKE) get-deps-proto

.PHONY: package
package:
Expand All @@ -20,16 +28,27 @@ package:
.PHONY: build-%
build-%:
$(MAKE) -C $(subst -,/,$*) build

.PHONY: build-docs
build-docs: build-common build-harness build-cli build-deploy build-examples build-helm build-proto
$(MAKE) -C docs build
.PHONY: build-master
build-master: build-webui build-docs
$(MAKE) -C master build

.PHONY: build-bindings
build-bindings: build-proto
$(MAKE) -C bindings build

.PHONY: build-webui
build-webui: build-proto
$(MAKE) build-bindings
build-webui: build-bindings
$(MAKE) -C webui build

.PHONY: build-agent
build-agent: build-proto
$(MAKE) -C agent build

.PHONY: build-master
build-master: build-proto build-webui build-docs
$(MAKE) -C master build

.PHONY: build
build: build-master build-agent

Expand All @@ -43,7 +62,8 @@ clean: clean-tools clean-proto clean-common clean-harness clean-cli clean-deploy
check-%:
$(MAKE) -C $(subst -,/,$*) check
.PHONY: check
check: check-common check-proto check-harness check-cli check-deploy check-e2e_tests check-tools check-master check-agent check-webui check-examples check-docs check-schemas
check: check-common check-proto check-harness check-cli check-deploy check-e2e_tests check-tools check-master check-webui check-examples check-docs check-schemas
$(MAKE) check-agent

.PHONY: fmt-%
fmt-%:
Expand Down
12 changes: 6 additions & 6 deletions bindings/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ all: get-deps
$(MAKE) build

.PHONY: get-deps
get-deps: deps/${CODEGEN_BIN}
get-deps: deps/$(CODEGEN_BIN)

deps/${CODEGEN_BIN}:
deps/$(CODEGEN_BIN):
mkdir -p deps
curl https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.14/${CODEGEN_BIN} \
-o deps/${CODEGEN_BIN}
curl https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.14/$(CODEGEN_BIN) \
-o deps/$(CODEGEN_BIN)

build/%: ${SWAGGER_SPEC} deps/${CODEGEN_BIN}
build/%: $(SWAGGER_SPEC) deps/$(CODEGEN_BIN)
mkdir -p build/$*
java -jar deps/$(CODEGEN_BIN) generate -i ${SWAGGER_SPEC} \
java -jar deps/$(CODEGEN_BIN) generate -i $(SWAGGER_SPEC) \
-l $* -o build/$*
touch build/$*

Expand Down
26 changes: 18 additions & 8 deletions webui/react/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
swagger_client := src/services/swagger
export PROJECT_ROOT := ../..
# Set the path React is going to be served from eg ./ for serving from root.
export PUBLIC_URL ?= /det
swagger_client := src/services/swagger
source_files := $(shell find src -type f)
ts_bindings_src := ../../bindings/build/typescript-fetch
ts_bindings_dest := src/services/api-ts-sdk
ts_bindings := $(shell find $(ts_bindings_src) -type f)

.PHONY: default
default: get-deps
Expand All @@ -12,10 +15,13 @@ default: get-deps
build-bindings:
$(MAKE) -C ../../bindings build
.PHONY: get-deps-api
get-deps-api:
# WARN this has a dependency on build-bindings which isn't link through make here
rm -rf src/services/api-ts-sdk
cp -r ${PROJECT_ROOT}/bindings/build/typescript-fetch src/services/api-ts-sdk
get-deps-api: $(ts_bindings_dest)/done.stamp
# WARN this has a dependency on build-bindings which isn't linked here.

$(ts_bindings_dest)/done.stamp: $(ts_bindings)
rm -rf $(ts_bindings_dest)
cp -r $(ts_bindings_src) $(ts_bindings_dest)
touch $@

.PHONY: get-deps-npm
get-deps-npm:
Expand All @@ -25,14 +31,18 @@ get-deps-npm:

node_modules/done.stamp: package-lock.json
$(MAKE) get-deps-npm
touch node_modules/done.stamp
touch $@

.PHONY: get-deps
get-deps: node_modules/done.stamp

.PHONY: build
build: get-deps-api
build: $(ts_bindings_dest)/done.stamp
$(MAKE) build/done.stamp

build/done.stamp: $(source_files) node_modules/done.stamp tsconfig.json config-overrides.js
npm run build
touch $@

.PHONY: build-storybook
build-storybook:
Expand Down

0 comments on commit b531bda

Please sign in to comment.