Skip to content

Commit

Permalink
build: add makefiles for elixir, rust, and typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
mrinalwadhwa committed May 31, 2023
1 parent 2b34947 commit 9171a56
Show file tree
Hide file tree
Showing 4 changed files with 186 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
build: rust_build elixir_build typescript_build
build_release: rust_build_release elixir_build_release typescript_build_release
test: rust_test elixir_test typescript_test
lint: rust_lint elixir_lint typescript_lint
clean: rust_clean elixir_clean typescript_clean
very_clean: rust_very_clean elixir_very_clean typescript_very_clean

elixir_%:
$(MAKE) -C implementations/elixir $(@:elixir_%=%)

rust_%:
$(MAKE) -C implementations/rust $(@:rust_%=%)

typescript_%:
$(MAKE) -C implementations/typescript $(@:typescript_%=%)

.PHONY: \
build build_release test lint clean very_clean \
elixir_% rust_% typescript_%
66 changes: 66 additions & 0 deletions implementations/elixir/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
PACKAGES := \
ockam_vault_software \
ockam \
ockam_abac \
ockam_services \
ockam_kafka \
ockam_metrics \
ockam_healthcheck \
ockam_cloud_node \
ockam_typed_cbor


build: $(addprefix build_,$(PACKAGES))
build_%: deps_%
cd ockam/$* && mix compile
build_ockam_vault_software: rust_build_release_ockam-ffi deps_ockam_vault_software
cd ockam/ockam_vault_software && mix compile
rust_build_ockam-ffi:
$(MAKE) -C ../rust build_ockam-ffi


build_release: $(addprefix build_release_,$(PACKAGES))
build_release_%: deps_%
cd ockam/$* && MIX_ENV=prod mix compile
build_release_ockam_vault_software: rust_build_release_ockam-ffi deps_ockam_vault_software
cd ockam/ockam_vault_software && MIX_ENV=prod mix compile
rust_build_release_ockam-ffi:
$(MAKE) -C ../rust build_release_ockam-ffi


test: $(addprefix test_,$(PACKAGES))
test_%: build_% deps_%
cd ockam/$* && mix test


lint: $(addprefix lint_,$(PACKAGES))
lint_%: deps_%
cd ockam/$* && mix lint


clean: $(addprefix clean_,$(PACKAGES))
clean_%:
cd ockam/$* && mix clean


very_clean: $(addprefix very_clean_,$(PACKAGES))
$(MAKE) -C ../rust very_clean
very_clean_%:
cd ockam/$* && rm -rf deps && rm -rf _build


deps: $(addprefix deps_,$(PACKAGES))
deps_%: hex rebar
cd ockam/$* && mix deps.get


hex:
mix local.hex --force --if-missing

rebar:
mix local.rebar --force --if-missing


.PHONY: \
build build_% build_release build_release_% \
test test_% lint lint_% clean clean_% deps deps_% hex rebar
62 changes: 62 additions & 0 deletions implementations/rust/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
build:
cargo build
build_%:
cargo build --package $*


build_release:
cargo --locked build --release
build_release_%:
cargo --locked build --release --package $*


test:
@if [ "$(CI)" = "true" ]; then \
$(MAKE) test_nextest; \
else \
cargo --locked test; \
fi
test_%:
@if [ "$(CI)" = "true" ]; then \
$(MAKE) test_nextest; \
else \
cargo --locked test; \
fi

test_nextest:
cargo --locked nextest --config-file tools/nextest/.config/nextest.toml run
cargo --locked test --doc


lint: lint_format lint_cargo_deny lint_cargo_clippy
lint_format:
cargo fmt --all -- --check
lint_cargo_deny:
cargo deny --all-features \
--manifest-path=../../Cargo.toml check \
--config=tools/cargo-deny/deny.toml licenses advisories
lint_cargo_clippy:
cargo clippy --no-deps --all-targets -- -D warnings


clean:
cargo clean
clean_%:
cargo clean --package $*


very_clean:
rm -rf ../../target

docs:
cargo doc --no-deps

format:
cargo fmt --all


.PHONY: \
build build_% build_release build_release_% \
test test_% test_nextest \
lint lint_format lint_cargo_deny lint_cargo_clippy \
clean clean_% very_clean docs format
39 changes: 39 additions & 0 deletions implementations/typescript/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
build: deps
pnpm build
build_%: deps
pnpm --filter $* build


build_release: deps
pnpm build
build_release_%: deps
pnpm --filter $* build


test: deps
pnpm test
test_%: deps
pnpm --filter $* test


lint: deps
pnpm lint


clean: deps
pnpm clean
clean_%: deps
pnpm --filter $* clean


very_clean:
find . -type d -name "node_modules" -exec rm -rf {} +


deps:
pnpm install


.PHONY: \
build build_release build_release_% \
test test_% lint lint_% clean very_clean deps

0 comments on commit 9171a56

Please sign in to comment.