Repository navigation
fix(contracts): prevent unnecessary build script triggers - #281
Merged
Merged
Conversation
The build script was triggering on every cargo build even when contract files hadn't changed. This was due to: - Watching entire contracts/ directory instead of specific paths - Scarb.lock being updated by scarb build, causing rebuild cycles - No timestamp checking to skip builds when artifacts are up-to-date Changes: - Add explicit build script configuration in Cargo.toml - Track specific source directories instead of entire contracts folder - Add timestamp comparison to skip scarb build when sources unchanged - Exclude Scarb.lock from tracked files since scarb updates it - Add informative warnings showing when builds are skipped This significantly speeds up the development workflow by only rebuilding contracts when their source files actually change. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
kariy
marked this pull request as draft
September 22, 2025 20:31
kariy
marked this pull request as ready for review
September 22, 2025 21:14
Member
Author
|
1 Job Failed: test / dojo-integration-test failed on "Build and migrate `spawn-and-move` project"Summary: 1 failed workflow
Last updated: 2025-09-22 22:02:31 UTC |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #281 +/- ##
==========================================
+ Coverage 73.32% 75.85% +2.52%
==========================================
Files 209 229 +20
Lines 23132 27062 +3930
==========================================
+ Hits 16961 20527 +3566
- Misses 6171 6535 +364 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
kariy
added a commit
that referenced
this pull request
Sep 25, 2025
Fixes build script triggering on every `cargo build` even when contract files haven't changed ## Problem The `katana-contracts` build script was being triggered unnecessarily on every `cargo build` command, even when no files in the `crates/contracts/contracts` directory had changed. ## Root Causes * The build script was watching the entire `contracts/` directory with `cargo:rerun-if-changed=contracts/`, which is unreliable in Cargo * `scarb build` updates `Scarb.lock` file timestamp even when content doesn't change ## Solution Instead of watching the entire `contracts/` directory, the script watches the nested directories instead to avoid including `Scarb.lock` file in the watch list. 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude <noreply@anthropic.com>
kariy
added a commit
that referenced
this pull request
Sep 25, 2025
Fixes build script triggering on every `cargo build` even when contract files haven't changed ## Problem The `katana-contracts` build script was being triggered unnecessarily on every `cargo build` command, even when no files in the `crates/contracts/contracts` directory had changed. ## Root Causes * The build script was watching the entire `contracts/` directory with `cargo:rerun-if-changed=contracts/`, which is unreliable in Cargo * `scarb build` updates `Scarb.lock` file timestamp even when content doesn't change ## Solution Instead of watching the entire `contracts/` directory, the script watches the nested directories instead to avoid including `Scarb.lock` file in the watch list. 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude <noreply@anthropic.com>
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Mar 10, 2026
The contracts build script tracked entire directories with `cargo:rerun-if-changed`, which caused it to re-run on every `cargo build` because `scarb build` modifies `Scarb.lock` and `target/` within those directories. This replaces directory-level tracking with recursive file-level tracking that excludes `Scarb.lock` files and `target/` directories. A similar PR ( #281 ) was made to address the same issue. It worked but the fix was done under the assumption that the `/contracts` directory is a single `Scarb` workspace. But since #399, that is no longer the case as now it may include git submodules which are independent `Scarb` workspace by themselves. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes build script triggering on every
cargo buildeven when contract files haven't changedProblem
The
katana-contractsbuild script was being triggered unnecessarily on everycargo buildcommand, even when no files in thecrates/contracts/contractsdirectory had changed.Root Causes
contracts/directory withcargo:rerun-if-changed=contracts/, which is unreliable in Cargoscarb buildupdatesScarb.lockfile timestamp even when content doesn't changeSolution
Instead of watching the entire
contracts/directory, the script watches the nested directories instead to avoid includingScarb.lockfile in the watch list.🤖 Generated with Claude Code