Skip to content

Commit 18c952a

Browse files
committed
Refactore: Native simulator debug project move to native-simulator
1 parent f3ec544 commit 18c952a

File tree

6 files changed

+651
-190
lines changed

6 files changed

+651
-190
lines changed

contract/Makefile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ build:
4444
done \
4545
fi
4646

47-
build-simulator:
48-
cd {{project-name}}-dbg && cargo build && cp target/debug/*_dbg.* $(TOP)/$(BUILD_DIR)
49-
5047
# test, check, clippy and fmt here are provided for completeness,
5148
# there is nothing wrong invoking cargo directly instead of make.
5249
test:
@@ -73,10 +70,6 @@ cargo:
7370

7471
clean:
7572
cargo clean
76-
@set -eu; \
77-
if [ -d "{{project-name}}-dbg" ]; then \
78-
cd {{project-name}}-dbg && cargo clean; \
79-
fi
8073

8174
prepare:
8275
rustup target add riscv64imac-unknown-none-elf

native-simulator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77
[dependencies]
8-
{{contract_name}} = { path = "../", features = ["simulator"] }
8+
{{contract_name}} = { path = "../../contracts/{{contract_name}}", features = ["simulator"] }
99
ckb-std = { version = "0.15.1", features = ["simulator"] }
1010

1111
[lib]

native-simulator/GlobalMakefile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
# This file is used by the parent directory.
3+
# The current project can directly execute cargo build
4+
5+
MODE := release
6+
BUILD_DIR := ../build/$(MODE)
7+
8+
build:
9+
mkdir -p ../$(BUILD_DIR)
10+
@set -eu; \
11+
if [ "x$(CONTRACT)" = "x" ]; then \
12+
for contract in $(wildcard ./*); do \
13+
if [ -f $$contract/Cargo.toml ]; then \
14+
cd $$contract && cargo build && cp target/debug/*_dbg.* ../$(BUILD_DIR); \
15+
fi; \
16+
done; \
17+
else \
18+
cd $(CONTRACT) && cargo build; \
19+
fi
20+
21+
clean:
22+
@set -eu; \
23+
rm -rf $(BUILD_DIR)/*_sim.*; \
24+
for contract in $(wildcard ./*); do \
25+
if [ -f $$contract/Cargo.toml ]; then \
26+
cd $$contract && cargo clean; \
27+
fi; \
28+
done;

0 commit comments

Comments
 (0)