mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-21 03:36:06 +00:00
Implement build command, shuffle around some internals to make it easier
This commit is contained in:
parent
7c585fcbce
commit
8aee5c769f
5 changed files with 67 additions and 26 deletions
|
|
@ -5,6 +5,23 @@ use std::{
|
|||
io,
|
||||
};
|
||||
|
||||
use crate::project::{Project, ProjectNode};
|
||||
|
||||
fn add_sync_points(imfs: &mut Imfs, project_node: &ProjectNode) -> io::Result<()> {
|
||||
match project_node {
|
||||
ProjectNode::Instance(node) => {
|
||||
for child in node.children.values() {
|
||||
add_sync_points(imfs, child)?;
|
||||
}
|
||||
},
|
||||
ProjectNode::SyncPoint(node) => {
|
||||
imfs.add_root(&node.path)?;
|
||||
},
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The in-memory filesystem keeps a mirror of all files being watcher by Rojo
|
||||
/// in order to deduplicate file changes in the case of bidirectional syncing
|
||||
/// from Roblox Studio.
|
||||
|
|
@ -15,7 +32,15 @@ pub struct Imfs {
|
|||
}
|
||||
|
||||
impl Imfs {
|
||||
pub fn new() -> Imfs {
|
||||
pub fn new(project: &Project) -> io::Result<Imfs> {
|
||||
let mut imfs = Imfs::empty();
|
||||
|
||||
add_sync_points(&mut imfs, &project.tree)?;
|
||||
|
||||
Ok(imfs)
|
||||
}
|
||||
|
||||
pub fn empty() -> Imfs {
|
||||
Imfs {
|
||||
items: HashMap::new(),
|
||||
roots: HashSet::new(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue