diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d836008..db24c4e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,5 +83,10 @@ jobs: with: path: target key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} + - name: Install dependencies + if: runner.os == 'Linux' + run: | + sudo apt-get install libxcb-xkb-dev + sudo apt install libxcb-composite0-dev - name: Run Tests run: cargo test -- --skip=e2e --color always diff --git a/Cargo.lock b/Cargo.lock index c1f96c4..7739dc3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -207,7 +207,6 @@ dependencies = [ "objc", "objc-foundation", "objc_id", - "smithay-clipboard", "x11-clipboard", ] @@ -328,27 +327,12 @@ dependencies = [ "generic-array", ] -[[package]] -name = "dlib" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1b7517328c04c2aa68422fc60a41b92208182142ed04a25879c26c8f878794" -dependencies = [ - "libloading", -] - [[package]] name = "dotenv" version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" -[[package]] -name = "downcast-rs" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" - [[package]] name = "easy-cast" version = "0.4.4" @@ -678,16 +662,6 @@ version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12b8adadd720df158f4d70dfe7ccc6adb0472d7c55ca83445f6a5ab3e36f8fb6" -[[package]] -name = "libloading" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f84d96438c15fcd6c3f244c8fce01d1e2b9c6b5623e9c711dc9286d8fc92d6a" -dependencies = [ - "cfg-if 1.0.0", - "winapi 0.3.9", -] - [[package]] name = "libm" version = "0.2.1" @@ -739,15 +713,6 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" -[[package]] -name = "memmap2" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723e3ebdcdc5c023db1df315364573789f8857c11b631a2fdfad7c00f5c046b4" -dependencies = [ - "libc", -] - [[package]] name = "mio" version = "0.6.23" @@ -835,18 +800,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "nix" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" -dependencies = [ - "bitflags", - "cc", - "cfg-if 1.0.0", - "libc", -] - [[package]] name = "nom" version = "6.1.2" @@ -1060,12 +1013,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "pkg-config" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" - [[package]] name = "ppv-lite86" version = "0.2.10" @@ -1231,12 +1178,6 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" -[[package]] -name = "scoped-tls" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" - [[package]] name = "scopeguard" version = "1.1.0" @@ -1372,33 +1313,6 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" -[[package]] -name = "smithay-client-toolkit" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec783683499a2cfc85b6df3d04f83b1907b5cbd98a1aed44667dbdf1eac4e64c" -dependencies = [ - "bitflags", - "dlib", - "lazy_static", - "log", - "memmap2", - "nix", - "wayland-client", - "wayland-cursor", - "wayland-protocols", -] - -[[package]] -name = "smithay-clipboard" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "986c5b4a7bd4f50d4c51f81f844745535cb488360f9cf63293780b109b9295f3" -dependencies = [ - "smithay-client-toolkit", - "wayland-client", -] - [[package]] name = "spin" version = "0.5.2" @@ -1836,79 +1750,6 @@ version = "0.2.74" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f" -[[package]] -name = "wayland-client" -version = "0.28.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3ab332350e502f159382201394a78e3cc12d0f04db863429260164ea40e0355" -dependencies = [ - "bitflags", - "downcast-rs", - "libc", - "nix", - "scoped-tls", - "wayland-commons", - "wayland-scanner", - "wayland-sys", -] - -[[package]] -name = "wayland-commons" -version = "0.28.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21817947c7011bbd0a27e11b17b337bfd022e8544b071a2641232047966fbda" -dependencies = [ - "nix", - "once_cell", - "smallvec", - "wayland-sys", -] - -[[package]] -name = "wayland-cursor" -version = "0.28.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be610084edd1586d45e7bdd275fe345c7c1873598caa464c4fb835dee70fa65a" -dependencies = [ - "nix", - "wayland-client", - "xcursor", -] - -[[package]] -name = "wayland-protocols" -version = "0.28.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "286620ea4d803bacf61fa087a4242ee316693099ee5a140796aaba02b29f861f" -dependencies = [ - "bitflags", - "wayland-client", - "wayland-commons", - "wayland-scanner", -] - -[[package]] -name = "wayland-scanner" -version = "0.28.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce923eb2deb61de332d1f356ec7b6bf37094dc5573952e1c8936db03b54c03f1" -dependencies = [ - "proc-macro2", - "quote", - "xml-rs", -] - -[[package]] -name = "wayland-sys" -version = "0.28.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d841fca9aed7febf9bed2e9796c49bf58d4152ceda8ac949ebe00868d8f0feb8" -dependencies = [ - "dlib", - "lazy_static", - "pkg-config", -] - [[package]] name = "web-sys" version = "0.3.51" @@ -2017,21 +1858,6 @@ dependencies = [ "log", ] -[[package]] -name = "xcursor" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a9a231574ae78801646617cefd13bfe94be907c0e4fa979cfd8b770aa3c5d08" -dependencies = [ - "nom", -] - -[[package]] -name = "xml-rs" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b07db065a5cf61a7e4ba64f29e67db906fb1787316516c4e6e5ff0fea1efcd8a" - [[package]] name = "zeroize" version = "1.3.0" diff --git a/Cargo.toml b/Cargo.toml index ebc91fa..14b6401 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,11 @@ repository = "https://github.com/TaKO8Ki/gobang" readme = "README.md" description = "A cross-platform terminal database tool written in Rust" +[workspace] +members=[ + "database-tree" +] + [dependencies] tui = { version = "0.14.0", features = ["crossterm"], default-features = false } crossterm = "0.19" @@ -26,9 +31,10 @@ strum = "0.21" strum_macros = "0.21" database-tree = { path = "./database-tree", version = "0.1" } easy-cast = "0.4" -copypasta = { version = "0.7.0" } +copypasta = { version = "0.7.0", default-features = false } -[workspace] -members=[ - "database-tree" -] +[target.'cfg(any(target_os = "macos", windows))'.dependencies] +copypasta = { version = "0.7.0", default-features = false } + +[target.'cfg(not(any(target_os = "macos", windows)))'.dependencies] +copypasta = { version = "0.7.0", features = ["x11"], default-features = false } diff --git a/src/clipboard.rs b/src/clipboard.rs index a9bb87a..7fafd12 100644 --- a/src/clipboard.rs +++ b/src/clipboard.rs @@ -1,8 +1,3 @@ -#[cfg(any(test, not(any(target_os = "linux", target_os = "macos", windows))))] -use copypasta::nop_clipboard::NopClipboardContext; -#[cfg(target_os = "linux")] -use copypasta::x11_clipboard::{Primary as X11SelectionClipboard, X11ClipboardContext}; -#[cfg(any(target_os = "linux", target_os = "macos", windows))] use copypasta::ClipboardContext; use copypasta::ClipboardProvider; @@ -12,38 +7,36 @@ pub struct Clipboard { } impl Clipboard { - #[cfg(any(target_os = "linux", target_os = "macos", windows))] pub fn new() -> Self { Self::default() } - #[cfg(any(test, not(any(target_os = "linux", target_os = "macos", windows))))] - pub fn new_nop() -> Self { - Self { - clipboard: Box::new(NopClipboardContext::new().unwrap()), - selection: None, - } - } + // #[cfg(any(test, not(any(target_os = "macos", windows))))] + // pub fn new_nop() -> Self { + // Self { + // clipboard: Box::new(NopClipboardContext::new().unwrap()), + // selection: None, + // } + // } } impl Default for Clipboard { fn default() -> Self { - #[cfg(any(target_os = "macos", windows))] return Self { clipboard: Box::new(ClipboardContext::new().unwrap()), selection: None, }; - #[cfg(target_os = "linux")] - return Self { - clipboard: Box::new(ClipboardContext::new().unwrap()), - selection: Some(Box::new( - X11ClipboardContext::::new().unwrap(), - )), - }; + // #[cfg(target_os = "linux")] + // return Self { + // clipboard: Box::new(ClipboardContext::new().unwrap()), + // selection: Some(Box::new( + // X11ClipboardContext::::new().unwrap(), + // )), + // }; - #[cfg(not(any(target_os = "linux", target_os = "macos", windows)))] - return Self::new_nop(); + // #[cfg(not(any(target_os = "macos", windows)))] + // return Self::new_nop(); } }