* Use session's state instead of existence to determine action
* Retain host/port text
* Use bindings instead of text/ref tunneling
Co-authored-by: Lucien Greathouse <me@lpghatguy.com>
* Create plugin action component
* Add plugin action for session start/end
* Add output for connection status change
* Move host & port refs to App level so keybind can access them
* Use passed function directly
* Improve the action text clarity
* Add actions for single action
* Add to changelog
* Explicitly return nil
Co-authored-by: Lucien Greathouse <me@lpghatguy.com>
* Change log level to info
* Refactor startSession to contain the logic
* Formatting
Co-authored-by: Lucien Greathouse <me@lpghatguy.com>
* 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>
* Add support for the new Open Cloud API
* Cleanup Open Cloud variables
* Avoid cloning buffer for do_upload_open_cloud
* Satisfy cargo fmt
* Actually correct cargo fmt
Apparently my earlier fix did not fix everything.
* Update CHANGELOG.md
* Update CHANGELOG.md
Forgot to add the link to issue #486 in the previous commit :/
* Cleanup & improve code for open cloud api
* Commit to force GH Actions to run (?)
Co-authored-by: Lucien Greathouse <me@lpghatguy.com>
* Implement ChangeBatcher
* Use ChangeBatcher for two-way sync
* Pause updates during patch application
* I can English good
* Break after encountering a nil Parent change
This prevents __flush from erroring out when an instance's Parent is
changed to nil and it has other property changes in the same batch.
* Update rbx_dom_lua
* Don't connect changed listeners in a running game
#468 made me realize how bad of an idea this is in general...
* Update TestEZ and fix sibling Ref reification test
* Add ChangeBatcher tests
* Test instance unpausing by breaking functionality out to __cycle
* Break up the module a bit and improve tests
* Shuffle requires around and edit comment
* Break out more stuff, rename createChangePatch -> createPatchSet
* Make ChangeBatcher responsible for unpausing all paused instances
This somewhat improves the situation (of course, it would preferrable
to not have to hack around this problem with Source at all). It also
sets us up nicely if we come across any other properties that do
anything similar.
* Remove old reference to pausedBatchInstances
* Use RenderStepped instead of Heartbeat and trash multi-frame pauses
I probably should have done this in the first place...
ChangeBatcher still needs to unpause instances, but we don't need to
hold pauses for any longer than one cycle.
* Remove useless branch
* if not next(x) -> if next(x) == nil
* Add InstanceMap:unpauseAllInstances, use it in ChangeBatcher
* Move IsRunning check to InstanceMap:__maybeFireInstanceChanged
* Upgrade dependencies, oneshot channel ref
* New service style?
* Fix warning
* A server is running again
* Working server with async blocks
* UI working again
* Finish upgrade
* Bump MSRV to 1.46.0 for if/match in const fn
* Update the README as part of this
* Ignore empty/whitespace-only model.json files
* Ignore no return value from model.json files during snapshot
* Use str::from_utf8 instead of String::from_utf8
* Revert "Ignore no return value from model.json files during snapshot"
This reverts commit 0aef16e30a.
* Add test for empty .model.json files
* Change empty .model.json check method
Co-authored-by: Lucien Greathouse <me@lpghatguy.com>
* Format code with cargo fmt
* Use raw string instead
Co-authored-by: Lucien Greathouse <me@lpghatguy.com>
* Ignore usage of "Name" or "Parent" in $properties
* Use match instead of array
* Add changelog entry
Co-authored-by: Lucien Greathouse <me@lpghatguy.com>
* web/mod.rs - change server bind address
127.0.0.1 is a loopback interface, and only works on the same host
0.0.0.0 will allow connections from other hosts
ideally, this should be a console arg - but it's a quick fix
* implement --address option, revert default bind address to 127.0.0.1
* revert silly autoformatting
* ok, actually using rustfmt now
* More precise --address flag description
* Use SocketAddr where available, take advantage of const-ness
* Display 'localhost' if address is loopback
* Update Changelog
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
* Add Flipper
* Remove old UI
* Add boilerplate UI
* Change plugin version
* Merge upstream
* Bunch of new UI changes
Too lazy to list them all in individual commits
* Touch ripple for buttons and a few other things
* Make the close button on the PluginGui work
* Set button state to guiEnabled
* Implement Connecting, NotConnected; add Header; don't update plugin button on render
* Replace mapLerpColor with mapLerp
* Update blendAlpha to be 0 without any values
* Add ActionFillTransparency to Theme.Button
* Suffix all Theme entries
* Update Flipper
* Add disconnect button
* Remove cancel button
* Add settings page
* Add scrollbar and dark theme support to settings
* Include settings in startSession
* Set context default value to nil
I always thought this was the name, lol...
* Add Error page
* Fix preloadAssets
* Fix preloadAssets import
* Update checkbox colors a little
* Add setting descriptions
* Fix scrolling frame in settings panel
* Remove .vscode
* Rename Throbber to Spinner
* Update merge
* Move Spinner images to assets
* Change casing of directories
* Remove old directories
* Add comments to getDerivedStateFromProps
* Account for offset in host TextBox size
* Turn width variables into constants
* Attempt to fix the comments
* Add a missing comma in Settings
* Remove a double space
* Remove Dummy object
* Move most of the Studio logic out of render
* Don't truncate port input
* Replace merge with Dictionary.merge
* Replace "Got it!" with "Okay"
* Add projectName to setStatus call
* Add Flipper to build.rs
* Start splitting apart reconciler, with tests
* Reify children in reify
* Baseline hydrate implementation
* Remove debug print
* Scaffold out diff implementation, just supporting name changes
* invariant -> error in decodeValue
* Flesh out diff and add getProperty
* Clear out top-level reconciler interface, start updating code that touches it
* Address review feedback
* Add (experimental) Selene configuration
* Add emptiness checks to PatchSet, remove unimplement invert method
* Improve descendant destruction behavior in InstanceMap
* Track instanceId on all reify errors
* Base implementation of applyPatch, returning partial patches on failure
* Change reify to accept InstanceMap and insert instances into it
* Start testing applyPatch for removals
* Add test for applyPatch adding instances successfully and not
* Add , which is just error with formatting
* Correctly use new diff and applyPatch APIs
* Improve applyPatch logging and fix field name typo
* Better debug output when reify fails
* Print out unapplied patch in debug mode
* Don't write properties if their values are not different.
This was exposed trying to sync the Rojo plugin, which
has a gigantic ModuleScript in it with the reflection
database. This workaround was present in some form in
many versions of Rojo, and I guess we still need it.
This time, I actually documented why it's here so that
I don't forget for the umpteenth time...
* Add placeholder test that needs to happen still
* Introduce easier plugin testing, write applyPatch properties test
* Delete legacy get/setCanonicalProperty files
* Fix trying to remove numbers instead of instances
* Change applyPatch to return partial patches instead of binary success
* Work towards being able to decode and apply refs
* Add helpers for PatchSet assertions
* Apply refs in reify, test all cases
* Improve diagnostics when patches fail to apply
* Stop logging when destroying untracked instances, it's ok
* Remove read before setting property in applyPatch
* Fix diff thinking all properties are changed
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.
* First take at flattening middleware for simpler code and better perf
* Undo debug prints
* Fix using wrong path in snapshot_from_vfs
* Disable some broken tests
* Re-enable (mistakenly?) disabled CSV test
* Fix some tests
* Update project file tests
* Fix benchmark
* infer service names
* Update project code and add support for StarterPlayer
* Store parent_class in InstigatingSource
* Update snapshots
Co-authored-by: Lucien Greathouse <me@lpghatguy.com>
* add install command
* cargo fmt
* filter spec files
* Update src/cli/plugin.rs
Co-Authored-By: Lucien Greathouse <me@lpghatguy.com>
* Update src/cli/plugin.rs
Co-Authored-By: Lucien Greathouse <me@lpghatguy.com>
* fix comments
* encode plugin with rbx_binary
* update build script
* refactor pathbuf error into io error
* fix rojo typo
* remove snafu
* Update `snapshot_from_fs_path`
* Print `rerun-if-changed` even for directories, in order to run the
build.rs script when files are added.
* Switch `filter_map` loop to a regular for loop. I like the FP-style
iterator stuff in Rust, but I think Result handling is easier in a
normal loop. Also, I don't believe the result of read_dir implements
`ExactSizedIterator`, so some of the wins of map+collect aren't there.
* Replace Result::unwrap with ? in build.rs
* Simplify error handling code in runtime
* Checkout with submodules
Co-authored-by: Lucien Greathouse <me@lpghatguy.com>
* Stub implementation
* Flesh out feature and add tests. Other snapshots currently failing.
* Blacklist .meta.json in JSON handler
* Write to correct property (Source) instead of Value
* Update changelog
- Replaced main() to use custom panic hook
- Updated log formatting
- Switched to panic=abort, since we don't need to unwind now.
- Process will now abort if any thread panics.
* 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
Upgrades to Roact master and introduces dynamic theme switching.
We branch on the theme name in order to try to use Rojo's brand
colors instead of Studio's. I kind of winged it with these colors
and we might want to choose slightly nicer dark theme colors
in the future.
I also took the opportunity to reorganize the color naming scheme
since it didn't really work for dark theme.
* Add Glob wrapper type with better serialization
* Introduce PathIgnoreRule struct
* Implement equality for Glob type
* Add PathIgnoreRule to InstanceContext
* Implement glob ignores in directory middleware
* Fix up filters
* Use Iterator::all instead of loop
* Add project-level configuration for glob ignores
* Add test project for glob ignores
* Wire up project file and snapshots to make glob ignores work
* Better codepaths for adding ignore rules with empty iterators
* Add test for globs inherited from parent projects
* Add test details, support glob ignores in nested projects
* Add feature flag for globs
* Switch to use ExactSizeIterator instead of size_hint
* Remove glob visitor
* 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
The refactor to use StructOpt instead of plain Clap had some absolute
vs relative path issues that slipped through. This commit adds getters
to each StructOpt struct that exposes an explicitly absolute version
of each path value.
* Rewrite project file to have relative paths and drop SourceProject
* Redo project error types
* Tidy up and document Project type
* Strip out init command
* Drop plugin context on the floor
* Remove redirect from old context to new context
* Pass InstanceContext via & instead of &mut reference
* Re-use context value in ChangeProcessor from metadata
This doesn't feel ideal. Though it's true that all directories are influenced by
any init scripts they have, the directory middleware shouldn't need to know
about Lua.
I don't really want to go back into working on the middleware chain since it
mostly feels like busywork when there are other things to build on in Rojo.
also all of this feels really complicated
Map sorting in Insta was previously not recursive.
As of this PR, it is!
https://github.com/mitsuhiko/insta/pull/80
Since it hasn't made it into a release yet, but is
important for Rojo to have snapshot determinism,
we're moving temporarily to depend on Insta via Git.
This was failing snapshot tests on the Linux CI machines,
since I committed snapshots with backslashes.
I think the old path serializer was still the wrong approach,
this one is sort of a middleground but I'm still not super
happy with it.
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.
* Refactor contributing_paths into contributing_sources, deleting project node sources
* Instead of changing contributing_paths, add instigating_source
* Remove InstanceMetadata::project_node
* Stop pushing project path to front of contributing_paths since it doesn't matter now
* Remove accidental UI change for path display
* Start actually computing AppliedPatchSet values
* Improve patch_apply documentation and flesh out applied patch code
* Add file link notes
* Stub out where tests for snapshot subsystem will go
* Create baseline tests
* Fix build failure by silencing Clippy
- JSON model names now come from the file name
- The 'Name' field is now optional for the top-level instance
- Snapshot tests run way faster by executing Rojo directly instead of Cargo
* A minimum viable product for init.meta.json
* Properties support
* Add ignoreUnknownChildren support
* Apply requested changes
* Use reflection guiding
* Add a script to the test
* Change to ignoreUnknownInstances
* Apply requested changes
* Add children sorting to snapshot_reconciler
* Update snapshot tests to include stable children order
* Bump dependencies, which should make this PR work
- Renamed setProperty to setCanonicalProperty, which is more usefully
descriptive. Also added a detailed comment.
- Fixed reconciler behavior with regards to removing known instances
when $ignoreUnknownInstances is set
* Changes project-related structures to use `BTreeMap` instead of `HashMap` for children to aid determiniusm
* Changes imfs-related structures to have total ordering and use `BTreeSet` instead of `HashSet`
* Upgrades dependencies to `bx_dom_weak`1.2.0 and rbx_xml 0.5.0 to aid in more determinism stuff
* Re-exposes the `RbxSession`'s root project via `root_project()`
* Implements `Default` for a couple things
* Tweaks visualization code to support visualizing trees not attached to an `RbxSession`
* Adds an ID-invariant comparison method for `rbx_tree` relying on previous determinism changes
* Adds a (disabled) test to start finding issues in the reconciler with regards to communicativity of snapshot application
* Adds a snapshot testing system that operates on `RbxTree` and associated metadata, which are committed in this change
* Add 'plugins' field to project and add rlua
* Scaffold out new SnapshotContext type (again) with plugin state
* Almost functional snapshot system with rlua proof-of-concept
* Gate plugin config on 'plugins-enabled' feature, tell Travis to test all features
* Guard remaining plugin setup code behind feature
* Bump minimum version to 1.33, should've caught this before
* Whoops, latest Rust is 1.32, not 1.33
* Do the nested partition thing
* Tidy up touched code
* Add nested partition test project, not fully functional
* Clean up variable names, move path_metadata mutation strictly into snapshot_reconciler
* Remove path_metadata, snapshotting is now pure
* Factor out snapshot metadata storage to fix a missing case
* Pull instance_name out of per_path_metadata, closer to what we need
* Refactor to make metadata make more sense, part one
* All appears to be well
* Cull 'metadata_per_path' in favor of 'instances_per_path'
* Remove SnapshotContext
* InstanceMetadata -> PublicInstanceMetadata in web module
* Build in snapshot testing system for testing... snapshots?
* Remove pretty_assertions to see if it fixes a snapshot comparison bug
* Reintroduce pretty assertions, it's not the cause of inequality
* Fix snapshot tests with custom relative path serializer
* HTTP responses in the error range (400+) now properly turn into errors
* ROJO_EPIPHANY_DEV_CREATE now creates more verbose configuration
* Default configuration values are now much more explicit
* Errors that cause session termination are labeled more clearly.
* Begin the metadata merge trek
* Tidy up path metadata, entry API, begin implementing
* Flesh out use of PathMap Entry API
* Metadata per instance is a go
* Tidy up naming for metadata per instance
* SnapshotMetadata -> SnapshotContext
Permission errors aren't reported since I'm not sure what the user could do about them.
Some properties can be set in the model format but not in live-sync mode, like HttpEnabled.
This is the last release candidate for Rojo 7. In an effort to get Rojo 7 out the door, we'll be freezing features from here on out, something we should've done a couple months ago.
Expect to see Rojo 7 stable soon!
* Added support for writing `Tags` in project files, model files, and meta files. ([#484])
* Adjusted Studio plugin colors to match Roblox Studio palette. ([#482])
* Improved experimental two-way sync feature by batching changes. ([#478])
This release includes a brand new implementation of the Roblox DOM. It brings performance improvements, much better support for `rbxl` and `rbxm` files, and a better internal API.
* Added support for all remaining property types.
* Added support for the entire Roblox binary model format.
* Changed `rojo upload` to upload binary places and models instead of XML.
* This should make using `rojo upload` much more feasible for large places.
* **Breaking**: Changed format of some types of values in `project.json`, `model.json`, and `meta.json` files.
* This should impact few projects. See [this file][allValues.json] for new examples of each property type.
Formatting of types will change more before the stable release of Rojo 7. We're hoping to use this opportunity to normalize some of the case inconsistency introduced in Rojo 0.5.
This release jumped from 0.6.0 to 6.0.0. Rojo has been in use in production for many users for quite a long times, and so 6.0 is a more accurate reflection of Rojo's version than a pre-1.0 version.
* Added basic settings panel to plugin, with two settings:
* "Open Scripts Externally": When enabled, opening a script in Studio will instead open it in your default text editor.
* "Two-Way Sync": When enabled, Rojo will attempt to save changes to your place back to the filesystem. **Very early feature, very broken, beware!**
* Added `--color` option to force-enable or force-disable color in Rojo's output.
* Added support for turning `.json` files into `ModuleScript` instances ([#308](https://github.com/rojo-rbx/rojo/pull/308))
* Added `rojo plugin install` and `rojo plugin uninstall` to allow Rojo to manage its Roblox Studio plugin. ([#304](https://github.com/rojo-rbx/rojo/pull/304))
* Class names no longer need to be specified for Roblox services in Rojo projects. ([#210](https://github.com/rojo-rbx/rojo/pull/210))
* The server half of **experimental** two-way sync is now enabled by default.
* Increased default logging verbosity in commands like `rojo build`.
* Rojo now requires a project file again, just like 0.5.4.
* This means that properties like `PrimaryPart` now work!
* Improved live sync protocol to reduce round-trips and improve syncing consistency.
* Improved support for binary model files and places.
### Command Line
* Added `--verbose`/`-v` flag, which can be specified multiple times to increase verbosity.
* Added support for automatically finding Roblox Studio's auth cookie for `rojo upload` on Windows.
* Added support for building, serving and uploading sources that aren't Rojo projects.
* Improved feedback from `rojo serve`.
* Removed support for legacy `roblox-project.json` projects, deprecated in an early Rojo 0.5.0 alpha.
* Rojo no longer traverses directories upwards looking for project files.
* Though undocumented, Rojo 0.5.x will search for a project file contained in any ancestor folders. This feature was removed to better support other 0.6.x features.
### Roblox Studio Plugin
* Added "connecting" state to improve experience when live syncing.
* Added "error" state to show errors in a place that isn't the output panel.
* Improved diagnostics for when the Rojo plugin cannot create an instance.
*`init.meta.json` files replace `init.model.json` files from Rojo 0.4.x ([#183](https://github.com/rojo-rbx/rojo/pull/183))
* Other `.meta.json` files allow attaching extra data to other files ([#189](https://github.com/rojo-rbx/rojo/pull/189))
* Added support for infinite and NaN values in types like `Vector2` when building models and places.
* These types aren't supported for live-syncing yet due to limitations around JSON encoding.
* Added support for using `SharedString` values when building XML models and places.
* Added support for live-syncing `CollectionService` tags.
* Added a warning when building binary place files, since they're still experimental and have bugs.
* Added a warning when trying to use Rojo 0.5.x with a Rojo 0.4.x-only project.
* Added a warning when a Rojo project contains keys that start with `$`, which are reserved names. ([#191](https://github.com/rojo-rbx/rojo/issues/191))
* Rojo now throws an error if unknown keys are found most files.
* Added an icon to the plugin's toolbar button
* Changed the plugin to use a docking widget for all UI.
* Changed the plugin to ignore unknown properties when live-syncing.
* Rojo's approach to this problem might change later, like with a strict model mode ([#190](https://github.com/rojo-rbx/rojo/issues/190)) or another approach.
* Upgraded to reflection database from client release 388.
* Updated Rojo's branding to shift the color palette to make it work better on dark backgrounds
* Changed `rojo build` to use buffered I/O, which can make it up to 2x faster in some cases.
* Building [*Road Not Taken*](https://github.com/LPGhatguy/roads) to an `rbxlx` file dropped from 150ms to 70ms on my machine
* Fixed `LocalizationTable` instances being made from `csv` files incorrectly interpreting empty rows and columns. ([#149](https://github.com/rojo-rbx/rojo/pull/149))
* Fixed CSV files with entries that parse as numbers causing Rojo to panic. ([#152](https://github.com/rojo-rbx/rojo/pull/152))
* Improved error messages when malformed CSV files are found in a Rojo project.
* Added support for a bunch of new types when dealing with XML model/place files:
*`ColorSequence`
*`Float64`
*`Int64`
*`NumberRange`
*`NumberSequence`
*`PhysicalProperties`
*`Ray`
*`Rect`
*`Ref`
* Improved server instance ordering behavior when files are added during a live session ([#135](https://github.com/rojo-rbx/rojo/pull/135))
* Fixed error being thrown when trying to unload the Rojo plugin.
* Added partial fix for [issue #141](https://github.com/rojo-rbx/rojo/issues/141) for `Lighting.Technology`, which should restore live sync functionality for the default project file.
* Added support for `init.model.json` files, which enable versioning `Tool` instances (among other things) with Rojo. ([#66](https://github.com/rojo-rbx/rojo/issues/66))
* Fixed obscure error when syncing into an invalid service.
* Fixed multiple sync processes occurring when a server ID mismatch is detected.
* Fixed final case of duplicated instance insertion, caused by reconciled instances not being inserted into `RouteMap`.
* The reconciler is still not a perfect solution, especially if script instances get moved around without being destroyed. I don't think this can be fixed before a big refactor.
* Protocol version 1, which shifts more responsibility onto the server
* This is a **major breaking** change!
* The server now has a content of 'filter plugins', which transform data at various stages in the pipeline
* The server now exposes Roblox instance objects instead of file contents, which lines up with how `rojo pack` will work, and paves the way for more robust syncing.
* Added `*.model.json` files, which let you embed small Roblox objects into your Rojo tree.
* Improved error messages in some cases ([#46](https://github.com/rojo-rbx/rojo/issues/46))
* Factored out the plugin into a separate repository
* Fixed server when using a file as a partition
* Previously, trailing slashes were put on the end of a partition even if the read request was an empty string. This broke file reading on Windows when a partition pointed to a file instead of a directory!
* Started running automatic tests on Travis CI (#9)
* Defensively insert existing instances into RouteMap; should fix most duplication cases when syncing into existing trees.
* Fixed incorrect synchronization from `Plugin:_pull` that would cause polling to create issues
* Fixed incorrect file routes being assigned to `init.lua` and `init.model.json` files
* Untangled route handling-internals slightly
## 0.4.10 (June 2, 2018)
* Added support for `init.model.json` files, which enable versioning `Tool` instances (among other things) with Rojo. ([#66](https://github.com/LPGhatguy/rojo/issues/66))
* Fixed obscure error when syncing into an invalid service.
* Fixed multiple sync processes occurring when a server ID mismatch is detected.
## 0.4.9 (May 26, 2018)
* Fixed warning when renaming or removing files that would sometimes corrupt the instance cache ([#72](https://github.com/LPGhatguy/rojo/pull/72))
* JSON models are no longer as strict -- `Children` and `Properties` are now optional.
## 0.4.8 (May 26, 2018)
* Hotfix to prevent errors from being thrown when objects managed by Rojo are deleted
## 0.4.7 (May 25, 2018)
* Added icons to the Rojo plugin, made by [@Vorlias](https://github.com/Vorlias)! ([#70](https://github.com/LPGhatguy/rojo/pull/70))
* Server will now issue a warning if no partitions are specified in `rojo serve` ([#40](https://github.com/LPGhatguy/rojo/issues/40))
## 0.4.6 (May 21, 2018)
* Rojo handles being restarted by Roblox Studio more gracefully ([#67](https://github.com/LPGhatguy/rojo/issues/67))
* Folders should no longer get collapsed when syncing occurs.
* **Significant** robustness improvements with regards to caching.
* **This should catch all existing script duplication bugs.**
* If there are any bugs with script duplication or caching in the future, restarting the Rojo server process will fix them for that session.
* Fixed message in plugin not being prefixed with `Rojo: `.
## 0.4.5 (May 1, 2018)
* Rojo messages are now prefixed with `Rojo: ` to make them stand out in the output more.
* Fixed server to notice file changes *much* more quickly. (200ms vs 1000ms)
* Server now lists name of project when starting up.
* Rojo now throws an error if no project file is found. ([#63](https://github.com/LPGhatguy/rojo/issues/63))
* Fixed multiple sync operations occuring at the same time. ([#61](https://github.com/LPGhatguy/rojo/issues/61))
* Partitions targeting files directly now work as expected. ([#57](https://github.com/LPGhatguy/rojo/issues/57))
## 0.4.4 (April 7, 2018)
* Fix small regression introduced in 0.4.3
## 0.4.3 (April 7, 2018)
* Plugin now automatically selects `HttpService` if it determines that HTTP isn't enabled ([#58](https://github.com/LPGhatguy/rojo/pull/58))
* Plugin now has much more robust handling and will wipe all state when the server changes.
* This should fix issues that would otherwise be solved by restarting Roblox Studio.
## 0.4.2 (April 4, 2018)
* Fixed final case of duplicated instance insertion, caused by reconciled instances not being inserted into `RouteMap`.
* The reconciler is still not a perfect solution, especially if script instances get moved around without being destroyed. I don't think this can be fixed before a big refactor.
## 0.4.1 (April 1, 2018)
* Merged plugin repository into main Rojo repository for easier tracking.
* Improved `RouteMap` object tracking; this should fix some cases of duplicated instances being synced into the tree.
## 0.4.0 (March 27, 2018)
* Protocol version 1, which shifts more responsibility onto the server
* This is a **major breaking** change!
* The server now has a content of 'filter plugins', which transform data at various stages in the pipeline
* The server now exposes Roblox instance objects instead of file contents, which lines up with how `rojo pack` will work, and paves the way for more robust syncing.
* Added `*.model.json` files, which let you embed small Roblox objects into your Rojo tree.
* Improved error messages in some cases ([#46](https://github.com/LPGhatguy/rojo/issues/46))
## 0.3.2 (December 20, 2017)
* Fixed `rojo serve` failing to correctly construct an absolute root path when passed as an argument
* Fixed intense CPU usage when running `rojo serve`
## 0.3.1 (December 14, 2017)
* Improved error reporting when invalid JSON is found in a `rojo.json` project
* These messages are passed on from Serde
## 0.3.0 (December 12, 2017)
* Factored out the plugin into a separate repository
* Fixed server when using a file as a partition
* Previously, trailing slashes were put on the end of a partition even if the read request was an empty string. This broke file reading on Windows when a partition pointed to a file instead of a directory!
* Started running automatic tests on Travis CI (#9)
## 0.2.3 (December 4, 2017)
* Plugin only release
* Tightened `init` file rules to only match script files
* Previously, Rojo would sometimes pick up the wrong file when syncing
## 0.2.2 (December 1, 2017)
* Plugin only release
* Fixed broken reconciliation behavior with `init` files
## 0.2.1 (December 1, 2017)
* Plugin only release
* Changes default port to 8000
## 0.2.0 (December 1, 2017)
* Support for `init.lua` like rbxfs and rbxpacker
* More robust syncing with a new reconciler
## 0.1.0 (November 29, 2017)
* Initial release, functionally very similar to [rbxfs](https://github.com/LPGhatguy/rbxfs)
Rojo is a big project and can always use more help!
Some of the repositories covered are:
* https://github.com/rojo-rbx/rojo
* https://github.com/rojo-rbx/rbx-dom
* https://github.com/rojo-rbx/vscode-rojo
* https://github.com/rojo-rbx/rbxlx-to-rojo
## Code
Code contributions are welcome for features and bugs that have been reported in the project's bug tracker. We want to make sure that no one wastes their time, so be sure to talk with maintainers about what changes would be accepted before doing any work!
Documentation impacts way more people than the individual lines of code we write.
If you find any problems in documentation, including typos, bad grammar, misleading phrasing, or missing content, feel free to file issues and pull requests to fix them.
## Bug Reports and Feature Requests
Most of the tools around Rojo try to be clear when an issue is a bug. Even if they aren't, sometimes things don't work quite right.
Sometimes there's something that Rojo doesn't do that it probably should.
Please file issues and we'll try to help figure out what the best way forward is.
## Local Development Gotchas
If your build fails with "Error: failed to open file `D:\code\rojo\plugin\modules\roact\src`" you need to update your Git submodules.
Run the command and try building again: `git submodule update --init --recursive`.
## Pushing a Rojo Release
The Rojo release process is pretty manual right now. If you need to do it, here's how:
1. Bump server version in [`Cargo.toml`](Cargo.toml)
2. Bump plugin version in [`plugin/src/Config.lua`](plugin/src/Config.lua)
3. Run `cargo test` to update `Cargo.lock` and run tests
4. Update [`CHANGELOG.md`](CHANGELOG.md)
5. Commit!
*`git add . && git commit -m "Release vX.Y.Z"`
6. Tag the commit
*`git tag vX.Y.Z`
7. Publish the CLI
*`cargo publish`
8. Publish the Plugin
*`cargo run -- upload plugin --asset_id 6415005344`
*`cargo run -- build plugin --output Rojo.rbxm`
9. Push commits and tags
*`git push && git push --tags`
10. Copy GitHub release content from previous release
* Update the leading text with a summary about the release
* Paste the changelog notes (as-is!) from [`CHANGELOG.md`](CHANGELOG.md)
* Write a small summary of each major feature
* Attach release artifacts from GitHub Actions for each platform
This is a super rough draft that I'm trying to use to lay out some of my thoughts.
## API
### POST `/read`
Accepts a `Vec<Route>` of items to read.
Returns `Vec<Option<RbxInstance>>`, in the same order as the request.
### POST `/write`
Accepts a `Vec<{ Route, RbxInstance }>` of items to write.
I imagine that the `Name` attribute of the top-level `RbxInstance` would be ignored in favor of the route name?
## CLI
The `rojo serve` command uses three major components:
* A Virtual Filesystem (VFS), which exposes the filesystem as `VfsItem` objects
* A VFS watcher, which tracks changes to the filesystem and logs them
* An HTTP API, which exposes an interface to the Roblox Studio plugin
### Transform Plugins
Transform plugins (or filter plugins?) can interject in three places:
* Transform a `VfsItem` that's being read into an `RbxInstance` in the VFS
* Transform an `RbxInstance` that's being written into a `VfsItem` in the VFS
* Transform a file change into paths that need to be updated in the VFS watcher
The plan is to have several built-in plugins that can be rearranged/configured in project settings:
* Base plugin
* Transforms all unhandled files to/from StringValue objects
* Script plugin
* Transforms `*.lua` files to their appropriate file types
* JSON/rbxmx/rbxlx model plugin
* External binary plugin
* User passes a binary name (like `moonc`) that modifies file contents
## Roblox Studio Plugin
With the protocol version 1 change, the Roblox Studio plugin got a lot simpler. Notably, the plugin doesn't need to be aware of anything about the filesystem's semantics, which is super handy.
## Bi-directional syncing
Quenty laid out a good way to handle bi-directional syncing.
When receiving a change from the plugin:
1. Hash the new contents of the file, store it in a map from routes to hashes
2. Write the new file contents to the filesystem
3. Later down the line, receive a change event from the filesystem watcher
4. When receiving a change, if the item is in the hash map, read it and hash those contents
5. If the hash matches the last noted hash, discard the change, else continue as normal
You can also view the documentation by browsing the [docs folder of the repository](https://github.com/LPGhatguy/rojo/tree/master/docs), but because it uses a number of Markdown extensions, it may not be very readable.
Documentation is hosted in the [rojo.space repository](https://github.com/rojo-rbx/rojo.space).
## Inspiration
There are lots of other tools that sync scripts into Roblox or provide other tools for working with Roblox places.
Here are a few, if you're looking for alternatives or supplements to Rojo:
* [Studio Bridge by Vocksel](https://github.com/vocksel/studio-bridge)
* [RbxRefresh by Osyris](https://github.com/osyrisrblx/RbxRefresh)
* [RbxSync by evaera](https://github.com/evaera/RbxSync)
* [CodeSync](https://github.com/MemoryPenguin/CodeSync) and [rbx-exteditor](https://github.com/MemoryPenguin/rbx-exteditor) by [MemoryPenguin](https://github.com/MemoryPenguin)
* [rbxmk by Anaminus](https://github.com/anaminus/rbxmk)
I also have a couple tools that Rojo intends to replace:
* [rbxfs](https://github.com/LPGhatguy/rbxfs), which has been deprecated by Rojo
* [rbxpacker](https://github.com/LPGhatguy/rbxpacker), which is still useful
## Contributing
## Contributing
Check out our [contribution guide](CONTRIBUTING.md) for detailed instructions for helping work on Rojo!
Pull requests are welcome!
Pull requests are welcome!
All pull requests are run against a test suite on Travis CI. That test suite should always pass!
Rojo supports Rust 1.46.0 and newer. The minimum supported version of Rust is based on the latest versions of the dependencies that Rojo has.
## License
## License
Rojo is available under the terms of the Mozilla Public License, Version 2.0. See [LICENSE](LICENSE) for details.
Rojo is available under the terms of the Mozilla Public License, Version 2.0. See [LICENSE.txt](LICENSE.txt) for details.
To use Rojo, you'll need to create a new project file, which tells Rojo what your project is, and how to load it into Roblox Studio.
## New Project
Create a new folder, then run `rojo init` inside that folder to initialize an empty project.
```sh
mkdir my-new-project
cd my-new-project
rojo init
```
Rojo will create an empty project file named `rojo.json` in the directory.
The default configuration doesn't do anything. We need to tell Rojo where our code is on the filesystem, and where we want to put it in the Roblox tree.
To do that, open up `rojo.json` and add an entry to the `partitions` table:
```json
{
"name":"your-project-name-here",
"servePort":8000,
"partitions":{
"src":{
"path":"src",
"target":"ReplicatedStorage.Project"
}
}
}
```
!!! warning
Make sure that the `src` directory exists in your project, or Rojo will throw an error!
!!! warning
Any objects contained in the `target` of a partition will be destroyed by Rojo if not found on the filesystem!
A Rojo project has one or more *partitions*. Partitions define how code should be transferred between the filesystem and Roblox by mapping directories and files to Roblox objects.
Each partition has:
* A name (the key in the `partitions` object), which is used for debugging
*`path`, the location on the filesystem relative to `rojo.json`
*`target`, the location in Roblox relative to `game`
## Syncing into Studio
Once you've added your partition to the project file, you can start the Rojo dev server by running a command in your project's directory:
```sh
rojo serve
```
If your project is in the right place, Rojo will let you know that it was found and start an HTTP server that the plugin can connect to.
In Roblox Studio, open the plugins tab and find Rojo's buttons.

{: align="center" }
Press **Test Connection** to verify that the plugin can communicate with the dev server. Watch the Output panel for the results.
!!! info
If you see an error message, return to the previous steps and make sure that the Rojo dev server is running.

{: align="center" }
After your connection was successful, press **Sync In** to move code from the filesystem into Studio, or use **Toggle Polling** to have Rojo automatically sync in changes as they happen.
## Importing an Existing Project
Rojo will eventually support importing an existing Roblox project onto the filesystem for use with Rojo.
Rojo doesn't currently support converting an existing project or syncing files from Roblox Studio onto the filesystem. In the mean time, you can manually copy your files into the structure that Rojo expects.
Up-to-date information will be available on [issue #5](https://github.com/LPGhatguy/rojo/issues/5) as this is worked on.
* The plugin, a Roblox Studio plugin written in Lua
It's important that the plugin and server are compatible. The plugin will show errors in the Roblox Studio Output window if there is a version mismatch.
## Installing the Server
To install the server, either:
* If you have Rust installed, use `cargo install rojo`
* Or, download a pre-built Windows binary from [the GitHub releases page](https://github.com/LPGhatguy/rojo/releases)
**The Rojo binary must be run from the command line, like Terminal on MacOS or `cmd.exe` on Windows. It's recommended that you put the Rojo binary on your `PATH` to make this easier.**
## Installing the Plugin
To install the plugin, either:
* Install the plugin from the [Roblox plugin page](https://www.roblox.com/library/1211549683/Rojo).
* This gives you less control over what version you install -- you will always have the latest version.
* Or, download the latest release from [the GitHub releases section](https://github.com/LPGhatguy/rojo/releases) and install it into your Roblox plugins folder
* You can open this folder by clicking the "Plugins Folder" button from the Plugins toolbar in Roblox Studio
## Visual Studio Code Extension
If you use Visual Studio Code on Windows, you can install [Evaera's unofficial Rojo extension](https://marketplace.visualstudio.com/items?itemName=evaera.vscode-rojo), which will install both halves of Rojo for you. It even has a nifty UI to add partitions and start/stop the Rojo server!
This page aims to describe how Rojo turns files on the filesystem into Roblox objects.
## Folders
Any directory on the filesystem will turn into a `Folder` instance in Roblox, unless that folder matches the name of a service or other existing instance. In those cases, that instance will be preserved.
## Scripts
Rojo can represent `ModuleScript`, `Script`, and `LocalScript` objects. The default script type is `ModuleScript`, since most scripts in well-structued Roblox projects will be modules.
| File Name | Instance Type |
| -------------- | -------------- |
| `*.server.lua` | `Script` |
| `*.client.lua` | `LocalScript` |
| `*.lua` | `ModuleScript` |
If a directory contains a file named `init.server.lua`, `init.client.lua`, or `init.lua`, that folder will be transformed into a `*Script` instance with the conents of the `init` file. This can be used to create scripts inside of scripts.
For example, this file tree:
* my-game
* init.client.lua
* foo.lua
Will turn into these instances in Roblox:

## Models
Rojo supports a JSON model format for representing simple models. It's designed for instance types like `BindableEvent` or `Value` objects, and is not suitable for larger models.
Rojo JSON models are stored in `.model.json` files.
Starting in Rojo version **0.4.10**, model files named `init.model.json` that are located in folders will replace that folder, much like Rojo's `init.lua` support. This can be useful to version instances like `Tool` that tend to contain several instances as well as one or more scripts.
!!! info
In the future, Rojo will support `.rbxmx` models. See [issue #7](https://github.com/LPGhatguy/rojo/issues/7) for more details and updates on this feature.
!!! warning
Prior to Rojo version **0.4.9**, the `Properties` and `Children` properties are required on all instances in JSON models!
JSON model files are fairly strict; any syntax errors will cause the model to fail to sync! They look like this:
There are a number of existing plugins for Roblox that move code from the filesystem into Roblox.
Besides Rojo, there is:
* [Studio Bridge](https://github.com/vocksel/studio-bridge) by [Vocksel](https://github.com/vocksel)
* [RbxRefresh](https://github.com/osyrisrblx/RbxRefresh) by [Osyris](https://github.com/osyrisrblx)
* [RbxSync](https://github.com/evaera/RbxSync) by [evaera](https://github.com/evaera)
* [CodeSync](https://github.com/MemoryPenguin/CodeSync) and [rbx-exteditor](https://github.com/MemoryPenguin/rbx-exteditor) by [MemoryPenguin](https://github.com/MemoryPenguin)
* [rbxmk](https://github.com/anaminus/rbxmk) by [Anaminus](https://github.com/anaminus)
So why did I build Rojo?
Each of these tools solves what is essentially the same problem from a few different angles. The goal of Rojo is to take all of the lessons and ideas learned from these projects and build a tool that can solve the problem for good.
Additionally:
* I think that this tool needs to be built in a compiled language without a runtime, for easy distribution and good performance.
* I think that the conventions promoted by other sync plugins (`.module.lua` for modules, as well a single sync point) are sub-optimal.
* I think that I have a good enough understanding of the problem to build something robust.
* I think that Rojo should be able to do more than just sync code.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-- This should use the equivalent of Rust's 'Display', ie
-- tostring and the __tostring metamethod.
buffer:writeRaw(tostring(arg))
elseifformatSpecifier==":?"then
-- This should use the equivalent of Rust's 'Debug',
-- invented for this library as __fmtDebug.
debugImpl(buffer,arg,false)
elseifformatSpecifier==":#?"then
-- This should use the equivlant of Rust's 'Debug' with the
-- 'alternate' (ie expanded) flag set.
debugImpl(buffer,arg,true)
else
error("unsupported format specifier "..formatSpecifier,2)
end
i=closeBrace+1
end
end
end
end
localfunctiondebugOutputBuffer()
localbuffer={}
localstartOfLine=true
localindentLevel=0
localindentation=""
functionbuffer:writeLine(template,...)
writeFmt(self,template,...)
self:nextLine()
end
functionbuffer:writeLineRaw(value)
self:writeRaw(value)
self:nextLine()
end
functionbuffer:write(template,...)
returnwriteFmt(self,template,...)
end
functionbuffer:writeRaw(value)
if#value>0then
ifstartOfLineand#indentation>0then
startOfLine=false
table.insert(self,indentation)
end
table.insert(self,value)
startOfLine=false
end
end
functionbuffer:nextLine()
table.insert(self,"\n")
startOfLine=true
end
functionbuffer:indent()
indentLevel=indentLevel+1
indentation=string.rep("",indentLevel)
end
functionbuffer:unindent()
indentLevel=math.max(0,indentLevel-1)
indentation=string.rep("",indentLevel)
end
functionbuffer:finish()
returntable.concat(self,"")
end
returnbuffer
end
localfunctionfmt(template,...)
localbuffer=debugOutputBuffer()
writeFmt(buffer,template,...)
returnbuffer:finish()
end
--[[
Wrap the given object in a type that implements the given function as its
Debug implementation, and forwards __tostring to the type's underlying
tostring implementation.
]]
localfunctiondebugify(object,fmtFunc)
returnsetmetatable({},{
__fmtDebug=function(_,...)
returnfmtFunc(object,...)
end,
__tostring=function()
returntostring(object)
end,
})
end
return{
debugOutputBuffer=debugOutputBuffer,
fmt=fmt,
debugify=debugify,
}
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.