mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-20 12:45:05 +00:00
Compare commits
37 Commits
v0.5.0-alp
...
v0.5.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91caa67e04 | ||
|
|
53793f7dd2 | ||
|
|
32af8783ba | ||
|
|
d6f51f8eba | ||
|
|
f40b7361e8 | ||
|
|
0231e114d5 | ||
|
|
ca61a3e83f | ||
|
|
6979f5c82d | ||
|
|
7d45b45667 | ||
|
|
7575504b80 | ||
|
|
36bcb611f1 | ||
|
|
cc34c36794 | ||
|
|
b84cb93d2c | ||
|
|
08211a7740 | ||
|
|
97985dd458 | ||
|
|
edf157215c | ||
|
|
89671c71fa | ||
|
|
eeedcc50ab | ||
|
|
de0bb069aa | ||
|
|
5d53f8bfb3 | ||
|
|
d4a7de8070 | ||
|
|
3fe15641c7 | ||
|
|
08df71a7e4 | ||
|
|
77db25b4d9 | ||
|
|
62bb5a28aa | ||
|
|
f768b200d2 | ||
|
|
a5b6db74e5 | ||
|
|
cbe4467a22 | ||
|
|
8417d18eec | ||
|
|
93ae8187cd | ||
|
|
972338d86a | ||
|
|
a4a6e3b8f6 | ||
|
|
d788dd3042 | ||
|
|
974760f020 | ||
|
|
65569c4a60 | ||
|
|
39da45f0bd | ||
|
|
dc7c27e619 |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1,9 +1,9 @@
|
||||
/site
|
||||
/target
|
||||
/scratch-project
|
||||
**/*.rs.bk
|
||||
/server/failed-snapshots/
|
||||
**/*.rs.bk
|
||||
/*.rbxm
|
||||
/*.rbxmx
|
||||
/*.rbxl
|
||||
/*.rbxlx
|
||||
/*.rbxlx
|
||||
**/*.snap.new
|
||||
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -15,4 +15,4 @@
|
||||
url = https://github.com/osyrisrblx/t.git
|
||||
[submodule "plugin/modules/rbx-dom"]
|
||||
path = plugin/modules/rbx-dom
|
||||
url = http://github.com/LPGhatguy/rbx-dom
|
||||
url = http://github.com/rojo-rbx/rbx-dom
|
||||
14
.travis.yml
14
.travis.yml
@@ -30,25 +30,15 @@ matrix:
|
||||
# - luacov-coveralls -e $TRAVIS_BUILD_DIR/lua_install
|
||||
|
||||
- language: rust
|
||||
rust: 1.32.0
|
||||
rust: 1.34.0
|
||||
cache: cargo
|
||||
|
||||
script:
|
||||
- cargo test --verbose
|
||||
- cargo test --verbose --all-features
|
||||
|
||||
- language: rust
|
||||
rust: stable
|
||||
cache: cargo
|
||||
|
||||
script:
|
||||
- cargo test --verbose
|
||||
- cargo test --verbose --all-features
|
||||
|
||||
- language: rust
|
||||
rust: beta
|
||||
cache: cargo
|
||||
|
||||
script:
|
||||
- cargo test --verbose
|
||||
- cargo test --verbose --all-features
|
||||
- cargo test --verbose
|
||||
15
CHANGELOG.md
15
CHANGELOG.md
@@ -1,5 +1,20 @@
|
||||
# Rojo Changelog
|
||||
|
||||
## Unreleased Changes
|
||||
|
||||
## [0.5.0](https://github.com/rojo-rbx/rojo/releases/tag/v0.5.0) (August XX, 2019)
|
||||
* Changed `.model.json` naming, which may require projects to migrate ambiguous cases:
|
||||
* The file name now takes precedence over the `Name` field in the model, like Rojo 0.4.x.
|
||||
* The `Name` field of the top-level instance is now optional. It's recommended that you remove it from your models.
|
||||
* Rojo will emit a warning when `Name` is specified and does not match the name from the file.
|
||||
* Fixed `Rect` values being set to `0, 0, 0, 0` when synced with the Rojo plugin. ([#201](https://github.com/rojo-rbx/rojo/issues/201))
|
||||
* Fixed live-syncing of `PhysicalProperties`, `NumberSequence`, and `ColorSequence` values
|
||||
|
||||
## [0.5.0 Alpha 13](https://github.com/rojo-rbx/rojo/releases/tag/v0.5.0-alpha.13) (August 2, 2019)
|
||||
* Bumped minimum Rust version to 1.34.0.
|
||||
* Fixed default port documentation in `rojo serve --help` ([#219](https://github.com/rojo-rbx/rojo/issues/219))
|
||||
* Fixed BrickColor support by upgrading Roblox-related dependencies
|
||||
|
||||
## [0.5.0 Alpha 12](https://github.com/rojo-rbx/rojo/releases/tag/v0.5.0-alpha.12) (July 2, 2019)
|
||||
* Added `.meta.json` files
|
||||
* `init.meta.json` files replace `init.model.json` files from Rojo 0.4.x ([#183](https://github.com/rojo-rbx/rojo/pull/183))
|
||||
|
||||
48
CONTRIBUTING.md
Normal file
48
CONTRIBUTING.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# Contributing to the Rojo Project
|
||||
Rojo is a big project and can always use more help! This guide covers all repositories underneath the [rojo-rbx organization on GitHub](https://github.com/rojo-rbx).
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
## 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 [`server/Cargo.toml`](server/Cargo.toml)
|
||||
2. Bump plugin version in [`plugin/src/Config.lua`](plugin/src/Config.lua)
|
||||
3. Run `cargo test` to update `Cargo.lock` and double-check tests
|
||||
4. Update [`CHANGELOG.md`](CHANGELOG.md)
|
||||
5. Commit!
|
||||
* `git add . && git commit -m "Release vX.Y.Z"`
|
||||
6. Tag the commit with the version from `Cargo.toml` prepended with a v, like `v0.4.13`
|
||||
7. Build Windows release build of CLI
|
||||
* `cargo build --release`
|
||||
7. Publish the CLI
|
||||
* `cargo publish`
|
||||
8. Build and upload the plugin
|
||||
* `rojo build plugin -o Rojo.rbxm`
|
||||
* Upload `Rojo.rbxm` to Roblox.com, keep it for later
|
||||
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
|
||||
903
Cargo.lock
generated
903
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
[workspace]
|
||||
members = [
|
||||
"server",
|
||||
"rojo-test",
|
||||
]
|
||||
|
||||
[profile.dev]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div align="center">
|
||||
<a href="https://rojo.space">
|
||||
<img src="assets/rojo-logo.png" alt="Rojo" height="217" />
|
||||
<img src="assets/logo-512.png" alt="Rojo" height="217" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -48,9 +48,11 @@ Soon, Rojo will be able to:
|
||||
If you find any mistakes, feel free to make changes in the [docs](https://github.com/rojo-rbx/rojo/tree/master/docs) folder of this repository and submit a pull request!
|
||||
|
||||
## Contributing
|
||||
Check out our [contribution guide](CONTRIBUTING.md) for detailed instructions for helping work on Rojo!
|
||||
|
||||
Pull requests are welcome!
|
||||
|
||||
Rojo supports Rust 1.32 and newer.
|
||||
Rojo supports Rust 1.34.0 and newer. The minimum supported version of Rust is based on the latest versions of the dependencies that Rojo has.
|
||||
|
||||
## License
|
||||
Rojo is available under the terms of the Mozilla Public License, Version 2.0. See [LICENSE.txt](LICENSE.txt) for details.
|
||||
BIN
assets/logo-512.png
Normal file
BIN
assets/logo-512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
@@ -2,10 +2,10 @@
|
||||
|
||||
## Summary
|
||||
* Tools to port existing games are in progress!
|
||||
* [rbxlx-to-rojo](https://github.com/rojo/rbxlx-to-rojo)
|
||||
* [rbxlx-to-rojo](https://github.com/rojo-rbx/rbxlx-to-rojo)
|
||||
* `rojo export` ([issue #208](https://github.com/rojo-rbx/rojo/issues/208))
|
||||
* Can port as much or as little of your game as you like
|
||||
* Rojo can manage just a slice of your game!
|
||||
* Some Roblox idioms aren't very well supported
|
||||
* Redundant copies of scripts don't work well with files
|
||||
* Having only a couple places with scripts simplifies your project dramatically!
|
||||
* Having only a couple places with scripts simplifies your project dramatically!
|
||||
|
||||
@@ -29,7 +29,7 @@ If you have Rust installed, the easiest way to get Rojo is with Cargo!
|
||||
To install the latest 0.5.0 alpha, use:
|
||||
|
||||
```sh
|
||||
cargo install rojo --version 0.5.0-alpha.12
|
||||
cargo install rojo --version 0.5.0-alpha.13
|
||||
```
|
||||
|
||||
## Installing the Plugin
|
||||
|
||||
@@ -41,7 +41,7 @@ All we have to do is call `rojo build`:
|
||||
rojo build -o MyNewProject.rbxlx
|
||||
```
|
||||
|
||||
If you open `MyNewProject.rbxlx` in Roblox Studio now, you should see a `Folder` containing a `ModuleScript` under `ReplicatedStorage`!
|
||||
If you open `MyNewProject.rbxlx` in Roblox Studio now, you should see a `Folder` named "Source" containing a `ModuleScript` under `ReplicatedStorage`.
|
||||
|
||||
!!! info
|
||||
To generate a binary place file instead, use `rbxl`. Note that support for binary model/place files (`rbxm` and `rbxl`) is very limited in Rojo presently.
|
||||
@@ -49,7 +49,7 @@ If you open `MyNewProject.rbxlx` in Roblox Studio now, you should see a `Folder`
|
||||
## Live-Syncing into Studio
|
||||
Building a place file is great for starting to work on a game, but for active iteration, you'll want something faster.
|
||||
|
||||
In Roblox Studio, make sure the Rojo plugin is installed. If you need it, check out [the installation guide](installation) to learn how to install it.
|
||||
In Roblox Studio, make sure the Rojo plugin is installed. If you need it, check out [the installation guide](../installation) to learn how to install it.
|
||||
|
||||
To expose your project to the plugin, you'll need to start a new **live sync session** from the command line:
|
||||
|
||||
@@ -87,4 +87,4 @@ Generating and publishing your game is as simple as:
|
||||
rojo upload --asset_id [PLACE ID] --cookie "[SECURITY COOKIE]"
|
||||
```
|
||||
|
||||
An example project is available on GitHub that deploys to Roblox.com from GitHub and Travis-CI automatically: [https://github.com/LPGhatguy/roads](https://github.com/LPGhatguy/roads)
|
||||
An example project is available on GitHub that deploys to Roblox.com from GitHub and Travis-CI automatically: [https://github.com/LPGhatguy/roads](https://github.com/LPGhatguy/roads)
|
||||
|
||||
@@ -1,25 +1,31 @@
|
||||
[TOC]
|
||||
|
||||
## Project File
|
||||
Rojo projects are JSON files that have the `.project.json` extension. They have the following fields:
|
||||
|
||||
Rojo projects are JSON files that have the `.project.json` extension. They have these fields:
|
||||
|
||||
* `name`: A string indicating the name of the project.
|
||||
* This is only used for diagnostics.
|
||||
* `name`: A string indicating the name of the project. This name is used when building the project into a model or place file.
|
||||
* **Required**
|
||||
* `tree`: An [Instance Description](#instance-description) describing the root instance of the project.
|
||||
* **Required**
|
||||
* `servePort`: The port that `rojo serve` should listen on. Passing `--port` will override this setting.
|
||||
* **Optional**
|
||||
* Default is `34872`
|
||||
* `servePlaceIds`: A list of place IDs that this project may be live-synced to. This feature can help prevent overwriting the wrong game with source from Rojo.
|
||||
* **Optional**
|
||||
* Default is `null`
|
||||
|
||||
## Instance Description
|
||||
Instance Descriptions correspond one-to-one with the actual Roblox Instances in the project. They can be specified directly in the project file or be pulled from the filesystem.
|
||||
Instance Descriptions correspond one-to-one with the actual Roblox Instances in the project.
|
||||
|
||||
* `$className`: The ClassName of the Instance being described.
|
||||
* Optional if `$path` is specified.
|
||||
* **Optional if `$path` is specified.**
|
||||
* `$path`: The path on the filesystem to pull files from into the project.
|
||||
* Optional if `$className` is specified.
|
||||
* **Optional if `$className` is specified.**
|
||||
* Paths are relative to the folder containing the project file.
|
||||
* `$properties`: Properties to apply to the instance. Values should be [Instance Property Values](#instance-property-value).
|
||||
* Optional
|
||||
* **Optional**
|
||||
* `$ignoreUnknownInstances`: Whether instances that Rojo doesn't know about should be deleted.
|
||||
* Optional
|
||||
* **Optional**
|
||||
* Default is `false` if `$path` is specified, otherwise `true`.
|
||||
|
||||
All other fields in an Instance Description are turned into instances whose name is the key. These values should also be Instance Descriptions!
|
||||
|
||||
@@ -86,6 +86,11 @@ It would turn into instances in this shape:
|
||||

|
||||
{: align="center" }
|
||||
|
||||
!!! warning
|
||||
Starting in Rojo 0.5.0 (stable), the `Name` field is no longer required. The name of the top-level instance in a JSON model is now based on its file name, and the `Name` field is now ignored.
|
||||
|
||||
Rojo will emit a warning if the `Name` field is specified and does not match the file's name.
|
||||
|
||||
## Binary and XML Models
|
||||
Rojo supports both binary (`.rbxm`) and XML (`.rbxmx`) models generated by Roblox Studio or another tool.
|
||||
|
||||
|
||||
@@ -2,6 +2,11 @@ Adding a tool like Rojo to your Roblox workflow can be daunting, but it comes wi
|
||||
|
||||
[TOC]
|
||||
|
||||
## Rojo at RDC 2019
|
||||
Nathan Riemer (Kampfkarren) gave a talk at RDC 2019 talking about some of the benefits of using a tool like Rojo.
|
||||
|
||||
<iframe style="margin: 0 auto; max-width: 100%" width="560" height="315" src="https://www.youtube-nocookie.com/embed/czlvzEyhaBc" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
|
||||
## External Text Editors
|
||||
Rojo opens the door to use the absolute best text editors in the world and their rich plugin ecosystems.
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# Rojo Plugin
|
||||
|
||||
This is the source to the Rojo Roblox Studio plugin.
|
||||
|
||||
Documentation is WIP.
|
||||
Submodule plugin/modules/rbx-dom updated: d7be961eb3...6739c42beb
@@ -1,6 +1,6 @@
|
||||
return {
|
||||
codename = "Epiphany",
|
||||
version = {0, 5, 0, "-alpha.12"},
|
||||
version = {0, 5, 0},
|
||||
expectedServerVersionString = "0.5.0 or newer",
|
||||
protocolVersion = 2,
|
||||
defaultHost = "localhost",
|
||||
|
||||
14
rojo-test/Cargo.toml
Normal file
14
rojo-test/Cargo.toml
Normal file
@@ -0,0 +1,14 @@
|
||||
[package]
|
||||
name = "rojo-test"
|
||||
version = "0.1.0"
|
||||
authors = ["Lucien Greathouse <me@lpghatguy.com>"]
|
||||
edition = "2018"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
insta = "0.10.0"
|
||||
paste = "0.1.5"
|
||||
tempfile = "3.1.0"
|
||||
|
||||
# We execute Rojo via std::process::Command, so depend on it so it's built!
|
||||
rojo = { path = "../server" }
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "client_in_folder",
|
||||
"tree": {
|
||||
"$path": "folder"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
-- This is a Lua client script
|
||||
6
rojo-test/build-tests/client_init/default.project.json
Normal file
6
rojo-test/build-tests/client_init/default.project.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "client_init",
|
||||
"tree": {
|
||||
"$path": "folder"
|
||||
}
|
||||
}
|
||||
1
rojo-test/build-tests/client_init/folder/init.client.lua
Normal file
1
rojo-test/build-tests/client_init/folder/init.client.lua
Normal file
@@ -0,0 +1 @@
|
||||
return "From folder/init.client.lua"
|
||||
6
rojo-test/build-tests/csv_bug_145/default.project.json
Normal file
6
rojo-test/build-tests/csv_bug_145/default.project.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "csv_bug_145",
|
||||
"tree": {
|
||||
"$path": "folder"
|
||||
}
|
||||
}
|
||||
6
rojo-test/build-tests/csv_bug_147/default.project.json
Normal file
6
rojo-test/build-tests/csv_bug_147/default.project.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "csv_bug_147",
|
||||
"tree": {
|
||||
"$path": "folder"
|
||||
}
|
||||
}
|
||||
6
rojo-test/build-tests/csv_in_folder/default.project.json
Normal file
6
rojo-test/build-tests/csv_in_folder/default.project.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "csv_in_folder",
|
||||
"tree": {
|
||||
"$path": "folder"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "localization",
|
||||
"name": "gitkeep",
|
||||
"tree": {
|
||||
"$path": "src"
|
||||
}
|
||||
0
rojo-test/build-tests/gitkeep/src/.gitkeep
Normal file
0
rojo-test/build-tests/gitkeep/src/.gitkeep
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "json_model_in_folder",
|
||||
"tree": {
|
||||
"$path": "folder"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"ClassName": "IntValue",
|
||||
"Properties": {
|
||||
"Value": 5
|
||||
},
|
||||
"Children": [
|
||||
{
|
||||
"Name": "A Child",
|
||||
"ClassName": "Folder"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "json_model_legacy_name",
|
||||
"tree": {
|
||||
"$path": "folder"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"Name": "Overridden Name",
|
||||
"ClassName": "Folder"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "module_in_folder",
|
||||
"tree": {
|
||||
"$path": "folder"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
-- This is a Lua module
|
||||
6
rojo-test/build-tests/module_init/default.project.json
Normal file
6
rojo-test/build-tests/module_init/default.project.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "module_init",
|
||||
"tree": {
|
||||
"$path": "folder"
|
||||
}
|
||||
}
|
||||
1
rojo-test/build-tests/module_init/folder/init.lua
Normal file
1
rojo-test/build-tests/module_init/folder/init.lua
Normal file
@@ -0,0 +1 @@
|
||||
return "From folder/init.lua"
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "rbxm_in_folder",
|
||||
"tree": {
|
||||
"$path": "folder"
|
||||
}
|
||||
}
|
||||
BIN
rojo-test/build-tests/rbxm_in_folder/folder/foo.rbxm
Normal file
BIN
rojo-test/build-tests/rbxm_in_folder/folder/foo.rbxm
Normal file
Binary file not shown.
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "rbxmx_in_folder",
|
||||
"tree": {
|
||||
"$path": "folder"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<roblox xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.roblox.com/roblox.xsd" version="4">
|
||||
<Meta name="ExplicitAutoJoints">true</Meta>
|
||||
<External>null</External>
|
||||
<External>nil</External>
|
||||
<Item class="Model" referent="RBX7E9D90237E87493FB533B16578969429">
|
||||
<Properties>
|
||||
<CoordinateFrame name="ModelInPrimary">
|
||||
<X>0</X>
|
||||
<Y>0</Y>
|
||||
<Z>0</Z>
|
||||
<R00>1</R00>
|
||||
<R01>0</R01>
|
||||
<R02>0</R02>
|
||||
<R10>0</R10>
|
||||
<R11>1</R11>
|
||||
<R12>0</R12>
|
||||
<R20>0</R20>
|
||||
<R21>0</R21>
|
||||
<R22>1</R22>
|
||||
</CoordinateFrame>
|
||||
<string name="Name">Awesome Model</string>
|
||||
<Ref name="PrimaryPart">null</Ref>
|
||||
<BinaryString name="Tags"></BinaryString>
|
||||
</Properties>
|
||||
<Item class="StringValue" referent="RBXD2A682F437C84BE89C7B356CF5E4D92E">
|
||||
<Properties>
|
||||
<string name="Name">Cool StringValue</string>
|
||||
<BinaryString name="Tags"></BinaryString>
|
||||
<string name="Value">Did you know that BaseValue.Changed is different than Instance.Changed?</string>
|
||||
</Properties>
|
||||
</Item>
|
||||
</Item>
|
||||
</roblox>
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "server_in_folder",
|
||||
"tree": {
|
||||
"$path": "folder"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
-- This is a Lua server script
|
||||
6
rojo-test/build-tests/server_init/default.project.json
Normal file
6
rojo-test/build-tests/server_init/default.project.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "server_init",
|
||||
"tree": {
|
||||
"$path": "folder"
|
||||
}
|
||||
}
|
||||
1
rojo-test/build-tests/server_init/folder/init.server.lua
Normal file
1
rojo-test/build-tests/server_init/folder/init.server.lua
Normal file
@@ -0,0 +1 @@
|
||||
return "From folder/init.server.lua"
|
||||
6
rojo-test/build-tests/txt_in_folder/default.project.json
Normal file
6
rojo-test/build-tests/txt_in_folder/default.project.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "txt_in_folder",
|
||||
"tree": {
|
||||
"$path": "src"
|
||||
}
|
||||
}
|
||||
0
rojo-test/build-tests/txt_in_folder/src/foo.txt
Normal file
0
rojo-test/build-tests/txt_in_folder/src/foo.txt
Normal file
71
rojo-test/src/build_test.rs
Normal file
71
rojo-test/src/build_test.rs
Normal file
@@ -0,0 +1,71 @@
|
||||
use std::{
|
||||
fs,
|
||||
path::Path,
|
||||
process::Command,
|
||||
};
|
||||
|
||||
use insta::assert_snapshot_matches;
|
||||
use tempfile::tempdir;
|
||||
|
||||
macro_rules! gen_build_tests {
|
||||
( $($test_name: ident,)* ) => {
|
||||
$(
|
||||
paste::item! {
|
||||
#[test]
|
||||
fn [<build_ $test_name>]() {
|
||||
run_build_test(stringify!($test_name));
|
||||
}
|
||||
}
|
||||
)*
|
||||
};
|
||||
}
|
||||
|
||||
gen_build_tests! {
|
||||
client_in_folder,
|
||||
client_init,
|
||||
csv_bug_145,
|
||||
csv_bug_147,
|
||||
csv_in_folder,
|
||||
gitkeep,
|
||||
json_model_in_folder,
|
||||
json_model_legacy_name,
|
||||
module_in_folder,
|
||||
module_init,
|
||||
rbxm_in_folder,
|
||||
rbxmx_in_folder,
|
||||
server_in_folder,
|
||||
server_init,
|
||||
txt_in_folder,
|
||||
}
|
||||
|
||||
fn run_build_test(test_name: &str) {
|
||||
let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR"));
|
||||
let build_test_path = manifest_dir.join("build-tests");
|
||||
let working_dir = manifest_dir.parent().unwrap();
|
||||
|
||||
let output_dir = tempdir().expect("couldn't create temporary directory");
|
||||
|
||||
let input_path = build_test_path.join(test_name);
|
||||
let output_path = output_dir.path().join(format!("{}.rbxmx", test_name));
|
||||
|
||||
let mut exe_path = working_dir.join("target/debug/rojo");
|
||||
if cfg!(windows) {
|
||||
exe_path.set_extension("exe");
|
||||
}
|
||||
|
||||
let status = Command::new(exe_path)
|
||||
.args(&[
|
||||
"build", input_path.to_str().unwrap(), "-o", output_path.to_str().unwrap(),
|
||||
])
|
||||
.env("RUST_LOG", "error")
|
||||
.current_dir(working_dir)
|
||||
.status()
|
||||
.expect("Couldn't start Rojo");
|
||||
|
||||
assert!(status.success(), "Rojo did not exit successfully");
|
||||
|
||||
let contents = fs::read_to_string(&output_path)
|
||||
.expect("Couldn't read output file");
|
||||
|
||||
assert_snapshot_matches!(test_name, contents);
|
||||
}
|
||||
2
rojo-test/src/lib.rs
Normal file
2
rojo-test/src/lib.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
#[cfg(test)]
|
||||
mod build_test;
|
||||
19
rojo-test/src/snapshots/build_test__client_in_folder.snap
Normal file
19
rojo-test/src/snapshots/build_test__client_in_folder.snap
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
created: "2019-08-09T01:29:47.650277200Z"
|
||||
creator: insta@0.10.0
|
||||
source: rojo-test/src/build_test.rs
|
||||
expression: contents
|
||||
---
|
||||
<roblox version="4">
|
||||
<Item class="Folder" referent="0">
|
||||
<Properties>
|
||||
<string name="Name">client_in_folder</string>
|
||||
</Properties>
|
||||
<Item class="LocalScript" referent="1">
|
||||
<Properties>
|
||||
<string name="Name">localScript</string>
|
||||
<string name="Source">-- This is a Lua client script</string>
|
||||
</Properties>
|
||||
</Item>
|
||||
</Item>
|
||||
</roblox>
|
||||
14
rojo-test/src/snapshots/build_test__client_init.snap
Normal file
14
rojo-test/src/snapshots/build_test__client_init.snap
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
created: "2019-08-16T19:37:51.277332900Z"
|
||||
creator: insta@0.10.0
|
||||
source: rojo-test/src/build_test.rs
|
||||
expression: contents
|
||||
---
|
||||
<roblox version="4">
|
||||
<Item class="LocalScript" referent="0">
|
||||
<Properties>
|
||||
<string name="Name">client_init</string>
|
||||
<string name="Source">return "From folder/init.client.lua"</string>
|
||||
</Properties>
|
||||
</Item>
|
||||
</roblox>
|
||||
19
rojo-test/src/snapshots/build_test__csv_bug_145.snap
Normal file
19
rojo-test/src/snapshots/build_test__csv_bug_145.snap
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
created: "2019-08-14T22:42:52.297447700Z"
|
||||
creator: insta@0.10.0
|
||||
source: rojo-test/src/build_test.rs
|
||||
expression: contents
|
||||
---
|
||||
<roblox version="4">
|
||||
<Item class="Folder" referent="0">
|
||||
<Properties>
|
||||
<string name="Name">csv_bug_145</string>
|
||||
</Properties>
|
||||
<Item class="LocalizationTable" referent="1">
|
||||
<Properties>
|
||||
<string name="Name">normal</string>
|
||||
<string name="Contents">[{"key":"Count","example":"A number demonstrating issue 145","source":"3","values":{"es":"7"}}]</string>
|
||||
</Properties>
|
||||
</Item>
|
||||
</Item>
|
||||
</roblox>
|
||||
19
rojo-test/src/snapshots/build_test__csv_bug_147.snap
Normal file
19
rojo-test/src/snapshots/build_test__csv_bug_147.snap
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
created: "2019-08-14T22:42:52.310414Z"
|
||||
creator: insta@0.10.0
|
||||
source: rojo-test/src/build_test.rs
|
||||
expression: contents
|
||||
---
|
||||
<roblox version="4">
|
||||
<Item class="Folder" referent="0">
|
||||
<Properties>
|
||||
<string name="Name">csv_bug_147</string>
|
||||
</Properties>
|
||||
<Item class="LocalizationTable" referent="1">
|
||||
<Properties>
|
||||
<string name="Name">normal</string>
|
||||
<string name="Contents">[{"key":"Language.Name","source":"English","values":{}},{"key":"Language.Region","source":"United States","values":{}},{"key":"Label.Thickness","source":"Thickness","values":{}},{"key":"Label.Opacity","source":"Opacity","values":{}},{"key":"Toolbar.Undo","source":"Undo","values":{}},{"key":"Toolbar.Redo","source":"Redo","values":{}},{"key":"Toolbar.Camera","source":"Top-down camera","values":{}},{"key":"Toolbar.Saves","source":"Saved drawings","values":{}},{"key":"Toolbar.Preferences","source":"Settings","values":{}},{"key":"Toolbar.Mode.Vector","source":"Vector mode","values":{}},{"key":"Toolbar.Mode.Pixel","source":"Pixel mode","values":{}}]</string>
|
||||
</Properties>
|
||||
</Item>
|
||||
</Item>
|
||||
</roblox>
|
||||
19
rojo-test/src/snapshots/build_test__csv_in_folder.snap
Normal file
19
rojo-test/src/snapshots/build_test__csv_in_folder.snap
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
created: "2019-08-14T22:34:06.206495600Z"
|
||||
creator: insta@0.10.0
|
||||
source: rojo-test/src/build_test.rs
|
||||
expression: contents
|
||||
---
|
||||
<roblox version="4">
|
||||
<Item class="Folder" referent="0">
|
||||
<Properties>
|
||||
<string name="Name">csv_in_folder</string>
|
||||
</Properties>
|
||||
<Item class="LocalizationTable" referent="1">
|
||||
<Properties>
|
||||
<string name="Name">normal</string>
|
||||
<string name="Contents">[{"key":"Ack","example":"An exclamation of despair","source":"Ack!","values":{"es":"¡Ay!"}}]</string>
|
||||
</Properties>
|
||||
</Item>
|
||||
</Item>
|
||||
</roblox>
|
||||
13
rojo-test/src/snapshots/build_test__gitkeep.snap
Normal file
13
rojo-test/src/snapshots/build_test__gitkeep.snap
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
created: "2019-08-08T00:48:33.382271800Z"
|
||||
creator: insta@0.10.0
|
||||
source: rojo-test/src/build_test.rs
|
||||
expression: contents
|
||||
---
|
||||
<roblox version="4">
|
||||
<Item class="Folder" referent="0">
|
||||
<Properties>
|
||||
<string name="Name">gitkeep</string>
|
||||
</Properties>
|
||||
</Item>
|
||||
</roblox>
|
||||
@@ -0,0 +1,24 @@
|
||||
---
|
||||
created: "2019-08-15T20:40:50.467761900Z"
|
||||
creator: insta@0.10.0
|
||||
source: rojo-test/src/build_test.rs
|
||||
expression: contents
|
||||
---
|
||||
<roblox version="4">
|
||||
<Item class="Folder" referent="0">
|
||||
<Properties>
|
||||
<string name="Name">json_model_in_folder</string>
|
||||
</Properties>
|
||||
<Item class="IntValue" referent="1">
|
||||
<Properties>
|
||||
<string name="Name">simple-model</string>
|
||||
<int name="Value">5</int>
|
||||
</Properties>
|
||||
<Item class="Folder" referent="2">
|
||||
<Properties>
|
||||
<string name="Name">A Child</string>
|
||||
</Properties>
|
||||
</Item>
|
||||
</Item>
|
||||
</Item>
|
||||
</roblox>
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
created: "2019-08-15T20:41:28.743618200Z"
|
||||
creator: insta@0.10.0
|
||||
source: rojo-test/src/build_test.rs
|
||||
expression: contents
|
||||
---
|
||||
<roblox version="4">
|
||||
<Item class="Folder" referent="0">
|
||||
<Properties>
|
||||
<string name="Name">json_model_legacy_name</string>
|
||||
</Properties>
|
||||
<Item class="Folder" referent="1">
|
||||
<Properties>
|
||||
<string name="Name">Expected Name</string>
|
||||
</Properties>
|
||||
</Item>
|
||||
</Item>
|
||||
</roblox>
|
||||
19
rojo-test/src/snapshots/build_test__module_in_folder.snap
Normal file
19
rojo-test/src/snapshots/build_test__module_in_folder.snap
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
created: "2019-08-09T01:27:22.597759700Z"
|
||||
creator: insta@0.10.0
|
||||
source: rojo-test/src/build_test.rs
|
||||
expression: contents
|
||||
---
|
||||
<roblox version="4">
|
||||
<Item class="Folder" referent="0">
|
||||
<Properties>
|
||||
<string name="Name">module_in_folder</string>
|
||||
</Properties>
|
||||
<Item class="ModuleScript" referent="1">
|
||||
<Properties>
|
||||
<string name="Name">aModule</string>
|
||||
<string name="Source">-- This is a Lua module</string>
|
||||
</Properties>
|
||||
</Item>
|
||||
</Item>
|
||||
</roblox>
|
||||
14
rojo-test/src/snapshots/build_test__module_init.snap
Normal file
14
rojo-test/src/snapshots/build_test__module_init.snap
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
created: "2019-08-16T19:36:55.442461700Z"
|
||||
creator: insta@0.10.0
|
||||
source: rojo-test/src/build_test.rs
|
||||
expression: contents
|
||||
---
|
||||
<roblox version="4">
|
||||
<Item class="ModuleScript" referent="0">
|
||||
<Properties>
|
||||
<string name="Name">module_init</string>
|
||||
<string name="Source">return "From folder/init.lua"</string>
|
||||
</Properties>
|
||||
</Item>
|
||||
</roblox>
|
||||
18
rojo-test/src/snapshots/build_test__rbxm_in_folder.snap
Normal file
18
rojo-test/src/snapshots/build_test__rbxm_in_folder.snap
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
created: "2019-08-14T22:05:46.597722600Z"
|
||||
creator: insta@0.10.0
|
||||
source: rojo-test/src/build_test.rs
|
||||
expression: contents
|
||||
---
|
||||
<roblox version="4">
|
||||
<Item class="Folder" referent="0">
|
||||
<Properties>
|
||||
<string name="Name">rbxm_in_folder</string>
|
||||
</Properties>
|
||||
<Item class="Folder" referent="1">
|
||||
<Properties>
|
||||
<string name="Name">foo</string>
|
||||
</Properties>
|
||||
</Item>
|
||||
</Item>
|
||||
</roblox>
|
||||
41
rojo-test/src/snapshots/build_test__rbxmx_in_folder.snap
Normal file
41
rojo-test/src/snapshots/build_test__rbxmx_in_folder.snap
Normal file
@@ -0,0 +1,41 @@
|
||||
---
|
||||
created: "2019-08-10T07:45:07.961823500Z"
|
||||
creator: insta@0.10.0
|
||||
source: rojo-test/src/build_test.rs
|
||||
expression: contents
|
||||
---
|
||||
<roblox version="4">
|
||||
<Item class="Folder" referent="0">
|
||||
<Properties>
|
||||
<string name="Name">rbxmx_in_folder</string>
|
||||
</Properties>
|
||||
<Item class="Model" referent="1">
|
||||
<Properties>
|
||||
<string name="Name">test-model</string>
|
||||
<CoordinateFrame name="ModelInPrimary">
|
||||
<X>0</X>
|
||||
<Y>0</Y>
|
||||
<Z>0</Z>
|
||||
<R00>1</R00>
|
||||
<R01>0</R01>
|
||||
<R02>0</R02>
|
||||
<R10>0</R10>
|
||||
<R11>1</R11>
|
||||
<R12>0</R12>
|
||||
<R20>0</R20>
|
||||
<R21>0</R21>
|
||||
<R22>1</R22>
|
||||
</CoordinateFrame>
|
||||
<Ref name="PrimaryPart">null</Ref>
|
||||
<BinaryString name="Tags"><![CDATA[]]></BinaryString>
|
||||
</Properties>
|
||||
<Item class="StringValue" referent="2">
|
||||
<Properties>
|
||||
<string name="Name">Cool StringValue</string>
|
||||
<BinaryString name="Tags"><![CDATA[]]></BinaryString>
|
||||
<string name="Value">Did you know that BaseValue.Changed is different than Instance.Changed?</string>
|
||||
</Properties>
|
||||
</Item>
|
||||
</Item>
|
||||
</Item>
|
||||
</roblox>
|
||||
19
rojo-test/src/snapshots/build_test__server_in_folder.snap
Normal file
19
rojo-test/src/snapshots/build_test__server_in_folder.snap
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
created: "2019-08-09T01:29:48.071133300Z"
|
||||
creator: insta@0.10.0
|
||||
source: rojo-test/src/build_test.rs
|
||||
expression: contents
|
||||
---
|
||||
<roblox version="4">
|
||||
<Item class="Folder" referent="0">
|
||||
<Properties>
|
||||
<string name="Name">server_in_folder</string>
|
||||
</Properties>
|
||||
<Item class="Script" referent="1">
|
||||
<Properties>
|
||||
<string name="Name">serverScript</string>
|
||||
<string name="Source">-- This is a Lua server script</string>
|
||||
</Properties>
|
||||
</Item>
|
||||
</Item>
|
||||
</roblox>
|
||||
14
rojo-test/src/snapshots/build_test__server_init.snap
Normal file
14
rojo-test/src/snapshots/build_test__server_init.snap
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
created: "2019-08-16T19:36:55.442461700Z"
|
||||
creator: insta@0.10.0
|
||||
source: rojo-test/src/build_test.rs
|
||||
expression: contents
|
||||
---
|
||||
<roblox version="4">
|
||||
<Item class="Script" referent="0">
|
||||
<Properties>
|
||||
<string name="Name">server_init</string>
|
||||
<string name="Source">return "From folder/init.server.lua"</string>
|
||||
</Properties>
|
||||
</Item>
|
||||
</roblox>
|
||||
19
rojo-test/src/snapshots/build_test__txt_in_folder.snap
Normal file
19
rojo-test/src/snapshots/build_test__txt_in_folder.snap
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
created: "2019-08-08T00:48:33.502257600Z"
|
||||
creator: insta@0.10.0
|
||||
source: rojo-test/src/build_test.rs
|
||||
expression: contents
|
||||
---
|
||||
<roblox version="4">
|
||||
<Item class="Folder" referent="0">
|
||||
<Properties>
|
||||
<string name="Name">txt_in_folder</string>
|
||||
</Properties>
|
||||
<Item class="StringValue" referent="1">
|
||||
<Properties>
|
||||
<string name="Name">foo</string>
|
||||
<string name="Value"></string>
|
||||
</Properties>
|
||||
</Item>
|
||||
</Item>
|
||||
</roblox>
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "rojo"
|
||||
version = "0.5.0-alpha.12"
|
||||
version = "0.5.0"
|
||||
authors = ["Lucien Greathouse <me@lpghatguy.com>"]
|
||||
description = "Enables professional-grade development tools for Roblox developers"
|
||||
license = "MIT"
|
||||
@@ -30,8 +30,8 @@ log = "0.4"
|
||||
maplit = "1.0.1"
|
||||
notify = "4.0"
|
||||
rbx_binary = "0.4.1"
|
||||
rbx_dom_weak = "1.8.0"
|
||||
rbx_xml = "0.10.0"
|
||||
rbx_dom_weak = "1.9.0"
|
||||
rbx_xml = "0.11.0"
|
||||
rbx_reflection = "3.1.388"
|
||||
regex = "1.0"
|
||||
reqwest = "0.9.5"
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
# Rojo Server
|
||||
This is the source to the Rojo server.
|
||||
|
||||
Documentation is WIP.
|
||||
@@ -43,7 +43,7 @@ fn main() {
|
||||
(@subcommand serve =>
|
||||
(about: "Serves the project's files for use with the Rojo Studio plugin.")
|
||||
(@arg PROJECT: "Path to the project to serve. Defaults to the current directory.")
|
||||
(@arg port: --port +takes_value "The port to listen on. Defaults to 8000.")
|
||||
(@arg port: --port +takes_value "The port to listen on. Defaults to 34872.")
|
||||
)
|
||||
|
||||
(@subcommand build =>
|
||||
|
||||
@@ -724,28 +724,63 @@ fn snapshot_csv_file<'source>(
|
||||
fn snapshot_json_model_file<'source>(
|
||||
file: &'source ImfsFile,
|
||||
) -> SnapshotResult<'source> {
|
||||
let file_name = file.path
|
||||
.file_name().expect("Could not extract file stem")
|
||||
.to_str().expect("Could not convert path to UTF-8");
|
||||
|
||||
let instance_name = match_trailing(file_name, ".model.json")
|
||||
.expect("JSON model file did not end in .model.json");
|
||||
|
||||
let contents = str::from_utf8(&file.contents)
|
||||
.map_err(|inner| SnapshotError::Utf8Error {
|
||||
inner,
|
||||
path: file.path.to_owned(),
|
||||
})?;
|
||||
|
||||
let json_instance: JsonModelInstance = serde_json::from_str(contents)
|
||||
let json_instance: JsonModel = serde_json::from_str(contents)
|
||||
.map_err(|inner| SnapshotError::JsonModelDecodeError {
|
||||
inner,
|
||||
path: file.path.to_owned(),
|
||||
})?;
|
||||
|
||||
let mut snapshot = json_instance.into_snapshot()?;
|
||||
if let Some(json_name) = &json_instance.name {
|
||||
if json_name != instance_name {
|
||||
log::warn!("Name from JSON model did not match its file name: {}", file.path.display());
|
||||
log::warn!("In Rojo < alpha 14, this model is named \"{}\" (from its 'Name' property)", json_name);
|
||||
log::warn!("In Rojo >= alpha 14, this model is named \"{}\" (from its file name)", instance_name);
|
||||
log::warn!("'Name' for the top-level instance in a JSON model is now optional and will be ignored.");
|
||||
}
|
||||
}
|
||||
|
||||
let mut snapshot = json_instance.core.into_snapshot(instance_name.to_owned())?;
|
||||
|
||||
snapshot.name = Cow::Borrowed(instance_name);
|
||||
snapshot.metadata.source_path = Some(file.path.to_owned());
|
||||
|
||||
Ok(Some(snapshot))
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
struct JsonModel {
|
||||
name: Option<String>,
|
||||
|
||||
#[serde(flatten)]
|
||||
core: JsonModelCore,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
struct JsonModelInstance {
|
||||
name: String,
|
||||
|
||||
#[serde(flatten)]
|
||||
core: JsonModelCore,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
struct JsonModelCore {
|
||||
class_name: String,
|
||||
|
||||
#[serde(default = "Vec::new", skip_serializing_if = "Vec::is_empty")]
|
||||
@@ -755,12 +790,12 @@ struct JsonModelInstance {
|
||||
properties: HashMap<String, UnresolvedRbxValue>,
|
||||
}
|
||||
|
||||
impl JsonModelInstance {
|
||||
fn into_snapshot(self) -> Result<RbxSnapshotInstance<'static>, SnapshotError> {
|
||||
impl JsonModelCore {
|
||||
fn into_snapshot(self, name: String) -> Result<RbxSnapshotInstance<'static>, SnapshotError> {
|
||||
let mut children = Vec::with_capacity(self.children.len());
|
||||
|
||||
for child in self.children {
|
||||
children.push(child.into_snapshot()?);
|
||||
children.push(child.core.into_snapshot(child.name)?);
|
||||
}
|
||||
|
||||
let mut properties = HashMap::with_capacity(self.properties.len());
|
||||
@@ -771,7 +806,7 @@ impl JsonModelInstance {
|
||||
}
|
||||
|
||||
Ok(RbxSnapshotInstance {
|
||||
name: Cow::Owned(self.name),
|
||||
name: Cow::Owned(name),
|
||||
class_name: Cow::Owned(self.class_name),
|
||||
properties,
|
||||
children,
|
||||
|
||||
@@ -2,7 +2,6 @@ mod test_util;
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use pretty_assertions::assert_eq;
|
||||
use rbx_dom_weak::{RbxTree, RbxInstanceProperties};
|
||||
|
||||
use librojo::{
|
||||
|
||||
@@ -2,8 +2,6 @@ mod test_util;
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
use pretty_assertions::assert_eq;
|
||||
|
||||
use librojo::{
|
||||
imfs::Imfs,
|
||||
project::Project,
|
||||
@@ -34,7 +32,6 @@ macro_rules! generate_snapshot_tests {
|
||||
generate_snapshot_tests!(
|
||||
empty,
|
||||
json_model,
|
||||
localization,
|
||||
meta_files,
|
||||
multi_partition_game,
|
||||
nested_partitions,
|
||||
|
||||
@@ -43,6 +43,15 @@ fn multi_partition_game() {
|
||||
tree_step("with_moved_dir", &live_session, &source_path);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn spawn_location() {
|
||||
let _ = env_logger::try_init();
|
||||
let source_path = project_path("spawn_location");
|
||||
|
||||
let (_dir, live_session) = start_session(&source_path);
|
||||
tree_step("initial", &live_session, &source_path);
|
||||
}
|
||||
|
||||
/// Find the path to the given test project relative to the manifest.
|
||||
fn project_path(name: &str) -> PathBuf {
|
||||
let mut path = Path::new(env!("CARGO_MANIFEST_DIR")).join("../test-projects");
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
{
|
||||
"name": "localization",
|
||||
"class_name": "Folder",
|
||||
"properties": {},
|
||||
"children": [
|
||||
{
|
||||
"name": "empty-column-bug-147",
|
||||
"class_name": "LocalizationTable",
|
||||
"properties": {
|
||||
"Contents": {
|
||||
"Type": "String",
|
||||
"Value": "[{\"key\":\"Language.Name\",\"source\":\"English\",\"values\":{}},{\"key\":\"Language.Region\",\"source\":\"United States\",\"values\":{}},{\"key\":\"Label.Thickness\",\"source\":\"Thickness\",\"values\":{}},{\"key\":\"Label.Opacity\",\"source\":\"Opacity\",\"values\":{}},{\"key\":\"Toolbar.Undo\",\"source\":\"Undo\",\"values\":{}},{\"key\":\"Toolbar.Redo\",\"source\":\"Redo\",\"values\":{}},{\"key\":\"Toolbar.Camera\",\"source\":\"Top-down camera\",\"values\":{}},{\"key\":\"Toolbar.Saves\",\"source\":\"Saved drawings\",\"values\":{}},{\"key\":\"Toolbar.Preferences\",\"source\":\"Settings\",\"values\":{}},{\"key\":\"Toolbar.Mode.Vector\",\"source\":\"Vector mode\",\"values\":{}},{\"key\":\"Toolbar.Mode.Pixel\",\"source\":\"Pixel mode\",\"values\":{}}]"
|
||||
}
|
||||
},
|
||||
"children": [],
|
||||
"metadata": {
|
||||
"ignore_unknown_instances": false,
|
||||
"source_path": "src/empty-column-bug-147.csv",
|
||||
"project_definition": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "integers-bug-145",
|
||||
"class_name": "LocalizationTable",
|
||||
"properties": {
|
||||
"Contents": {
|
||||
"Type": "String",
|
||||
"Value": "[{\"key\":\"Count\",\"example\":\"A number demonstrating issue 145\",\"source\":\"3\",\"values\":{\"es\":\"7\"}}]"
|
||||
}
|
||||
},
|
||||
"children": [],
|
||||
"metadata": {
|
||||
"ignore_unknown_instances": false,
|
||||
"source_path": "src/integers-bug-145.csv",
|
||||
"project_definition": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "normal",
|
||||
"class_name": "LocalizationTable",
|
||||
"properties": {
|
||||
"Contents": {
|
||||
"Type": "String",
|
||||
"Value": "[{\"key\":\"Ack\",\"example\":\"An exclamation of despair\",\"source\":\"Ack!\",\"values\":{\"es\":\"¡Ay!\"}}]"
|
||||
}
|
||||
},
|
||||
"children": [],
|
||||
"metadata": {
|
||||
"ignore_unknown_instances": false,
|
||||
"source_path": "src/normal.csv",
|
||||
"project_definition": null
|
||||
}
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"ignore_unknown_instances": false,
|
||||
"source_path": "src",
|
||||
"project_definition": [
|
||||
"localization",
|
||||
{
|
||||
"class_name": null,
|
||||
"children": {},
|
||||
"properties": {},
|
||||
"ignore_unknown_instances": null,
|
||||
"path": "src"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
12
test-projects/slice-center-gh-201/default.project.json
Normal file
12
test-projects/slice-center-gh-201/default.project.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "slice-center-gh-201",
|
||||
"tree": {
|
||||
"$className": "DataModel",
|
||||
|
||||
"ReplicatedStorage": {
|
||||
"$className": "ReplicatedStorage",
|
||||
|
||||
"$path": "folder"
|
||||
}
|
||||
}
|
||||
}
|
||||
89
test-projects/slice-center-gh-201/folder/image-label.rbxmx
Normal file
89
test-projects/slice-center-gh-201/folder/image-label.rbxmx
Normal file
@@ -0,0 +1,89 @@
|
||||
<roblox xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.roblox.com/roblox.xsd" version="4">
|
||||
<Meta name="ExplicitAutoJoints">true</Meta>
|
||||
<External>null</External>
|
||||
<External>nil</External>
|
||||
<Item class="ImageLabel" referent="RBXBB7AE810E3EE49438CCAA4DF1409C167">
|
||||
<Properties>
|
||||
<bool name="Active">false</bool>
|
||||
<Vector2 name="AnchorPoint">
|
||||
<X>0</X>
|
||||
<Y>0</Y>
|
||||
</Vector2>
|
||||
<bool name="AutoLocalize">true</bool>
|
||||
<Color3 name="BackgroundColor3">
|
||||
<R>1</R>
|
||||
<G>1</G>
|
||||
<B>1</B>
|
||||
</Color3>
|
||||
<float name="BackgroundTransparency">0</float>
|
||||
<Color3 name="BorderColor3">
|
||||
<R>0.105882362</R>
|
||||
<G>0.164705887</G>
|
||||
<B>0.207843155</B>
|
||||
</Color3>
|
||||
<token name="BorderMode">0</token>
|
||||
<int name="BorderSizePixel">1</int>
|
||||
<bool name="ClipsDescendants">false</bool>
|
||||
<bool name="Draggable">false</bool>
|
||||
<Content name="Image"><url>rbxasset://textures/ui/GuiImagePlaceholder.png</url></Content>
|
||||
<Color3 name="ImageColor3">
|
||||
<R>1</R>
|
||||
<G>1</G>
|
||||
<B>1</B>
|
||||
</Color3>
|
||||
<Vector2 name="ImageRectOffset">
|
||||
<X>0</X>
|
||||
<Y>0</Y>
|
||||
</Vector2>
|
||||
<Vector2 name="ImageRectSize">
|
||||
<X>0</X>
|
||||
<Y>0</Y>
|
||||
</Vector2>
|
||||
<float name="ImageTransparency">0</float>
|
||||
<int name="LayoutOrder">0</int>
|
||||
<string name="Name">ImageLabel</string>
|
||||
<Ref name="NextSelectionDown">null</Ref>
|
||||
<Ref name="NextSelectionLeft">null</Ref>
|
||||
<Ref name="NextSelectionRight">null</Ref>
|
||||
<Ref name="NextSelectionUp">null</Ref>
|
||||
<UDim2 name="Position">
|
||||
<XS>0</XS>
|
||||
<XO>0</XO>
|
||||
<YS>0</YS>
|
||||
<YO>0</YO>
|
||||
</UDim2>
|
||||
<Ref name="RootLocalizationTable">null</Ref>
|
||||
<float name="Rotation">0</float>
|
||||
<token name="ScaleType">1</token>
|
||||
<bool name="Selectable">false</bool>
|
||||
<Ref name="SelectionImageObject">null</Ref>
|
||||
<UDim2 name="Size">
|
||||
<XS>0</XS>
|
||||
<XO>100</XO>
|
||||
<YS>0</YS>
|
||||
<YO>100</YO>
|
||||
</UDim2>
|
||||
<token name="SizeConstraint">0</token>
|
||||
<Rect2D name="SliceCenter">
|
||||
<min>
|
||||
<X>1</X>
|
||||
<Y>2</Y>
|
||||
</min>
|
||||
<max>
|
||||
<X>3</X>
|
||||
<Y>4</Y>
|
||||
</max>
|
||||
</Rect2D>
|
||||
<float name="SliceScale">1</float>
|
||||
<BinaryString name="Tags"></BinaryString>
|
||||
<UDim2 name="TileSize">
|
||||
<XS>1</XS>
|
||||
<XO>0</XO>
|
||||
<YS>1</YS>
|
||||
<YO>0</YO>
|
||||
</UDim2>
|
||||
<bool name="Visible">true</bool>
|
||||
<int name="ZIndex">1</int>
|
||||
</Properties>
|
||||
</Item>
|
||||
</roblox>
|
||||
6
test-projects/spawn_location/default.project.json
Normal file
6
test-projects/spawn_location/default.project.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "spawn_location",
|
||||
"tree": {
|
||||
"$path": "src"
|
||||
}
|
||||
}
|
||||
266
test-projects/spawn_location/initial.tree.json
Normal file
266
test-projects/spawn_location/initial.tree.json
Normal file
@@ -0,0 +1,266 @@
|
||||
{
|
||||
"instances": {
|
||||
"21406306-61c7-45f6-9e3e-50cd6b609214": {
|
||||
"Name": "spawn_location",
|
||||
"ClassName": "Folder",
|
||||
"Properties": {},
|
||||
"Id": "21406306-61c7-45f6-9e3e-50cd6b609214",
|
||||
"Children": [
|
||||
"da5dd362-4eb6-488a-984b-c96327927a70"
|
||||
],
|
||||
"Parent": null
|
||||
},
|
||||
"da5dd362-4eb6-488a-984b-c96327927a70": {
|
||||
"Name": "spawn",
|
||||
"ClassName": "SpawnLocation",
|
||||
"Properties": {
|
||||
"Size": {
|
||||
"Type": "Vector3",
|
||||
"Value": [
|
||||
12.0,
|
||||
1.0,
|
||||
12.0
|
||||
]
|
||||
},
|
||||
"Massless": {
|
||||
"Type": "Bool",
|
||||
"Value": false
|
||||
},
|
||||
"LeftSurface": {
|
||||
"Type": "Enum",
|
||||
"Value": 0
|
||||
},
|
||||
"Color": {
|
||||
"Type": "Color3",
|
||||
"Value": [
|
||||
0.6392157,
|
||||
0.63529414,
|
||||
0.64705884
|
||||
]
|
||||
},
|
||||
"RightSurfaceInput": {
|
||||
"Type": "Enum",
|
||||
"Value": 0
|
||||
},
|
||||
"Neutral": {
|
||||
"Type": "Bool",
|
||||
"Value": true
|
||||
},
|
||||
"Locked": {
|
||||
"Type": "Bool",
|
||||
"Value": false
|
||||
},
|
||||
"Anchored": {
|
||||
"Type": "Bool",
|
||||
"Value": true
|
||||
},
|
||||
"CanCollide": {
|
||||
"Type": "Bool",
|
||||
"Value": true
|
||||
},
|
||||
"FrontSurfaceInput": {
|
||||
"Type": "Enum",
|
||||
"Value": 0
|
||||
},
|
||||
"LeftSurfaceInput": {
|
||||
"Type": "Enum",
|
||||
"Value": 0
|
||||
},
|
||||
"RightSurface": {
|
||||
"Type": "Enum",
|
||||
"Value": 0
|
||||
},
|
||||
"FrontSurface": {
|
||||
"Type": "Enum",
|
||||
"Value": 0
|
||||
},
|
||||
"TopSurfaceInput": {
|
||||
"Type": "Enum",
|
||||
"Value": 0
|
||||
},
|
||||
"CastShadow": {
|
||||
"Type": "Bool",
|
||||
"Value": true
|
||||
},
|
||||
"BottomSurface": {
|
||||
"Type": "Enum",
|
||||
"Value": 0
|
||||
},
|
||||
"Duration": {
|
||||
"Type": "Int32",
|
||||
"Value": 10
|
||||
},
|
||||
"Velocity": {
|
||||
"Type": "Vector3",
|
||||
"Value": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
]
|
||||
},
|
||||
"BottomSurfaceInput": {
|
||||
"Type": "Enum",
|
||||
"Value": 0
|
||||
},
|
||||
"TopSurface": {
|
||||
"Type": "Enum",
|
||||
"Value": 0
|
||||
},
|
||||
"CFrame": {
|
||||
"Type": "CFrame",
|
||||
"Value": [
|
||||
-6.0,
|
||||
0.500001,
|
||||
-11.0,
|
||||
1.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
1.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
1.0
|
||||
]
|
||||
},
|
||||
"TeamColor": {
|
||||
"Type": "BrickColor",
|
||||
"Value": 194
|
||||
},
|
||||
"RotVelocity": {
|
||||
"Type": "Vector3",
|
||||
"Value": [
|
||||
0.0,
|
||||
0.0,
|
||||
0.0
|
||||
]
|
||||
},
|
||||
"Reflectance": {
|
||||
"Type": "Float32",
|
||||
"Value": 0.0
|
||||
},
|
||||
"AllowTeamChangeOnTouch": {
|
||||
"Type": "Bool",
|
||||
"Value": false
|
||||
},
|
||||
"RightParamA": {
|
||||
"Type": "Float32",
|
||||
"Value": -0.5
|
||||
},
|
||||
"LeftParamA": {
|
||||
"Type": "Float32",
|
||||
"Value": -0.5
|
||||
},
|
||||
"Tags": {
|
||||
"Type": "BinaryString",
|
||||
"Value": ""
|
||||
},
|
||||
"Transparency": {
|
||||
"Type": "Float32",
|
||||
"Value": 0.0
|
||||
},
|
||||
"Shape": {
|
||||
"Type": "Enum",
|
||||
"Value": 1
|
||||
},
|
||||
"FrontParamA": {
|
||||
"Type": "Float32",
|
||||
"Value": -0.5
|
||||
},
|
||||
"RootPriority": {
|
||||
"Type": "Int32",
|
||||
"Value": 0
|
||||
},
|
||||
"FrontParamB": {
|
||||
"Type": "Float32",
|
||||
"Value": 0.5
|
||||
},
|
||||
"FormFactor": {
|
||||
"Type": "Enum",
|
||||
"Value": 1
|
||||
},
|
||||
"BottomParamB": {
|
||||
"Type": "Float32",
|
||||
"Value": 0.5
|
||||
},
|
||||
"BackSurface": {
|
||||
"Type": "Enum",
|
||||
"Value": 0
|
||||
},
|
||||
"BottomParamA": {
|
||||
"Type": "Float32",
|
||||
"Value": -0.5
|
||||
},
|
||||
"Enabled": {
|
||||
"Type": "Bool",
|
||||
"Value": true
|
||||
},
|
||||
"BackParamB": {
|
||||
"Type": "Float32",
|
||||
"Value": 0.5
|
||||
},
|
||||
"BackParamA": {
|
||||
"Type": "Float32",
|
||||
"Value": -0.5
|
||||
},
|
||||
"LeftParamB": {
|
||||
"Type": "Float32",
|
||||
"Value": 0.5
|
||||
},
|
||||
"TopParamA": {
|
||||
"Type": "Float32",
|
||||
"Value": -0.5
|
||||
},
|
||||
"RightParamB": {
|
||||
"Type": "Float32",
|
||||
"Value": 0.5
|
||||
},
|
||||
"CollisionGroupId": {
|
||||
"Type": "Int32",
|
||||
"Value": 0
|
||||
},
|
||||
"BackSurfaceInput": {
|
||||
"Type": "Enum",
|
||||
"Value": 0
|
||||
},
|
||||
"CustomPhysicalProperties": {
|
||||
"Type": "PhysicalProperties",
|
||||
"Value": null
|
||||
},
|
||||
"TopParamB": {
|
||||
"Type": "Float32",
|
||||
"Value": 0.5
|
||||
},
|
||||
"Material": {
|
||||
"Type": "Enum",
|
||||
"Value": 256
|
||||
}
|
||||
},
|
||||
"Id": "da5dd362-4eb6-488a-984b-c96327927a70",
|
||||
"Children": [],
|
||||
"Parent": "21406306-61c7-45f6-9e3e-50cd6b609214"
|
||||
}
|
||||
},
|
||||
"root_id": "21406306-61c7-45f6-9e3e-50cd6b609214",
|
||||
"metadata": {
|
||||
"da5dd362-4eb6-488a-984b-c96327927a70": {
|
||||
"ignore_unknown_instances": false,
|
||||
"source_path": "src/spawn.rbxmx",
|
||||
"project_definition": null
|
||||
},
|
||||
"21406306-61c7-45f6-9e3e-50cd6b609214": {
|
||||
"ignore_unknown_instances": false,
|
||||
"source_path": "src",
|
||||
"project_definition": [
|
||||
"spawn_location",
|
||||
{
|
||||
"class_name": null,
|
||||
"children": {},
|
||||
"properties": {},
|
||||
"ignore_unknown_instances": null,
|
||||
"path": "src"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
85
test-projects/spawn_location/src/spawn.rbxmx
Normal file
85
test-projects/spawn_location/src/spawn.rbxmx
Normal file
@@ -0,0 +1,85 @@
|
||||
<roblox xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.roblox.com/roblox.xsd" version="4">
|
||||
<Meta name="ExplicitAutoJoints">true</Meta>
|
||||
<External>null</External>
|
||||
<External>nil</External>
|
||||
<Item class="SpawnLocation" referent="RBX8927A074BA5942B696D00BDFD02B5365">
|
||||
<Properties>
|
||||
<bool name="AllowTeamChangeOnTouch">false</bool>
|
||||
<bool name="Anchored">true</bool>
|
||||
<float name="BackParamA">-0.5</float>
|
||||
<float name="BackParamB">0.5</float>
|
||||
<token name="BackSurface">0</token>
|
||||
<token name="BackSurfaceInput">0</token>
|
||||
<float name="BottomParamA">-0.5</float>
|
||||
<float name="BottomParamB">0.5</float>
|
||||
<token name="BottomSurface">0</token>
|
||||
<token name="BottomSurfaceInput">0</token>
|
||||
<CoordinateFrame name="CFrame">
|
||||
<X>-6</X>
|
||||
<Y>0.500001013</Y>
|
||||
<Z>-11</Z>
|
||||
<R00>1</R00>
|
||||
<R01>0</R01>
|
||||
<R02>0</R02>
|
||||
<R10>0</R10>
|
||||
<R11>1</R11>
|
||||
<R12>0</R12>
|
||||
<R20>0</R20>
|
||||
<R21>0</R21>
|
||||
<R22>1</R22>
|
||||
</CoordinateFrame>
|
||||
<bool name="CanCollide">true</bool>
|
||||
<bool name="CastShadow">true</bool>
|
||||
<int name="CollisionGroupId">0</int>
|
||||
<Color3uint8 name="Color3uint8">4288914085</Color3uint8>
|
||||
<PhysicalProperties name="CustomPhysicalProperties">
|
||||
<CustomPhysics>false</CustomPhysics>
|
||||
</PhysicalProperties>
|
||||
<int name="Duration">10</int>
|
||||
<bool name="Enabled">true</bool>
|
||||
<float name="FrontParamA">-0.5</float>
|
||||
<float name="FrontParamB">0.5</float>
|
||||
<token name="FrontSurface">0</token>
|
||||
<token name="FrontSurfaceInput">0</token>
|
||||
<float name="LeftParamA">-0.5</float>
|
||||
<float name="LeftParamB">0.5</float>
|
||||
<token name="LeftSurface">0</token>
|
||||
<token name="LeftSurfaceInput">0</token>
|
||||
<bool name="Locked">false</bool>
|
||||
<bool name="Massless">false</bool>
|
||||
<token name="Material">256</token>
|
||||
<string name="Name">SpawnLocation</string>
|
||||
<bool name="Neutral">true</bool>
|
||||
<float name="Reflectance">0</float>
|
||||
<float name="RightParamA">-0.5</float>
|
||||
<float name="RightParamB">0.5</float>
|
||||
<token name="RightSurface">0</token>
|
||||
<token name="RightSurfaceInput">0</token>
|
||||
<int name="RootPriority">0</int>
|
||||
<Vector3 name="RotVelocity">
|
||||
<X>0</X>
|
||||
<Y>0</Y>
|
||||
<Z>0</Z>
|
||||
</Vector3>
|
||||
<BinaryString name="Tags"></BinaryString>
|
||||
<int name="TeamColor">194</int>
|
||||
<float name="TopParamA">-0.5</float>
|
||||
<float name="TopParamB">0.5</float>
|
||||
<token name="TopSurface">0</token>
|
||||
<token name="TopSurfaceInput">0</token>
|
||||
<float name="Transparency">0</float>
|
||||
<Vector3 name="Velocity">
|
||||
<X>0</X>
|
||||
<Y>0</Y>
|
||||
<Z>0</Z>
|
||||
</Vector3>
|
||||
<token name="formFactorRaw">1</token>
|
||||
<token name="shape">1</token>
|
||||
<Vector3 name="size">
|
||||
<X>12</X>
|
||||
<Y>1</Y>
|
||||
<Z>12</Z>
|
||||
</Vector3>
|
||||
</Properties>
|
||||
</Item>
|
||||
</roblox>
|
||||
Reference in New Issue
Block a user