diff options
| -rw-r--r-- | server/Cargo.lock | 22 | ||||
| -rw-r--r-- | server/Cargo.toml | 46 | ||||
| -rw-r--r-- | server/README | 7 | ||||
| -rw-r--r-- | server/common/Cargo.toml | 10 | ||||
| -rw-r--r-- | server/common/src/fs_utils.rs (renamed from server/src/fs_utils.rs) | 0 | ||||
| -rw-r--r-- | server/common/src/git.rs (renamed from server/src/git.rs) | 2 | ||||
| -rw-r--r-- | server/common/src/git_socket.rs (renamed from server/src/git_socket.rs) | 0 | ||||
| -rw-r--r-- | server/common/src/lib.rs | 3 | ||||
| -rw-r--r-- | server/hook/Cargo.toml | 14 | ||||
| -rw-r--r-- | server/hook/src/githook.rs (renamed from server/src/githook.rs) | 5 | ||||
| -rw-r--r-- | server/src/main.rs | 7 |
11 files changed, 80 insertions, 36 deletions
diff --git a/server/Cargo.lock b/server/Cargo.lock index 8fd8e92..7dfa00a 100644 --- a/server/Cargo.lock +++ b/server/Cargo.lock @@ -551,9 +551,9 @@ name = "eyeballs" version = "0.1.0" dependencies = [ "anyhow", + "eyeballs-common", "futures", "ldap3", - "pathdiff", "rmp-serde", "rocket", "rocket_db_pools", @@ -568,6 +568,26 @@ dependencies = [ ] [[package]] +name = "eyeballs-common" +version = "0.1.0" +dependencies = [ + "futures", + "pathdiff", + "serde", + "tokio", +] + +[[package]] +name = "eyeballs-githook" +version = "0.1.0" +dependencies = [ + "eyeballs-common", + "rmp-serde", + "serde", + "tokio", +] + +[[package]] name = "fastrand" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/server/Cargo.toml b/server/Cargo.toml index 64d6796..9288bc2 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -2,38 +2,32 @@ name = "eyeballs" version = "0.1.0" edition = "2021" -default-run = "eyeballs" -[dependencies] -# Used by all binaries, either because its needed or because the library is small enough I don't care -anyhow = "1.0" +[workspace] +members = ["hook"] +resolver = "2" + +[workspace.dependencies] futures = "0.3.31" -pathdiff = "0.2.3" rmp-serde = "1.3" serde = { version = "1.0", features = ["derive"] } -time = "0.3.34" -tokio = { version = "1", features = ["full"] } +tokio = { version = "1" } -# Optional dependencies, listed in features -ldap3 = { version = "0.11.5", default-features = false, features = [ "native-tls", "tls", "tls-native", "tokio-native-tls" ], optional = true } -rocket = { version = "0.5.1", features = ["json", "secrets"], optional = true } -rocket_db_pools = { version = "0.2.0", features = ["sqlx_mysql"], optional = true } -sqlx = { version = "0.7.0", default-features = false, features = ["macros", "migrate"], optional = true } -utoipa = { version = "5", features = ["rocket_extras"], optional = true } -utoipa-swagger-ui = { version = "9", features = ["rocket", "vendored"], default-features = false, optional = true } +[dependencies] +anyhow = "1.0" +eyeballs-common = { path = "common" } +futures.workspace = true +ldap3 = { version = "0.11.5", default-features = false, features = [ "native-tls", "tls", "tls-native", "tokio-native-tls" ] } +rmp-serde.workspace = true +rocket = { version = "0.5.1", features = ["json", "secrets"] } +rocket_db_pools = { version = "0.2.0", features = ["sqlx_mysql"] } +serde.workspace = true +sqlx = { version = "0.7.0", default-features = false, features = ["macros", "migrate"] } +time = "0.3.34" +tokio = { workspace = true, features = ["process"] } +utoipa = { version = "5", features = ["rocket_extras"] } +utoipa-swagger-ui = { version = "9", features = ["rocket", "vendored"], default-features = false } [dev-dependencies] stdext = "0.3.3" testdir = "0.9.3" - -[features] -build-server = ["ldap3", "rocket", "rocket_db_pools", "sqlx", "utoipa", "utoipa-swagger-ui"] - -[[bin]] -name = "eyeballs" -path = "src/main.rs" -required-features = ["build-server"] - -[[bin]] -name = "eyeballs-githook" -path = "src/githook.rs" diff --git a/server/README b/server/README index e0ecaf9..4e97d2e 100644 --- a/server/README +++ b/server/README @@ -4,7 +4,8 @@ Development setup Start git, ldap and mariadb in docker/dev using docker compose up or simular. You might have to create docker/git/authorized_keys to be able to mount it. -Then compile, and because rust hasn't figured out how to do dependencies per -artifact, you have to do this: -cargo build --target=x86_64-unknown-linux-musl --bin eyeballs-githook && cargo build --features="build-server" && cargo run --features="build-server" +Then compile, using this to get musl based binaries for the githook: +cargo --target=x86_64-unknown-linux-musl --package eyeballs-githook build +and then: +cargo build && cargo run diff --git a/server/common/Cargo.toml b/server/common/Cargo.toml new file mode 100644 index 0000000..a17fb95 --- /dev/null +++ b/server/common/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "eyeballs-common" +version = "0.1.0" +edition = "2021" + +[dependencies] +futures.workspace = true +pathdiff = "0.2.3" +serde.workspace = true +tokio = { workspace = true, features = ["fs", "process", "sync"] } diff --git a/server/src/fs_utils.rs b/server/common/src/fs_utils.rs index 7905d01..7905d01 100644 --- a/server/src/fs_utils.rs +++ b/server/common/src/fs_utils.rs diff --git a/server/src/git.rs b/server/common/src/git.rs index a05c670..e2966e0 100644 --- a/server/src/git.rs +++ b/server/common/src/git.rs @@ -1,3 +1,5 @@ +#![allow(dead_code)] + use futures::future::TryFutureExt; use pathdiff::diff_paths; use std::collections::HashMap; diff --git a/server/src/git_socket.rs b/server/common/src/git_socket.rs index a4805be..a4805be 100644 --- a/server/src/git_socket.rs +++ b/server/common/src/git_socket.rs diff --git a/server/common/src/lib.rs b/server/common/src/lib.rs new file mode 100644 index 0000000..a63e05b --- /dev/null +++ b/server/common/src/lib.rs @@ -0,0 +1,3 @@ +pub mod fs_utils; +pub mod git; +pub mod git_socket; diff --git a/server/hook/Cargo.toml b/server/hook/Cargo.toml new file mode 100644 index 0000000..2a298b7 --- /dev/null +++ b/server/hook/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "eyeballs-githook" +version = "0.1.0" +edition = "2021" + +[dependencies] +eyeballs-common = { path = "../common" } +rmp-serde.workspace = true +serde.workspace = true +tokio = { workspace = true, features = ["full"] } + +[[bin]] +name = "eyeballs-githook" +path = "src/githook.rs" diff --git a/server/src/githook.rs b/server/hook/src/githook.rs index 2e1de13..a9cb898 100644 --- a/server/src/githook.rs +++ b/server/hook/src/githook.rs @@ -7,9 +7,8 @@ use std::path::PathBuf; use tokio::io::{self, AsyncBufReadExt, AsyncWriteExt, BufReader}; use tokio::task; -mod fs_utils; -mod git; -mod git_socket; +use eyeballs_common::git; +use eyeballs_common::git_socket; #[derive(Debug)] struct IoError { diff --git a/server/src/main.rs b/server/src/main.rs index 3d6d0e6..b2974ac 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -14,6 +14,10 @@ use std::path::PathBuf; use utoipa::OpenApi; use utoipa_swagger_ui::SwaggerUi; +use eyeballs_common::fs_utils; +use eyeballs_common::git; +use eyeballs_common::git_socket; + #[cfg(test)] mod tests; @@ -21,10 +25,7 @@ mod api_model; mod auth; mod authorized_keys; mod db_utils; -mod fs_utils; -mod git; mod git_root; -mod git_socket; use auth::AuthApiAddon; |
