Skip to content

Commit 00296a6

Browse files
committed
Fix some bugs in add-debugger
1 parent 61a2e65 commit 00296a6

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
@@ -115,15 +115,20 @@ generate:
115115
GENERATED_DIR=$$(ls -dt $(DESTINATION)/* | head -n 1); \
116116
sed "s,@@INSERTION_POINT@@,@@INSERTION_POINT@@\n \"$$GENERATED_DIR\"\,," Cargo.toml > Cargo.toml.new; \
117117
mv Cargo.toml.new Cargo.toml; \
118+
if [ "$(ALSO_ADD_DEBUGGER)" = "true" ] && [ "$(TEMPLATE)" = "contract" ]; then \
119+
echo "Generate native simulator debugger"; \
120+
scripts/add-debugger $${GENERATED_DIR#$(DESTINATION)/} $(TEMPLATE_TYPE) $(TEMPLATE_REPO); \
121+
fi; \
118122
else \
119123
cargo generate $(TEMPLATE_TYPE) $(TEMPLATE_REPO) $(TEMPLATE) \
120124
--destination $(DESTINATION) \
121125
--name $(CRATE); \
122126
sed '/@@INSERTION_POINT@@/s/$$/\n "$(DESTINATION)\/$(CRATE)",/' Cargo.toml > Cargo.toml.new; \
123127
mv Cargo.toml.new Cargo.toml; \
124-
fi; \
125-
if [ "$(ALSO_ADD_DEBUGGER)" = "true" ] && [ "$(TEMPLATE)" = "contract" ]; then \
126-
make -C ./ add-debugger; \
128+
if [ "$(ALSO_ADD_DEBUGGER)" = "true" ] && [ "$(TEMPLATE)" = "contract" ]; then \
129+
echo "Generate native simulator debugger"; \
130+
scripts/add-debugger $(CRATE) $(TEMPLATE_TYPE) $(TEMPLATE_REPO); \
131+
fi; \
127132
fi;
128133

129134
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)