forked from rojo-rbx/rojo
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") {
|
||||
Some(v) => match v.parse::<u16>() {
|
||||
Ok(port) => port,
|
||||
Ok(port) => Some(port),
|
||||
Err(_) => {
|
||||
error!("Invalid port {}", v);
|
||||
process::exit(1);
|
||||
|
||||
@@ -34,16 +34,16 @@ impl From<ProjectLoadFuzzyError> for ServeError {
|
||||
pub fn serve(options: &ServeOptions) -> Result<(), ServeError> {
|
||||
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!("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 port = options.port
|
||||
// .or(project.serve_port)
|
||||
.or(project.serve_port)
|
||||
.unwrap_or(DEFAULT_PORT);
|
||||
|
||||
println!("Rojo server listening on port {}", port);
|
||||
|
||||
@@ -77,6 +77,7 @@ impl SourceProjectNode {
|
||||
struct SourceProject {
|
||||
name: String,
|
||||
tree: SourceProjectNode,
|
||||
serve_port: Option<u16>,
|
||||
}
|
||||
|
||||
impl SourceProject {
|
||||
@@ -86,6 +87,7 @@ impl SourceProject {
|
||||
Project {
|
||||
name: self.name,
|
||||
tree,
|
||||
serve_port: self.serve_port,
|
||||
file_location: PathBuf::from(project_file_location),
|
||||
}
|
||||
}
|
||||
@@ -169,6 +171,7 @@ pub struct SyncPointProjectNode {
|
||||
pub struct Project {
|
||||
pub name: String,
|
||||
pub tree: ProjectNode,
|
||||
pub serve_port: Option<u16>,
|
||||
pub file_location: PathBuf,
|
||||
}
|
||||
|
||||
|
||||
@@ -23,14 +23,13 @@ pub struct Session {
|
||||
}
|
||||
|
||||
impl Session {
|
||||
pub fn new(project: Project) -> io::Result<Session> {
|
||||
pub fn new(project: Arc<Project>) -> io::Result<Session> {
|
||||
let imfs = {
|
||||
let mut imfs = Imfs::new();
|
||||
imfs.add_roots_from_project(&project)?;
|
||||
|
||||
Arc::new(Mutex::new(imfs))
|
||||
};
|
||||
let project = Arc::new(project);
|
||||
let message_queue = Arc::new(MessageQueue::new());
|
||||
|
||||
let rbx_session = Arc::new(Mutex::new(RbxSession::new(
|
||||
|
||||
Reference in New Issue
Block a user