Description
I would like to propose several enhancements to the Scrypto CLI to improve the development experience, especially for tasks such as compiling, testing, and managing dependencies. Drawing inspiration from the fast and efficient workflow provided by tools like Forge/Foundry in Solidity development, the following features are suggested to streamline and speed up the development process in Scrypto:
Proposed Features
-
Conditional Compilation and Testing
- Feature: Implement a mechanism where
scrypto test only recompiles if changes have been made since the last compilation.
- Benefit: Saves time by avoiding unnecessary recompilation and allows developers to quickly run tests.
-
Incremental Compilation
- Feature: Ensure incremental compilation is enabled by default for development builds.
- Benefit: Significantly reduces compilation times for incremental changes, enhancing the iterative development process.
-
Parallel Testing
- Feature: Enable parallel test execution by default.
- Benefit: Speeds up the execution of the test suite, making the feedback loop faster for developers.
-
Custom CLI Options
- Feature: Add CLI options for fast compilation and clean recompilation. For example:
--fast: Perform a fast compilation optimized for development speed.
--clean: Clean the build directory and recompile everything.
- Benefit: Provides flexibility to developers to choose between fast iterative builds and complete clean builds.
-
Automatic Change Detection with cargo watch Integration
- Feature: Integrate
cargo watch to automatically run checks, builds, or tests when files change.
- Benefit: Provides instant feedback to developers, similar to hot-reload in other development environments.
-
Optimized Development Profile
- Feature: Define and use a custom profile for faster builds during development.
- Benefit: Allows for quicker builds without sacrificing essential debugging capabilities.
-
Improved Build Scripts
- Feature: Provide a set of build scripts (e.g., Bash scripts or Makefiles) to handle common tasks such as conditional compilation, testing, and cleaning.
- Benefit: Streamlines common development tasks and reduces the overhead of manually managing build commands.
Example Custom CLI Script
#!/bin/bash
# Function to compile in development mode
fast_compile() {
echo "Performing fast compilation..."
cargo build --profile dev
}
# Function to run tests
run_tests() {
echo "Running tests..."
cargo test
}
# Function to check for changes
check_for_changes() {
echo "Checking for changes..."
if cargo check; then
echo "No changes detected."
return 0
else
echo "Changes detected."
return 1
fi
}
# Function to clean and recompile
clean_and_compile() {
echo "Cleaning and recompiling..."
cargo clean
cargo build
}
# Parse CLI arguments
while [[ "$#" -gt 0 ]]; do
case $1 in
--fast) fast=1 ;;
--clean) clean=1 ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift
done
# Check for changes and act accordingly
if check_for_changes; then
run_tests
else
if [[ $clean -eq 1 ]]; then
clean_and_compile
elif [[ $fast -eq 1 ]]; then
fast_compile
else
cargo build
fi
run_tests
fi
NOTE: I don't have much Rust experience so GPT4 helped me draft.
Description
I would like to propose several enhancements to the Scrypto CLI to improve the development experience, especially for tasks such as compiling, testing, and managing dependencies. Drawing inspiration from the fast and efficient workflow provided by tools like Forge/Foundry in Solidity development, the following features are suggested to streamline and speed up the development process in Scrypto:
Proposed Features
Conditional Compilation and Testing
scrypto testonly recompiles if changes have been made since the last compilation.Incremental Compilation
Parallel Testing
Custom CLI Options
--fast: Perform a fast compilation optimized for development speed.--clean: Clean the build directory and recompile everything.Automatic Change Detection with
cargo watchIntegrationcargo watchto automatically run checks, builds, or tests when files change.Optimized Development Profile
Improved Build Scripts
Example Custom CLI Script
NOTE: I don't have much Rust experience so GPT4 helped me draft.