diff --git a/Cargo.toml b/Cargo.toml index 18f4c09..b6c718b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,8 @@ [workspace] members = [ - "bindings", "app", + "crates/bindings", ] + +[workspace.dependencies] +bindings = { path = "crates/bindings" } \ No newline at end of file diff --git a/Makefile b/Makefile index 5f6cf72..9f563c3 100644 --- a/Makefile +++ b/Makefile @@ -5,21 +5,22 @@ default: build # Define variables CARGO=cargo +CRATES_FOLDER=crates CONTRACTS_PATH=./contracts BINDINGS_FOLDER=bindings +BINDINGS_CRATES_FOLDER=$(CRATES_FOLDER)/$(BINDINGS_FOLDER) BINDINGS_OUT_PATH=$(CONTRACTS_PATH)/out/$(BINDINGS_FOLDER) # Target for generating bindings bindings: -# Remove old bindings - rm -rf $(BINDINGS_FOLDER) + rm -rf $(BINDINGS_CRATES_FOLDER) rm -rf $(BINDINGS_OUT_PATH) # Generate new bindings @forge bind --root $(CONTRACTS_PATH) --crate-name $(BINDINGS_FOLDER) # Move bindings to the correct location - @mv -f $(BINDINGS_OUT_PATH) . + @mv -f $(BINDINGS_OUT_PATH) $(CRATES_FOLDER) # Target for building the project build: bindings diff --git a/app/Cargo.toml b/app/Cargo.toml index 258356d..ff47c8e 100644 --- a/app/Cargo.toml +++ b/app/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bindings = { path = "../bindings" } +bindings = { workspace = true } ethers = { version = "2", default-features = false, features = ["rustls"] } eyre = "0.6" -tokio = { version = "1.19", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.19", features = ["macros", "rt-multi-thread"] } \ No newline at end of file diff --git a/bindings/Cargo.toml b/crates/bindings/Cargo.toml similarity index 100% rename from bindings/Cargo.toml rename to crates/bindings/Cargo.toml diff --git a/bindings/src/counter.rs b/crates/bindings/src/counter.rs similarity index 100% rename from bindings/src/counter.rs rename to crates/bindings/src/counter.rs diff --git a/bindings/src/lib.rs b/crates/bindings/src/lib.rs similarity index 100% rename from bindings/src/lib.rs rename to crates/bindings/src/lib.rs diff --git a/rustfmt.toml b/rustfmt.toml index 657d478..6d250c1 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -6,6 +6,6 @@ imports_granularity = "Crate" wrap_comments = true comment_width = 100 # ignore automatically generated bindings -ignore = ["bindings/"] +ignore = ["crates/bindings/"] # See more keys and their definitions at https://rust-lang.github.io/rustfmt