Skip to content

Commit

Permalink
fix: makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Farhad-Shabani committed Aug 6, 2024
1 parent 54d1731 commit f206c66
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ mc.log
/Cargo.lock

# Ignore CosmWasm artifacts
/cw-contracts
cw-contracts/

# Ignore dotenv
.env
70 changes: 35 additions & 35 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,45 @@
resolver = "2"
# members sorted by publishing order to `crates.io`
members = [
"ibc-derive",
"ibc-primitives",
"ibc-core/ics24-host/types",
"ibc-core/ics26-routing/types",
"ibc-core/ics23-commitment/types",
"ibc-core/ics02-client/types",
"ibc-core/ics03-connection/types",
"ibc-core/ics04-channel/types",
"ibc-core/ics25-handler/types",
"ibc-core/ics02-client/context",
"ibc-core/ics24-host",
"ibc-core/ics26-routing",
"ibc-core/ics02-client",
"ibc-core/ics03-connection",
"ibc-core/ics04-channel",
"ibc-core/ics25-handler",
"ibc-core",
"ibc-clients/ics07-tendermint/types",
"ibc-clients/ics07-tendermint",
"ibc-clients/ics08-wasm/types",
"ibc-clients",
"ibc-apps/ics20-transfer/types",
"ibc-apps/ics20-transfer",
"ibc-apps/ics721-nft-transfer/types",
"ibc-apps/ics721-nft-transfer",
"ibc-apps",
"ibc-core/ics24-host/cosmos",
"ibc-data-types",
"ibc",
"ibc-query",
"ibc-testkit",
"ibc-derive",
"ibc-primitives",
"ibc-core/ics24-host/types",
"ibc-core/ics26-routing/types",
"ibc-core/ics23-commitment/types",
"ibc-core/ics02-client/types",
"ibc-core/ics03-connection/types",
"ibc-core/ics04-channel/types",
"ibc-core/ics25-handler/types",
"ibc-core/ics02-client/context",
"ibc-core/ics24-host",
"ibc-core/ics26-routing",
"ibc-core/ics02-client",
"ibc-core/ics03-connection",
"ibc-core/ics04-channel",
"ibc-core/ics25-handler",
"ibc-core",
"ibc-clients/ics07-tendermint/types",
"ibc-clients/ics07-tendermint",
"ibc-clients/ics08-wasm/types",
"ibc-clients",
"ibc-apps/ics20-transfer/types",
"ibc-apps/ics20-transfer",
"ibc-apps/ics721-nft-transfer/types",
"ibc-apps/ics721-nft-transfer",
"ibc-apps",
"ibc-core/ics24-host/cosmos",
"ibc-data-types",
"ibc",
"ibc-query",
"ibc-testkit",

# internal crates that are not published
"tests-integration",
# internal crates that are not published
"tests-integration",
]

exclude = [
"ci/cw-check",
"ci/no-std-check",
"ci/cw-check",
"ci/no-std-check",
]

[workspace.package]
Expand Down
18 changes: 8 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@ lint: ## Lint the code using rustfmt, clippy and whitespace lints.
cargo +nightly fmt --all --check
cargo clippy --all-targets --all-features
cargo clippy --all-targets --no-default-features
$(MAKE) -C ./cosmwasm lint $@
typos --config $(CURDIR)/.github/typos.toml
bash ./ci/code-quality/whitespace-lints.sh
taplo fmt --check

check-features: ## Check that project compiles with all combinations of features.
cargo hack check --workspace --feature-powerset --exclude-features default

check-docs: ## Build documentation with all features and without default features.
cargo doc --all --all-features --release
cargo doc --all --no-default-features --release
$(MAKE) -C ./cosmwasm check-docs $@

check-no-std: ## Check that libraries compile with `no_std` feature.
$(MAKE) -C ./ci/no-std-check $@
Expand All @@ -35,22 +36,19 @@ check-cw: ## Check that the CosmWasm smart contract compiles.
test: ## Run tests with all features and without default features.
cargo test --all-targets --all-features
cargo test --all-targets --no-default-features
$(MAKE) -C ./cosmwasm test $@

check-release: ## Check that the release build compiles.
cargo release --workspace --no-push --no-tag \
--exclude ibc-derive \
--exclude ibc-primitives \
--exclude ibc-client-tendermint-cw
--exclude ibc-primitives
$(MAKE) -C ./cosmwasm check-release $@

release: ## Perform an actual release and publishes to crates.io.
cargo release --workspace --no-push --no-tag --allow-branch HEAD --execute \
--exclude ibc-derive \
--exclude ibc-primitives \
--exclude ibc-client-tendermint-cw
--exclude ibc-primitives
$(MAKE) -C ./cosmwasm release $@

build-tendermint-cw: ## Build the WASM file for the ICS-07 Tendermint light client.
@echo "Building the WASM file for the ICS-07 Tendermint light client"
cd cosmwasm && \
RUSTFLAGS='-C link-arg=-s' cargo build -p ibc-client-tendermint-cw --target wasm32-unknown-unknown --release --lib --locked && \
mkdir -p cw-contracts && \
cp target/wasm32-unknown-unknown/release/ibc_client_tendermint_cw.wasm cw-contracts/
$(MAKE) -C ./cosmwasm build-tendermint-cw $@
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ disallowed-types = [
disallowed-methods = [
"std::time::Duration::as_secs_f64",
]
msrv = "1.72.1"

33 changes: 33 additions & 0 deletions cosmwasm/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.PHONY: help

help: ## Display help message.
@echo "Usage: make <target>"
@awk 'BEGIN {FS = ":.*?## "}/^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

install-tools: ## Install development tools including nightly rustfmt, cargo-hack and cargo-release.
rustup target add wasm32-unknown-unknown

lint: ## Lint the code using rustfmt, clippy and whitespace lints.
cargo +nightly fmt --all --check
cargo clippy --all-targets --all-features
cargo clippy --all-targets --no-default-features

check-docs: ## Build documentation with all features and without default features.
cargo doc --all --all-features --release

test: ## Run tests with all features and without default features.
cargo test --all-targets --all-features --release

check-release: ## Check that the release build compiles.
cargo release --workspace --no-push --no-tag \
--exclude ibc-client-tendermint-cw

release: ## Perform an actual release and publishes to crates.io.
cargo release --workspace --no-push --no-tag --allow-branch HEAD --execute \
--exclude ibc-client-tendermint-cw

build-tendermint-cw: ## Build the WASM file for the ICS-07 Tendermint light client.
@echo "Building the WASM file for the ICS-07 Tendermint light client"
RUSTFLAGS='-C link-arg=-s' cargo build -p ibc-client-tendermint-cw --target wasm32-unknown-unknown --release --lib --locked && \
mkdir -p cw-contracts && \
cp target/wasm32-unknown-unknown/release/ibc_client_tendermint_cw.wasm cw-contracts/

0 comments on commit f206c66

Please sign in to comment.