Skip to content

Commit

Permalink
Customize statis initialize move dir in simtest (MystenLabs#18752)
Browse files Browse the repository at this point in the history
## Description 

So that other projects can choose their own move package for this static
initialization.

## Test plan 

How did you test the new or updated feature?

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
halfprice committed Jul 24, 2024
1 parent e95007c commit 25d2f30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions crates/sui-proc-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ pub fn init_static_initializers(_args: TokenStream, item: TokenStream) -> TokenS
use sui_simulator::move_package::package_hooks::register_package_hooks;

register_package_hooks(Box::new(SuiPackageHooks {}));
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
path.extend(["..", "..", "examples", "move", "basics"]);
let mut path = PathBuf::from(env!("SIMTEST_STATIC_INIT_MOVE"));
let mut build_config = BuildConfig::default();

build_config.config.install_dir = Some(TempDir::new().unwrap().into_path());
Expand Down
5 changes: 5 additions & 0 deletions scripts/simtest/cargo-simtest
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ fi
# Must supply a new temp dir - the test is deterministic and can't choose one randomly itself.
export TMPDIR=$(mktemp -d)

# Set the example move package for the simtest static initializer
# https://github.com/MystenLabs/sui/blob/7bc276d534c6c758ac2cfefe96431c2b1318ca01/crates/sui-proc-macros/src/lib.rs#L52
root_dir=$(git rev-parse --show-toplevel)
export SIMTEST_STATIC_INIT_MOVE=$root_dir"/examples/move/basics"

cargo ${CARGO_COMMAND[@]} \
--config "build.rustflags = [$RUST_FLAGS]" \
"${cargo_patch_args[@]}" \
Expand Down

0 comments on commit 25d2f30

Please sign in to comment.