Skip to content

Commit 9509909

Browse files
authored
Backport #870 (optional project names) to 7.4.x (#871)
Unlike most of the other backports, this code couldn't be directly translated so it had to be re-implemented. Luckily, it is very simple. This implementation is a bit messy and heavy handed with potential panics, but I think it's probably fine since file names that aren't UTF-8 aren't really supported anyway. The original implementation is a lot cleaner though. The test snapshots are (almost) all identical between the 7.5 implementation and this one. The sole exception is with the path in the `snapshot_middleware::project` test, since I didn't feel like adding a `name` parameter to `snapshot_project` in this implementation.
1 parent 88efbd4 commit 9509909

26 files changed

+459
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Rojo Changelog
22

33
## Unreleased Changes
4+
* Made the `name` field optional on project files ([#870])
5+
Files named `default.project.json` inherit the name of the folder they're in and all other projects
6+
are named as expect (e.g. `foo.project.json` becomes an Instance named `foo`)
7+
8+
There is no change in behavior if `name` is set.
49
* Fixed incorrect results when building model pivots ([#865])
510
* Fixed incorrect results when serving model pivots ([#868])
611
* Rojo now converts any line endings to LF, preventing spurious diffs when syncing Lua files on Windows ([#854])
@@ -15,6 +20,7 @@
1520
[#854]: https://github.com/rojo-rbx/rojo/pull/854
1621
[#865]: https://github.com/rojo-rbx/rojo/pull/865
1722
[#868]: https://github.com/rojo-rbx/rojo/pull/868
23+
[#870]: https://github.com/rojo-rbx/rojo/pull/870
1824

1925
## [7.4.0] - January 16, 2024
2026
* Improved the visualization for array properties like Tags ([#829])
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
source: tests/tests/build.rs
3+
expression: contents
4+
---
5+
<roblox version="4">
6+
<Item class="Folder" referent="0">
7+
<Properties>
8+
<string name="Name">top-level</string>
9+
</Properties>
10+
<Item class="Folder" referent="1">
11+
<Properties>
12+
<string name="Name">second-level</string>
13+
</Properties>
14+
<Item class="IntValue" referent="2">
15+
<Properties>
16+
<string name="Name">third-level</string>
17+
<int64 name="Value">1337</int64>
18+
</Properties>
19+
</Item>
20+
</Item>
21+
</Item>
22+
</roblox>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
source: tests/tests/build.rs
3+
expression: contents
4+
---
5+
<roblox version="4">
6+
<Item class="Folder" referent="0">
7+
<Properties>
8+
<string name="Name">no_name_project</string>
9+
</Properties>
10+
<Item class="Folder" referent="1">
11+
<Properties>
12+
<string name="Name">second-level</string>
13+
</Properties>
14+
<Item class="BoolValue" referent="2">
15+
<Properties>
16+
<string name="Name">bool_value</string>
17+
<bool name="Value">true</bool>
18+
</Properties>
19+
</Item>
20+
</Item>
21+
</Item>
22+
</roblox>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
source: tests/tests/build.rs
3+
assertion_line: 104
4+
expression: contents
5+
---
6+
<roblox version="4">
7+
<Item class="StringValue" referent="0">
8+
<Properties>
9+
<string name="Name">no_name_top_level_project</string>
10+
<string name="Value">If this isn't named `no_name_top_level_project`, something went wrong!</string>
11+
</Properties>
12+
</Item>
13+
</roblox>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "top-level",
3+
"tree": {
4+
"$className": "Folder",
5+
"second-level": {
6+
"$path": "src"
7+
}
8+
}
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"tree": {
3+
"$className": "IntValue",
4+
"$properties": {
5+
"Value": 1337
6+
}
7+
}
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "no_name_project",
3+
"tree": {
4+
"$className": "Folder",
5+
"second-level": {
6+
"$path": "src"
7+
}
8+
}
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"tree": {
3+
"$className": "BoolValue",
4+
"$properties": {
5+
"Value": true
6+
}
7+
}
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"tree": {
3+
"$className": "StringValue",
4+
"$properties": {
5+
"Value": "If this isn't named `no_name_top_level_project`, something went wrong!"
6+
}
7+
}
8+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
source: tests/tests/serve.rs
3+
expression: "read_response.intern_and_redact(&mut redactions, root_id)"
4+
---
5+
instances:
6+
id-2:
7+
Children:
8+
- id-3
9+
ClassName: Folder
10+
Id: id-2
11+
Metadata:
12+
ignoreUnknownInstances: true
13+
Name: top-level
14+
Parent: "00000000000000000000000000000000"
15+
Properties: {}
16+
id-3:
17+
Children:
18+
- id-4
19+
ClassName: Folder
20+
Id: id-3
21+
Metadata:
22+
ignoreUnknownInstances: false
23+
Name: second-level
24+
Parent: id-2
25+
Properties: {}
26+
id-4:
27+
Children: []
28+
ClassName: IntValue
29+
Id: id-4
30+
Metadata:
31+
ignoreUnknownInstances: true
32+
Name: third-level
33+
Parent: id-3
34+
Properties:
35+
Value:
36+
Int64: 1337
37+
messageCursor: 0
38+
sessionId: id-1
39+

0 commit comments

Comments
 (0)