mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-23 22:25:26 +00:00
Remove unfinished plugin scaffolding
This commit is contained in:
@@ -25,10 +25,6 @@ struct SourceProject {
|
|||||||
name: String,
|
name: String,
|
||||||
tree: SourceProjectNode,
|
tree: SourceProjectNode,
|
||||||
|
|
||||||
#[cfg_attr(not(feature = "plugins-enabled"), serde(skip_deserializing))]
|
|
||||||
#[serde(default = "Vec::new", skip_serializing_if = "Vec::is_empty")]
|
|
||||||
plugins: Vec<SourcePlugin>,
|
|
||||||
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
serve_port: Option<u16>,
|
serve_port: Option<u16>,
|
||||||
|
|
||||||
@@ -40,16 +36,10 @@ impl SourceProject {
|
|||||||
/// Consumes the SourceProject and yields a Project, ready for prime-time.
|
/// Consumes the SourceProject and yields a Project, ready for prime-time.
|
||||||
pub fn into_project(mut self, project_file_location: &Path) -> Project {
|
pub fn into_project(mut self, project_file_location: &Path) -> Project {
|
||||||
let tree = self.tree.into_project_node(project_file_location);
|
let tree = self.tree.into_project_node(project_file_location);
|
||||||
let plugins = self
|
|
||||||
.plugins
|
|
||||||
.drain(..)
|
|
||||||
.map(|source_plugin| source_plugin.into_plugin(project_file_location))
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
Project {
|
Project {
|
||||||
name: self.name,
|
name: self.name,
|
||||||
tree,
|
tree,
|
||||||
plugins,
|
|
||||||
serve_port: self.serve_port,
|
serve_port: self.serve_port,
|
||||||
serve_place_ids: self.serve_place_ids,
|
serve_place_ids: self.serve_place_ids,
|
||||||
file_location: PathBuf::from(project_file_location),
|
file_location: PathBuf::from(project_file_location),
|
||||||
@@ -193,24 +183,6 @@ impl SourceProjectNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
|
||||||
struct SourcePlugin {
|
|
||||||
path: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl SourcePlugin {
|
|
||||||
pub fn into_plugin(self, project_file_location: &Path) -> Plugin {
|
|
||||||
let path = if Path::new(&self.path).is_absolute() {
|
|
||||||
PathBuf::from(self.path)
|
|
||||||
} else {
|
|
||||||
let project_folder_location = project_file_location.parent().unwrap();
|
|
||||||
project_folder_location.join(self.path)
|
|
||||||
};
|
|
||||||
|
|
||||||
Plugin { path }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Fail)]
|
#[derive(Debug, Fail)]
|
||||||
pub enum ProjectLoadError {
|
pub enum ProjectLoadError {
|
||||||
NotFound,
|
NotFound,
|
||||||
@@ -340,28 +312,10 @@ impl ProjectNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
|
||||||
pub struct Plugin {
|
|
||||||
pub path: PathBuf,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Plugin {
|
|
||||||
fn to_source_plugin(&self, project_file_location: &Path) -> SourcePlugin {
|
|
||||||
let project_folder_location = project_file_location.parent().unwrap();
|
|
||||||
let path = match self.path.strip_prefix(project_folder_location) {
|
|
||||||
Ok(stripped) => stripped.to_str().unwrap().replace("\\", "/"),
|
|
||||||
Err(_) => format!("{}", self.path.display()),
|
|
||||||
};
|
|
||||||
|
|
||||||
SourcePlugin { path }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct Project {
|
pub struct Project {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub tree: ProjectNode,
|
pub tree: ProjectNode,
|
||||||
pub plugins: Vec<Plugin>,
|
|
||||||
pub serve_port: Option<u16>,
|
pub serve_port: Option<u16>,
|
||||||
pub serve_place_ids: Option<HashSet<u64>>,
|
pub serve_place_ids: Option<HashSet<u64>>,
|
||||||
pub file_location: PathBuf,
|
pub file_location: PathBuf,
|
||||||
@@ -428,7 +382,6 @@ impl Project {
|
|||||||
let project = Project {
|
let project = Project {
|
||||||
name: project_name.to_string(),
|
name: project_name.to_string(),
|
||||||
tree,
|
tree,
|
||||||
plugins: Vec::new(),
|
|
||||||
serve_port: None,
|
serve_port: None,
|
||||||
serve_place_ids: None,
|
serve_place_ids: None,
|
||||||
file_location: project_path.clone(),
|
file_location: project_path.clone(),
|
||||||
@@ -593,16 +546,9 @@ impl Project {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn to_source_project(&self) -> SourceProject {
|
fn to_source_project(&self) -> SourceProject {
|
||||||
let plugins = self
|
|
||||||
.plugins
|
|
||||||
.iter()
|
|
||||||
.map(|plugin| plugin.to_source_plugin(&self.file_location))
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
SourceProject {
|
SourceProject {
|
||||||
name: self.name.clone(),
|
name: self.name.clone(),
|
||||||
tree: self.tree.to_source_node(&self.file_location),
|
tree: self.tree.to_source_node(&self.file_location),
|
||||||
plugins,
|
|
||||||
serve_port: self.serve_port,
|
serve_port: self.serve_port,
|
||||||
serve_place_ids: self.serve_place_ids.clone(),
|
serve_place_ids: self.serve_place_ids.clone(),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ fn single_partition_game() {
|
|||||||
Project {
|
Project {
|
||||||
name: "single-sync-point".to_string(),
|
name: "single-sync-point".to_string(),
|
||||||
tree: root_node,
|
tree: root_node,
|
||||||
plugins: Vec::new(),
|
|
||||||
serve_port: None,
|
serve_port: None,
|
||||||
serve_place_ids: None,
|
serve_place_ids: None,
|
||||||
file_location: project_location.join("default.project.json"),
|
file_location: project_location.join("default.project.json"),
|
||||||
|
|||||||
Reference in New Issue
Block a user