diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7f26d92e3..b2114a92a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -28,6 +28,8 @@
* Added support for `Terrain.MaterialColors` ([#770])
* Allow `Terrain` to be specified without a classname ([#771])
* Add Confirmation Behavior setting ([#774])
+* Projects can no longer be built with the wrong file extension ([#772])
+* Projects can no longer be served if they don't have a DataModel root ([#722])
[#761]: https://github.com/rojo-rbx/rojo/pull/761
[#745]: https://github.com/rojo-rbx/rojo/pull/745
@@ -55,6 +57,7 @@
[#760]: https://github.com/rojo-rbx/rojo/pull/760
[#770]: https://github.com/rojo-rbx/rojo/pull/770
[#771]: https://github.com/rojo-rbx/rojo/pull/771
+[#772]: https://github.com/rojo-rbx/rojo/pull/772
[#774]: https://github.com/rojo-rbx/rojo/pull/774
## [7.3.0] - April 22, 2023
diff --git a/rojo-test/build-test-snapshots/end_to_end__tests__build__infer_service_name.snap b/rojo-test/build-test-snapshots/end_to_end__tests__build__infer_service_name.snap
index 98b92a469..d99731e74 100644
--- a/rojo-test/build-test-snapshots/end_to_end__tests__build__infer_service_name.snap
+++ b/rojo-test/build-test-snapshots/end_to_end__tests__build__infer_service_name.snap
@@ -3,26 +3,21 @@ source: tests/tests/build.rs
expression: contents
---
- -
+
-
- infer-service-name
+ HttpService
+ true
-
-
-
- HttpService
- true
-
-
- -
+
+ -
+
+ ReplicatedStorage
+
+
-
- ReplicatedStorage
+ Main
+ -- hello, from main
-
-
-
- Main
- -- hello, from main
-
-
diff --git a/rojo-test/build-test-snapshots/end_to_end__tests__build__infer_starter_player.snap b/rojo-test/build-test-snapshots/end_to_end__tests__build__infer_starter_player.snap
index 6e9e5fc06..7252023b1 100644
--- a/rojo-test/build-test-snapshots/end_to_end__tests__build__infer_starter_player.snap
+++ b/rojo-test/build-test-snapshots/end_to_end__tests__build__infer_starter_player.snap
@@ -3,24 +3,19 @@ source: tests/tests/build.rs
expression: contents
---
- -
+
-
- infer-service-name
+ StarterPlayer
-
-
+
-
- StarterPlayer
+ StarterCharacterScripts
+
+
+ -
+
+ StarterPlayerScripts
-
-
-
- StarterCharacterScripts
-
-
- -
-
- StarterPlayerScripts
-
-
diff --git a/rojo-test/build-test-snapshots/end_to_end__tests__build__unresolved_values.snap b/rojo-test/build-test-snapshots/end_to_end__tests__build__unresolved_values.snap
index 8b9eac0e3..30912900a 100644
--- a/rojo-test/build-test-snapshots/end_to_end__tests__build__unresolved_values.snap
+++ b/rojo-test/build-test-snapshots/end_to_end__tests__build__unresolved_values.snap
@@ -1,66 +1,60 @@
---
source: tests/tests/build.rs
expression: contents
-
---
- -
+
-
- unresolved-values
+ Lighting
+
+ 1
+ 0
+ 0
+
+ 1
-
-
+
+ -
+
+ Workspace
+
+
-
+
+ Bool
+ true
+
+
+ -
+
+ Color
+
+ 1
+ 2
+ 3
+ 0
+ 1
+ 0
+ 0
+ 0
+ 1
+ 1
+ 0
+ 0
+
+ 8404992
+
+
+ -
- Lighting
-
- 1
- 0
- 0
-
- 1
+ Float
+ 123.5
- -
+
-
- Workspace
+ Int
+ 65
-
-
-
- Bool
- true
-
-
- -
-
- Color
-
- 1
- 2
- 3
- 0
- 1
- 0
- 0
- 0
- 1
- 1
- 0
- 0
-
- 8404992
-
-
- -
-
- Float
- 123.5
-
-
- -
-
- Int
- 65
-
-
diff --git a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__add_folder_all-2.snap b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__add_folder_all-2.snap
index 2053b9c71..9bdcddfd9 100644
--- a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__add_folder_all-2.snap
+++ b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__add_folder_all-2.snap
@@ -6,7 +6,7 @@ instances:
id-2:
Children:
- id-3
- ClassName: Folder
+ ClassName: DataModel
Id: id-2
Metadata:
ignoreUnknownInstances: false
@@ -24,3 +24,4 @@ instances:
Properties: {}
messageCursor: 1
sessionId: id-1
+
diff --git a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__add_folder_all.snap b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__add_folder_all.snap
index 3cffd761e..4dd3b648e 100644
--- a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__add_folder_all.snap
+++ b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__add_folder_all.snap
@@ -5,7 +5,7 @@ expression: "read_response.intern_and_redact(&mut redactions, root_id)"
instances:
id-2:
Children: []
- ClassName: Folder
+ ClassName: DataModel
Id: id-2
Metadata:
ignoreUnknownInstances: false
@@ -14,3 +14,4 @@ instances:
Properties: {}
messageCursor: 0
sessionId: id-1
+
diff --git a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__edit_init_all-2.snap b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__edit_init_all-2.snap
index 0229179a3..600cc5892 100644
--- a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__edit_init_all-2.snap
+++ b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__edit_init_all-2.snap
@@ -1,17 +1,26 @@
---
source: tests/tests/serve.rs
expression: "read_response.intern_and_redact(&mut redactions, root_id)"
-
---
instances:
id-2:
+ Children:
+ - id-3
+ ClassName: DataModel
+ Id: id-2
+ Metadata:
+ ignoreUnknownInstances: true
+ Name: edit_init
+ Parent: "00000000000000000000000000000000"
+ Properties: {}
+ id-3:
Children: []
ClassName: ModuleScript
- Id: id-2
+ Id: id-3
Metadata:
ignoreUnknownInstances: false
Name: edit_init
- Parent: "00000000000000000000000000000000"
+ Parent: id-2
Properties:
Source:
String: "-- Edited contents"
diff --git a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__edit_init_all.snap b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__edit_init_all.snap
index d3f50dbd4..ff5a46c16 100644
--- a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__edit_init_all.snap
+++ b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__edit_init_all.snap
@@ -1,17 +1,26 @@
---
source: tests/tests/serve.rs
expression: "read_response.intern_and_redact(&mut redactions, root_id)"
-
---
instances:
id-2:
+ Children:
+ - id-3
+ ClassName: DataModel
+ Id: id-2
+ Metadata:
+ ignoreUnknownInstances: true
+ Name: edit_init
+ Parent: "00000000000000000000000000000000"
+ Properties: {}
+ id-3:
Children: []
ClassName: ModuleScript
- Id: id-2
+ Id: id-3
Metadata:
ignoreUnknownInstances: false
Name: edit_init
- Parent: "00000000000000000000000000000000"
+ Parent: id-2
Properties:
Source:
String: "-- Original contents"
diff --git a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__edit_init_subscribe.snap b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__edit_init_subscribe.snap
index cef27f2c2..d54fee2db 100644
--- a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__edit_init_subscribe.snap
+++ b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__edit_init_subscribe.snap
@@ -1,7 +1,6 @@
---
source: tests/tests/serve.rs
expression: "subscribe_response.intern_and_redact(&mut redactions, ())"
-
---
messageCursor: 1
messages:
@@ -14,6 +13,6 @@ messages:
changedProperties:
Source:
String: "-- Edited contents"
- id: id-2
+ id: id-3
sessionId: id-1
diff --git a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__empty_all.snap b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__empty_all.snap
index 71fded9ea..ebc2c2036 100644
--- a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__empty_all.snap
+++ b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__empty_all.snap
@@ -5,12 +5,13 @@ expression: "read_response.intern_and_redact(&mut redactions, root_id)"
instances:
id-2:
Children: []
- ClassName: Folder
+ ClassName: DataModel
Id: id-2
Metadata:
- ignoreUnknownInstances: true
+ ignoreUnknownInstances: false
Name: empty
Parent: "00000000000000000000000000000000"
Properties: {}
messageCursor: 0
sessionId: id-1
+
diff --git a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__empty_json_model_all-2.snap b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__empty_json_model_all-2.snap
index 6f02d667f..7184590c3 100644
--- a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__empty_json_model_all-2.snap
+++ b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__empty_json_model_all-2.snap
@@ -1,13 +1,12 @@
---
source: tests/tests/serve.rs
expression: "read_response.intern_and_redact(&mut redactions, root_id)"
-
---
instances:
id-2:
Children:
- id-3
- ClassName: Folder
+ ClassName: DataModel
Id: id-2
Metadata:
ignoreUnknownInstances: false
diff --git a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__empty_json_model_all.snap b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__empty_json_model_all.snap
index f7440a4a5..6aa08e99f 100644
--- a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__empty_json_model_all.snap
+++ b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__empty_json_model_all.snap
@@ -1,12 +1,11 @@
---
source: tests/tests/serve.rs
expression: "read_response.intern_and_redact(&mut redactions, root_id)"
-
---
instances:
id-2:
Children: []
- ClassName: Folder
+ ClassName: DataModel
Id: id-2
Metadata:
ignoreUnknownInstances: false
diff --git a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__move_folder_of_stuff_all-2.snap b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__move_folder_of_stuff_all-2.snap
index 9b4c47f79..98037e903 100644
--- a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__move_folder_of_stuff_all-2.snap
+++ b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__move_folder_of_stuff_all-2.snap
@@ -1,7 +1,6 @@
---
source: tests/tests/serve.rs
expression: "read_response.intern_and_redact(&mut redactions, root_id)"
-
---
instances:
id-10:
@@ -51,7 +50,7 @@ instances:
id-2:
Children:
- id-3
- ClassName: Folder
+ ClassName: DataModel
Id: id-2
Metadata:
ignoreUnknownInstances: false
diff --git a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__move_folder_of_stuff_all.snap b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__move_folder_of_stuff_all.snap
index 08cc4e319..542708d55 100644
--- a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__move_folder_of_stuff_all.snap
+++ b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__move_folder_of_stuff_all.snap
@@ -5,7 +5,7 @@ expression: "read_response.intern_and_redact(&mut redactions, root_id)"
instances:
id-2:
Children: []
- ClassName: Folder
+ ClassName: DataModel
Id: id-2
Metadata:
ignoreUnknownInstances: false
@@ -14,3 +14,4 @@ instances:
Properties: {}
messageCursor: 0
sessionId: id-1
+
diff --git a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__move_folder_of_stuff_subscribe.snap b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__move_folder_of_stuff_subscribe.snap
index 40afc8882..486ed0462 100644
--- a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__move_folder_of_stuff_subscribe.snap
+++ b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__move_folder_of_stuff_subscribe.snap
@@ -1,7 +1,6 @@
---
source: tests/tests/serve.rs
expression: "subscribe_response.intern_and_redact(&mut redactions, ())"
-
---
messageCursor: 1
messages:
diff --git a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__remove_file_all-2.snap b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__remove_file_all-2.snap
index 7d0b25bbf..0a5b4f4b3 100644
--- a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__remove_file_all-2.snap
+++ b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__remove_file_all-2.snap
@@ -5,7 +5,7 @@ expression: "read_response.intern_and_redact(&mut redactions, root_id)"
instances:
id-2:
Children: []
- ClassName: Folder
+ ClassName: DataModel
Id: id-2
Metadata:
ignoreUnknownInstances: false
@@ -14,3 +14,4 @@ instances:
Properties: {}
messageCursor: 1
sessionId: id-1
+
diff --git a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__remove_file_all.snap b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__remove_file_all.snap
index 4ec6ce4ce..4470d8d3f 100644
--- a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__remove_file_all.snap
+++ b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__remove_file_all.snap
@@ -1,13 +1,12 @@
---
source: tests/tests/serve.rs
expression: "read_response.intern_and_redact(&mut redactions, root_id)"
-
---
instances:
id-2:
Children:
- id-3
- ClassName: Folder
+ ClassName: DataModel
Id: id-2
Metadata:
ignoreUnknownInstances: false
diff --git a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__remove_file_subscribe.snap b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__remove_file_subscribe.snap
index e70d17f99..ba0fe7d88 100644
--- a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__remove_file_subscribe.snap
+++ b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__remove_file_subscribe.snap
@@ -9,3 +9,4 @@ messages:
- id-3
updated: []
sessionId: id-1
+
diff --git a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__scripts_all-2.snap b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__scripts_all-2.snap
index 78dcebea3..1b168b401 100644
--- a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__scripts_all-2.snap
+++ b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__scripts_all-2.snap
@@ -1,14 +1,13 @@
---
source: tests/tests/serve.rs
expression: "read_response.intern_and_redact(&mut redactions, root_id)"
-
---
instances:
id-2:
Children:
- id-3
- id-4
- ClassName: Folder
+ ClassName: DataModel
Id: id-2
Metadata:
ignoreUnknownInstances: false
diff --git a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__scripts_all.snap b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__scripts_all.snap
index 52efebac4..75322c590 100644
--- a/rojo-test/serve-test-snapshots/end_to_end__tests__serve__scripts_all.snap
+++ b/rojo-test/serve-test-snapshots/end_to_end__tests__serve__scripts_all.snap
@@ -1,14 +1,13 @@
---
source: tests/tests/serve.rs
expression: "read_response.intern_and_redact(&mut redactions, root_id)"
-
---
instances:
id-2:
Children:
- id-3
- id-4
- ClassName: Folder
+ ClassName: DataModel
Id: id-2
Metadata:
ignoreUnknownInstances: false
diff --git a/rojo-test/serve-tests/add_folder/default.project.json b/rojo-test/serve-tests/add_folder/default.project.json
index 6831b9781..06c992212 100644
--- a/rojo-test/serve-tests/add_folder/default.project.json
+++ b/rojo-test/serve-tests/add_folder/default.project.json
@@ -1,6 +1,7 @@
{
"name": "add_folder",
"tree": {
+ "$className": "DataModel",
"$path": "src"
}
}
\ No newline at end of file
diff --git a/rojo-test/serve-tests/add_optional_folder/default.project.json b/rojo-test/serve-tests/add_optional_folder/default.project.json
index d582e8e5c..7f73459ad 100644
--- a/rojo-test/serve-tests/add_optional_folder/default.project.json
+++ b/rojo-test/serve-tests/add_optional_folder/default.project.json
@@ -1,9 +1,11 @@
{
"name": "optional",
"tree": {
- "$className": "Folder",
+ "$className": "DataModel",
"create-later": {
- "$path": { "optional": "create-later" }
+ "$path": {
+ "optional": "create-later"
+ }
}
}
}
\ No newline at end of file
diff --git a/rojo-test/serve-tests/edit_init/default.project.json b/rojo-test/serve-tests/edit_init/default.project.json
index 88d3bdc68..a885ff08f 100644
--- a/rojo-test/serve-tests/edit_init/default.project.json
+++ b/rojo-test/serve-tests/edit_init/default.project.json
@@ -1,6 +1,9 @@
{
"name": "edit_init",
"tree": {
- "$path": "src"
+ "$className": "DataModel",
+ "edit_init": {
+ "$path": "src"
+ }
}
}
\ No newline at end of file
diff --git a/rojo-test/serve-tests/empty/default.project.json b/rojo-test/serve-tests/empty/default.project.json
index f7cd20159..699b0a04d 100644
--- a/rojo-test/serve-tests/empty/default.project.json
+++ b/rojo-test/serve-tests/empty/default.project.json
@@ -1,6 +1,7 @@
{
"name": "empty",
"tree": {
- "$className": "Folder"
+ "$className": "DataModel",
+ "$path": "src"
}
}
\ No newline at end of file
diff --git a/rojo-test/serve-tests/empty_json_model/default.project.json b/rojo-test/serve-tests/empty_json_model/default.project.json
index 5d67b95ba..d7b401b5c 100644
--- a/rojo-test/serve-tests/empty_json_model/default.project.json
+++ b/rojo-test/serve-tests/empty_json_model/default.project.json
@@ -1,6 +1,7 @@
{
"name": "empty_folder",
"tree": {
+ "$className": "DataModel",
"$path": "src"
}
}
\ No newline at end of file
diff --git a/rojo-test/serve-tests/move_folder_of_stuff/default.project.json b/rojo-test/serve-tests/move_folder_of_stuff/default.project.json
index e4a6a2e93..824b69d3a 100644
--- a/rojo-test/serve-tests/move_folder_of_stuff/default.project.json
+++ b/rojo-test/serve-tests/move_folder_of_stuff/default.project.json
@@ -1,6 +1,7 @@
{
"name": "move_folder_of_stuff",
"tree": {
+ "$className": "DataModel",
"$path": "src"
}
}
\ No newline at end of file
diff --git a/rojo-test/serve-tests/remove_file/default.project.json b/rojo-test/serve-tests/remove_file/default.project.json
index 6055a0bfa..1bb58d954 100644
--- a/rojo-test/serve-tests/remove_file/default.project.json
+++ b/rojo-test/serve-tests/remove_file/default.project.json
@@ -1,6 +1,7 @@
{
"name": "remove_file",
"tree": {
+ "$className": "DataModel",
"$path": "src"
}
}
\ No newline at end of file
diff --git a/rojo-test/serve-tests/scripts/default.project.json b/rojo-test/serve-tests/scripts/default.project.json
index 52987f7dd..3b879cdc5 100644
--- a/rojo-test/serve-tests/scripts/default.project.json
+++ b/rojo-test/serve-tests/scripts/default.project.json
@@ -1,6 +1,7 @@
{
"name": "scripts",
"tree": {
+ "$className": "DataModel",
"$path": "src"
}
}
\ No newline at end of file
diff --git a/src/cli/build.rs b/src/cli/build.rs
index 8f705d376..b76c10edd 100644
--- a/src/cli/build.rs
+++ b/src/cli/build.rs
@@ -20,6 +20,11 @@ const UNKNOWN_OUTPUT_KIND_ERR: &str = "Could not detect what kind of file to bui
const UNKNOWN_PLUGIN_KIND_ERR: &str = "Could not detect what kind of file to build. \
Expected plugin file to end in .rbxm or .rbxmx.";
+const PLACE_AS_MODEL_ERR: &str = "Cannot build a place project file as a model file. \
+ Expected output file to end in .rbxl or .rbxlx.";
+const MODEL_AS_PLACE_ERR: &str = "Cannot build a model project file as a place file. \
+ Expected output file file to end in .rbxm or .rbxmx.";
+
/// Generates a model or place file from the Rojo project.
#[derive(Debug, Parser)]
pub struct BuildCommand {
@@ -168,6 +173,17 @@ fn write_model(
let tree = session.tree();
let root_id = tree.get_root_id();
+ let root_class = tree.get_instance(root_id).unwrap().class_name();
+
+ // Bail out of building a model if the internal project is wrong.
+ if matches!(output_kind, OutputKind::Rbxm | OutputKind::Rbxmx) && root_class == "DataModel" {
+ bail!(PLACE_AS_MODEL_ERR)
+ } else if matches!(output_kind, OutputKind::Rbxl | OutputKind::Rbxlx)
+ && root_class != "DataModel"
+ {
+ bail!(MODEL_AS_PLACE_ERR)
+ }
+
log::trace!("Opening output file for write");
let mut file = BufWriter::new(File::create(output)?);
diff --git a/src/cli/serve.rs b/src/cli/serve.rs
index f89e43875..be6b869c6 100644
--- a/src/cli/serve.rs
+++ b/src/cli/serve.rs
@@ -16,6 +16,9 @@ use super::{resolve_path, GlobalOptions};
const DEFAULT_BIND_ADDRESS: Ipv4Addr = Ipv4Addr::new(127, 0, 0, 1);
const DEFAULT_PORT: u16 = 34872;
+const SERVING_MODEL_ERR: &str = "Cannot serve a model project file. \
+ Projects must have a `DataModel` at their root to be served.";
+
/// Expose a Rojo project to the Rojo Studio plugin.
#[derive(Debug, Parser)]
pub struct ServeCommand {
@@ -41,6 +44,17 @@ impl ServeCommand {
let session = Arc::new(ServeSession::new(vfs, project_path)?);
+ // `ServeSession.tree()` is locking, so we have to let it fall out
+ // of scope when we're done.
+ {
+ let tree = session.tree();
+ // This cannot fail because the root must always exist.
+ let root = tree.get_instance(tree.get_root_id()).unwrap();
+ if root.class_name() != "DataModel" {
+ anyhow::bail!(SERVING_MODEL_ERR)
+ }
+ }
+
let ip = self
.address
.or_else(|| session.serve_address())
diff --git a/tests/tests/build.rs b/tests/tests/build.rs
index 4907449d2..aba4815d5 100644
--- a/tests/tests/build.rs
+++ b/tests/tests/build.rs
@@ -6,14 +6,14 @@ use tempfile::tempdir;
use crate::rojo_test::io_util::{get_working_dir_path, BUILD_TESTS_PATH, ROJO_PATH};
macro_rules! gen_build_tests {
- ( $($test_name: ident,)* ) => {
+ ( $($test_name:ident: $out_format:literal,)* ) => {
$(
paste::item! {
#[test]
fn []() {
let _ = env_logger::try_init();
- run_build_test(stringify!($test_name));
+ run_build_test(stringify!($test_name), $out_format);
}
}
)*
@@ -21,52 +21,54 @@ macro_rules! gen_build_tests {
}
gen_build_tests! {
- init_csv_with_children,
- attributes,
- client_in_folder,
- client_init,
- csv_bug_145,
- csv_bug_147,
- csv_in_folder,
- deep_nesting,
- gitkeep,
- ignore_glob_inner,
- ignore_glob_nested,
- ignore_glob_spec,
- infer_service_name,
- infer_starter_player,
- init_meta_class_name,
- init_meta_properties,
- init_with_children,
- issue_546,
- json_as_lua,
- json_model_in_folder,
- json_model_legacy_name,
- module_in_folder,
- module_init,
- optional,
- project_composed_default,
- project_composed_file,
- project_root_name,
- rbxm_in_folder,
- rbxmx_in_folder,
- rbxmx_ref,
- script_meta_disabled,
- server_in_folder,
- server_init,
- txt,
- txt_in_folder,
- unresolved_values,
- weldconstraint,
+ init_csv_with_children: "rbxmx",
+ attributes: "rbxmx",
+ client_in_folder: "rbxmx",
+ client_init: "rbxmx",
+ csv_bug_145: "rbxmx",
+ csv_bug_147: "rbxmx",
+ csv_in_folder: "rbxmx",
+ deep_nesting: "rbxmx",
+ gitkeep: "rbxmx",
+ ignore_glob_inner: "rbxmx",
+ ignore_glob_nested: "rbxmx",
+ ignore_glob_spec: "rbxmx",
+ infer_service_name: "rbxlx",
+ infer_starter_player: "rbxlx",
+ init_meta_class_name: "rbxmx",
+ init_meta_properties: "rbxmx",
+ init_with_children: "rbxmx",
+ issue_546: "rbxmx",
+ json_as_lua: "rbxmx",
+ json_model_in_folder: "rbxmx",
+ json_model_legacy_name: "rbxmx",
+ module_in_folder: "rbxmx",
+ module_init: "rbxmx",
+ optional: "rbxmx",
+ project_composed_default: "rbxmx",
+ project_composed_file: "rbxmx",
+ project_root_name: "rbxmx",
+ rbxm_in_folder: "rbxmx",
+ rbxmx_in_folder: "rbxmx",
+ rbxmx_ref: "rbxmx",
+ script_meta_disabled: "rbxmx",
+ server_in_folder: "rbxmx",
+ server_init: "rbxmx",
+ txt: "rbxmx",
+ txt_in_folder: "rbxmx",
+ unresolved_values: "rbxlx",
+ weldconstraint: "rbxmx",
}
-fn run_build_test(test_name: &str) {
+fn run_build_test(test_name: &str, out_format: &str) {
let working_dir = get_working_dir_path();
let input_path = Path::new(BUILD_TESTS_PATH).join(test_name);
let output_dir = tempdir().expect("couldn't create temporary directory");
- let output_path = output_dir.path().join(format!("{}.rbxmx", test_name));
+ let output_path = output_dir
+ .path()
+ .join(format!("{}.{}", test_name, out_format));
let output = Command::new(ROJO_PATH)
.args(&[