forked from rojo-rbx/rojo
Remove unfinished plugin scaffolding
This commit is contained in:
@@ -25,10 +25,6 @@ struct SourceProject {
|
||||
name: String,
|
||||
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")]
|
||||
serve_port: Option<u16>,
|
||||
|
||||
@@ -40,16 +36,10 @@ impl SourceProject {
|
||||
/// Consumes the SourceProject and yields a Project, ready for prime-time.
|
||||
pub fn into_project(mut self, project_file_location: &Path) -> Project {
|
||||
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 {
|
||||
name: self.name,
|
||||
tree,
|
||||
plugins,
|
||||
serve_port: self.serve_port,
|
||||
serve_place_ids: self.serve_place_ids,
|
||||
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)]
|
||||
pub enum ProjectLoadError {
|
||||
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)]
|
||||
pub struct Project {
|
||||
pub name: String,
|
||||
pub tree: ProjectNode,
|
||||
pub plugins: Vec<Plugin>,
|
||||
pub serve_port: Option<u16>,
|
||||
pub serve_place_ids: Option<HashSet<u64>>,
|
||||
pub file_location: PathBuf,
|
||||
@@ -428,7 +382,6 @@ impl Project {
|
||||
let project = Project {
|
||||
name: project_name.to_string(),
|
||||
tree,
|
||||
plugins: Vec::new(),
|
||||
serve_port: None,
|
||||
serve_place_ids: None,
|
||||
file_location: project_path.clone(),
|
||||
@@ -593,16 +546,9 @@ impl Project {
|
||||
}
|
||||
|
||||
fn to_source_project(&self) -> SourceProject {
|
||||
let plugins = self
|
||||
.plugins
|
||||
.iter()
|
||||
.map(|plugin| plugin.to_source_plugin(&self.file_location))
|
||||
.collect();
|
||||
|
||||
SourceProject {
|
||||
name: self.name.clone(),
|
||||
tree: self.tree.to_source_node(&self.file_location),
|
||||
plugins,
|
||||
serve_port: self.serve_port,
|
||||
serve_place_ids: self.serve_place_ids.clone(),
|
||||
}
|
||||
|
||||
@@ -85,7 +85,6 @@ fn single_partition_game() {
|
||||
Project {
|
||||
name: "single-sync-point".to_string(),
|
||||
tree: root_node,
|
||||
plugins: Vec::new(),
|
||||
serve_port: None,
|
||||
serve_place_ids: None,
|
||||
file_location: project_location.join("default.project.json"),
|
||||
|
||||
Reference in New Issue
Block a user