File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 1
1
#![ cfg_attr( not( feature = "simulator" ) , no_std) ]
2
2
3
3
// This file will be automatically placed in the contract file, and rename to lib.rs
4
- // TODO
5
- // Need to export main function.
6
- // At the same time, you need to add a feature to the contract's Cargo.toml.
7
- // simulator = ["ckb-std/simulator"]
8
4
9
5
// #[cfg(feature = "simulator")]
10
6
// pub mod entry;
Original file line number Diff line number Diff line change @@ -110,7 +110,10 @@ generate:
110
110
fi ; \
111
111
sed ' /@@INSERTION_POINT@@/s/$$/\n "$(DESTINATION)\/$(CRATE)",/' Cargo.toml > Cargo.toml.new; \
112
112
mv Cargo.toml.new Cargo.toml; \
113
- fi
113
+ fi ; \
114
+ if [ " $( ALSO_ADD_DEBUGGER) " = " true" ]; then \
115
+ make -C ./ add-debugger; \
116
+ fi ;
114
117
115
118
add-debugger :
116
119
@set -eu; \
Original file line number Diff line number Diff line change @@ -56,4 +56,11 @@ cd contracts/$CONTRACT_NAME
56
56
cargo generate $2 $3 add-debugger -n $CONTRACT_NAME -dbg -d contract_name=$CONTRACT_NAME -d contract_crate_name=$CONTRACT_CRATE
57
57
mv $CONTRACT_NAME -dbg/src/contract-lib.rs src/lib.rs
58
58
echo " Finally, you need to add a feature to the contract's Cargo.toml:"
59
- echo " simulator = [" ckb-std/simulator" ]"
59
+ echo " simulator = [" ckb-std/simulator" ]"
60
+
61
+ FILE=" Cargo.toml"
62
+ if grep -q " \[features\]" " $FILE " ; then
63
+ sed -i ' /\[features\]/a\simulator = ["ckb-std/simulator"]' " $FILE "
64
+ else
65
+ echo -e " \n[features]\nsimulator = [\" ckb-std/simulator\" ]" >> " $FILE "
66
+ fi
You can’t perform that action at this time.
0 commit comments