mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-20 20:55:50 +00:00
Compare commits
10 Commits
v7.1.1
...
v7.1.1-per
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86875ab5f2 | ||
|
|
85f113fcad | ||
|
|
d666634330 | ||
|
|
b2be0a513d | ||
|
|
9767d4d8bd | ||
|
|
824cdc5dcd | ||
|
|
7aa7a35aa5 | ||
|
|
79b57b3359 | ||
|
|
c7aeffe586 | ||
|
|
79c02f2457 |
@@ -1,6 +1,7 @@
|
||||
# Rojo Changelog
|
||||
|
||||
## Unreleased Changes
|
||||
* Switched from structopt to clap for command line argument parsing.
|
||||
|
||||
## [7.1.1] - May 26, 2022
|
||||
* Fixed sourcemap command not stripping paths correctly ([#544])
|
||||
|
||||
277
Cargo.lock
generated
277
Cargo.lock
generated
@@ -217,13 +217,48 @@ version = "2.34.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
|
||||
dependencies = [
|
||||
"ansi_term",
|
||||
"bitflags",
|
||||
"textwrap 0.11.0",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "3.1.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2dbdf4bdacb33466e854ce889eee8dfd5729abf7ccd7664d0a2d60cd384440b"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"bitflags",
|
||||
"clap_derive",
|
||||
"clap_lex",
|
||||
"indexmap",
|
||||
"lazy_static",
|
||||
"strsim",
|
||||
"textwrap",
|
||||
"unicode-width",
|
||||
"vec_map",
|
||||
"termcolor",
|
||||
"textwrap 0.15.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "3.1.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "25320346e922cffe59c0bbc5410c8d8784509efb321488971081313cb1e1a33c"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-error",
|
||||
"proc-macro2 1.0.39",
|
||||
"quote 1.0.18",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a37c35f1112dad5e6e0b1adaff798507497a18fceeb30cceb3bae7d1427b9213"
|
||||
dependencies = [
|
||||
"os_str_bytes",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -269,7 +304,7 @@ checksum = "1604dafd25fba2fe2d5895a9da139f8dc9b319a5fe5354ca137cbbce4e178d10"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"cast",
|
||||
"clap",
|
||||
"clap 2.34.0",
|
||||
"criterion-plot",
|
||||
"csv",
|
||||
"itertools",
|
||||
@@ -655,6 +690,19 @@ dependencies = [
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generator"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1d9279ca822891c1a4dae06d185612cf8fc6acfe5dff37781b41297811b12ee"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"log",
|
||||
"rustversion",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.12.4"
|
||||
@@ -738,12 +786,9 @@ checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.3.3"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
|
||||
dependencies = [
|
||||
"unicode-segmentation",
|
||||
]
|
||||
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
@@ -997,6 +1042,19 @@ dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "loom"
|
||||
version = "0.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"generator",
|
||||
"scoped-tls",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lz4"
|
||||
version = "1.23.3"
|
||||
@@ -1023,6 +1081,15 @@ version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
|
||||
|
||||
[[package]]
|
||||
name = "matchers"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
|
||||
dependencies = [
|
||||
"regex-automata",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "matches"
|
||||
version = "0.1.9"
|
||||
@@ -1272,6 +1339,12 @@ dependencies = [
|
||||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "os_str_bytes"
|
||||
version = "6.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa"
|
||||
|
||||
[[package]]
|
||||
name = "output_vt100"
|
||||
version = "0.1.3"
|
||||
@@ -1454,6 +1527,26 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "profiling"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2f61dcf0b917cd75d4521d7343d1ffff3d1583054133c9b5cbea3375c703c40d"
|
||||
dependencies = [
|
||||
"profiling-procmacros",
|
||||
"tracy-client",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "profiling-procmacros"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "98eee3c112f2a6f784b6713fe1d7fb7d6506e066121c0a49371fdb976f72bae5"
|
||||
dependencies = [
|
||||
"quote 1.0.18",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "0.6.13"
|
||||
@@ -1540,11 +1633,11 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "rbx_binary"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68f424adb7a0a24ab4bd153be141035f1404ae40affed902fd2721b42cca7f86"
|
||||
source = "git+https://github.com/rojo-rbx/rbx-dom#4fa99b4190009f417ce63c86b2c6725e32c0090e"
|
||||
dependencies = [
|
||||
"log",
|
||||
"lz4",
|
||||
"profiling",
|
||||
"rbx_dom_weak",
|
||||
"rbx_reflection",
|
||||
"rbx_reflection_database",
|
||||
@@ -1554,8 +1647,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "rbx_dom_weak"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f7f524fb18f30d7065c82c4e87f747705679329810207e96169c6d4ec922d1f"
|
||||
source = "git+https://github.com/rojo-rbx/rbx-dom#4fa99b4190009f417ce63c86b2c6725e32c0090e"
|
||||
dependencies = [
|
||||
"rbx_types",
|
||||
"serde",
|
||||
@@ -1564,8 +1656,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "rbx_reflection"
|
||||
version = "4.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8915748c8a3b2a92540e4e35e99ebd548df2d62b0a6cf38ae5d0081f0e611d5"
|
||||
source = "git+https://github.com/rojo-rbx/rbx-dom#4fa99b4190009f417ce63c86b2c6725e32c0090e"
|
||||
dependencies = [
|
||||
"rbx_types",
|
||||
"serde",
|
||||
@@ -1574,8 +1665,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "rbx_reflection_database"
|
||||
version = "0.2.4+roblox-504"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b41e8da85aa697cd04cef48e6dd7d96992786d2e322bafe1d3cc93045f4de1e1"
|
||||
source = "git+https://github.com/rojo-rbx/rbx-dom#4fa99b4190009f417ce63c86b2c6725e32c0090e"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"rbx_reflection",
|
||||
@@ -1586,8 +1676,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "rbx_types"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d637383aa560cb675b7ea7a7778b945dab065ccc7c158f77b5455e27efadc6df"
|
||||
source = "git+https://github.com/rojo-rbx/rbx-dom#4fa99b4190009f417ce63c86b2c6725e32c0090e"
|
||||
dependencies = [
|
||||
"base64 0.11.0",
|
||||
"bitflags",
|
||||
@@ -1601,8 +1690,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "rbx_xml"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67387cd246cdec9251dd2451672541499ae6ce0a47c768b3ea9ee0a1becda9dd"
|
||||
source = "git+https://github.com/rojo-rbx/rbx-dom#4fa99b4190009f417ce63c86b2c6725e32c0090e"
|
||||
dependencies = [
|
||||
"base64 0.11.0",
|
||||
"log",
|
||||
@@ -1648,6 +1736,9 @@ name = "regex-automata"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
|
||||
dependencies = [
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
@@ -1764,6 +1855,7 @@ dependencies = [
|
||||
"anyhow",
|
||||
"backtrace",
|
||||
"bincode",
|
||||
"clap 3.1.18",
|
||||
"criterion",
|
||||
"crossbeam-channel",
|
||||
"csv",
|
||||
@@ -1783,6 +1875,7 @@ dependencies = [
|
||||
"opener",
|
||||
"paste",
|
||||
"pretty_assertions",
|
||||
"profiling",
|
||||
"rbx_binary",
|
||||
"rbx_dom_weak",
|
||||
"rbx_reflection",
|
||||
@@ -1795,11 +1888,11 @@ dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_yaml",
|
||||
"structopt",
|
||||
"tempfile",
|
||||
"termcolor",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracy-client",
|
||||
"uuid",
|
||||
"walkdir",
|
||||
"winreg 0.10.1",
|
||||
@@ -1828,6 +1921,12 @@ dependencies = [
|
||||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.10"
|
||||
@@ -1853,6 +1952,12 @@ dependencies = [
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scoped-tls"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.1.0"
|
||||
@@ -1965,6 +2070,15 @@ dependencies = [
|
||||
"opaque-debug",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sharded-slab"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "similar"
|
||||
version = "2.1.0"
|
||||
@@ -1977,6 +2091,12 @@ version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
|
||||
|
||||
[[package]]
|
||||
name = "snax"
|
||||
version = "0.2.0"
|
||||
@@ -1998,33 +2118,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.8.0"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
||||
|
||||
[[package]]
|
||||
name = "structopt"
|
||||
version = "0.3.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"lazy_static",
|
||||
"structopt-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "structopt-derive"
|
||||
version = "0.4.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro-error",
|
||||
"proc-macro2 1.0.39",
|
||||
"quote 1.0.18",
|
||||
"syn",
|
||||
]
|
||||
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||
|
||||
[[package]]
|
||||
name = "subtle"
|
||||
@@ -2085,6 +2181,12 @@ dependencies = [
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.31"
|
||||
@@ -2105,6 +2207,15 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "1.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tinytemplate"
|
||||
version = "1.2.1"
|
||||
@@ -2216,6 +2327,56 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"valuable",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-log"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"log",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-subscriber"
|
||||
version = "0.3.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4bc28f93baff38037f64e6f43d34cfa1605f27a49c34e8a04c5e78b0babf2596"
|
||||
dependencies = [
|
||||
"ansi_term",
|
||||
"lazy_static",
|
||||
"matchers",
|
||||
"regex",
|
||||
"sharded-slab",
|
||||
"smallvec",
|
||||
"thread_local",
|
||||
"tracing",
|
||||
"tracing-core",
|
||||
"tracing-log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracy-client"
|
||||
version = "0.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42ebfe7a24c18b5ba86d8920c124b41b942352f863fbe0c84d3d63428fa1860f"
|
||||
dependencies = [
|
||||
"loom",
|
||||
"once_cell",
|
||||
"tracy-client-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracy-client-sys"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9012b9dfeccaff16e93f5a8b02336125113a80a769902e679d334cbdd4d83f3b"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2257,12 +2418,6 @@ dependencies = [
|
||||
"tinyvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.9"
|
||||
@@ -2297,18 +2452,18 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "valuable"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
|
||||
|
||||
[[package]]
|
||||
name = "vcpkg"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
|
||||
33
Cargo.toml
33
Cargo.toml
@@ -27,11 +27,10 @@ default = []
|
||||
# Enable this feature to live-reload assets from the web UI.
|
||||
dev_live_assets = []
|
||||
|
||||
profile-with-tracy = ["profiling/profile-with-tracy", "tracy-client"]
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
"rojo-insta-ext",
|
||||
"memofs",
|
||||
]
|
||||
members = ["crates/*"]
|
||||
|
||||
[lib]
|
||||
name = "librojo"
|
||||
@@ -42,7 +41,7 @@ name = "build"
|
||||
harness = false
|
||||
|
||||
[dependencies]
|
||||
memofs = { version = "0.2.0", path = "memofs" }
|
||||
memofs = { version = "0.2.0", path = "crates/memofs" }
|
||||
|
||||
# These dependencies can be uncommented when working on rbx-dom simultaneously
|
||||
# rbx_binary = { path = "../rbx-dom/rbx_binary" }
|
||||
@@ -51,11 +50,17 @@ memofs = { version = "0.2.0", path = "memofs" }
|
||||
# rbx_reflection_database = { path = "../rbx-dom/rbx_reflection_database" }
|
||||
# rbx_xml = { path = "../rbx-dom/rbx_xml" }
|
||||
|
||||
rbx_binary = "0.6.4"
|
||||
rbx_dom_weak = "2.3.0"
|
||||
rbx_reflection = "4.2.0"
|
||||
rbx_reflection_database = "0.2.2"
|
||||
rbx_xml = "0.12.3"
|
||||
rbx_binary = { git = "https://github.com/rojo-rbx/rbx-dom" }
|
||||
rbx_dom_weak = { git = "https://github.com/rojo-rbx/rbx-dom" }
|
||||
rbx_reflection = { git = "https://github.com/rojo-rbx/rbx-dom" }
|
||||
rbx_reflection_database = { git = "https://github.com/rojo-rbx/rbx-dom" }
|
||||
rbx_xml = { git = "https://github.com/rojo-rbx/rbx-dom" }
|
||||
|
||||
# rbx_binary = "0.6.4"
|
||||
# rbx_dom_weak = "2.3.0"
|
||||
# rbx_reflection = "4.2.0"
|
||||
# rbx_reflection_database = "0.2.2"
|
||||
# rbx_xml = "0.12.3"
|
||||
|
||||
anyhow = "1.0.44"
|
||||
backtrace = "0.3.61"
|
||||
@@ -78,17 +83,19 @@ ritz = "0.1.0"
|
||||
roblox_install = "1.0.0"
|
||||
serde = { version = "1.0.130", features = ["derive", "rc"] }
|
||||
serde_json = "1.0.68"
|
||||
structopt = "0.3.23"
|
||||
termcolor = "1.1.2"
|
||||
thiserror = "1.0.30"
|
||||
tokio = { version = "1.12.0", features = ["rt", "rt-multi-thread"] }
|
||||
uuid = { version = "1.0.0", features = ["v4", "serde"] }
|
||||
clap = { version = "3.1.18", features = ["derive"] }
|
||||
profiling = "1.0.6"
|
||||
tracy-client = { version = "0.13.2", optional = true }
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
winreg = "0.10.1"
|
||||
|
||||
[build-dependencies]
|
||||
memofs = { version = "0.2.0", path = "memofs" }
|
||||
memofs = { version = "0.2.0", path = "crates/memofs" }
|
||||
|
||||
embed-resource = "1.6.4"
|
||||
anyhow = "1.0.44"
|
||||
@@ -97,7 +104,7 @@ fs-err = "2.6.0"
|
||||
maplit = "1.0.2"
|
||||
|
||||
[dev-dependencies]
|
||||
rojo-insta-ext = { path = "rojo-insta-ext" }
|
||||
rojo-insta-ext = { path = "crates/rojo-insta-ext" }
|
||||
|
||||
criterion = "0.3.5"
|
||||
insta = { version = "1.8.0", features = ["redactions"] }
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
watchexec -c -w plugin "sh -c './bin/install-dev-plugin.sh'"
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
DIR="$( mktemp -d )"
|
||||
PLUGIN_FILE="$DIR/Rojo.rbxm"
|
||||
TESTEZ_FILE="$DIR/TestEZ.rbxm"
|
||||
|
||||
rojo build plugin -o "$PLUGIN_FILE"
|
||||
rojo build plugin/testez.project.json -o "$TESTEZ_FILE"
|
||||
remodel bin/mark-plugin-as-dev.lua "$PLUGIN_FILE" "$TESTEZ_FILE" 2>/dev/null
|
||||
|
||||
cp "$PLUGIN_FILE" "$LOCALAPPDATA/Roblox/Plugins/Rojo.rbxm"
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
rojo build plugin -o "$LOCALAPPDATA/Roblox/Plugins/Rojo.rbxm"
|
||||
@@ -1,12 +0,0 @@
|
||||
local pluginPath, testezPath = ...
|
||||
|
||||
local plugin = remodel.readModelFile(pluginPath)[1]
|
||||
local testez = remodel.readModelFile(testezPath)[1]
|
||||
|
||||
local marker = Instance.new("Folder")
|
||||
marker.Name = "ROJO_DEV_BUILD"
|
||||
marker.Parent = plugin
|
||||
|
||||
testez.Parent = plugin
|
||||
|
||||
remodel.writeModelFile(plugin, pluginPath)
|
||||
@@ -1,8 +0,0 @@
|
||||
local pluginPath, placePath = ...
|
||||
|
||||
local plugin = remodel.readModelFile(pluginPath)[1]
|
||||
local place = remodel.readPlaceFile(placePath)
|
||||
|
||||
plugin.Parent = place:GetService("ReplicatedStorage")
|
||||
|
||||
remodel.writePlaceFile(place, placePath)
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
./bin/run-cli-tests.sh
|
||||
./bin/run-plugin-tests.sh
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
cargo test --all --locked
|
||||
cargo fmt -- --check
|
||||
|
||||
touch src/lib.rs # Nudge Rust source to make Clippy actually check things
|
||||
cargo clippy
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
DIR="$( mktemp -d )"
|
||||
PLUGIN_FILE="$DIR/Rojo.rbxmx"
|
||||
PLACE_FILE="$DIR/RojoTestPlace.rbxlx"
|
||||
|
||||
rojo build plugin -o "$PLUGIN_FILE"
|
||||
rojo build plugin/place.project.json -o "$PLACE_FILE"
|
||||
|
||||
remodel bin/put-plugin-in-test-place.lua "$PLUGIN_FILE" "$PLACE_FILE"
|
||||
|
||||
run-in-roblox -s plugin/testBootstrap.server.lua "$PLACE_FILE"
|
||||
|
||||
luacheck plugin/src plugin/log plugin/http
|
||||
@@ -1,3 +1,4 @@
|
||||
[tools]
|
||||
rojo = { source = "rojo-rbx/rojo", version = "6.1.0" }
|
||||
rojo = { source = "rojo-rbx/rojo", version = "7.1.1" }
|
||||
run-in-roblox = { source = "rojo-rbx/run-in-roblox", version = "0.3.0" }
|
||||
selene = { source = "Kampfkarren/selene", version = "0.17.0" }
|
||||
|
||||
@@ -291,7 +291,7 @@ fn compute_and_apply_changes(tree: &mut RojoTree, vfs: &Vfs, id: Ref) -> Option<
|
||||
}
|
||||
};
|
||||
|
||||
let patch_set = compute_patch_set(snapshot.as_ref(), &tree, id);
|
||||
let patch_set = compute_patch_set(snapshot, &tree, id);
|
||||
apply_patch_set(tree, patch_set)
|
||||
}
|
||||
Ok(None) => {
|
||||
@@ -334,7 +334,7 @@ fn compute_and_apply_changes(tree: &mut RojoTree, vfs: &Vfs, id: Ref) -> Option<
|
||||
}
|
||||
};
|
||||
|
||||
let patch_set = compute_patch_set(snapshot.as_ref(), &tree, id);
|
||||
let patch_set = compute_patch_set(snapshot, &tree, id);
|
||||
apply_patch_set(tree, patch_set)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
use std::{
|
||||
io::{BufWriter, Write},
|
||||
mem::ManuallyDrop,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use anyhow::Context;
|
||||
use clap::Parser;
|
||||
use fs_err::File;
|
||||
use memofs::Vfs;
|
||||
use structopt::StructOpt;
|
||||
use tokio::runtime::Runtime;
|
||||
|
||||
use crate::serve_session::ServeSession;
|
||||
@@ -17,20 +18,20 @@ const UNKNOWN_OUTPUT_KIND_ERR: &str = "Could not detect what kind of file to bui
|
||||
Expected output file to end in .rbxl, .rbxlx, .rbxm, or .rbxmx.";
|
||||
|
||||
/// Generates a model or place file from the Rojo project.
|
||||
#[derive(Debug, StructOpt)]
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct BuildCommand {
|
||||
/// Path to the project to serve. Defaults to the current directory.
|
||||
#[structopt(default_value = "")]
|
||||
#[clap(default_value = "")]
|
||||
pub project: PathBuf,
|
||||
|
||||
/// Where to output the result.
|
||||
///
|
||||
/// Should end in .rbxm, .rbxl, .rbxmx, or .rbxlx.
|
||||
#[structopt(long, short)]
|
||||
#[clap(long, short)]
|
||||
pub output: PathBuf,
|
||||
|
||||
/// Whether to automatically rebuild when any input files change.
|
||||
#[structopt(long)]
|
||||
#[clap(long)]
|
||||
pub watch: bool,
|
||||
}
|
||||
|
||||
@@ -61,6 +62,14 @@ impl BuildCommand {
|
||||
}
|
||||
}
|
||||
|
||||
// Never drop ServeSession, because it's VERY expensive to drop and
|
||||
// we're about to exit anyways.
|
||||
//
|
||||
// This is kind of evil; if this function is ever called outside of the
|
||||
// context of a CLI, this will leak a large object forever. However, the
|
||||
// performance benefits of leaking it outweigh the cost at this time.
|
||||
let _session = ManuallyDrop::new(session);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -97,6 +106,7 @@ fn xml_encode_config() -> rbx_xml::EncodeOptions {
|
||||
rbx_xml::EncodeOptions::new().property_behavior(rbx_xml::EncodePropertyBehavior::WriteUnknown)
|
||||
}
|
||||
|
||||
#[profiling::function]
|
||||
fn write_model(
|
||||
session: &ServeSession,
|
||||
output: &Path,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use structopt::StructOpt;
|
||||
use clap::Parser;
|
||||
|
||||
/// Open Rojo's documentation in your browser.
|
||||
#[derive(Debug, StructOpt)]
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct DocCommand {}
|
||||
|
||||
impl DocCommand {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use anyhow::Context;
|
||||
use structopt::StructOpt;
|
||||
use clap::Parser;
|
||||
|
||||
use crate::project::Project;
|
||||
|
||||
/// Reformat a Rojo project using the standard JSON formatting rules.
|
||||
#[derive(Debug, StructOpt)]
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct FmtProjectCommand {
|
||||
/// Path to the project to format. Defaults to the current directory.
|
||||
#[structopt(default_value = "")]
|
||||
#[clap(default_value = "")]
|
||||
pub project: PathBuf,
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ use std::process::{Command, Stdio};
|
||||
use std::str::FromStr;
|
||||
|
||||
use anyhow::{bail, format_err};
|
||||
use clap::Parser;
|
||||
use fs_err as fs;
|
||||
use fs_err::OpenOptions;
|
||||
use structopt::StructOpt;
|
||||
|
||||
use super::resolve_path;
|
||||
|
||||
@@ -22,14 +22,14 @@ static PLACE_README: &str = include_str!("../../assets/default-place-project/REA
|
||||
static PLACE_GIT_IGNORE: &str = include_str!("../../assets/default-place-project/gitignore.txt");
|
||||
|
||||
/// Initializes a new Rojo project.
|
||||
#[derive(Debug, StructOpt)]
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct InitCommand {
|
||||
/// Path to the place to create the project. Defaults to the current directory.
|
||||
#[structopt(default_value = "")]
|
||||
#[clap(default_value = "")]
|
||||
pub path: PathBuf,
|
||||
|
||||
/// The kind of project to create, 'place' or 'model'. Defaults to place.
|
||||
#[structopt(long, default_value = "place")]
|
||||
#[clap(long, default_value = "place")]
|
||||
pub kind: InitKind,
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Defines Rojo's CLI through structopt types.
|
||||
//! Defines Rojo's CLI through clap types.
|
||||
|
||||
mod build;
|
||||
mod doc;
|
||||
@@ -11,7 +11,7 @@ mod upload;
|
||||
|
||||
use std::{borrow::Cow, env, path::Path, str::FromStr};
|
||||
|
||||
use structopt::StructOpt;
|
||||
use clap::Parser;
|
||||
use thiserror::Error;
|
||||
|
||||
pub use self::build::BuildCommand;
|
||||
@@ -23,15 +23,15 @@ pub use self::serve::ServeCommand;
|
||||
pub use self::sourcemap::SourcemapCommand;
|
||||
pub use self::upload::UploadCommand;
|
||||
|
||||
/// Command line options that Rojo accepts, defined using the structopt crate.
|
||||
#[derive(Debug, StructOpt)]
|
||||
#[structopt(name = "Rojo", about, author)]
|
||||
/// Command line options that Rojo accepts, defined using the clap crate.
|
||||
#[derive(Debug, Parser)]
|
||||
#[clap(name = "Rojo", version, about, author)]
|
||||
pub struct Options {
|
||||
#[structopt(flatten)]
|
||||
#[clap(flatten)]
|
||||
pub global: GlobalOptions,
|
||||
|
||||
/// Subcommand to run in this invocation.
|
||||
#[structopt(subcommand)]
|
||||
#[clap(subcommand)]
|
||||
pub subcommand: Subcommand,
|
||||
}
|
||||
|
||||
@@ -50,14 +50,14 @@ impl Options {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, StructOpt)]
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct GlobalOptions {
|
||||
/// Sets verbosity level. Can be specified multiple times.
|
||||
#[structopt(long("verbose"), short, global(true), parse(from_occurrences))]
|
||||
#[clap(long("verbose"), short, global(true), parse(from_occurrences))]
|
||||
pub verbosity: u8,
|
||||
|
||||
/// Set color behavior. Valid values are auto, always, and never.
|
||||
#[structopt(long("color"), global(true), default_value("auto"))]
|
||||
#[clap(long("color"), global(true), default_value("auto"))]
|
||||
pub color: ColorChoice,
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ pub struct ColorChoiceParseError {
|
||||
attempted: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, StructOpt)]
|
||||
#[derive(Debug, Parser)]
|
||||
pub enum Subcommand {
|
||||
Init(InitCommand),
|
||||
Serve(ServeCommand),
|
||||
|
||||
@@ -3,9 +3,9 @@ use std::{
|
||||
io::BufWriter,
|
||||
};
|
||||
|
||||
use clap::Parser;
|
||||
use memofs::{InMemoryFs, Vfs, VfsSnapshot};
|
||||
use roblox_install::RobloxStudio;
|
||||
use structopt::StructOpt;
|
||||
|
||||
use crate::serve_session::ServeSession;
|
||||
|
||||
@@ -13,14 +13,14 @@ static PLUGIN_BINCODE: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/plugin.
|
||||
static PLUGIN_FILE_NAME: &str = "RojoManagedPlugin.rbxm";
|
||||
|
||||
/// Install Rojo's plugin.
|
||||
#[derive(Debug, StructOpt)]
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct PluginCommand {
|
||||
#[structopt(subcommand)]
|
||||
#[clap(subcommand)]
|
||||
subcommand: PluginSubcommand,
|
||||
}
|
||||
|
||||
/// Manages Rojo's Roblox Studio plugin.
|
||||
#[derive(Debug, StructOpt)]
|
||||
#[derive(Debug, Parser)]
|
||||
pub enum PluginSubcommand {
|
||||
/// Install the plugin in Roblox Studio's plugins folder. If the plugin is
|
||||
/// already installed, installing it again will overwrite the current plugin
|
||||
|
||||
@@ -5,8 +5,8 @@ use std::{
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
use clap::Parser;
|
||||
use memofs::Vfs;
|
||||
use structopt::StructOpt;
|
||||
use termcolor::{BufferWriter, Color, ColorChoice, ColorSpec, WriteColor};
|
||||
|
||||
use crate::{serve_session::ServeSession, web::LiveServer};
|
||||
@@ -17,19 +17,19 @@ const DEFAULT_BIND_ADDRESS: Ipv4Addr = Ipv4Addr::new(127, 0, 0, 1);
|
||||
const DEFAULT_PORT: u16 = 34872;
|
||||
|
||||
/// Expose a Rojo project to the Rojo Studio plugin.
|
||||
#[derive(Debug, StructOpt)]
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct ServeCommand {
|
||||
/// Path to the project to serve. Defaults to the current directory.
|
||||
#[structopt(default_value = "")]
|
||||
#[clap(default_value = "")]
|
||||
pub project: PathBuf,
|
||||
|
||||
/// The IP address to listen on. Defaults to `127.0.0.1`.
|
||||
#[structopt(long)]
|
||||
#[clap(long)]
|
||||
pub address: Option<IpAddr>,
|
||||
|
||||
/// The port to listen on. Defaults to the project's preference, or `34872` if
|
||||
/// it has none.
|
||||
#[structopt(long)]
|
||||
#[clap(long)]
|
||||
pub port: Option<u16>,
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ use std::{
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use clap::Parser;
|
||||
use fs_err::File;
|
||||
use memofs::Vfs;
|
||||
use rbx_dom_weak::types::Ref;
|
||||
use serde::Serialize;
|
||||
use structopt::StructOpt;
|
||||
|
||||
use crate::{
|
||||
serve_session::ServeSession,
|
||||
@@ -33,22 +33,22 @@ struct SourcemapNode {
|
||||
}
|
||||
|
||||
/// Generates a sourcemap file from the Rojo project.
|
||||
#[derive(Debug, StructOpt)]
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct SourcemapCommand {
|
||||
/// Path to the project to use for the sourcemap. Defaults to the current
|
||||
/// directory.
|
||||
#[structopt(default_value = "")]
|
||||
#[clap(default_value = "")]
|
||||
pub project: PathBuf,
|
||||
|
||||
/// Where to output the sourcemap. Omit this to use stdout instead of
|
||||
/// writing to a file.
|
||||
///
|
||||
/// Should end in .json.
|
||||
#[structopt(long, short)]
|
||||
#[clap(long, short)]
|
||||
pub output: Option<PathBuf>,
|
||||
|
||||
/// If non-script files should be included or not. Defaults to false.
|
||||
#[structopt(long)]
|
||||
#[clap(long)]
|
||||
pub include_non_scripts: bool,
|
||||
}
|
||||
|
||||
|
||||
@@ -2,38 +2,38 @@ use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
|
||||
use anyhow::{bail, format_err, Context};
|
||||
use clap::Parser;
|
||||
use memofs::Vfs;
|
||||
use reqwest::{
|
||||
header::{ACCEPT, CONTENT_TYPE, COOKIE, USER_AGENT},
|
||||
StatusCode,
|
||||
};
|
||||
use structopt::StructOpt;
|
||||
|
||||
use crate::{auth_cookie::get_auth_cookie, serve_session::ServeSession};
|
||||
|
||||
use super::resolve_path;
|
||||
|
||||
/// Builds the project and uploads it to Roblox.
|
||||
#[derive(Debug, StructOpt)]
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct UploadCommand {
|
||||
/// Path to the project to upload. Defaults to the current directory.
|
||||
#[structopt(default_value = "")]
|
||||
#[clap(default_value = "")]
|
||||
pub project: PathBuf,
|
||||
|
||||
/// Authenication cookie to use. If not specified, Rojo will attempt to find one from the system automatically.
|
||||
#[structopt(long)]
|
||||
#[clap(long)]
|
||||
pub cookie: Option<String>,
|
||||
|
||||
/// API key obtained from create.roblox.com/credentials. Rojo will use the Open Cloud API when this is provided. Only supports uploading to a place.
|
||||
#[structopt(long = "api_key")]
|
||||
#[clap(long = "api_key")]
|
||||
pub api_key: Option<String>,
|
||||
|
||||
/// The Universe ID of the given place. Required when using the Open Cloud API.
|
||||
#[structopt(long = "universe_id")]
|
||||
#[clap(long = "universe_id")]
|
||||
pub universe_id: Option<u64>,
|
||||
|
||||
/// Asset ID to upload to.
|
||||
#[structopt(long = "asset_id")]
|
||||
#[clap(long = "asset_id")]
|
||||
pub asset_id: u64,
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
use std::{env, panic, process};
|
||||
|
||||
use backtrace::Backtrace;
|
||||
use structopt::StructOpt;
|
||||
use clap::Parser;
|
||||
|
||||
use librojo::cli::Options;
|
||||
|
||||
fn main() {
|
||||
#[cfg(feature = "profile-with-tracy")]
|
||||
tracy_client::Client::start();
|
||||
|
||||
panic::set_hook(Box::new(|panic_info| {
|
||||
// PanicInfo's payload is usually a &'static str or String.
|
||||
// See: https://doc.rust-lang.org/beta/std/panic/struct.PanicInfo.html#method.payload
|
||||
@@ -49,7 +52,7 @@ fn main() {
|
||||
process::exit(1);
|
||||
}));
|
||||
|
||||
let options = Options::from_args();
|
||||
let options = Options::parse();
|
||||
|
||||
let log_filter = match options.global.verbosity {
|
||||
0 => "info",
|
||||
|
||||
@@ -130,7 +130,7 @@ impl ServeSession {
|
||||
let snapshot = snapshot_from_vfs(&instance_context, &vfs, &start_path)?;
|
||||
|
||||
log::trace!("Computing initial patch set");
|
||||
let patch_set = compute_patch_set(snapshot.as_ref(), &tree, root_id);
|
||||
let patch_set = compute_patch_set(snapshot, &tree, root_id);
|
||||
|
||||
log::trace!("Applying initial patch set");
|
||||
apply_patch_set(&mut tree, patch_set);
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::{borrow::Cow, collections::HashMap};
|
||||
|
||||
use rbx_dom_weak::{
|
||||
types::{Ref, Variant},
|
||||
WeakDom,
|
||||
Instance, WeakDom,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@@ -102,22 +102,29 @@ impl InstanceSnapshot {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_tree(tree: &WeakDom, id: Ref) -> Self {
|
||||
let instance = tree.get_by_ref(id).expect("instance did not exist in tree");
|
||||
#[profiling::function]
|
||||
pub fn from_tree(tree: WeakDom, id: Ref) -> Self {
|
||||
let (_, mut raw_tree) = tree.into_raw();
|
||||
Self::from_raw_tree(&mut raw_tree, id)
|
||||
}
|
||||
|
||||
fn from_raw_tree(raw_tree: &mut HashMap<Ref, Instance>, id: Ref) -> Self {
|
||||
let instance = raw_tree
|
||||
.remove(&id)
|
||||
.expect("instance did not exist in tree");
|
||||
|
||||
let children = instance
|
||||
.children()
|
||||
.iter()
|
||||
.copied()
|
||||
.map(|id| Self::from_tree(tree, id))
|
||||
.map(|&id| Self::from_raw_tree(raw_tree, id))
|
||||
.collect();
|
||||
|
||||
Self {
|
||||
snapshot_id: Some(id),
|
||||
metadata: InstanceMetadata::default(),
|
||||
name: Cow::Owned(instance.name.clone()),
|
||||
class_name: Cow::Owned(instance.class.clone()),
|
||||
properties: instance.properties.clone(),
|
||||
name: Cow::Owned(instance.name),
|
||||
class_name: Cow::Owned(instance.class),
|
||||
properties: instance.properties,
|
||||
children,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
//! Defines the algorithm for applying generated patches.
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
mem::take,
|
||||
};
|
||||
|
||||
use rbx_dom_weak::types::{Ref, Variant};
|
||||
|
||||
@@ -12,21 +15,31 @@ use super::{
|
||||
/// Consumes the input `PatchSet`, applying all of its prescribed changes to the
|
||||
/// tree and returns an `AppliedPatchSet`, which can be used to keep another
|
||||
/// tree in sync with Rojo's.
|
||||
#[profiling::function]
|
||||
pub fn apply_patch_set(tree: &mut RojoTree, patch_set: PatchSet) -> AppliedPatchSet {
|
||||
let mut context = PatchApplyContext::default();
|
||||
|
||||
for removed_id in patch_set.removed_instances {
|
||||
apply_remove_instance(&mut context, tree, removed_id);
|
||||
{
|
||||
profiling::scope!("removals");
|
||||
for removed_id in patch_set.removed_instances {
|
||||
apply_remove_instance(&mut context, tree, removed_id);
|
||||
}
|
||||
}
|
||||
|
||||
for add_patch in patch_set.added_instances {
|
||||
apply_add_child(&mut context, tree, add_patch.parent_id, add_patch.instance);
|
||||
{
|
||||
profiling::scope!("additions");
|
||||
for add_patch in patch_set.added_instances {
|
||||
apply_add_child(&mut context, tree, add_patch.parent_id, add_patch.instance);
|
||||
}
|
||||
}
|
||||
|
||||
// Updates need to be applied after additions, which reduces the complexity
|
||||
// of updates significantly.
|
||||
for update_patch in patch_set.updated_instances {
|
||||
apply_update_child(&mut context, tree, update_patch);
|
||||
{
|
||||
profiling::scope!("updates");
|
||||
// Updates need to be applied after additions, which reduces the complexity
|
||||
// of updates significantly.
|
||||
for update_patch in patch_set.updated_instances {
|
||||
apply_update_child(&mut context, tree, update_patch);
|
||||
}
|
||||
}
|
||||
|
||||
finalize_patch_application(context, tree)
|
||||
@@ -55,20 +68,9 @@ struct PatchApplyContext {
|
||||
/// eachother.
|
||||
snapshot_id_to_instance_id: HashMap<Ref, Ref>,
|
||||
|
||||
/// The properties of instances added by the current `PatchSet`.
|
||||
///
|
||||
/// Instances added to the tree can refer to eachother via Ref properties,
|
||||
/// but we need to make sure they're correctly transformed from snapshot
|
||||
/// space into tree space (via `snapshot_id_to_instance_id`).
|
||||
///
|
||||
/// It's not possible to do that transformation for refs that refer to added
|
||||
/// instances until all the instances have actually been inserted into the
|
||||
/// tree. For simplicity, we defer application of _all_ properties on added
|
||||
/// instances instead of just Refs.
|
||||
///
|
||||
/// This doesn't affect updated instances, since they're always applied
|
||||
/// after we've added all the instances from the patch.
|
||||
added_instance_properties: HashMap<Ref, HashMap<String, Variant>>,
|
||||
/// Tracks all of the instances added by this patch that have refs that need
|
||||
/// to be rewritten.
|
||||
has_refs_to_rewrite: HashSet<Ref>,
|
||||
|
||||
/// The current applied patch result, describing changes made to the tree.
|
||||
applied_patch_set: AppliedPatchSet,
|
||||
@@ -84,23 +86,22 @@ struct PatchApplyContext {
|
||||
/// The remaining Ref properties need to be handled during patch application,
|
||||
/// where we build up a map of snapshot IDs to instance IDs as they're created,
|
||||
/// then apply properties all at once at the end.
|
||||
#[profiling::function]
|
||||
fn finalize_patch_application(context: PatchApplyContext, tree: &mut RojoTree) -> AppliedPatchSet {
|
||||
for (id, properties) in context.added_instance_properties {
|
||||
for id in context.has_refs_to_rewrite {
|
||||
// This should always succeed since instances marked as added in our
|
||||
// patch should be added without fail.
|
||||
let mut instance = tree
|
||||
.get_instance_mut(id)
|
||||
.expect("Invalid instance ID in deferred property map");
|
||||
|
||||
for (key, mut property_value) in properties {
|
||||
if let Variant::Ref(referent) = property_value {
|
||||
for value in instance.properties_mut().values_mut() {
|
||||
if let Variant::Ref(referent) = value {
|
||||
if let Some(&instance_referent) = context.snapshot_id_to_instance_id.get(&referent)
|
||||
{
|
||||
property_value = Variant::Ref(instance_referent);
|
||||
*value = Variant::Ref(instance_referent);
|
||||
}
|
||||
}
|
||||
|
||||
instance.properties_mut().insert(key, property_value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,24 +117,24 @@ fn apply_add_child(
|
||||
context: &mut PatchApplyContext,
|
||||
tree: &mut RojoTree,
|
||||
parent_id: Ref,
|
||||
snapshot: InstanceSnapshot,
|
||||
mut snapshot: InstanceSnapshot,
|
||||
) {
|
||||
let snapshot_id = snapshot.snapshot_id;
|
||||
let properties = snapshot.properties;
|
||||
let children = snapshot.children;
|
||||
let children = take(&mut snapshot.children);
|
||||
|
||||
// Property application is deferred until after all children
|
||||
// are constructed. This helps apply referents correctly.
|
||||
let remaining_snapshot = InstanceSnapshot::new()
|
||||
.name(snapshot.name)
|
||||
.class_name(snapshot.class_name)
|
||||
.metadata(snapshot.metadata)
|
||||
.snapshot_id(snapshot.snapshot_id);
|
||||
// If an object we're adding has a non-null referent, we'll note this
|
||||
// instance down as needing to be revisited later.
|
||||
let has_refs = snapshot.properties.values().any(|value| match value {
|
||||
Variant::Ref(value) => value.is_some(),
|
||||
_ => false,
|
||||
});
|
||||
|
||||
let id = tree.insert_instance(parent_id, remaining_snapshot);
|
||||
let id = tree.insert_instance(parent_id, snapshot);
|
||||
context.applied_patch_set.added.push(id);
|
||||
|
||||
context.added_instance_properties.insert(id, properties);
|
||||
if has_refs {
|
||||
context.has_refs_to_rewrite.insert(id);
|
||||
}
|
||||
|
||||
if let Some(snapshot_id) = snapshot_id {
|
||||
context.snapshot_id_to_instance_id.insert(snapshot_id, id);
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
//! Defines the algorithm for computing a roughly-minimal patch set given an
|
||||
//! existing instance tree and an instance snapshot.
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
mem::take,
|
||||
};
|
||||
|
||||
use rbx_dom_weak::types::{Ref, Variant};
|
||||
|
||||
@@ -10,11 +13,8 @@ use super::{
|
||||
InstanceSnapshot, InstanceWithMeta, RojoTree,
|
||||
};
|
||||
|
||||
pub fn compute_patch_set(
|
||||
snapshot: Option<&InstanceSnapshot>,
|
||||
tree: &RojoTree,
|
||||
id: Ref,
|
||||
) -> PatchSet {
|
||||
#[profiling::function]
|
||||
pub fn compute_patch_set(snapshot: Option<InstanceSnapshot>, tree: &RojoTree, id: Ref) -> PatchSet {
|
||||
let mut patch_set = PatchSet::new();
|
||||
|
||||
if let Some(snapshot) = snapshot {
|
||||
@@ -74,7 +74,7 @@ fn rewrite_refs_in_snapshot(context: &ComputePatchContext, snapshot: &mut Instan
|
||||
|
||||
fn compute_patch_set_internal(
|
||||
context: &mut ComputePatchContext,
|
||||
snapshot: &InstanceSnapshot,
|
||||
mut snapshot: InstanceSnapshot,
|
||||
tree: &RojoTree,
|
||||
id: Ref,
|
||||
patch_set: &mut PatchSet,
|
||||
@@ -87,12 +87,12 @@ fn compute_patch_set_internal(
|
||||
.get_instance(id)
|
||||
.expect("Instance did not exist in tree");
|
||||
|
||||
compute_property_patches(snapshot, &instance, patch_set);
|
||||
compute_children_patches(context, snapshot, tree, id, patch_set);
|
||||
compute_property_patches(&mut snapshot, &instance, patch_set);
|
||||
compute_children_patches(context, &mut snapshot, tree, id, patch_set);
|
||||
}
|
||||
|
||||
fn compute_property_patches(
|
||||
snapshot: &InstanceSnapshot,
|
||||
snapshot: &mut InstanceSnapshot,
|
||||
instance: &InstanceWithMeta,
|
||||
patch_set: &mut PatchSet,
|
||||
) {
|
||||
@@ -102,32 +102,32 @@ fn compute_property_patches(
|
||||
let changed_name = if snapshot.name == instance.name() {
|
||||
None
|
||||
} else {
|
||||
Some(snapshot.name.clone().into_owned())
|
||||
Some(take(&mut snapshot.name).into_owned())
|
||||
};
|
||||
|
||||
let changed_class_name = if snapshot.class_name == instance.class_name() {
|
||||
None
|
||||
} else {
|
||||
Some(snapshot.class_name.clone().into_owned())
|
||||
Some(take(&mut snapshot.class_name).into_owned())
|
||||
};
|
||||
|
||||
let changed_metadata = if &snapshot.metadata == instance.metadata() {
|
||||
None
|
||||
} else {
|
||||
Some(snapshot.metadata.clone())
|
||||
Some(take(&mut snapshot.metadata))
|
||||
};
|
||||
|
||||
for (name, snapshot_value) in &snapshot.properties {
|
||||
visited_properties.insert(name.as_str());
|
||||
for (name, snapshot_value) in take(&mut snapshot.properties) {
|
||||
visited_properties.insert(name.clone());
|
||||
|
||||
match instance.properties().get(name) {
|
||||
match instance.properties().get(&name) {
|
||||
Some(instance_value) => {
|
||||
if snapshot_value != instance_value {
|
||||
changed_properties.insert(name.clone(), Some(snapshot_value.clone()));
|
||||
if &snapshot_value != instance_value {
|
||||
changed_properties.insert(name, Some(snapshot_value));
|
||||
}
|
||||
}
|
||||
None => {
|
||||
changed_properties.insert(name.clone(), Some(snapshot_value.clone()));
|
||||
changed_properties.insert(name, Some(snapshot_value));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -159,7 +159,7 @@ fn compute_property_patches(
|
||||
|
||||
fn compute_children_patches(
|
||||
context: &mut ComputePatchContext,
|
||||
snapshot: &InstanceSnapshot,
|
||||
snapshot: &mut InstanceSnapshot,
|
||||
tree: &RojoTree,
|
||||
id: Ref,
|
||||
patch_set: &mut PatchSet,
|
||||
@@ -172,7 +172,7 @@ fn compute_children_patches(
|
||||
|
||||
let mut paired_instances = vec![false; instance_children.len()];
|
||||
|
||||
for snapshot_child in snapshot.children.iter() {
|
||||
for snapshot_child in take(&mut snapshot.children) {
|
||||
let matching_instance =
|
||||
instance_children
|
||||
.iter()
|
||||
@@ -209,7 +209,7 @@ fn compute_children_patches(
|
||||
None => {
|
||||
patch_set.added_instances.push(PatchAdd {
|
||||
parent_id: id,
|
||||
instance: snapshot_child.clone(),
|
||||
instance: snapshot_child,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -257,7 +257,7 @@ mod test {
|
||||
children: Vec::new(),
|
||||
};
|
||||
|
||||
let patch_set = compute_patch_set(Some(&snapshot), &tree, root_id);
|
||||
let patch_set = compute_patch_set(Some(snapshot), &tree, root_id);
|
||||
|
||||
let expected_patch_set = PatchSet {
|
||||
updated_instances: vec![PatchUpdate {
|
||||
@@ -307,7 +307,7 @@ mod test {
|
||||
class_name: Cow::Borrowed("foo"),
|
||||
};
|
||||
|
||||
let patch_set = compute_patch_set(Some(&snapshot), &tree, root_id);
|
||||
let patch_set = compute_patch_set(Some(snapshot), &tree, root_id);
|
||||
|
||||
let expected_patch_set = PatchSet {
|
||||
added_instances: vec![PatchAdd {
|
||||
|
||||
@@ -23,7 +23,7 @@ fn set_name_and_class_name() {
|
||||
children: Vec::new(),
|
||||
};
|
||||
|
||||
let patch_set = compute_patch_set(Some(&snapshot), &tree, tree.get_root_id());
|
||||
let patch_set = compute_patch_set(Some(snapshot), &tree, tree.get_root_id());
|
||||
let patch_value = redactions.redacted_yaml(patch_set);
|
||||
|
||||
assert_yaml_snapshot!(patch_value);
|
||||
@@ -47,7 +47,7 @@ fn set_property() {
|
||||
children: Vec::new(),
|
||||
};
|
||||
|
||||
let patch_set = compute_patch_set(Some(&snapshot), &tree, tree.get_root_id());
|
||||
let patch_set = compute_patch_set(Some(snapshot), &tree, tree.get_root_id());
|
||||
let patch_value = redactions.redacted_yaml(patch_set);
|
||||
|
||||
assert_yaml_snapshot!(patch_value);
|
||||
@@ -78,7 +78,7 @@ fn remove_property() {
|
||||
children: Vec::new(),
|
||||
};
|
||||
|
||||
let patch_set = compute_patch_set(Some(&snapshot), &tree, tree.get_root_id());
|
||||
let patch_set = compute_patch_set(Some(snapshot), &tree, tree.get_root_id());
|
||||
let patch_value = redactions.redacted_yaml(patch_set);
|
||||
|
||||
assert_yaml_snapshot!(patch_value);
|
||||
@@ -107,7 +107,7 @@ fn add_child() {
|
||||
}],
|
||||
};
|
||||
|
||||
let patch_set = compute_patch_set(Some(&snapshot), &tree, tree.get_root_id());
|
||||
let patch_set = compute_patch_set(Some(snapshot), &tree, tree.get_root_id());
|
||||
let patch_value = redactions.redacted_yaml(patch_set);
|
||||
|
||||
assert_yaml_snapshot!(patch_value);
|
||||
@@ -139,7 +139,7 @@ fn remove_child() {
|
||||
children: Vec::new(),
|
||||
};
|
||||
|
||||
let patch_set = compute_patch_set(Some(&snapshot), &tree, tree.get_root_id());
|
||||
let patch_set = compute_patch_set(Some(snapshot), &tree, tree.get_root_id());
|
||||
let patch_value = redactions.redacted_yaml(patch_set);
|
||||
|
||||
assert_yaml_snapshot!(patch_value);
|
||||
|
||||
@@ -87,8 +87,9 @@ impl RojoTree {
|
||||
}
|
||||
|
||||
pub fn insert_instance(&mut self, parent_ref: Ref, snapshot: InstanceSnapshot) -> Ref {
|
||||
let builder = InstanceBuilder::new(snapshot.class_name.to_owned())
|
||||
.with_name(snapshot.name.to_owned())
|
||||
let builder = InstanceBuilder::empty()
|
||||
.with_class(snapshot.class_name.into_owned())
|
||||
.with_name(snapshot.name.into_owned())
|
||||
.with_properties(snapshot.properties);
|
||||
|
||||
let referent = self.inner.insert(parent_ref, builder);
|
||||
|
||||
@@ -40,6 +40,7 @@ pub use self::project::snapshot_project_node;
|
||||
|
||||
/// The main entrypoint to the snapshot function. This function can be pointed
|
||||
/// at any path and will return something if Rojo knows how to deal with it.
|
||||
#[profiling::function]
|
||||
pub fn snapshot_from_vfs(
|
||||
context: &InstanceContext,
|
||||
vfs: &Vfs,
|
||||
|
||||
@@ -7,6 +7,7 @@ use crate::snapshot::{InstanceContext, InstanceMetadata, InstanceSnapshot};
|
||||
|
||||
use super::util::PathExt;
|
||||
|
||||
#[profiling::function]
|
||||
pub fn snapshot_rbxm(
|
||||
context: &InstanceContext,
|
||||
vfs: &Vfs,
|
||||
@@ -21,7 +22,8 @@ pub fn snapshot_rbxm(
|
||||
let children = root_instance.children();
|
||||
|
||||
if children.len() == 1 {
|
||||
let snapshot = InstanceSnapshot::from_tree(&temp_tree, children[0])
|
||||
let child = children[0];
|
||||
let snapshot = InstanceSnapshot::from_tree(temp_tree, child)
|
||||
.name(name)
|
||||
.metadata(
|
||||
InstanceMetadata::new()
|
||||
|
||||
@@ -24,7 +24,8 @@ pub fn snapshot_rbxmx(
|
||||
let children = root_instance.children();
|
||||
|
||||
if children.len() == 1 {
|
||||
let snapshot = InstanceSnapshot::from_tree(&temp_tree, children[0])
|
||||
let child = children[0];
|
||||
let snapshot = InstanceSnapshot::from_tree(temp_tree, child)
|
||||
.name(name)
|
||||
.metadata(
|
||||
InstanceMetadata::new()
|
||||
|
||||
Reference in New Issue
Block a user