feat(studio): add --watch mode for studio sync target#161
Draft
revvy02 wants to merge 2 commits into
Draft
Conversation
The Display impl for AssetRef already prepends "rbxasset://" for Studio
and "rbxassetid://" for Cloud variants. The studio backend was packing
those prefixes inside the inner string, causing codegen to emit doubled
URLs like:
["test1.png"] = "rbxasset://rbxasset://.asphalt-name/<hash>.png"
For cloud-uploaded models/animations, return AssetRef::Cloud(id) so the
correct "rbxassetid://{id}" is produced. For locally synced files, drop
the "rbxasset://" prefix from the inner string so Display adds it once.
Also adds an ASPHALT_TEST env var that routes the sync folder to the
project directory instead of the Roblox Studio content path. This is
test-only plumbing that lets the integration test exercise sync studio
without requiring a Roblox Studio install. The common test harness
already sets this env var in Project::run().
Includes a regression test (studio_sync_emits_single_rbxasset_prefix)
that fails on the previous behavior.
Adds a `--watch` flag to `asphalt sync studio` that performs an initial sync, then polls the input directories for added/modified/deleted files and re-syncs incrementally without restarting the process. - cli: SyncTarget::Studio gains a `watch: bool` field - sync: backend wrapped in Arc so the watch loop can share it across iterations - studio backend: new ASPHALT_TEST env var routes the sync folder to the project dir for integration tests; ref_for_hash and clean_orphans helpers let the watch loop maintain state without re-running the full pipeline - tests: studio_watch_detects_new_file integration test
b3ef85a to
6dd6c62
Compare
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.
Note
This PR depends on #160 (the rbxasset prefix fix). Marked draft until that lands; will rebase onto main once it does. The first commit in this branch is identical to #160.
Summary
Adds a
--watchflag toasphalt sync studiothat performs an initial sync, then polls the input directories for added/modified/deleted files and re-syncs incrementally without restarting the process.Motivation: when iterating on assets in Roblox Studio, re-running
asphalt sync studioafter every change is friction. Watch mode keeps codegen output and synced files up-to-date as you save.Changes
cli:SyncTarget::Studiogains awatch: boolfield;--watchflag exposed only on the studio subcommand.sync: backend wrapped inArc<Option<TargetBackend>>so the watch loop can share it across iterations.studiobackend: newref_for_hashandclean_orphanshelpers let the watch loop maintain state without re-running the full pipeline.tests:studio_watch_detects_new_fileintegration test that spawns watch mode, adds a file, and verifies codegen picks it up.Usage
Polls every 500ms (matching the existing notify defaults).
Ctrl+Cto stop.Test plan
cargo buildcleancargo test— 12/12 integration pass (including the new watch test).png, codegen output and synced file update within ~1s