diff options
author | Kunal Mohan <44079328+kunalmohan@users.noreply.github.com> | 2021-05-19 11:21:33 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-19 11:21:33 +0530 |
commit | b20ac47d689a13cc894c3a10838cb8c2247a6e42 (patch) | |
tree | e3f942bc4778ba882e24968524c068b555486a75 /zellij-server | |
parent | 68445af63feaf6ab53a240d046392be09ecf2f8b (diff) | |
parent | a351440c99c7fba4dd66329b2ae27301dec1f288 (diff) |
Merge pull request #522 from zellij-org/re-export-dependencies
Re-export common dependencies from zellij-utils
Diffstat (limited to 'zellij-server')
-rw-r--r-- | zellij-server/Cargo.toml | 21 | ||||
-rw-r--r-- | zellij-server/src/lib.rs | 7 | ||||
-rw-r--r-- | zellij-server/src/os_input_output.rs | 23 | ||||
-rw-r--r-- | zellij-server/src/panes/grid.rs | 3 | ||||
-rw-r--r-- | zellij-server/src/panes/terminal_character.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/panes/terminal_pane.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/panes/unit/grid_tests.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/pty.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/route.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/screen.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/tab.rs | 3 | ||||
-rw-r--r-- | zellij-server/src/ui/boundaries.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/ui/layout.rs | 5 | ||||
-rw-r--r-- | zellij-server/src/wasm_vm.rs | 2 |
14 files changed, 45 insertions, 33 deletions
diff --git a/zellij-server/Cargo.toml b/zellij-server/Cargo.toml index 97930c75b..532ef9317 100644 --- a/zellij-server/Cargo.toml +++ b/zellij-server/Cargo.toml @@ -9,26 +9,13 @@ license = "MIT" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -serde = { version = "1.0", features = ["derive"] } +ansi_term = "0.12.1" +daemonize = "0.4.1" +serde_json = "1.0" +unicode-width = "0.1.8" wasmer = "1.0.0" wasmer-wasi = "1.0.0" -zellij-tile = { path = "../zellij-tile/", version = "0.12.0" } zellij-utils = { path = "../zellij-utils/", version = "0.12.0" } -vte = "0.10.1" -unicode-width = "0.1.8" -ansi_term = "0.12.1" -serde_yaml = "0.8" -nix = "0.19.1" -termion = "1.5.0" -signal-hook = "0.3" -libc = "0.2" -serde_json = "1.0" -daemonize = "0.4.1" -interprocess = "1.1.1" - -[dependencies.async-std] -version = "1.3.0" -features = ["unstable"] [dev-dependencies] insta = "1.6.0" diff --git a/zellij-server/src/lib.rs b/zellij-server/src/lib.rs index 8d82313db..df0eea65f 100644 --- a/zellij-server/src/lib.rs +++ b/zellij-server/src/lib.rs @@ -9,6 +9,8 @@ mod thread_bus; mod ui; mod wasm_vm; +use zellij_utils::zellij_tile; + use std::sync::{Arc, RwLock}; use std::thread; use std::{path::PathBuf, sync::mpsc}; @@ -131,8 +133,9 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { let _ = thread::Builder::new() .name("server_listener".to_string()) .spawn({ - use interprocess::local_socket::LocalSocketListener; - use zellij_utils::shared::set_permissions; + use zellij_utils::{ + interprocess::local_socket::LocalSocketListener, shared::set_permissions, + }; let os_input = os_input.clone(); let sessions = sessions.clone(); diff --git a/zellij-server/src/os_input_output.rs b/zellij-server/src/os_input_output.rs index bd5e9a486..be51878ce 100644 --- a/zellij-server/src/os_input_output.rs +++ b/zellij-server/src/os_input_output.rs @@ -1,3 +1,11 @@ +use std::env; +use std::os::unix::io::RawFd; +use std::path::PathBuf; +use std::process::{Child, Command}; +use std::sync::{Arc, Mutex}; + +use zellij_utils::{interprocess, libc, nix, signal_hook, zellij_tile}; + use interprocess::local_socket::LocalSocketStream; use nix::fcntl::{fcntl, FcntlArg, OFlag}; use nix::pty::{forkpty, Winsize}; @@ -6,17 +14,12 @@ use nix::sys::termios; use nix::sys::wait::waitpid; use nix::unistd::{self, ForkResult}; use signal_hook::consts::*; -use std::env; -use std::os::unix::io::RawFd; -use std::path::PathBuf; -use std::process::{Child, Command}; -use std::sync::{Arc, Mutex}; use zellij_tile::data::Palette; -use zellij_utils::errors::ErrorContext; -use zellij_utils::ipc::{ - ClientToServerMsg, IpcReceiverWithContext, IpcSenderWithContext, ServerToClientMsg, +use zellij_utils::{ + errors::ErrorContext, + ipc::{ClientToServerMsg, IpcReceiverWithContext, IpcSenderWithContext, ServerToClientMsg}, + shared::default_palette, }; -use zellij_utils::shared::default_palette; pub use nix::unistd::Pid; pub(crate) fn set_terminal_size_using_fd(fd: RawFd, columns: u16, rows: u16) { @@ -37,7 +40,7 @@ pub(crate) fn set_terminal_size_using_fd(fd: RawFd, columns: u16, rows: u16) { /// process exits. fn handle_command_exit(mut child: Child) { // register the SIGINT signal (TODO handle more signals) - let mut signals = ::signal_hook::iterator::Signals::new(&[SIGINT]).unwrap(); + let mut signals = signal_hook::iterator::Signals::new(&[SIGINT]).unwrap(); 'handle_exit: loop { // test whether the child process has exited match child.try_wait() { diff --git a/zellij-server/src/panes/grid.rs b/zellij-server/src/panes/grid.rs index d9cef5def..ac347db0e 100644 --- a/zellij-server/src/panes/grid.rs +++ b/zellij-server/src/panes/grid.rs @@ -5,11 +5,12 @@ use std::{ str, }; -use vte::{Params, Perform}; +use zellij_utils::{vte, zellij_tile}; const TABSTOP_WIDTH: usize = 8; // TODO: is this always right? const SCROLL_BACK: usize = 10_000; +use vte::{Params, Perform}; use zellij_tile::data::{Palette, PaletteColor}; use zellij_utils::{consts::VERSION, logging::debug_log_to_file, shared::version_number}; diff --git a/zellij-server/src/panes/terminal_character.rs b/zellij-server/src/panes/terminal_character.rs index c55569f05..e6489eb42 100644 --- a/zellij-server/src/panes/terminal_character.rs +++ b/zellij-server/src/panes/terminal_character.rs @@ -3,8 +3,8 @@ use unicode_width::UnicodeWidthChar; use std::convert::TryFrom; use std::fmt::{self, Debug, Display, Formatter}; use std::ops::{Index, IndexMut}; -use vte::ParamsIter; use zellij_utils::logging::debug_log_to_file; +use zellij_utils::vte::ParamsIter; pub const EMPTY_TERMINAL_CHARACTER: TerminalCharacter = TerminalCharacter { character: ' ', diff --git a/zellij-server/src/panes/terminal_pane.rs b/zellij-server/src/panes/terminal_pane.rs index eaeb00264..7e45c77bb 100644 --- a/zellij-server/src/panes/terminal_pane.rs +++ b/zellij-server/src/panes/terminal_pane.rs @@ -1,3 +1,5 @@ +use zellij_utils::{vte, zellij_tile}; + use std::fmt::Debug; use std::os::unix::io::RawFd; use std::time::Instant; diff --git a/zellij-server/src/panes/unit/grid_tests.rs b/zellij-server/src/panes/unit/grid_tests.rs index 7612a05d1..1a1d7f5cc 100644 --- a/zellij-server/src/panes/unit/grid_tests.rs +++ b/zellij-server/src/panes/unit/grid_tests.rs @@ -1,6 +1,6 @@ use super::super::Grid; use ::insta::assert_snapshot; -use zellij_tile::data::Palette; +use zellij_utils::{vte, zellij_tile::data::Palette}; fn read_fixture(fixture_name: &str) -> Vec<u8> { let mut path_to_file = std::path::PathBuf::new(); diff --git a/zellij-server/src/pty.rs b/zellij-server/src/pty.rs index 9bf1bddfd..ecaef460a 100644 --- a/zellij-server/src/pty.rs +++ b/zellij-server/src/pty.rs @@ -1,3 +1,5 @@ +use zellij_utils::{async_std, nix}; + use async_std::stream::*; use async_std::task; use async_std::task::*; diff --git a/zellij-server/src/route.rs b/zellij-server/src/route.rs index daa0c0ead..0187d9536 100644 --- a/zellij-server/src/route.rs +++ b/zellij-server/src/route.rs @@ -1,6 +1,6 @@ use std::sync::{Arc, RwLock}; -use zellij_tile::data::Event; +use zellij_utils::zellij_tile::data::Event; use crate::{ os_input_output::ServerOsApi, pty::PtyInstruction, screen::ScreenInstruction, diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs index 0500d296d..830c42511 100644 --- a/zellij-server/src/screen.rs +++ b/zellij-server/src/screen.rs @@ -4,6 +4,8 @@ use std::collections::BTreeMap; use std::os::unix::io::RawFd; use std::str; +use zellij_utils::zellij_tile; + use crate::{ panes::PaneId, pty::{PtyInstruction, VteBytes}, diff --git a/zellij-server/src/tab.rs b/zellij-server/src/tab.rs index 78586d7a7..e6953bfa2 100644 --- a/zellij-server/src/tab.rs +++ b/zellij-server/src/tab.rs @@ -1,6 +1,8 @@ //! `Tab`s holds multiple panes. It tracks their coordinates (x/y) and size, //! as well as how they should be resized +use zellij_utils::{serde, zellij_tile}; + use crate::{ os_input_output::ServerOsApi, panes::{PaneId, PluginPane, TerminalPane}, @@ -78,6 +80,7 @@ pub(crate) struct Tab { } #[derive(Clone, Debug, Default, Serialize, Deserialize)] +#[serde(crate = "self::serde")] pub(crate) struct TabData { /* subset of fields to publish to plugins */ pub position: usize, diff --git a/zellij-server/src/ui/boundaries.rs b/zellij-server/src/ui/boundaries.rs index 984b13762..42a80ace1 100644 --- a/zellij-server/src/ui/boundaries.rs +++ b/zellij-server/src/ui/boundaries.rs @@ -1,3 +1,5 @@ +use zellij_utils::zellij_tile; + use crate::tab::Pane; use ansi_term::Colour::{Fixed, RGB}; use std::collections::HashMap; diff --git a/zellij-server/src/ui/layout.rs b/zellij-server/src/ui/layout.rs index 3965b478c..a9af665fa 100644 --- a/zellij-server/src/ui/layout.rs +++ b/zellij-server/src/ui/layout.rs @@ -1,3 +1,5 @@ +use zellij_utils::{serde, serde_yaml}; + use serde::{Deserialize, Serialize}; use std::path::{Path, PathBuf}; use std::{fs::File, io::prelude::*}; @@ -167,18 +169,21 @@ fn split_space( } #[derive(Debug, Serialize, Deserialize, Clone)] +#[serde(crate = "self::serde")] pub(crate) enum Direction { Horizontal, Vertical, } #[derive(Debug, Serialize, Deserialize, Clone, Copy)] +#[serde(crate = "self::serde")] pub(crate) enum SplitSize { Percent(u8), // 1 to 100 Fixed(u16), // An absolute number of columns or rows } #[derive(Debug, Serialize, Deserialize, Clone)] +#[serde(crate = "self::serde")] pub(crate) struct Layout { pub direction: Direction, #[serde(default, skip_serializing_if = "Vec::is_empty")] diff --git a/zellij-server/src/wasm_vm.rs b/zellij-server/src/wasm_vm.rs index 65f5358ad..53dceaa75 100644 --- a/zellij-server/src/wasm_vm.rs +++ b/zellij-server/src/wasm_vm.rs @@ -7,6 +7,8 @@ use std::sync::{mpsc::Sender, Arc, Mutex}; use std::thread; use std::time::{Duration, Instant}; +use zellij_utils::{serde, zellij_tile}; + use serde::{de::DeserializeOwned, Serialize}; use wasmer::{ imports, ChainableNamedResolver, Function, ImportObject, Instance, Module, Store, Value, |