Skip to content

Commit

Permalink
Makefile: fix building wasm-engine when nix is not installed and add …
Browse files Browse the repository at this point in the history
…task for local size measuring and comparision (#4622)

* Fix build-qe-wasm when nix is not installed

* Add measure-qe-wasm task to continuously measure size locally
  • Loading branch information
Miguel Fernández authored Jan 17, 2024
1 parent b157f36 commit 7f4fc14
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ CONFIG_FILE = .test_config
SCHEMA_EXAMPLES_PATH = ./query-engine/example_schemas
DEV_SCHEMA_FILE = dev_datamodel.prisma
DRIVER_ADAPTERS_BRANCH ?= main
NIX := $(shell command -v nix 2> /dev/null)
NIX := $(shell type nix 2> /dev/null)

LIBRARY_EXT := $(shell \
case "$$(uname -s)" in \
Expand Down Expand Up @@ -335,17 +335,9 @@ else
cd query-engine/query-engine-wasm && ./build.sh
endif

.PHONY: measure-qe-wasm
measure-qe-wasm: build-qe-wasm
@cd query-engine/query-engine-wasm/pkg; \
gzip -c query_engine_bg.wasm | wc -c | awk '{$$1/=(1024*1024); printf "%.3fMB\n", $$1}' > temp_size.txt; \
if [ ! -f size.txt ]; then \
echo "0MB" > size.txt; \
fi; \
echo "Previous size: `cat size.txt`"; \
echo "Current size: `cat temp_size.txt`"; \
awk '{print $$1}' size.txt temp_size.txt | paste -d" " - - | awk '{printf "Increment: %.3fMB\n", $$2 - $$1}'; \
mv temp_size.txt size.txt; \
gzip -k -c query_engine_bg.wasm | wc -c | awk '{$$1/=(1024*1024); printf "Current wasm query-engine size compressed: %.3fMB\n", $$1}'

build-driver-adapters-kit: build-driver-adapters
cd query-engine/driver-adapters && pnpm i && pnpm build
Expand Down

0 comments on commit 7f4fc14

Please sign in to comment.