Unlike most of the other backports, this code couldn't be directly
translated so it had to be re-implemented. Luckily, it is very simple.
This implementation is a bit messy and heavy handed with potential
panics, but I think it's probably fine since file names that aren't
UTF-8 aren't really supported anyway. The original implementation is a
lot cleaner though.
The test snapshots are (almost) all identical between the 7.5
implementation and this one. The sole exception is with the path in the
`snapshot_middleware::project` test, since I didn't feel like adding a
`name` parameter to `snapshot_project` in this implementation.
Resolves#667
This PR:
- Introduces a new field in the project file: `scriptType` which has the
default value of `Class` (in parity with previous versions), but can
also be `RunContext`.
- This is then passed to `InstanceContext` from the `Project` struct.
- This then changes the RunContext in the lua `snapshot_middleware`
---------
Co-authored-by: Micah <dekkonot@rocketmail.com>
* Use WeakDom::into_raw for faster snapshot generation from models
* Make compute_patch_set take snapshots by value
* Stop deferring property application in apply_patch_set
* Use InstanceBuilder::empty to avoid extra name allocations
* Git dependencies, skip dropping ServeSession
* Use std::mem::forget instead of ManuallyDrop
* Switch to latest rbx-dom crates.io dependencies
* Update other dependencies
* Add PathNode with optional fields to project. This allows a path to be defined either as `"$path": "src"` or `"$path": { "optional": "src" }`
* Make $path truly optional
* Prevent rojo from erroring if no project node is resolved
* Use match instead of if-statement
* Add end-to-end tests (credit to MobiusCraftFlip for initial scenario)
* Pass option with ref inside instead of reference to option
* Empty commit to restart GitHub Actions
* Simplify build test
* Minimize serve test: it fails
* Simplify serve test even more
* Ignore failing serve test
Co-authored-by: Lucien Greathouse <me@lpghatguy.com>
* Allow for setting the default port in project json
set as
```json
"serveAddress": "0.0.0.0"
```
* Update CHANGELOG.md
* cargo fmt
Co-authored-by: Lucien Greathouse <me@lpghatguy.com>
* Mostly mechanical port bits
* Almost there
* It builds again!
* Turn on all the code again
* Tests compiling but not passing
* Stub work for value resolution
* Implement resolution minus enums and derived properties
* Implement property descriptor resolution
* Update referent snapshots
* Update unions test project
Using a place file instead of a model yields better
error messages in Roblox Studio.
* Add easy shortcut to testing with local rbx-dom
* Update rbx-dom
* Add enum resolution
* Update init.meta.json to use UnresolvedValue
* Expand value resolution support, add test
* Filter SharedString values from web API
* Add 'property' builder method to InstanceSnapshot
* Change InstanceSnapshot/InstanceBuilder boundary
* Fix remove_file crash
* rustfmt
* Update to latest rbx_dom_lua
* Update dependencies, including rbx_dom_weak
* Update to latest rbx-dom
* Update dependencies
* Update rbx-dom, fixing more bugs
* Remove experimental warning on binary place builds
* Remove unused imports
Fixes#320.
Previously, the root project file was loaded via methods on Project
(which do not know about the VFS) instead of through the VFS like
all other disk access.
This meant that Rojo was unable to build its own plugin because
there is no project file on the real disk, only in the VFS.
* vroom
* Port dir middleware
* Filter rules
* Directory metadata
* Project support
* Enable Lua support
* StringValue support
* CSV
* rbxm, rbxmx, and rbxlx
* JSON models
* Clean up some warnings
* Strip out PathMap
* Unwatch paths when they're reported as removed
* Fix 'rojo upload' behavior
* Upgrade to Insta 0.13.1
* Update dependencies
* Release 0.6.0-alpha.2
* Fix bad merge
* Replace MemoryBackend with InMemoryFs
* Sledgehammer tests into passing for now
* Txt middleware
* Update easy snapshot tests
* Lua tests
* Project middleware tests
* Try to fix test failures by sorting
* Port first set of serve session tests
* Add InMemoryFs::raise_event
* Finish porting serve session tests
* Remove UI code for introspecting VFS for now
* VFS docs
* Unfinished two-way sync API
* In-memory two-way sync complete
* Move PatchSet application into ChangeProcessor thread, where it can be synchronous
* Stop InstanceMap's signals when a ServeSession terminates
* Apply patch in ChangeProcessor
* Feature flag
* Fix error in ChangeProcessor due to wrong drop order
This PR refactors all of the methods on `Vfs` from accepting `&mut self` to
accepting `&self` and keeping data wrapped in a mutex. This builds on previous
changes to make reference count file contents and cleans up the last places
where we're returning borrowed data out of the VFS interface.
Once this change lands, there are two possible directions we can go that I see:
* Conservative: Refactor all remaining `&mut Vfs` handles to `&Vfs`
* Interesting: Embrace ref counting by changing `Vfs` methods to accept `self:
Arc<Self>`, which makes the `VfsEntry` API no longer need an explicit `Vfs`
argument for its operations.
* Change VfsFetcher to be immutable with internal locking
* Refactor Vfs::would_be_resident
* Refactor Vfs::read_if_not_exists
* Refactor Vfs::raise_file_removed
* Refactor Vfs::raise_file_changed
* Add Vfs::get_internal as bits of Vfs::get
* Switch Vfs to use internal locking
* Migrate all Vfs methods from &mut self to &self
* Make VfsEntry access Vfs immutably
* Remove outer VFS locking (#260)
* Refactor all snapshot middleware to accept &Vfs instead of &mut Vfs
* Remove outer VFS Mutex across the board
Initialization logic needed for serve, build, and upload is now
much more clear than it was when these functions were written.
This commit refactors all of them to use a new common_setup
module for all of their initialization that's the same.
Starts work on #55.
This is similar to the previous work in #125. It's gated behind a new Cargo
feature, `user-plugins`. This time, the config gate is much smaller. The
`plugins` member of projects is still accessible when plugins aren't enabled,
but is always empty. Additionally, user plugins are only enabled if there's a
Lua state present in the snapshot context when the `SnapshotUserPlugins`
snapshot middleware runs. This not ever the case currently.
This code has very little possibility of rotting while we focus on other work,
since it'll be guaranteed to still compile and can be tested in isolation
without the feature being turned on.