mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-21 21:25:16 +00:00
Rewrite Project, remove SourceProject (#274)
* Rewrite project file to have relative paths and drop SourceProject * Redo project error types * Tidy up and document Project type * Strip out init command
This commit is contained in:
committed by
GitHub
parent
47c7f63d75
commit
1f7f2b22e7
@@ -6,7 +6,7 @@ use std::path::Path;
|
||||
use rbx_dom_weak::RbxInstanceProperties;
|
||||
|
||||
use crate::{
|
||||
project::{Project, ProjectLoadError},
|
||||
project::Project,
|
||||
snapshot::{
|
||||
apply_patch_set, compute_patch_set, InstanceContext, InstancePropertiesWithMeta, RojoTree,
|
||||
},
|
||||
@@ -19,11 +19,7 @@ pub fn start<F: VfsFetcher>(
|
||||
vfs: &Vfs<F>,
|
||||
) -> (Option<Project>, RojoTree) {
|
||||
log::trace!("Loading project file from {}", fuzzy_project_path.display());
|
||||
let maybe_project = match Project::load_fuzzy(fuzzy_project_path) {
|
||||
Ok(project) => Some(project),
|
||||
Err(ProjectLoadError::NotFound) => None,
|
||||
Err(other) => panic!("{}", other), // TODO: return error upward
|
||||
};
|
||||
let maybe_project = Project::load_fuzzy(fuzzy_project_path).expect("TODO: Project load failed");
|
||||
|
||||
log::trace!("Constructing initial tree");
|
||||
let mut tree = RojoTree::new(InstancePropertiesWithMeta {
|
||||
@@ -37,23 +33,13 @@ pub fn start<F: VfsFetcher>(
|
||||
|
||||
let root_id = tree.get_root_id();
|
||||
|
||||
log::trace!("Constructing snapshot context");
|
||||
let snapshot_context = InstanceContext::default();
|
||||
if let Some(project) = &maybe_project {
|
||||
// If the project file defines no plugins, then there's no need to
|
||||
// initialize the snapshot plugin context.
|
||||
if !project.plugins.is_empty() {
|
||||
// TODO: Initialize plugins in instance context
|
||||
}
|
||||
}
|
||||
|
||||
log::trace!("Reading project root");
|
||||
let entry = vfs
|
||||
.get(fuzzy_project_path)
|
||||
.expect("could not get project path");
|
||||
|
||||
log::trace!("Generating snapshot of instances from VFS");
|
||||
let snapshot = snapshot_from_vfs(&snapshot_context, vfs, &entry)
|
||||
let snapshot = snapshot_from_vfs(&InstanceContext::default(), vfs, &entry)
|
||||
.expect("snapshot failed")
|
||||
.expect("snapshot did not return an instance");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user