mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-22 13:21:38 +00:00
Merge b2a767318d into 95262a02e9
This commit is contained in:
commit
0bffb88bc9
8 changed files with 61 additions and 26 deletions
|
|
@ -31,6 +31,10 @@ Making a new release? Simply add the new header with the version and date undern
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
* Fixed a bug where `$path` in an instance description couldn't reference an init script directly (i.e init.luau, init.sever.luau, etc). ([#1285])
|
||||||
|
|
||||||
|
[#1285]: https://github.com/rojo-rbx/rojo/pull/1285
|
||||||
|
|
||||||
## [7.7.1] (October 1st, 2026)
|
## [7.7.1] (October 1st, 2026)
|
||||||
|
|
||||||
* Fixed `$path` values that point outside the project folder failing to match `syncRule`s on Windows, which broke `rojo sourcemap` with a "could not be turned into a Roblox Instance" error. ([#1290])
|
* Fixed `$path` values that point outside the project folder failing to match `syncRule`s on Windows, which broke `rojo sourcemap` with a "could not be turned into a Roblox Instance" error. ([#1290])
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
---
|
||||||
|
source: tests/tests/build.rs
|
||||||
|
expression: contents
|
||||||
|
---
|
||||||
|
<roblox version="4">
|
||||||
|
<Item class="Folder" referent="0">
|
||||||
|
<Properties>
|
||||||
|
<string name="Name">init_from_path</string>
|
||||||
|
</Properties>
|
||||||
|
<Item class="ModuleScript" referent="1">
|
||||||
|
<Properties>
|
||||||
|
<string name="Name">folder</string>
|
||||||
|
<string name="Source"><![CDATA[-- init.luau
|
||||||
|
]]></string>
|
||||||
|
</Properties>
|
||||||
|
</Item>
|
||||||
|
</Item>
|
||||||
|
</roblox>
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"name": "init_from_path",
|
||||||
|
"tree": {
|
||||||
|
"$className": "Folder",
|
||||||
|
"folder": {
|
||||||
|
"$path": "folder/init.luau"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
-- ignore_me.luau
|
||||||
1
rojo-test/build-tests/init_from_path/folder/init.luau
Normal file
1
rojo-test/build-tests/init_from_path/folder/init.luau
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
-- init.luau
|
||||||
|
|
@ -51,7 +51,7 @@ pub fn snapshot_dir_no_meta(
|
||||||
for entry in vfs.read_dir(path)? {
|
for entry in vfs.read_dir(path)? {
|
||||||
let entry = entry?;
|
let entry = entry?;
|
||||||
|
|
||||||
if !passes_filter_rules(&entry) {
|
if !passes_filter_rules(&entry) || is_init_file(entry.path()).unwrap() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -221,6 +221,21 @@ pub fn syncback_dir_no_meta<'sync>(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_init_file(path: &Path) -> anyhow::Result<bool> {
|
||||||
|
let file_name = path
|
||||||
|
.file_name()
|
||||||
|
.and_then(|n| n.to_str())
|
||||||
|
.with_context(|| format!("file name of {} is invalid", path.display()))?;
|
||||||
|
|
||||||
|
match file_name {
|
||||||
|
"init.server.luau" | "init.server.lua" | "init.client.luau" | "init.client.lua"
|
||||||
|
| "init.plugin.luau" | "init.plugin.lua" | "init.luau" | "init.lua" | "init.csv" => {
|
||||||
|
Ok(true)
|
||||||
|
}
|
||||||
|
_ => Ok(false),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
|
||||||
|
|
@ -72,32 +72,18 @@ pub fn snapshot_from_vfs(
|
||||||
None => return Ok(None),
|
None => return Ok(None),
|
||||||
};
|
};
|
||||||
|
|
||||||
if meta.is_dir() {
|
if !meta.is_dir() {
|
||||||
let (middleware, dir_name, init_path) = get_dir_middleware(vfs, path)?;
|
return snapshot_from_path(context, vfs, path);
|
||||||
// TODO: Support user defined init paths
|
}
|
||||||
// If and when we do, make sure to go support it in
|
|
||||||
// `Project::set_file_name`, as right now it special-cases
|
|
||||||
// `default.project.json` as an `init` path.
|
|
||||||
match middleware {
|
|
||||||
Middleware::Dir => middleware.snapshot(context, vfs, path, dir_name),
|
|
||||||
_ => middleware.snapshot(context, vfs, &init_path, dir_name),
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
let file_name = path
|
|
||||||
.file_name()
|
|
||||||
.and_then(|n| n.to_str())
|
|
||||||
.with_context(|| format!("file name of {} is invalid", path.display()))?;
|
|
||||||
|
|
||||||
// TODO: Is this even necessary anymore?
|
let (middleware, dir_name, init_path) = get_dir_middleware(vfs, path)?;
|
||||||
match file_name {
|
// TODO: Support user defined init paths
|
||||||
"init.server.luau" | "init.server.lua" | "init.client.luau" | "init.client.lua"
|
// If and when we do, make sure to go support it in
|
||||||
| "init.plugin.luau" | "init.plugin.lua" | "init.luau" | "init.lua" | "init.csv" => {
|
// `Project::set_file_name`, as right now it special-cases
|
||||||
return Ok(None)
|
// `default.project.json` as an `init` path.
|
||||||
}
|
match middleware {
|
||||||
_ => {}
|
Middleware::Dir => middleware.snapshot(context, vfs, path, dir_name),
|
||||||
}
|
_ => middleware.snapshot(context, vfs, &init_path, dir_name),
|
||||||
|
|
||||||
snapshot_from_path(context, vfs, path)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ gen_build_tests! {
|
||||||
no_name_project,
|
no_name_project,
|
||||||
no_name_top_level_project,
|
no_name_top_level_project,
|
||||||
plugin_init,
|
plugin_init,
|
||||||
|
init_from_path,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_build_test(test_name: &str) {
|
fn run_build_test(test_name: &str) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue