Skip to content

Commit d454a42

Browse files
committed
Fix some bugs in add-debugger
1 parent a08524d commit d454a42

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

contract/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![cfg_attr(not(feature = "simulator"), no_std)]
22
#![cfg_attr(not(any(feature = "simulator", test)), no_main)]
33

4-
#[cfg(test)]
4+
#[cfg(any(feature = "simulator", test))]
55
extern crate alloc;
66

77
#[cfg(not(any(feature = "simulator", test)))]

workspace/Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ generate:
119119
fi; \
120120
sed "s,@@INSERTION_POINT@@,@@INSERTION_POINT@@\n \"$$GENERATED_DIR\"\,," Cargo.toml > Cargo.toml.new; \
121121
mv Cargo.toml.new Cargo.toml; \
122+
if [ "$(ALSO_ADD_DEBUGGER)" = "true" ] && [ "$(TEMPLATE)" = "contract" ]; then \
123+
echo "Generate native simulator debugger"; \
124+
scripts/add-debugger $${GENERATED_DIR#$(DESTINATION)/} $(TEMPLATE_TYPE) $(TEMPLATE_REPO); \
125+
fi; \
122126
else \
123127
cargo generate $(TEMPLATE_TYPE) $(TEMPLATE_REPO) $(TEMPLATE) \
124128
--destination $(DESTINATION) \
@@ -129,9 +133,10 @@ generate:
129133
fi; \
130134
sed '/@@INSERTION_POINT@@/s/$$/\n "$(DESTINATION)\/$(CRATE)",/' Cargo.toml > Cargo.toml.new; \
131135
mv Cargo.toml.new Cargo.toml; \
132-
fi; \
133-
if [ "$(ALSO_ADD_DEBUGGER)" = "true" ] && [ "$(TEMPLATE)" = "contract" ]; then \
134-
make -C ./ add-debugger; \
136+
if [ "$(ALSO_ADD_DEBUGGER)" = "true" ] && [ "$(TEMPLATE)" = "contract" ]; then \
137+
echo "Generate native simulator debugger"; \
138+
scripts/add-debugger $(CRATE) $(TEMPLATE_TYPE) $(TEMPLATE_REPO); \
139+
fi; \
135140
fi;
136141

137142
add-debugger:

workspace/scripts/add-debugger

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
#!/usr/bin/env bash
22
#
33
# Add code for native debugging to existing onchain-script
4-
54
CONTRACT_NAME=$1
65

76
if [ "$CONTRACT_NAME" = "_" ]; then
87
directory="./contracts"
98
if [ ! -d "$directory" ]; then
10-
echo "No available contract"
9+
echo "No available contract a"
1110
exit 1
1211
fi
1312

@@ -20,9 +19,8 @@ if [ "$CONTRACT_NAME" = "_" ]; then
2019
fi
2120
done
2221

23-
2422
if [ ${#contracts[@]} -eq 0 ]; then
25-
echo "No available contract"
23+
echo "No available contract b"
2624
exit 2
2725
fi
2826

0 commit comments

Comments
 (0)