mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-21 05:06:29 +00:00
Compare commits
7 Commits
small-stri
...
unpack-com
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88d2d1f193 | ||
|
|
2e7c4b6dff | ||
|
|
e5dbee1073 | ||
|
|
c06463b61d | ||
|
|
10341e3776 | ||
|
|
824cdc5dcd | ||
|
|
7aa7a35aa5 |
@@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
## Unreleased Changes
|
## Unreleased Changes
|
||||||
* Switched from structopt to clap for command line argument parsing.
|
* Switched from structopt to clap for command line argument parsing.
|
||||||
|
* Significantly improved performance of building and serving. ([#548])
|
||||||
|
* Fixed `init.meta.json` when used with `init.lua` and related files. ([#549])
|
||||||
|
|
||||||
|
[#548]: https://github.com/rojo-rbx/rojo/pull/548
|
||||||
|
[#549]: https://github.com/rojo-rbx/rojo/pull/549
|
||||||
|
|
||||||
## [7.1.1] - May 26, 2022
|
## [7.1.1] - May 26, 2022
|
||||||
* Fixed sourcemap command not stripping paths correctly ([#544])
|
* Fixed sourcemap command not stripping paths correctly ([#544])
|
||||||
|
|||||||
331
Cargo.lock
generated
331
Cargo.lock
generated
@@ -49,9 +49,9 @@ checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arrayvec"
|
name = "arrayvec"
|
||||||
version = "0.5.2"
|
version = "0.7.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
|
checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "atty"
|
name = "atty"
|
||||||
@@ -114,17 +114,16 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "blake3"
|
name = "blake3"
|
||||||
version = "0.1.5"
|
version = "1.3.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "46080006c1505f12f64dd2a09264b343381ed3190fa02c8005d5d662ac571c63"
|
checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayref",
|
"arrayref",
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"cc",
|
"cc",
|
||||||
"cfg-if 0.1.10",
|
"cfg-if 1.0.0",
|
||||||
"constant_time_eq",
|
"constant_time_eq",
|
||||||
"crypto-mac",
|
"digest 0.10.3",
|
||||||
"digest",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -136,7 +135,16 @@ dependencies = [
|
|||||||
"block-padding",
|
"block-padding",
|
||||||
"byte-tools",
|
"byte-tools",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"generic-array",
|
"generic-array 0.12.4",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "block-buffer"
|
||||||
|
version = "0.10.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324"
|
||||||
|
dependencies = [
|
||||||
|
"generic-array 0.14.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -162,9 +170,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bumpalo"
|
name = "bumpalo"
|
||||||
version = "3.9.1"
|
version = "3.10.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899"
|
checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "byte-tools"
|
name = "byte-tools"
|
||||||
@@ -378,13 +386,13 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crypto-mac"
|
name = "crypto-common"
|
||||||
version = "0.7.0"
|
version = "0.1.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5"
|
checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"generic-array",
|
"generic-array 0.14.5",
|
||||||
"subtle",
|
"typenum",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -431,7 +439,18 @@ version = "0.8.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
|
checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"generic-array",
|
"generic-array 0.12.4",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "digest"
|
||||||
|
version = "0.10.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506"
|
||||||
|
dependencies = [
|
||||||
|
"block-buffer 0.10.2",
|
||||||
|
"crypto-common",
|
||||||
|
"subtle",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -690,6 +709,19 @@ dependencies = [
|
|||||||
"slab",
|
"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]]
|
[[package]]
|
||||||
name = "generic-array"
|
name = "generic-array"
|
||||||
version = "0.12.4"
|
version = "0.12.4"
|
||||||
@@ -700,14 +732,13 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "getrandom"
|
name = "generic-array"
|
||||||
version = "0.1.16"
|
version = "0.14.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
|
checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"typenum",
|
||||||
"libc",
|
"version_check",
|
||||||
"wasi 0.9.0+wasi-snapshot-preview1",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -718,7 +749,7 @@ checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"libc",
|
"libc",
|
||||||
"wasi 0.10.0+wasi-snapshot-preview1",
|
"wasi 0.10.2+wasi-snapshot-preview1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -834,9 +865,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hyper"
|
name = "hyper"
|
||||||
version = "0.14.18"
|
version = "0.14.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2"
|
checksum = "42dc3c131584288d375f2d07f822b0cb012d8c6fb899a5b9fdb3cb7eb9b6004f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
@@ -882,9 +913,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "1.8.1"
|
version = "1.8.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee"
|
checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
@@ -912,9 +943,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "insta"
|
name = "insta"
|
||||||
version = "1.14.0"
|
version = "1.14.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "689960f187c43c01650c805fb6bc6f55ab944499d86d4ffe9474ad78991d8e94"
|
checksum = "bcc3e639bcba360d9237acabd22014c16f3df772db463b7446cd81b070714767"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"console",
|
"console",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
@@ -1029,6 +1060,19 @@ dependencies = [
|
|||||||
"cfg-if 1.0.0",
|
"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]]
|
[[package]]
|
||||||
name = "lz4"
|
name = "lz4"
|
||||||
version = "1.23.3"
|
version = "1.23.3"
|
||||||
@@ -1055,6 +1099,15 @@ version = "1.0.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
|
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]]
|
[[package]]
|
||||||
name = "matches"
|
name = "matches"
|
||||||
version = "0.1.9"
|
version = "0.1.9"
|
||||||
@@ -1094,9 +1147,9 @@ checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "miniz_oxide"
|
name = "miniz_oxide"
|
||||||
version = "0.5.1"
|
version = "0.5.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d2b29bd4bc3f33391105ebee3589c19197c4271e3e5a9ec9bfe8127eeff8f082"
|
checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"adler",
|
"adler",
|
||||||
]
|
]
|
||||||
@@ -1233,9 +1286,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "once_cell"
|
||||||
version = "1.11.0"
|
version = "1.12.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7b10983b38c53aebdf33f542c6275b0f58a238129d00c4ae0e6fb59738d783ca"
|
checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "oorandom"
|
name = "oorandom"
|
||||||
@@ -1293,9 +1346,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openssl-sys"
|
name = "openssl-sys"
|
||||||
version = "0.9.73"
|
version = "0.9.74"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9d5fd19fb3e0a8191c1e34935718976a3e70c112ab9a24af6d7cadccd9d90bc0"
|
checksum = "835363342df5fba8354c5b453325b110ffd54044e588c539cf2f20a8014e4cb1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"cc",
|
"cc",
|
||||||
@@ -1499,7 +1552,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "2f61dcf0b917cd75d4521d7343d1ffff3d1583054133c9b5cbea3375c703c40d"
|
checksum = "2f61dcf0b917cd75d4521d7343d1ffff3d1583054133c9b5cbea3375c703c40d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"profiling-procmacros",
|
"profiling-procmacros",
|
||||||
"superluminal-perf",
|
"tracy-client",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1532,22 +1585,20 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand"
|
name = "rand"
|
||||||
version = "0.7.3"
|
version = "0.8.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
|
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.1.16",
|
|
||||||
"libc",
|
"libc",
|
||||||
"rand_chacha",
|
"rand_chacha",
|
||||||
"rand_core",
|
"rand_core",
|
||||||
"rand_hc",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand_chacha"
|
name = "rand_chacha"
|
||||||
version = "0.2.2"
|
version = "0.3.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
|
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ppv-lite86",
|
"ppv-lite86",
|
||||||
"rand_core",
|
"rand_core",
|
||||||
@@ -1555,20 +1606,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand_core"
|
name = "rand_core"
|
||||||
version = "0.5.1"
|
version = "0.6.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
|
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.1.16",
|
"getrandom",
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rand_hc"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
|
|
||||||
dependencies = [
|
|
||||||
"rand_core",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1611,9 +1653,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rbx_dom_weak"
|
name = "rbx_dom_weak"
|
||||||
version = "2.3.0"
|
version = "2.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6f7f524fb18f30d7065c82c4e87f747705679329810207e96169c6d4ec922d1f"
|
checksum = "b7cc2238fd858d706f4f5c6a0f9af3cd4a10f3f8dc8b6534e683f8543af26f33"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rbx_types",
|
"rbx_types",
|
||||||
"serde",
|
"serde",
|
||||||
@@ -1643,11 +1685,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rbx_types"
|
name = "rbx_types"
|
||||||
version = "1.3.0"
|
version = "1.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d637383aa560cb675b7ea7a7778b945dab065ccc7c158f77b5455e27efadc6df"
|
checksum = "cbfc0ca9c674968170d4fbbd95dc692d0b3f9405b4830babc76107dc00a66380"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.11.0",
|
"base64 0.13.0",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"blake3",
|
"blake3",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
@@ -1685,7 +1727,7 @@ version = "0.4.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
|
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.2.6",
|
"getrandom",
|
||||||
"redox_syscall",
|
"redox_syscall",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
@@ -1706,6 +1748,9 @@ name = "regex-automata"
|
|||||||
version = "0.1.10"
|
version = "0.1.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
|
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
|
||||||
|
dependencies = [
|
||||||
|
"regex-syntax",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-syntax"
|
name = "regex-syntax"
|
||||||
@@ -1816,15 +1861,7 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rojo-insta-ext"
|
name = "rojo"
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
"serde_yaml",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rojo-smallstring"
|
|
||||||
version = "7.1.1"
|
version = "7.1.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
@@ -1863,16 +1900,24 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_yaml",
|
"serde_yaml",
|
||||||
"smol_str",
|
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"termcolor",
|
"termcolor",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
"tracy-client",
|
||||||
"uuid",
|
"uuid",
|
||||||
"walkdir",
|
"walkdir",
|
||||||
"winreg 0.10.1",
|
"winreg 0.10.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rojo-insta-ext"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
"serde_yaml",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc-demangle"
|
name = "rustc-demangle"
|
||||||
version = "0.1.21"
|
version = "0.1.21"
|
||||||
@@ -1888,6 +1933,12 @@ dependencies = [
|
|||||||
"semver",
|
"semver",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustversion"
|
||||||
|
version = "1.0.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ryu"
|
name = "ryu"
|
||||||
version = "1.0.10"
|
version = "1.0.10"
|
||||||
@@ -1913,6 +1964,12 @@ dependencies = [
|
|||||||
"windows-sys",
|
"windows-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "scoped-tls"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "scopeguard"
|
name = "scopeguard"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
@@ -2019,12 +2076,21 @@ version = "0.8.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df"
|
checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"block-buffer",
|
"block-buffer 0.7.3",
|
||||||
"digest",
|
"digest 0.8.1",
|
||||||
"fake-simd",
|
"fake-simd",
|
||||||
"opaque-debug",
|
"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]]
|
[[package]]
|
||||||
name = "similar"
|
name = "similar"
|
||||||
version = "2.1.0"
|
version = "2.1.0"
|
||||||
@@ -2038,13 +2104,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32"
|
checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smol_str"
|
name = "smallvec"
|
||||||
version = "0.1.23"
|
version = "1.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7475118a28b7e3a2e157ce0131ba8c5526ea96e90ee601d9f6bb2e286a35ab44"
|
checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "snax"
|
name = "snax"
|
||||||
@@ -2073,30 +2136,15 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "subtle"
|
name = "subtle"
|
||||||
version = "1.0.0"
|
version = "2.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee"
|
checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "superluminal-perf"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "80ed8ddf5d2a4a849fa7dc75b3e0be740adb882fe7fee87e79584402ac9b1e60"
|
|
||||||
dependencies = [
|
|
||||||
"superluminal-perf-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "superluminal-perf-sys"
|
|
||||||
version = "0.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0342a02bcc62538822a46f54294130677f026666c2e19d078fc213b7bc07ff16"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.95"
|
version = "1.0.96"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fbaf6116ab8924f39d52792136fb74fd60a80194cf1b1c6ffa6453eef1c3f942"
|
checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 1.0.39",
|
"proc-macro2 1.0.39",
|
||||||
"quote 1.0.18",
|
"quote 1.0.18",
|
||||||
@@ -2171,6 +2219,15 @@ dependencies = [
|
|||||||
"syn",
|
"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]]
|
[[package]]
|
||||||
name = "tinytemplate"
|
name = "tinytemplate"
|
||||||
version = "1.2.1"
|
version = "1.2.1"
|
||||||
@@ -2198,9 +2255,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tokio"
|
||||||
version = "1.18.2"
|
version = "1.19.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4903bf0427cf68dddd5aa6a93220756f8be0c34fcfa9f5e6191e103e15a31395"
|
checksum = "95eec79ea28c00a365f539f1961e9278fbcaf81c0ff6aaf0e93c181352446948"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -2225,9 +2282,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio-util"
|
name = "tokio-util"
|
||||||
version = "0.7.2"
|
version = "0.7.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f988a1a1adc2fb21f9c12aa96441da33a1728193ae0b95d2be22dbd17fcb4e5c"
|
checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
@@ -2282,6 +2339,56 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f"
|
checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static",
|
"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]]
|
[[package]]
|
||||||
@@ -2349,14 +2456,20 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "uuid"
|
name = "uuid"
|
||||||
version = "1.0.0"
|
version = "1.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8cfcd319456c4d6ea10087ed423473267e1a071f3bc0aa89f80d60997843c6f0"
|
checksum = "c6d5d669b51467dcf7b2f1a796ce0f955f05f01cafda6c19d6e95f730df29238"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getrandom 0.2.6",
|
"getrandom",
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "valuable"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vcpkg"
|
name = "vcpkg"
|
||||||
version = "0.2.15"
|
version = "0.2.15"
|
||||||
@@ -2412,15 +2525,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
version = "0.9.0+wasi-snapshot-preview1"
|
version = "0.10.2+wasi-snapshot-preview1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
|
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasi"
|
|
||||||
version = "0.10.0+wasi-snapshot-preview1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
|
|||||||
10
Cargo.toml
10
Cargo.toml
@@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rojo-smallstring"
|
name = "rojo"
|
||||||
version = "7.1.1"
|
version = "7.1.1"
|
||||||
authors = ["Lucien Greathouse <me@lpghatguy.com>"]
|
authors = ["Lucien Greathouse <me@lpghatguy.com>"]
|
||||||
description = "Enables professional-grade development tools for Roblox developers"
|
description = "Enables professional-grade development tools for Roblox developers"
|
||||||
@@ -27,6 +27,8 @@ default = []
|
|||||||
# Enable this feature to live-reload assets from the web UI.
|
# Enable this feature to live-reload assets from the web UI.
|
||||||
dev_live_assets = []
|
dev_live_assets = []
|
||||||
|
|
||||||
|
profile-with-tracy = ["profiling/profile-with-tracy", "tracy-client"]
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = ["crates/*"]
|
members = ["crates/*"]
|
||||||
|
|
||||||
@@ -49,7 +51,7 @@ memofs = { version = "0.2.0", path = "crates/memofs" }
|
|||||||
# rbx_xml = { path = "../rbx-dom/rbx_xml" }
|
# rbx_xml = { path = "../rbx-dom/rbx_xml" }
|
||||||
|
|
||||||
rbx_binary = "0.6.4"
|
rbx_binary = "0.6.4"
|
||||||
rbx_dom_weak = "2.3.0"
|
rbx_dom_weak = "2.4.0"
|
||||||
rbx_reflection = "4.2.0"
|
rbx_reflection = "4.2.0"
|
||||||
rbx_reflection_database = "0.2.2"
|
rbx_reflection_database = "0.2.2"
|
||||||
rbx_xml = "0.12.3"
|
rbx_xml = "0.12.3"
|
||||||
@@ -80,8 +82,8 @@ thiserror = "1.0.30"
|
|||||||
tokio = { version = "1.12.0", features = ["rt", "rt-multi-thread"] }
|
tokio = { version = "1.12.0", features = ["rt", "rt-multi-thread"] }
|
||||||
uuid = { version = "1.0.0", features = ["v4", "serde"] }
|
uuid = { version = "1.0.0", features = ["v4", "serde"] }
|
||||||
clap = { version = "3.1.18", features = ["derive"] }
|
clap = { version = "3.1.18", features = ["derive"] }
|
||||||
smol_str = "0.1.23"
|
profiling = "1.0.6"
|
||||||
profiling = { version = "1.0.6", features = ["profile-with-superluminal"] }
|
tracy-client = { version = "0.13.2", optional = true }
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies]
|
[target.'cfg(windows)'.dependencies]
|
||||||
winreg = "0.10.1"
|
winreg = "0.10.1"
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
source: tests/tests/build.rs
|
||||||
|
assertion_line: 98
|
||||||
|
expression: contents
|
||||||
|
---
|
||||||
|
<roblox version="4">
|
||||||
|
<Item class="LocalScript" referent="0">
|
||||||
|
<Properties>
|
||||||
|
<string name="Name">issue_546</string>
|
||||||
|
<bool name="Disabled">true</bool>
|
||||||
|
<string name="Source">print("Hello, world!")</string>
|
||||||
|
</Properties>
|
||||||
|
</Item>
|
||||||
|
</roblox>
|
||||||
2
rojo-test/build-tests/issue_546/README.md
Normal file
2
rojo-test/build-tests/issue_546/README.md
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# Issue #546 (https://github.com/rojo-rbx/rojo/issues/546)
|
||||||
|
Regression from Rojo 6.2.0 to Rojo 7.0.0. Meta files named as init.meta.json should apply after init.client.lua and other init files.
|
||||||
6
rojo-test/build-tests/issue_546/default.project.json
Normal file
6
rojo-test/build-tests/issue_546/default.project.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "issue_546",
|
||||||
|
"tree": {
|
||||||
|
"$path": "hello"
|
||||||
|
}
|
||||||
|
}
|
||||||
1
rojo-test/build-tests/issue_546/hello/init.client.lua
Normal file
1
rojo-test/build-tests/issue_546/hello/init.client.lua
Normal file
@@ -0,0 +1 @@
|
|||||||
|
print("Hello, world!")
|
||||||
5
rojo-test/build-tests/issue_546/hello/init.meta.json
Normal file
5
rojo-test/build-tests/issue_546/hello/init.meta.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"Disabled": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -46,7 +46,6 @@ pub struct ChangeProcessor {
|
|||||||
impl ChangeProcessor {
|
impl ChangeProcessor {
|
||||||
/// Spin up the ChangeProcessor, connecting it to the given tree, VFS, and
|
/// Spin up the ChangeProcessor, connecting it to the given tree, VFS, and
|
||||||
/// outbound message queue.
|
/// outbound message queue.
|
||||||
#[profiling::function]
|
|
||||||
pub fn start(
|
pub fn start(
|
||||||
tree: Arc<Mutex<RojoTree>>,
|
tree: Arc<Mutex<RojoTree>>,
|
||||||
vfs: Arc<Vfs>,
|
vfs: Arc<Vfs>,
|
||||||
@@ -292,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)
|
apply_patch_set(tree, patch_set)
|
||||||
}
|
}
|
||||||
Ok(None) => {
|
Ok(None) => {
|
||||||
@@ -335,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)
|
apply_patch_set(tree, patch_set)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
use std::{
|
use std::{
|
||||||
io::{BufWriter, Write},
|
io::{BufWriter, Write},
|
||||||
|
mem::forget,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -61,6 +62,10 @@ impl BuildCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Avoid dropping ServeSession: it's potentially VERY expensive to drop
|
||||||
|
// and we're about to exit anyways.
|
||||||
|
forget(session);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ mod init;
|
|||||||
mod plugin;
|
mod plugin;
|
||||||
mod serve;
|
mod serve;
|
||||||
mod sourcemap;
|
mod sourcemap;
|
||||||
|
mod unpack;
|
||||||
mod upload;
|
mod upload;
|
||||||
|
|
||||||
use std::{borrow::Cow, env, path::Path, str::FromStr};
|
use std::{borrow::Cow, env, path::Path, str::FromStr};
|
||||||
@@ -21,6 +22,7 @@ pub use self::init::{InitCommand, InitKind};
|
|||||||
pub use self::plugin::{PluginCommand, PluginSubcommand};
|
pub use self::plugin::{PluginCommand, PluginSubcommand};
|
||||||
pub use self::serve::ServeCommand;
|
pub use self::serve::ServeCommand;
|
||||||
pub use self::sourcemap::SourcemapCommand;
|
pub use self::sourcemap::SourcemapCommand;
|
||||||
|
pub use self::unpack::UnpackCommand;
|
||||||
pub use self::upload::UploadCommand;
|
pub use self::upload::UploadCommand;
|
||||||
|
|
||||||
/// Command line options that Rojo accepts, defined using the clap crate.
|
/// Command line options that Rojo accepts, defined using the clap crate.
|
||||||
@@ -46,6 +48,7 @@ impl Options {
|
|||||||
Subcommand::FmtProject(subcommand) => subcommand.run(),
|
Subcommand::FmtProject(subcommand) => subcommand.run(),
|
||||||
Subcommand::Doc(subcommand) => subcommand.run(),
|
Subcommand::Doc(subcommand) => subcommand.run(),
|
||||||
Subcommand::Plugin(subcommand) => subcommand.run(),
|
Subcommand::Plugin(subcommand) => subcommand.run(),
|
||||||
|
Subcommand::Unpack(subcommand) => subcommand.run(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,6 +122,7 @@ pub enum Subcommand {
|
|||||||
FmtProject(FmtProjectCommand),
|
FmtProject(FmtProjectCommand),
|
||||||
Doc(DocCommand),
|
Doc(DocCommand),
|
||||||
Plugin(PluginCommand),
|
Plugin(PluginCommand),
|
||||||
|
Unpack(UnpackCommand),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn resolve_path(path: &Path) -> Cow<'_, Path> {
|
pub(super) fn resolve_path(path: &Path) -> Cow<'_, Path> {
|
||||||
|
|||||||
65
src/cli/unpack.rs
Normal file
65
src/cli/unpack.rs
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
use std::{io::BufReader, path::PathBuf};
|
||||||
|
|
||||||
|
use anyhow::bail;
|
||||||
|
use clap::Parser;
|
||||||
|
use fs_err::File;
|
||||||
|
use rbx_dom_weak::{Instance, WeakDom};
|
||||||
|
|
||||||
|
use crate::{Project, ProjectNode};
|
||||||
|
|
||||||
|
use super::resolve_path;
|
||||||
|
|
||||||
|
/// Unpack a Roblox place file into an existing Rojo project.
|
||||||
|
#[derive(Debug, Parser)]
|
||||||
|
pub struct UnpackCommand {
|
||||||
|
/// Path to the project to unpack. Defaults to the current directory.
|
||||||
|
#[clap(long, default_value = "")]
|
||||||
|
pub project: PathBuf,
|
||||||
|
|
||||||
|
/// Path to the place to unpack from.
|
||||||
|
pub place: PathBuf,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UnpackCommand {
|
||||||
|
pub fn run(self) -> anyhow::Result<()> {
|
||||||
|
let project_path = resolve_path(&self.project);
|
||||||
|
let project = match Project::load_fuzzy(&project_path)? {
|
||||||
|
Some(project) => project,
|
||||||
|
None => bail!("No project file was found; rojo unpack requires a project file."),
|
||||||
|
};
|
||||||
|
|
||||||
|
let place_ext = self
|
||||||
|
.place
|
||||||
|
.extension()
|
||||||
|
.and_then(|ext| ext.to_str())
|
||||||
|
.map(|ext| ext.to_lowercase());
|
||||||
|
|
||||||
|
let file = BufReader::new(File::open(&self.place)?);
|
||||||
|
|
||||||
|
let dom = match place_ext.as_deref() {
|
||||||
|
Some("rbxl") => rbx_binary::from_reader(file)?,
|
||||||
|
Some("rbxlx") => rbx_xml::from_reader_default(file)?,
|
||||||
|
Some(_) | None => bail!("Place files must end in .rbxl or .rbxlx"),
|
||||||
|
};
|
||||||
|
|
||||||
|
let context = Context { project, dom };
|
||||||
|
context.unpack();
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Context {
|
||||||
|
project: Project,
|
||||||
|
dom: WeakDom,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Context {
|
||||||
|
fn unpack(&self) {
|
||||||
|
self.unpack_node(&self.project.tree, self.dom.root());
|
||||||
|
}
|
||||||
|
|
||||||
|
fn unpack_node(&self, node: &ProjectNode, instance: &Instance) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,7 +18,6 @@ mod project;
|
|||||||
mod resolution;
|
mod resolution;
|
||||||
mod serve_session;
|
mod serve_session;
|
||||||
mod session_id;
|
mod session_id;
|
||||||
mod small_string;
|
|
||||||
mod snapshot;
|
mod snapshot;
|
||||||
mod snapshot_middleware;
|
mod snapshot_middleware;
|
||||||
mod web;
|
mod web;
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ use clap::Parser;
|
|||||||
use librojo::cli::Options;
|
use librojo::cli::Options;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
profiling::register_thread!("Main Thread");
|
#[cfg(feature = "profile-with-tracy")]
|
||||||
|
tracy_client::Client::start();
|
||||||
|
|
||||||
panic::set_hook(Box::new(|panic_info| {
|
panic::set_hook(Box::new(|panic_info| {
|
||||||
// PanicInfo's payload is usually a &'static str or String.
|
// PanicInfo's payload is usually a &'static str or String.
|
||||||
|
|||||||
@@ -96,7 +96,6 @@ impl ServeSession {
|
|||||||
/// The project file is expected to be loaded out-of-band since it's
|
/// The project file is expected to be loaded out-of-band since it's
|
||||||
/// currently loaded from the filesystem directly instead of through the
|
/// currently loaded from the filesystem directly instead of through the
|
||||||
/// in-memory filesystem layer.
|
/// in-memory filesystem layer.
|
||||||
#[profiling::function]
|
|
||||||
pub fn new<P: AsRef<Path>>(vfs: Vfs, start_path: P) -> Result<Self, ServeSessionError> {
|
pub fn new<P: AsRef<Path>>(vfs: Vfs, start_path: P) -> Result<Self, ServeSessionError> {
|
||||||
let start_path = start_path.as_ref();
|
let start_path = start_path.as_ref();
|
||||||
let start_time = Instant::now();
|
let start_time = Instant::now();
|
||||||
@@ -131,7 +130,7 @@ impl ServeSession {
|
|||||||
let snapshot = snapshot_from_vfs(&instance_context, &vfs, &start_path)?;
|
let snapshot = snapshot_from_vfs(&instance_context, &vfs, &start_path)?;
|
||||||
|
|
||||||
log::trace!("Computing initial patch set");
|
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");
|
log::trace!("Applying initial patch set");
|
||||||
apply_patch_set(&mut tree, patch_set);
|
apply_patch_set(&mut tree, patch_set);
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
pub use smol_str::SmolStr as SmallString;
|
|
||||||
@@ -1,15 +1,13 @@
|
|||||||
//! Defines the structure of an instance snapshot.
|
//! Defines the structure of an instance snapshot.
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::{borrow::Cow, collections::HashMap};
|
||||||
|
|
||||||
use rbx_dom_weak::{
|
use rbx_dom_weak::{
|
||||||
types::{Ref, Variant},
|
types::{Ref, Variant},
|
||||||
WeakDom,
|
Instance, WeakDom,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::small_string::SmallString;
|
|
||||||
|
|
||||||
use super::InstanceMetadata;
|
use super::InstanceMetadata;
|
||||||
|
|
||||||
/// A lightweight description of what an instance should look like.
|
/// A lightweight description of what an instance should look like.
|
||||||
@@ -27,13 +25,13 @@ pub struct InstanceSnapshot {
|
|||||||
pub metadata: InstanceMetadata,
|
pub metadata: InstanceMetadata,
|
||||||
|
|
||||||
/// Correpsonds to the Name property of the instance.
|
/// Correpsonds to the Name property of the instance.
|
||||||
pub name: SmallString,
|
pub name: Cow<'static, str>,
|
||||||
|
|
||||||
/// Corresponds to the ClassName property of the instance.
|
/// Corresponds to the ClassName property of the instance.
|
||||||
pub class_name: SmallString,
|
pub class_name: Cow<'static, str>,
|
||||||
|
|
||||||
/// All other properties of the instance, weakly-typed.
|
/// All other properties of the instance, weakly-typed.
|
||||||
pub properties: HashMap<SmallString, Variant>,
|
pub properties: HashMap<String, Variant>,
|
||||||
|
|
||||||
/// The children of the instance represented as more snapshots.
|
/// The children of the instance represented as more snapshots.
|
||||||
///
|
///
|
||||||
@@ -46,37 +44,37 @@ impl InstanceSnapshot {
|
|||||||
Self {
|
Self {
|
||||||
snapshot_id: None,
|
snapshot_id: None,
|
||||||
metadata: InstanceMetadata::default(),
|
metadata: InstanceMetadata::default(),
|
||||||
name: "DEFAULT".into(),
|
name: Cow::Borrowed("DEFAULT"),
|
||||||
class_name: "DEFAULT".into(),
|
class_name: Cow::Borrowed("DEFAULT"),
|
||||||
properties: HashMap::new(),
|
properties: HashMap::new(),
|
||||||
children: Vec::new(),
|
children: Vec::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name(self, name: impl Into<SmallString>) -> Self {
|
pub fn name(self, name: impl Into<String>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
name: name.into(),
|
name: Cow::Owned(name.into()),
|
||||||
..self
|
..self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn class_name(self, class_name: impl Into<SmallString>) -> Self {
|
pub fn class_name(self, class_name: impl Into<String>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
class_name: class_name.into(),
|
class_name: Cow::Owned(class_name.into()),
|
||||||
..self
|
..self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn property<K, V>(mut self, key: K, value: V) -> Self
|
pub fn property<K, V>(mut self, key: K, value: V) -> Self
|
||||||
where
|
where
|
||||||
K: Into<SmallString>,
|
K: Into<String>,
|
||||||
V: Into<Variant>,
|
V: Into<Variant>,
|
||||||
{
|
{
|
||||||
self.properties.insert(key.into(), value.into());
|
self.properties.insert(key.into(), value.into());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn properties(self, properties: impl Into<HashMap<SmallString, Variant>>) -> Self {
|
pub fn properties(self, properties: impl Into<HashMap<String, Variant>>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
properties: properties.into(),
|
properties: properties.into(),
|
||||||
..self
|
..self
|
||||||
@@ -104,28 +102,29 @@ impl InstanceSnapshot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_tree(tree: &WeakDom, id: Ref) -> Self {
|
#[profiling::function]
|
||||||
let instance = tree.get_by_ref(id).expect("instance did not exist in tree");
|
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
|
let children = instance
|
||||||
.children()
|
.children()
|
||||||
.iter()
|
.iter()
|
||||||
.copied()
|
.map(|&id| Self::from_raw_tree(raw_tree, id))
|
||||||
.map(|id| Self::from_tree(tree, id))
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
let properties = instance
|
|
||||||
.properties
|
|
||||||
.iter()
|
|
||||||
.map(|(key, value)| (key.into(), value.clone()))
|
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
snapshot_id: Some(id),
|
snapshot_id: Some(id),
|
||||||
metadata: InstanceMetadata::default(),
|
metadata: InstanceMetadata::default(),
|
||||||
name: SmallString::from(&instance.name),
|
name: Cow::Owned(instance.name),
|
||||||
class_name: SmallString::from(&instance.class),
|
class_name: Cow::Owned(instance.class),
|
||||||
properties,
|
properties: instance.properties,
|
||||||
children,
|
children,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ use std::collections::HashMap;
|
|||||||
use rbx_dom_weak::types::{Ref, Variant};
|
use rbx_dom_weak::types::{Ref, Variant};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::small_string::SmallString;
|
|
||||||
|
|
||||||
use super::{InstanceMetadata, InstanceSnapshot};
|
use super::{InstanceMetadata, InstanceSnapshot};
|
||||||
|
|
||||||
/// A set of different kinds of patches that can be applied to an WeakDom.
|
/// A set of different kinds of patches that can be applied to an WeakDom.
|
||||||
@@ -42,12 +40,12 @@ pub struct PatchAdd {
|
|||||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct PatchUpdate {
|
pub struct PatchUpdate {
|
||||||
pub id: Ref,
|
pub id: Ref,
|
||||||
pub changed_name: Option<SmallString>,
|
pub changed_name: Option<String>,
|
||||||
pub changed_class_name: Option<SmallString>,
|
pub changed_class_name: Option<String>,
|
||||||
|
|
||||||
/// Contains all changed properties. If a property is assigned to `None`,
|
/// Contains all changed properties. If a property is assigned to `None`,
|
||||||
/// then that property has been removed.
|
/// then that property has been removed.
|
||||||
pub changed_properties: HashMap<SmallString, Option<Variant>>,
|
pub changed_properties: HashMap<String, Option<Variant>>,
|
||||||
|
|
||||||
/// Changed Rojo-specific metadata, if any of it changed.
|
/// Changed Rojo-specific metadata, if any of it changed.
|
||||||
pub changed_metadata: Option<InstanceMetadata>,
|
pub changed_metadata: Option<InstanceMetadata>,
|
||||||
@@ -85,9 +83,9 @@ pub struct AppliedPatchUpdate {
|
|||||||
pub id: Ref,
|
pub id: Ref,
|
||||||
|
|
||||||
// TODO: Store previous values in order to detect application conflicts
|
// TODO: Store previous values in order to detect application conflicts
|
||||||
pub changed_name: Option<SmallString>,
|
pub changed_name: Option<String>,
|
||||||
pub changed_class_name: Option<SmallString>,
|
pub changed_class_name: Option<String>,
|
||||||
pub changed_properties: HashMap<SmallString, Option<Variant>>,
|
pub changed_properties: HashMap<String, Option<Variant>>,
|
||||||
pub changed_metadata: Option<InstanceMetadata>,
|
pub changed_metadata: Option<InstanceMetadata>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
//! Defines the algorithm for applying generated patches.
|
//! 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};
|
use rbx_dom_weak::types::{Ref, Variant};
|
||||||
|
|
||||||
use crate::small_string::SmallString;
|
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
patch::{AppliedPatchSet, AppliedPatchUpdate, PatchSet, PatchUpdate},
|
patch::{AppliedPatchSet, AppliedPatchUpdate, PatchSet, PatchUpdate},
|
||||||
InstanceSnapshot, RojoTree,
|
InstanceSnapshot, RojoTree,
|
||||||
@@ -18,18 +19,27 @@ use super::{
|
|||||||
pub fn apply_patch_set(tree: &mut RojoTree, patch_set: PatchSet) -> AppliedPatchSet {
|
pub fn apply_patch_set(tree: &mut RojoTree, patch_set: PatchSet) -> AppliedPatchSet {
|
||||||
let mut context = PatchApplyContext::default();
|
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.
|
profiling::scope!("updates");
|
||||||
for update_patch in patch_set.updated_instances {
|
// Updates need to be applied after additions, which reduces the complexity
|
||||||
apply_update_child(&mut context, tree, update_patch);
|
// of updates significantly.
|
||||||
|
for update_patch in patch_set.updated_instances {
|
||||||
|
apply_update_child(&mut context, tree, update_patch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
finalize_patch_application(context, tree)
|
finalize_patch_application(context, tree)
|
||||||
@@ -58,20 +68,9 @@ struct PatchApplyContext {
|
|||||||
/// eachother.
|
/// eachother.
|
||||||
snapshot_id_to_instance_id: HashMap<Ref, Ref>,
|
snapshot_id_to_instance_id: HashMap<Ref, Ref>,
|
||||||
|
|
||||||
/// The properties of instances added by the current `PatchSet`.
|
/// Tracks all of the instances added by this patch that have refs that need
|
||||||
///
|
/// to be rewritten.
|
||||||
/// Instances added to the tree can refer to eachother via Ref properties,
|
has_refs_to_rewrite: HashSet<Ref>,
|
||||||
/// 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<SmallString, Variant>>,
|
|
||||||
|
|
||||||
/// The current applied patch result, describing changes made to the tree.
|
/// The current applied patch result, describing changes made to the tree.
|
||||||
applied_patch_set: AppliedPatchSet,
|
applied_patch_set: AppliedPatchSet,
|
||||||
@@ -87,25 +86,22 @@ struct PatchApplyContext {
|
|||||||
/// The remaining Ref properties need to be handled during patch application,
|
/// 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,
|
/// 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.
|
/// then apply properties all at once at the end.
|
||||||
|
#[profiling::function]
|
||||||
fn finalize_patch_application(context: PatchApplyContext, tree: &mut RojoTree) -> AppliedPatchSet {
|
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
|
// This should always succeed since instances marked as added in our
|
||||||
// patch should be added without fail.
|
// patch should be added without fail.
|
||||||
let mut instance = tree
|
let mut instance = tree
|
||||||
.get_instance_mut(id)
|
.get_instance_mut(id)
|
||||||
.expect("Invalid instance ID in deferred property map");
|
.expect("Invalid instance ID in deferred property map");
|
||||||
|
|
||||||
for (key, mut property_value) in properties {
|
for value in instance.properties_mut().values_mut() {
|
||||||
if let Variant::Ref(referent) = property_value {
|
if let Variant::Ref(referent) = value {
|
||||||
if let Some(&instance_referent) = context.snapshot_id_to_instance_id.get(&referent)
|
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.to_string(), property_value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,24 +117,24 @@ fn apply_add_child(
|
|||||||
context: &mut PatchApplyContext,
|
context: &mut PatchApplyContext,
|
||||||
tree: &mut RojoTree,
|
tree: &mut RojoTree,
|
||||||
parent_id: Ref,
|
parent_id: Ref,
|
||||||
snapshot: InstanceSnapshot,
|
mut snapshot: InstanceSnapshot,
|
||||||
) {
|
) {
|
||||||
let snapshot_id = snapshot.snapshot_id;
|
let snapshot_id = snapshot.snapshot_id;
|
||||||
let properties = snapshot.properties;
|
let children = take(&mut snapshot.children);
|
||||||
let children = snapshot.children;
|
|
||||||
|
|
||||||
// Property application is deferred until after all children
|
// If an object we're adding has a non-null referent, we'll note this
|
||||||
// are constructed. This helps apply referents correctly.
|
// instance down as needing to be revisited later.
|
||||||
let remaining_snapshot = InstanceSnapshot::new()
|
let has_refs = snapshot.properties.values().any(|value| match value {
|
||||||
.name(snapshot.name)
|
Variant::Ref(value) => value.is_some(),
|
||||||
.class_name(snapshot.class_name)
|
_ => false,
|
||||||
.metadata(snapshot.metadata)
|
});
|
||||||
.snapshot_id(snapshot.snapshot_id);
|
|
||||||
|
|
||||||
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.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 {
|
if let Some(snapshot_id) = snapshot_id {
|
||||||
context.snapshot_id_to_instance_id.insert(snapshot_id, id);
|
context.snapshot_id_to_instance_id.insert(snapshot_id, id);
|
||||||
@@ -169,13 +165,13 @@ fn apply_update_child(context: &mut PatchApplyContext, tree: &mut RojoTree, patc
|
|||||||
};
|
};
|
||||||
|
|
||||||
if let Some(name) = patch.changed_name {
|
if let Some(name) = patch.changed_name {
|
||||||
*instance.name_mut() = name.to_string();
|
*instance.name_mut() = name.clone();
|
||||||
applied_patch.changed_name = Some(name.into());
|
applied_patch.changed_name = Some(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(class_name) = patch.changed_class_name {
|
if let Some(class_name) = patch.changed_class_name {
|
||||||
*instance.class_name_mut() = class_name.to_string();
|
*instance.class_name_mut() = class_name.clone();
|
||||||
applied_patch.changed_class_name = Some(class_name.into());
|
applied_patch.changed_class_name = Some(class_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (key, property_entry) in patch.changed_properties {
|
for (key, property_entry) in patch.changed_properties {
|
||||||
@@ -200,15 +196,13 @@ fn apply_update_child(context: &mut PatchApplyContext, tree: &mut RojoTree, patc
|
|||||||
|
|
||||||
instance
|
instance
|
||||||
.properties_mut()
|
.properties_mut()
|
||||||
.insert(key.to_string(), Variant::Ref(new_referent));
|
.insert(key.clone(), Variant::Ref(new_referent));
|
||||||
}
|
}
|
||||||
Some(ref value) => {
|
Some(ref value) => {
|
||||||
instance
|
instance.properties_mut().insert(key.clone(), value.clone());
|
||||||
.properties_mut()
|
|
||||||
.insert(key.to_string(), value.clone());
|
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
instance.properties_mut().remove(key.as_str());
|
instance.properties_mut().remove(&key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
//! Defines the algorithm for computing a roughly-minimal patch set given an
|
//! Defines the algorithm for computing a roughly-minimal patch set given an
|
||||||
//! existing instance tree and an instance snapshot.
|
//! 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};
|
use rbx_dom_weak::types::{Ref, Variant};
|
||||||
|
|
||||||
@@ -11,11 +14,7 @@ use super::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
#[profiling::function]
|
#[profiling::function]
|
||||||
pub fn compute_patch_set(
|
pub fn compute_patch_set(snapshot: Option<InstanceSnapshot>, tree: &RojoTree, id: Ref) -> PatchSet {
|
||||||
snapshot: Option<&InstanceSnapshot>,
|
|
||||||
tree: &RojoTree,
|
|
||||||
id: Ref,
|
|
||||||
) -> PatchSet {
|
|
||||||
let mut patch_set = PatchSet::new();
|
let mut patch_set = PatchSet::new();
|
||||||
|
|
||||||
if let Some(snapshot) = snapshot {
|
if let Some(snapshot) = snapshot {
|
||||||
@@ -75,7 +74,7 @@ fn rewrite_refs_in_snapshot(context: &ComputePatchContext, snapshot: &mut Instan
|
|||||||
|
|
||||||
fn compute_patch_set_internal(
|
fn compute_patch_set_internal(
|
||||||
context: &mut ComputePatchContext,
|
context: &mut ComputePatchContext,
|
||||||
snapshot: &InstanceSnapshot,
|
mut snapshot: InstanceSnapshot,
|
||||||
tree: &RojoTree,
|
tree: &RojoTree,
|
||||||
id: Ref,
|
id: Ref,
|
||||||
patch_set: &mut PatchSet,
|
patch_set: &mut PatchSet,
|
||||||
@@ -88,12 +87,12 @@ fn compute_patch_set_internal(
|
|||||||
.get_instance(id)
|
.get_instance(id)
|
||||||
.expect("Instance did not exist in tree");
|
.expect("Instance did not exist in tree");
|
||||||
|
|
||||||
compute_property_patches(snapshot, &instance, patch_set);
|
compute_property_patches(&mut snapshot, &instance, patch_set);
|
||||||
compute_children_patches(context, snapshot, tree, id, patch_set);
|
compute_children_patches(context, &mut snapshot, tree, id, patch_set);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compute_property_patches(
|
fn compute_property_patches(
|
||||||
snapshot: &InstanceSnapshot,
|
snapshot: &mut InstanceSnapshot,
|
||||||
instance: &InstanceWithMeta,
|
instance: &InstanceWithMeta,
|
||||||
patch_set: &mut PatchSet,
|
patch_set: &mut PatchSet,
|
||||||
) {
|
) {
|
||||||
@@ -103,32 +102,32 @@ fn compute_property_patches(
|
|||||||
let changed_name = if snapshot.name == instance.name() {
|
let changed_name = if snapshot.name == instance.name() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(snapshot.name.clone())
|
Some(take(&mut snapshot.name).into_owned())
|
||||||
};
|
};
|
||||||
|
|
||||||
let changed_class_name = if snapshot.class_name == instance.class_name() {
|
let changed_class_name = if snapshot.class_name == instance.class_name() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(snapshot.class_name.clone())
|
Some(take(&mut snapshot.class_name).into_owned())
|
||||||
};
|
};
|
||||||
|
|
||||||
let changed_metadata = if &snapshot.metadata == instance.metadata() {
|
let changed_metadata = if &snapshot.metadata == instance.metadata() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(snapshot.metadata.clone())
|
Some(take(&mut snapshot.metadata))
|
||||||
};
|
};
|
||||||
|
|
||||||
for (name, snapshot_value) in &snapshot.properties {
|
for (name, snapshot_value) in take(&mut snapshot.properties) {
|
||||||
visited_properties.insert(name.as_str());
|
visited_properties.insert(name.clone());
|
||||||
|
|
||||||
match instance.properties().get(name.as_str()) {
|
match instance.properties().get(&name) {
|
||||||
Some(instance_value) => {
|
Some(instance_value) => {
|
||||||
if snapshot_value != instance_value {
|
if &snapshot_value != instance_value {
|
||||||
changed_properties.insert(name.clone(), Some(snapshot_value.clone()));
|
changed_properties.insert(name, Some(snapshot_value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
changed_properties.insert(name.clone(), Some(snapshot_value.clone()));
|
changed_properties.insert(name, Some(snapshot_value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -138,7 +137,7 @@ fn compute_property_patches(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
changed_properties.insert(name.into(), None);
|
changed_properties.insert(name.clone(), None);
|
||||||
}
|
}
|
||||||
|
|
||||||
if changed_properties.is_empty()
|
if changed_properties.is_empty()
|
||||||
@@ -160,7 +159,7 @@ fn compute_property_patches(
|
|||||||
|
|
||||||
fn compute_children_patches(
|
fn compute_children_patches(
|
||||||
context: &mut ComputePatchContext,
|
context: &mut ComputePatchContext,
|
||||||
snapshot: &InstanceSnapshot,
|
snapshot: &mut InstanceSnapshot,
|
||||||
tree: &RojoTree,
|
tree: &RojoTree,
|
||||||
id: Ref,
|
id: Ref,
|
||||||
patch_set: &mut PatchSet,
|
patch_set: &mut PatchSet,
|
||||||
@@ -173,7 +172,7 @@ fn compute_children_patches(
|
|||||||
|
|
||||||
let mut paired_instances = vec![false; instance_children.len()];
|
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 =
|
let matching_instance =
|
||||||
instance_children
|
instance_children
|
||||||
.iter()
|
.iter()
|
||||||
@@ -210,7 +209,7 @@ fn compute_children_patches(
|
|||||||
None => {
|
None => {
|
||||||
patch_set.added_instances.push(PatchAdd {
|
patch_set.added_instances.push(PatchAdd {
|
||||||
parent_id: id,
|
parent_id: id,
|
||||||
instance: snapshot_child.clone(),
|
instance: snapshot_child,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -258,7 +257,7 @@ mod test {
|
|||||||
children: Vec::new(),
|
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 {
|
let expected_patch_set = PatchSet {
|
||||||
updated_instances: vec![PatchUpdate {
|
updated_instances: vec![PatchUpdate {
|
||||||
@@ -308,7 +307,7 @@ mod test {
|
|||||||
class_name: Cow::Borrowed("foo"),
|
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 {
|
let expected_patch_set = PatchSet {
|
||||||
added_instances: vec![PatchAdd {
|
added_instances: vec![PatchAdd {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ fn set_name_and_class_name() {
|
|||||||
children: Vec::new(),
|
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);
|
let patch_value = redactions.redacted_yaml(patch_set);
|
||||||
|
|
||||||
assert_yaml_snapshot!(patch_value);
|
assert_yaml_snapshot!(patch_value);
|
||||||
@@ -47,7 +47,7 @@ fn set_property() {
|
|||||||
children: Vec::new(),
|
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);
|
let patch_value = redactions.redacted_yaml(patch_set);
|
||||||
|
|
||||||
assert_yaml_snapshot!(patch_value);
|
assert_yaml_snapshot!(patch_value);
|
||||||
@@ -78,7 +78,7 @@ fn remove_property() {
|
|||||||
children: Vec::new(),
|
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);
|
let patch_value = redactions.redacted_yaml(patch_set);
|
||||||
|
|
||||||
assert_yaml_snapshot!(patch_value);
|
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);
|
let patch_value = redactions.redacted_yaml(patch_set);
|
||||||
|
|
||||||
assert_yaml_snapshot!(patch_value);
|
assert_yaml_snapshot!(patch_value);
|
||||||
@@ -139,7 +139,7 @@ fn remove_child() {
|
|||||||
children: Vec::new(),
|
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);
|
let patch_value = redactions.redacted_yaml(patch_set);
|
||||||
|
|
||||||
assert_yaml_snapshot!(patch_value);
|
assert_yaml_snapshot!(patch_value);
|
||||||
|
|||||||
@@ -87,8 +87,9 @@ impl RojoTree {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn insert_instance(&mut self, parent_ref: Ref, snapshot: InstanceSnapshot) -> Ref {
|
pub fn insert_instance(&mut self, parent_ref: Ref, snapshot: InstanceSnapshot) -> Ref {
|
||||||
let builder = InstanceBuilder::new(snapshot.class_name.to_owned())
|
let builder = InstanceBuilder::empty()
|
||||||
.with_name(snapshot.name.to_owned())
|
.with_class(snapshot.class_name.into_owned())
|
||||||
|
.with_name(snapshot.name.into_owned())
|
||||||
.with_properties(snapshot.properties);
|
.with_properties(snapshot.properties);
|
||||||
|
|
||||||
let referent = self.inner.insert(parent_ref, builder);
|
let referent = self.inner.insert(parent_ref, builder);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ pub fn snapshot_csv(
|
|||||||
.name(name)
|
.name(name)
|
||||||
.class_name("LocalizationTable")
|
.class_name("LocalizationTable")
|
||||||
.properties(hashmap! {
|
.properties(hashmap! {
|
||||||
"Contents".into() => table_contents.into(),
|
"Contents".to_owned() => table_contents.into(),
|
||||||
})
|
})
|
||||||
.metadata(
|
.metadata(
|
||||||
InstanceMetadata::new()
|
InstanceMetadata::new()
|
||||||
|
|||||||
@@ -10,6 +10,40 @@ pub fn snapshot_dir(
|
|||||||
context: &InstanceContext,
|
context: &InstanceContext,
|
||||||
vfs: &Vfs,
|
vfs: &Vfs,
|
||||||
path: &Path,
|
path: &Path,
|
||||||
|
) -> anyhow::Result<Option<InstanceSnapshot>> {
|
||||||
|
let mut snapshot = match snapshot_dir_no_meta(context, vfs, path)? {
|
||||||
|
Some(snapshot) => snapshot,
|
||||||
|
None => return Ok(None),
|
||||||
|
};
|
||||||
|
|
||||||
|
if let Some(mut meta) = dir_meta(vfs, path)? {
|
||||||
|
meta.apply_all(&mut snapshot)?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(Some(snapshot))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Retrieves the meta file that should be applied for this directory, if it
|
||||||
|
/// exists.
|
||||||
|
pub fn dir_meta(vfs: &Vfs, path: &Path) -> anyhow::Result<Option<DirectoryMetadata>> {
|
||||||
|
let meta_path = path.join("init.meta.json");
|
||||||
|
|
||||||
|
if let Some(meta_contents) = vfs.read(&meta_path).with_not_found()? {
|
||||||
|
let metadata = DirectoryMetadata::from_slice(&meta_contents, meta_path)?;
|
||||||
|
Ok(Some(metadata))
|
||||||
|
} else {
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Snapshot a directory without applying meta files; useful for if the
|
||||||
|
/// directory's ClassName will change before metadata should be applied. For
|
||||||
|
/// example, this can happen if the directory contains an `init.client.lua`
|
||||||
|
/// file.
|
||||||
|
pub fn snapshot_dir_no_meta(
|
||||||
|
context: &InstanceContext,
|
||||||
|
vfs: &Vfs,
|
||||||
|
path: &Path,
|
||||||
) -> anyhow::Result<Option<InstanceSnapshot>> {
|
) -> anyhow::Result<Option<InstanceSnapshot>> {
|
||||||
let passes_filter_rules = |child: &DirEntry| {
|
let passes_filter_rules = |child: &DirEntry| {
|
||||||
context
|
context
|
||||||
@@ -52,7 +86,7 @@ pub fn snapshot_dir(
|
|||||||
path.join("init.client.lua"),
|
path.join("init.client.lua"),
|
||||||
];
|
];
|
||||||
|
|
||||||
let mut snapshot = InstanceSnapshot::new()
|
let snapshot = InstanceSnapshot::new()
|
||||||
.name(instance_name)
|
.name(instance_name)
|
||||||
.class_name("Folder")
|
.class_name("Folder")
|
||||||
.children(snapshot_children)
|
.children(snapshot_children)
|
||||||
@@ -63,11 +97,6 @@ pub fn snapshot_dir(
|
|||||||
.context(context),
|
.context(context),
|
||||||
);
|
);
|
||||||
|
|
||||||
if let Some(meta_contents) = vfs.read(&meta_path).with_not_found()? {
|
|
||||||
let mut metadata = DirectoryMetadata::from_slice(&meta_contents, meta_path)?;
|
|
||||||
metadata.apply_all(&mut snapshot)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(Some(snapshot))
|
Ok(Some(snapshot))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ pub fn snapshot_json(
|
|||||||
let as_lua = json_to_lua(value).to_string();
|
let as_lua = json_to_lua(value).to_string();
|
||||||
|
|
||||||
let properties = hashmap! {
|
let properties = hashmap! {
|
||||||
"Source".into() => as_lua.into(),
|
"Source".to_owned() => as_lua.into(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let meta_path = path.with_file_name(format!("{}.meta.json", name));
|
let meta_path = path.with_file_name(format!("{}.meta.json", name));
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use std::{collections::HashMap, path::Path, str};
|
use std::{borrow::Cow, collections::HashMap, path::Path, str};
|
||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use memofs::Vfs;
|
use memofs::Vfs;
|
||||||
@@ -85,14 +85,14 @@ impl JsonModelCore {
|
|||||||
let mut properties = HashMap::with_capacity(self.properties.len());
|
let mut properties = HashMap::with_capacity(self.properties.len());
|
||||||
for (key, unresolved) in self.properties {
|
for (key, unresolved) in self.properties {
|
||||||
let value = unresolved.resolve(&class_name, &key)?;
|
let value = unresolved.resolve(&class_name, &key)?;
|
||||||
properties.insert(key.into(), value);
|
properties.insert(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(InstanceSnapshot {
|
Ok(InstanceSnapshot {
|
||||||
snapshot_id: None,
|
snapshot_id: None,
|
||||||
metadata: Default::default(),
|
metadata: Default::default(),
|
||||||
name: name.into(),
|
name: Cow::Owned(name),
|
||||||
class_name: class_name.into(),
|
class_name: Cow::Owned(class_name),
|
||||||
properties,
|
properties,
|
||||||
children,
|
children,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -6,7 +6,11 @@ use memofs::{IoResultExt, Vfs};
|
|||||||
|
|
||||||
use crate::snapshot::{InstanceContext, InstanceMetadata, InstanceSnapshot};
|
use crate::snapshot::{InstanceContext, InstanceMetadata, InstanceSnapshot};
|
||||||
|
|
||||||
use super::{dir::snapshot_dir, meta_file::AdjacentMetadata, util::match_trailing};
|
use super::{
|
||||||
|
dir::{dir_meta, snapshot_dir_no_meta},
|
||||||
|
meta_file::AdjacentMetadata,
|
||||||
|
util::match_trailing,
|
||||||
|
};
|
||||||
|
|
||||||
/// Core routine for turning Lua files into snapshots.
|
/// Core routine for turning Lua files into snapshots.
|
||||||
pub fn snapshot_lua(
|
pub fn snapshot_lua(
|
||||||
@@ -38,7 +42,7 @@ pub fn snapshot_lua(
|
|||||||
.name(instance_name)
|
.name(instance_name)
|
||||||
.class_name(class_name)
|
.class_name(class_name)
|
||||||
.properties(hashmap! {
|
.properties(hashmap! {
|
||||||
"Source".into() => contents_str.into(),
|
"Source".to_owned() => contents_str.into(),
|
||||||
})
|
})
|
||||||
.metadata(
|
.metadata(
|
||||||
InstanceMetadata::new()
|
InstanceMetadata::new()
|
||||||
@@ -66,7 +70,7 @@ pub fn snapshot_lua_init(
|
|||||||
init_path: &Path,
|
init_path: &Path,
|
||||||
) -> anyhow::Result<Option<InstanceSnapshot>> {
|
) -> anyhow::Result<Option<InstanceSnapshot>> {
|
||||||
let folder_path = init_path.parent().unwrap();
|
let folder_path = init_path.parent().unwrap();
|
||||||
let dir_snapshot = snapshot_dir(context, vfs, folder_path)?.unwrap();
|
let dir_snapshot = snapshot_dir_no_meta(context, vfs, folder_path)?.unwrap();
|
||||||
|
|
||||||
if dir_snapshot.class_name != "Folder" {
|
if dir_snapshot.class_name != "Folder" {
|
||||||
anyhow::bail!(
|
anyhow::bail!(
|
||||||
@@ -86,6 +90,10 @@ pub fn snapshot_lua_init(
|
|||||||
init_snapshot.children = dir_snapshot.children;
|
init_snapshot.children = dir_snapshot.children;
|
||||||
init_snapshot.metadata = dir_snapshot.metadata;
|
init_snapshot.metadata = dir_snapshot.metadata;
|
||||||
|
|
||||||
|
if let Some(mut meta) = dir_meta(vfs, folder_path)? {
|
||||||
|
meta.apply_all(&mut init_snapshot)?;
|
||||||
|
}
|
||||||
|
|
||||||
Ok(Some(init_snapshot))
|
Ok(Some(init_snapshot))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use std::{collections::HashMap, path::PathBuf};
|
use std::{borrow::Cow, collections::HashMap, path::PathBuf};
|
||||||
|
|
||||||
use anyhow::{format_err, Context};
|
use anyhow::{format_err, Context};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@@ -49,7 +49,7 @@ impl AdjacentMetadata {
|
|||||||
.resolve(&snapshot.class_name, &key)
|
.resolve(&snapshot.class_name, &key)
|
||||||
.with_context(|| format!("error applying meta file {}", path.display()))?;
|
.with_context(|| format!("error applying meta file {}", path.display()))?;
|
||||||
|
|
||||||
snapshot.properties.insert(key.into(), value);
|
snapshot.properties.insert(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -116,7 +116,7 @@ impl DirectoryMetadata {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
snapshot.class_name = class_name.into();
|
snapshot.class_name = Cow::Owned(class_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -136,7 +136,7 @@ impl DirectoryMetadata {
|
|||||||
.resolve(&snapshot.class_name, &key)
|
.resolve(&snapshot.class_name, &key)
|
||||||
.with_context(|| format!("error applying meta file {}", path.display()))?;
|
.with_context(|| format!("error applying meta file {}", path.display()))?;
|
||||||
|
|
||||||
snapshot.properties.insert(key.into(), value);
|
snapshot.properties.insert(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ use rbx_reflection::ClassTag;
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
project::{PathNode, Project, ProjectNode},
|
project::{PathNode, Project, ProjectNode},
|
||||||
small_string::SmallString,
|
|
||||||
snapshot::{
|
snapshot::{
|
||||||
InstanceContext, InstanceMetadata, InstanceSnapshot, InstigatingSource, PathIgnoreRule,
|
InstanceContext, InstanceMetadata, InstanceSnapshot, InstigatingSource, PathIgnoreRule,
|
||||||
},
|
},
|
||||||
@@ -68,10 +67,13 @@ pub fn snapshot_project_node(
|
|||||||
) -> anyhow::Result<Option<InstanceSnapshot>> {
|
) -> anyhow::Result<Option<InstanceSnapshot>> {
|
||||||
let project_folder = project_path.parent().unwrap();
|
let project_folder = project_path.parent().unwrap();
|
||||||
|
|
||||||
let class_name_from_project = node.class_name.as_ref().map(|name| SmallString::from(name));
|
let class_name_from_project = node
|
||||||
|
.class_name
|
||||||
|
.as_ref()
|
||||||
|
.map(|name| Cow::Owned(name.clone()));
|
||||||
let mut class_name_from_path = None;
|
let mut class_name_from_path = None;
|
||||||
|
|
||||||
let name = SmallString::from(instance_name);
|
let name = Cow::Owned(instance_name.to_owned());
|
||||||
let mut properties = HashMap::new();
|
let mut properties = HashMap::new();
|
||||||
let mut children = Vec::new();
|
let mut children = Vec::new();
|
||||||
let mut metadata = InstanceMetadata::default();
|
let mut metadata = InstanceMetadata::default();
|
||||||
@@ -226,7 +228,7 @@ pub fn snapshot_project_node(
|
|||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
properties.insert(key.into(), value);
|
properties.insert(key.clone(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the user specified $ignoreUnknownInstances, overwrite the existing
|
// If the user specified $ignoreUnknownInstances, overwrite the existing
|
||||||
@@ -260,7 +262,7 @@ pub fn snapshot_project_node(
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn infer_class_name(name: &str, parent_class: Option<&str>) -> Option<SmallString> {
|
fn infer_class_name(name: &str, parent_class: Option<&str>) -> Option<Cow<'static, str>> {
|
||||||
// If className wasn't defined from another source, we may be able
|
// If className wasn't defined from another source, we may be able
|
||||||
// to infer one.
|
// to infer one.
|
||||||
|
|
||||||
@@ -273,13 +275,13 @@ fn infer_class_name(name: &str, parent_class: Option<&str>) -> Option<SmallStrin
|
|||||||
let descriptor = rbx_reflection_database::get().classes.get(name)?;
|
let descriptor = rbx_reflection_database::get().classes.get(name)?;
|
||||||
|
|
||||||
if descriptor.tags.contains(&ClassTag::Service) {
|
if descriptor.tags.contains(&ClassTag::Service) {
|
||||||
return Some(name.into());
|
return Some(Cow::Owned(name.to_owned()));
|
||||||
}
|
}
|
||||||
} else if parent_class == "StarterPlayer" {
|
} else if parent_class == "StarterPlayer" {
|
||||||
// StarterPlayer has two special members with their own classes.
|
// StarterPlayer has two special members with their own classes.
|
||||||
|
|
||||||
if name == "StarterPlayerScripts" || name == "StarterCharacterScripts" {
|
if name == "StarterPlayerScripts" || name == "StarterCharacterScripts" {
|
||||||
return Some(name.into());
|
return Some(Cow::Owned(name.to_owned()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use crate::snapshot::{InstanceContext, InstanceMetadata, InstanceSnapshot};
|
|||||||
|
|
||||||
use super::util::PathExt;
|
use super::util::PathExt;
|
||||||
|
|
||||||
|
#[profiling::function]
|
||||||
pub fn snapshot_rbxm(
|
pub fn snapshot_rbxm(
|
||||||
context: &InstanceContext,
|
context: &InstanceContext,
|
||||||
vfs: &Vfs,
|
vfs: &Vfs,
|
||||||
@@ -21,7 +22,8 @@ pub fn snapshot_rbxm(
|
|||||||
let children = root_instance.children();
|
let children = root_instance.children();
|
||||||
|
|
||||||
if children.len() == 1 {
|
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)
|
.name(name)
|
||||||
.metadata(
|
.metadata(
|
||||||
InstanceMetadata::new()
|
InstanceMetadata::new()
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ pub fn snapshot_rbxmx(
|
|||||||
let children = root_instance.children();
|
let children = root_instance.children();
|
||||||
|
|
||||||
if children.len() == 1 {
|
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)
|
.name(name)
|
||||||
.metadata(
|
.metadata(
|
||||||
InstanceMetadata::new()
|
InstanceMetadata::new()
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ pub fn snapshot_txt(
|
|||||||
.to_owned();
|
.to_owned();
|
||||||
|
|
||||||
let properties = hashmap! {
|
let properties = hashmap! {
|
||||||
"Value".into() => contents_str.into(),
|
"Value".to_owned() => contents_str.into(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let meta_path = path.with_file_name(format!("{}.meta.json", name));
|
let meta_path = path.with_file_name(format!("{}.meta.json", name));
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
session_id::SessionId,
|
session_id::SessionId,
|
||||||
small_string::SmallString,
|
|
||||||
snapshot::{
|
snapshot::{
|
||||||
AppliedPatchSet, InstanceMetadata as RojoInstanceMetadata, InstanceWithMeta, RojoTree,
|
AppliedPatchSet, InstanceMetadata as RojoInstanceMetadata, InstanceWithMeta, RojoTree,
|
||||||
},
|
},
|
||||||
@@ -84,13 +83,13 @@ impl<'a> SubscribeMessage<'a> {
|
|||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct InstanceUpdate {
|
pub struct InstanceUpdate {
|
||||||
pub id: Ref,
|
pub id: Ref,
|
||||||
pub changed_name: Option<SmallString>,
|
pub changed_name: Option<String>,
|
||||||
pub changed_class_name: Option<SmallString>,
|
pub changed_class_name: Option<String>,
|
||||||
|
|
||||||
// TODO: Transform from HashMap<_, Option<_>> to something else, since
|
// TODO: Transform from HashMap<String, Option<_>> to something else, since
|
||||||
// null will get lost when decoding from JSON in some languages.
|
// null will get lost when decoding from JSON in some languages.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub changed_properties: HashMap<SmallString, Option<Variant>>,
|
pub changed_properties: HashMap<String, Option<Variant>>,
|
||||||
pub changed_metadata: Option<InstanceMetadata>,
|
pub changed_metadata: Option<InstanceMetadata>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,11 +36,13 @@ gen_build_tests! {
|
|||||||
init_meta_class_name,
|
init_meta_class_name,
|
||||||
init_meta_properties,
|
init_meta_properties,
|
||||||
init_with_children,
|
init_with_children,
|
||||||
|
issue_546,
|
||||||
json_as_lua,
|
json_as_lua,
|
||||||
json_model_in_folder,
|
json_model_in_folder,
|
||||||
json_model_legacy_name,
|
json_model_legacy_name,
|
||||||
module_in_folder,
|
module_in_folder,
|
||||||
module_init,
|
module_init,
|
||||||
|
optional,
|
||||||
project_composed_default,
|
project_composed_default,
|
||||||
project_composed_file,
|
project_composed_file,
|
||||||
project_root_name,
|
project_root_name,
|
||||||
@@ -53,7 +55,6 @@ gen_build_tests! {
|
|||||||
txt,
|
txt,
|
||||||
txt_in_folder,
|
txt_in_folder,
|
||||||
unresolved_values,
|
unresolved_values,
|
||||||
optional,
|
|
||||||
weldconstraint,
|
weldconstraint,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user