From a0d269400ea78f8ed63d59deedeed11716489302 Mon Sep 17 00:00:00 2001 From: Sam Andreae Date: Thu, 12 Dec 2024 17:16:03 +0000 Subject: [PATCH] Re-structure project as cargo workspace --- Cargo.lock | 95 +++++++++---------- Cargo.toml | 30 +----- aardvark-app/Cargo.toml | 18 ++++ .../scalable/apps/org.p2panda.aardvark.svg | 0 .../apps/org.p2panda.aardvark-symbolic.svg | 0 {data => aardvark-app/data}/icons/meson.build | 0 {data => aardvark-app/data}/meson.build | 0 .../data}/org.p2panda.aardvark.desktop.in | 0 .../data}/org.p2panda.aardvark.gschema.xml | 0 .../org.p2panda.aardvark.metainfo.xml.in | 0 .../data}/org.p2panda.aardvark.service.in | 0 meson.build => aardvark-app/meson.build | 0 .../org.p2panda.aardvark.json | 0 {po => aardvark-app/po}/LINGUAS | 0 {po => aardvark-app/po}/POTFILES.in | 0 {po => aardvark-app/po}/meson.build | 0 .../src}/aardvark.gresource.xml | 0 {src => aardvark-app/src}/application.rs | 2 +- {src => aardvark-app/src}/config.rs | 1 + {src => aardvark-app/src}/config.rs.in | 0 {src => aardvark-app/src}/document.rs | 0 {src => aardvark-app/src}/gtk/help-overlay.ui | 0 {src => aardvark-app/src}/main.rs | 2 - {src => aardvark-app/src}/meson.build | 0 {src => aardvark-app/src}/style.css | 0 {src => aardvark-app/src}/textbuffer.rs | 0 {src => aardvark-app/src}/window.rs | 0 {src => aardvark-app/src}/window.ui | 0 aardvark-node/Cargo.toml | 18 ++++ aardvark-node/src/lib.rs | 2 + {src => aardvark-node/src}/network.rs | 0 {src => aardvark-node/src}/operation.rs | 0 32 files changed, 91 insertions(+), 77 deletions(-) create mode 100644 aardvark-app/Cargo.toml rename {data => aardvark-app/data}/icons/hicolor/scalable/apps/org.p2panda.aardvark.svg (100%) rename {data => aardvark-app/data}/icons/hicolor/symbolic/apps/org.p2panda.aardvark-symbolic.svg (100%) rename {data => aardvark-app/data}/icons/meson.build (100%) rename {data => aardvark-app/data}/meson.build (100%) rename {data => aardvark-app/data}/org.p2panda.aardvark.desktop.in (100%) rename {data => aardvark-app/data}/org.p2panda.aardvark.gschema.xml (100%) rename {data => aardvark-app/data}/org.p2panda.aardvark.metainfo.xml.in (100%) rename {data => aardvark-app/data}/org.p2panda.aardvark.service.in (100%) rename meson.build => aardvark-app/meson.build (100%) rename org.p2panda.aardvark.json => aardvark-app/org.p2panda.aardvark.json (100%) rename {po => aardvark-app/po}/LINGUAS (100%) rename {po => aardvark-app/po}/POTFILES.in (100%) rename {po => aardvark-app/po}/meson.build (100%) rename {src => aardvark-app/src}/aardvark.gresource.xml (100%) rename {src => aardvark-app/src}/application.rs (99%) rename {src => aardvark-app/src}/config.rs (71%) rename {src => aardvark-app/src}/config.rs.in (100%) rename {src => aardvark-app/src}/document.rs (100%) rename {src => aardvark-app/src}/gtk/help-overlay.ui (100%) rename {src => aardvark-app/src}/main.rs (99%) rename {src => aardvark-app/src}/meson.build (100%) rename {src => aardvark-app/src}/style.css (100%) rename {src => aardvark-app/src}/textbuffer.rs (100%) rename {src => aardvark-app/src}/window.rs (100%) rename {src => aardvark-app/src}/window.ui (100%) create mode 100644 aardvark-node/Cargo.toml create mode 100644 aardvark-node/src/lib.rs rename {src => aardvark-node/src}/network.rs (100%) rename {src => aardvark-node/src}/operation.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 53ec86b..4910f5c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6,13 +6,23 @@ version = 4 name = "aardvark" version = "0.1.0" dependencies = [ + "aardvark-node", "anyhow", - "async-trait", "automerge", - "ciborium", "gettext-rs", "gtk4", "libadwaita", + "serde", + "serde_json", +] + +[[package]] +name = "aardvark-node" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "ciborium", "p2panda-core", "p2panda-discovery", "p2panda-net", @@ -20,7 +30,6 @@ dependencies = [ "p2panda-stream", "p2panda-sync", "serde", - "serde_json", "tokio", "tokio-stream", ] @@ -399,9 +408,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.38" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" dependencies = [ "android-tzdata", "iana-time-zone", @@ -976,9 +985,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "ff" @@ -1145,7 +1154,7 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cef40d21ae2c515b51041df9ed313ed21e572df340ea58a922a0aefe7e8891a1" dependencies = [ - "fastrand 2.2.0", + "fastrand 2.3.0", "futures-core", "futures-io", "parking", @@ -1645,9 +1654,9 @@ dependencies = [ [[package]] name = "hickory-proto" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07698b8420e2f0d6447a436ba999ec85d8fbf2a398bbd737b82cac4a2e96e512" +checksum = "447afdcdb8afb9d0a852af6dc65d9b285ce720ed7a59e42a8bf2e931c67bc1b5" dependencies = [ "async-trait", "cfg-if", @@ -1656,7 +1665,7 @@ dependencies = [ "futures-channel", "futures-io", "futures-util", - "idna 0.4.0", + "idna 1.0.3", "ipnet", "once_cell", "rand", @@ -1735,9 +1744,9 @@ dependencies = [ [[package]] name = "hmac-sha256" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3688e69b38018fec1557254f64c8dc2cc8ec502890182f395dbb0aa997aa5735" +checksum = "4a8575493d277c9092b988c780c94737fb9fd8651a1001e16bee3eccfc1baedb" [[package]] name = "hostname" @@ -2046,16 +2055,6 @@ dependencies = [ "syn 2.0.90", ] -[[package]] -name = "idna" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "0.5.0" @@ -2475,9 +2474,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.167" +version = "0.2.168" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" +checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" [[package]] name = "libm" @@ -2743,9 +2742,9 @@ dependencies = [ [[package]] name = "netlink-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "416060d346fbaf1f23f9512963e3e878f1a78e707cb699ba9215761754244307" +checksum = "16c903aa70590cb93691bf97a767c8d1d6122d2cc9070433deb3bbf36ce8bd23" dependencies = [ "bytes", "futures", @@ -3006,7 +3005,7 @@ dependencies = [ "flume", "futures-buffered", "futures-lite 2.5.0", - "hickory-proto 0.24.1", + "hickory-proto 0.24.2", "iroh-base", "iroh-net", "socket2", @@ -3201,7 +3200,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" dependencies = [ "memchr", - "thiserror 2.0.4", + "thiserror 2.0.6", "ucd-trie", ] @@ -3572,7 +3571,7 @@ dependencies = [ "rustc-hash", "rustls", "socket2", - "thiserror 2.0.4", + "thiserror 2.0.6", "tokio", "tracing", ] @@ -3591,7 +3590,7 @@ dependencies = [ "rustls", "rustls-pki-types", "slab", - "thiserror 2.0.4", + "thiserror 2.0.6", "tinyvec", "tracing", "web-time", @@ -3599,16 +3598,16 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5a626c6807713b15cac82a6acaccd6043c9a5408c24baae07611fec3f243da" +checksum = "52cd4b1eff68bf27940dd39811292c49e007f4d0b4c357358dc9b0197be6b527" dependencies = [ "cfg_aliases", "libc", "once_cell", "socket2", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3692,9 +3691,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" +checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ "bitflags 2.6.0", ] @@ -3897,9 +3896,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.19" +version = "0.23.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" +checksum = "5065c3f250cbd332cd894be57c40fa52387247659b14a2d6041d121547903b1b" dependencies = [ "log", "once_cell", @@ -4082,9 +4081,9 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.215" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" +checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" dependencies = [ "serde_derive", ] @@ -4119,9 +4118,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.215" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" +checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" dependencies = [ "proc-macro2", "quote", @@ -4579,11 +4578,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.4" +version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f49a1853cf82743e3b7950f77e0f4d622ca36cf4317cba00c767838bac8d490" +checksum = "8fec2a1820ebd077e2b90c4df007bebf344cd394098a13c563957d0afc83ea47" dependencies = [ - "thiserror-impl 2.0.4", + "thiserror-impl 2.0.6", ] [[package]] @@ -4599,9 +4598,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.4" +version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8381894bb3efe0c4acac3ded651301ceee58a15d47c2e34885ed1908ad667061" +checksum = "d65750cab40f4ff1929fb1ba509e9914eb756131cef4210da8d5d700d26f6312" dependencies = [ "proc-macro2", "quote", @@ -5228,7 +5227,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 7ed1e05..e6f446f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,27 +1,5 @@ -[package] -name = "aardvark" -version = "0.1.0" -edition = "2021" +[workspace] -[dependencies] -anyhow = "1.0.94" -async-trait = "0.1.83" -automerge = "0.5.12" -ciborium = "0.2.2" -gettext-rs = { version = "0.7", features = ["gettext-system"] } -gtk = { version = "0.9", package = "gtk4", features = ["gnome_47"] } -p2panda-core = "0.1.0" -p2panda-discovery = { version = "0.1.0", features = ["mdns"] } -p2panda-net = "0.1.0" -p2panda-store = "0.1.0" -p2panda-stream = "0.1.0" -p2panda-sync = { version = "0.1.0", features = ["log-sync"] } -serde = { version = "1.0.215", features = ["derive"] } -serde_json = "1.0.128" -tokio = { version = "1.42.0", features = ["full"] } -tokio-stream = "0.1.17" - -[dependencies.adw] -package = "libadwaita" -version = "0.7" -features = ["v1_6"] +members = [ + "aardvark-app", "aardvark-node", +] diff --git a/aardvark-app/Cargo.toml b/aardvark-app/Cargo.toml new file mode 100644 index 0000000..dae8ac8 --- /dev/null +++ b/aardvark-app/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "aardvark" +version = "0.1.0" +edition = "2021" + +[dependencies] +anyhow = "1.0.94" +automerge = "0.5.12" +gettext-rs = { version = "0.7", features = ["gettext-system"] } +gtk = { version = "0.9", package = "gtk4", features = ["gnome_47"] } +serde = { version = "1.0.215", features = ["derive"] } +serde_json = "1.0.128" +aardvark-node = { path = "../aardvark-node" } + +[dependencies.adw] +package = "libadwaita" +version = "0.7" +features = ["v1_6"] diff --git a/data/icons/hicolor/scalable/apps/org.p2panda.aardvark.svg b/aardvark-app/data/icons/hicolor/scalable/apps/org.p2panda.aardvark.svg similarity index 100% rename from data/icons/hicolor/scalable/apps/org.p2panda.aardvark.svg rename to aardvark-app/data/icons/hicolor/scalable/apps/org.p2panda.aardvark.svg diff --git a/data/icons/hicolor/symbolic/apps/org.p2panda.aardvark-symbolic.svg b/aardvark-app/data/icons/hicolor/symbolic/apps/org.p2panda.aardvark-symbolic.svg similarity index 100% rename from data/icons/hicolor/symbolic/apps/org.p2panda.aardvark-symbolic.svg rename to aardvark-app/data/icons/hicolor/symbolic/apps/org.p2panda.aardvark-symbolic.svg diff --git a/data/icons/meson.build b/aardvark-app/data/icons/meson.build similarity index 100% rename from data/icons/meson.build rename to aardvark-app/data/icons/meson.build diff --git a/data/meson.build b/aardvark-app/data/meson.build similarity index 100% rename from data/meson.build rename to aardvark-app/data/meson.build diff --git a/data/org.p2panda.aardvark.desktop.in b/aardvark-app/data/org.p2panda.aardvark.desktop.in similarity index 100% rename from data/org.p2panda.aardvark.desktop.in rename to aardvark-app/data/org.p2panda.aardvark.desktop.in diff --git a/data/org.p2panda.aardvark.gschema.xml b/aardvark-app/data/org.p2panda.aardvark.gschema.xml similarity index 100% rename from data/org.p2panda.aardvark.gschema.xml rename to aardvark-app/data/org.p2panda.aardvark.gschema.xml diff --git a/data/org.p2panda.aardvark.metainfo.xml.in b/aardvark-app/data/org.p2panda.aardvark.metainfo.xml.in similarity index 100% rename from data/org.p2panda.aardvark.metainfo.xml.in rename to aardvark-app/data/org.p2panda.aardvark.metainfo.xml.in diff --git a/data/org.p2panda.aardvark.service.in b/aardvark-app/data/org.p2panda.aardvark.service.in similarity index 100% rename from data/org.p2panda.aardvark.service.in rename to aardvark-app/data/org.p2panda.aardvark.service.in diff --git a/meson.build b/aardvark-app/meson.build similarity index 100% rename from meson.build rename to aardvark-app/meson.build diff --git a/org.p2panda.aardvark.json b/aardvark-app/org.p2panda.aardvark.json similarity index 100% rename from org.p2panda.aardvark.json rename to aardvark-app/org.p2panda.aardvark.json diff --git a/po/LINGUAS b/aardvark-app/po/LINGUAS similarity index 100% rename from po/LINGUAS rename to aardvark-app/po/LINGUAS diff --git a/po/POTFILES.in b/aardvark-app/po/POTFILES.in similarity index 100% rename from po/POTFILES.in rename to aardvark-app/po/POTFILES.in diff --git a/po/meson.build b/aardvark-app/po/meson.build similarity index 100% rename from po/meson.build rename to aardvark-app/po/meson.build diff --git a/src/aardvark.gresource.xml b/aardvark-app/src/aardvark.gresource.xml similarity index 100% rename from src/aardvark.gresource.xml rename to aardvark-app/src/aardvark.gresource.xml diff --git a/src/application.rs b/aardvark-app/src/application.rs similarity index 99% rename from src/application.rs rename to aardvark-app/src/application.rs index a4e6f3e..d53b531 100644 --- a/src/application.rs +++ b/aardvark-app/src/application.rs @@ -20,6 +20,7 @@ use std::cell::{OnceCell, RefCell}; +use aardvark_node::network; use adw::prelude::*; use adw::subclass::prelude::*; use gettextrs::gettext; @@ -29,7 +30,6 @@ use tokio::sync::{mpsc, oneshot}; use crate::config::VERSION; use crate::document::Document; use crate::glib::closure_local; -use crate::network; use crate::{AardvarkTextBuffer, AardvarkWindow}; mod imp { diff --git a/src/config.rs b/aardvark-app/src/config.rs similarity index 71% rename from src/config.rs rename to aardvark-app/src/config.rs index 452f4d7..61bd805 100644 --- a/src/config.rs +++ b/aardvark-app/src/config.rs @@ -1,3 +1,4 @@ pub static VERSION: &str = "0.1.0"; pub static GETTEXT_PACKAGE: &str = "aardvark"; pub static LOCALEDIR: &str = "/app/share/locale"; +pub static PKGDATADIR: &str = "/app/share/aardvark"; diff --git a/src/config.rs.in b/aardvark-app/src/config.rs.in similarity index 100% rename from src/config.rs.in rename to aardvark-app/src/config.rs.in diff --git a/src/document.rs b/aardvark-app/src/document.rs similarity index 100% rename from src/document.rs rename to aardvark-app/src/document.rs diff --git a/src/gtk/help-overlay.ui b/aardvark-app/src/gtk/help-overlay.ui similarity index 100% rename from src/gtk/help-overlay.ui rename to aardvark-app/src/gtk/help-overlay.ui diff --git a/src/main.rs b/aardvark-app/src/main.rs similarity index 99% rename from src/main.rs rename to aardvark-app/src/main.rs index d18e4b4..8948af2 100644 --- a/src/main.rs +++ b/aardvark-app/src/main.rs @@ -21,8 +21,6 @@ mod application; mod config; mod document; -mod network; -mod operation; mod textbuffer; mod window; diff --git a/src/meson.build b/aardvark-app/src/meson.build similarity index 100% rename from src/meson.build rename to aardvark-app/src/meson.build diff --git a/src/style.css b/aardvark-app/src/style.css similarity index 100% rename from src/style.css rename to aardvark-app/src/style.css diff --git a/src/textbuffer.rs b/aardvark-app/src/textbuffer.rs similarity index 100% rename from src/textbuffer.rs rename to aardvark-app/src/textbuffer.rs diff --git a/src/window.rs b/aardvark-app/src/window.rs similarity index 100% rename from src/window.rs rename to aardvark-app/src/window.rs diff --git a/src/window.ui b/aardvark-app/src/window.ui similarity index 100% rename from src/window.ui rename to aardvark-app/src/window.ui diff --git a/aardvark-node/Cargo.toml b/aardvark-node/Cargo.toml new file mode 100644 index 0000000..73fcf5d --- /dev/null +++ b/aardvark-node/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "aardvark-node" +version = "0.1.0" +edition = "2021" + +[dependencies] +anyhow = "1.0.94" +async-trait = "0.1.83" +ciborium = "0.2.2" +p2panda-core = "0.1.0" +p2panda-discovery = { version = "0.1.0", features = ["mdns"] } +p2panda-net = "0.1.0" +p2panda-store = "0.1.0" +p2panda-stream = "0.1.0" +p2panda-sync = { version = "0.1.0", features = ["log-sync"] } +serde = { version = "1.0.215", features = ["derive"] } +tokio = { version = "1.42.0", features = ["full"] } +tokio-stream = "0.1.17" diff --git a/aardvark-node/src/lib.rs b/aardvark-node/src/lib.rs new file mode 100644 index 0000000..5ffec0e --- /dev/null +++ b/aardvark-node/src/lib.rs @@ -0,0 +1,2 @@ +pub mod network; +pub mod operation; \ No newline at end of file diff --git a/src/network.rs b/aardvark-node/src/network.rs similarity index 100% rename from src/network.rs rename to aardvark-node/src/network.rs diff --git a/src/operation.rs b/aardvark-node/src/operation.rs similarity index 100% rename from src/operation.rs rename to aardvark-node/src/operation.rs