mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-23 14:15:24 +00:00
Fix build issue, add servePort project option
This commit is contained in:
@@ -65,7 +65,7 @@ fn main() {
|
|||||||
|
|
||||||
let port = match sub_matches.value_of("port") {
|
let port = match sub_matches.value_of("port") {
|
||||||
Some(v) => match v.parse::<u16>() {
|
Some(v) => match v.parse::<u16>() {
|
||||||
Ok(port) => port,
|
Ok(port) => Some(port),
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
error!("Invalid port {}", v);
|
error!("Invalid port {}", v);
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
|
|||||||
@@ -34,16 +34,16 @@ impl From<ProjectLoadFuzzyError> for ServeError {
|
|||||||
pub fn serve(options: &ServeOptions) -> Result<(), ServeError> {
|
pub fn serve(options: &ServeOptions) -> Result<(), ServeError> {
|
||||||
info!("Looking for project at {}", options.fuzzy_project_path.display());
|
info!("Looking for project at {}", options.fuzzy_project_path.display());
|
||||||
|
|
||||||
let project = Project::load_fuzzy(&options.fuzzy_project_path)?;
|
let project = Arc::new(Project::load_fuzzy(&options.fuzzy_project_path)?);
|
||||||
|
|
||||||
info!("Found project at {}", project.file_location.display());
|
info!("Found project at {}", project.file_location.display());
|
||||||
info!("Using project {:#?}", project);
|
info!("Using project {:#?}", project);
|
||||||
|
|
||||||
let session = Arc::new(Session::new(project).unwrap());
|
let session = Arc::new(Session::new(Arc::clone(&project)).unwrap());
|
||||||
let server = Server::new(Arc::clone(&session));
|
let server = Server::new(Arc::clone(&session));
|
||||||
|
|
||||||
let port = options.port
|
let port = options.port
|
||||||
// .or(project.serve_port)
|
.or(project.serve_port)
|
||||||
.unwrap_or(DEFAULT_PORT);
|
.unwrap_or(DEFAULT_PORT);
|
||||||
|
|
||||||
println!("Rojo server listening on port {}", port);
|
println!("Rojo server listening on port {}", port);
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ impl SourceProjectNode {
|
|||||||
struct SourceProject {
|
struct SourceProject {
|
||||||
name: String,
|
name: String,
|
||||||
tree: SourceProjectNode,
|
tree: SourceProjectNode,
|
||||||
|
serve_port: Option<u16>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SourceProject {
|
impl SourceProject {
|
||||||
@@ -86,6 +87,7 @@ impl SourceProject {
|
|||||||
Project {
|
Project {
|
||||||
name: self.name,
|
name: self.name,
|
||||||
tree,
|
tree,
|
||||||
|
serve_port: self.serve_port,
|
||||||
file_location: PathBuf::from(project_file_location),
|
file_location: PathBuf::from(project_file_location),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -169,6 +171,7 @@ pub struct SyncPointProjectNode {
|
|||||||
pub struct Project {
|
pub struct Project {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub tree: ProjectNode,
|
pub tree: ProjectNode,
|
||||||
|
pub serve_port: Option<u16>,
|
||||||
pub file_location: PathBuf,
|
pub file_location: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,14 +23,13 @@ pub struct Session {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Session {
|
impl Session {
|
||||||
pub fn new(project: Project) -> io::Result<Session> {
|
pub fn new(project: Arc<Project>) -> io::Result<Session> {
|
||||||
let imfs = {
|
let imfs = {
|
||||||
let mut imfs = Imfs::new();
|
let mut imfs = Imfs::new();
|
||||||
imfs.add_roots_from_project(&project)?;
|
imfs.add_roots_from_project(&project)?;
|
||||||
|
|
||||||
Arc::new(Mutex::new(imfs))
|
Arc::new(Mutex::new(imfs))
|
||||||
};
|
};
|
||||||
let project = Arc::new(project);
|
|
||||||
let message_queue = Arc::new(MessageQueue::new());
|
let message_queue = Arc::new(MessageQueue::new());
|
||||||
|
|
||||||
let rbx_session = Arc::new(Mutex::new(RbxSession::new(
|
let rbx_session = Arc::new(Mutex::new(RbxSession::new(
|
||||||
|
|||||||
Reference in New Issue
Block a user