From 870ef7209ce8b25793c9c92fddc02ebebcc5b888 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Wed, 24 Jul 2024 09:04:21 +0100 Subject: [PATCH] refactor: merge actor-macros into core Starting to flatten the crates. --- Cargo.toml | 1 + crates/actor-macros/Cargo.toml | 4 +-- crates/actor-macros/README.md | 2 ++ crates/actor-macros/src/lib.rs | 2 +- crates/cli/Cargo.toml | 3 +- crates/cli/README.md | 8 +++-- crates/core/Cargo.toml | 30 +++++++++++++++++++ crates/core/src/lib.rs | 1 + .../src => core/src/macros}/message.rs | 0 crates/core/src/macros/mod.rs | 2 ++ crates/core/src/macros/newtype.rs | 0 crates/file-watcher-actor/Cargo.toml | 2 -- crates/repo-actor/Cargo.toml | 2 +- crates/repo-actor/src/messages.rs | 2 +- crates/repo-actor/src/tests/mod.rs | 2 +- crates/server-actor/Cargo.toml | 2 +- crates/server-actor/src/lib.rs | 2 +- crates/server-actor/src/messages.rs | 2 +- crates/webhook-actor/Cargo.toml | 2 +- crates/webhook-actor/src/messages.rs | 2 +- 20 files changed, 53 insertions(+), 18 deletions(-) create mode 100644 crates/core/Cargo.toml create mode 100644 crates/core/src/lib.rs rename crates/{actor-macros/src => core/src/macros}/message.rs (100%) create mode 100644 crates/core/src/macros/mod.rs create mode 100644 crates/core/src/macros/newtype.rs diff --git a/Cargo.toml b/Cargo.toml index dd0828f..aa2d626 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,6 +23,7 @@ unwrap_used = "warn" expect_used = "warn" [workspace.dependencies] +git-next-core = { path = "crates/core", version = "0.10" } git-next-server = { path = "crates/server", version = "0.10" } git-next-server-actor = { path = "crates/server-actor", version = "0.10" } git-next-config = { path = "crates/config", version = "0.10" } diff --git a/crates/actor-macros/Cargo.toml b/crates/actor-macros/Cargo.toml index b5083ab..4e0aa61 100644 --- a/crates/actor-macros/Cargo.toml +++ b/crates/actor-macros/Cargo.toml @@ -4,11 +4,9 @@ version = { workspace = true } edition = { workspace = true } license = { workspace = true } repository = { workspace = true } -description = "macros for actors for git-next, the trunk-based development manager" +description = "[deprecated crate] macros for actors for git-next, the trunk-based development manager" [dependencies] -# Actors -actix = { workspace = true } [lints.clippy] nursery = { level = "warn", priority = -1 } diff --git a/crates/actor-macros/README.md b/crates/actor-macros/README.md index ddc70e2..f12c15d 100644 --- a/crates/actor-macros/README.md +++ b/crates/actor-macros/README.md @@ -7,3 +7,5 @@ development workflows where each commit must pass CI before being included in the main branch. See [git-next](https://crates.io/crates/git-next) for more information. + +N.B. this crate has been merged into [git-next-core](https://crates.io/crates/git-next-core). diff --git a/crates/actor-macros/src/lib.rs b/crates/actor-macros/src/lib.rs index e935b02..076971e 100644 --- a/crates/actor-macros/src/lib.rs +++ b/crates/actor-macros/src/lib.rs @@ -1 +1 @@ -mod message; +// moved to crates/core/src/macros/ diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 8bbf0f3..7927c62 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -4,7 +4,7 @@ version = { workspace = true } edition = { workspace = true } license = { workspace = true } repository = { workspace = true } -description = "CLI support for git-next, the trunk-based development manager" +description = "git-next, the trunk-based development manager" authors = { workspace = true } rust-version = { workspace = true } documentation = { workspace = true } @@ -12,6 +12,7 @@ keywords = { workspace = true } categories = { workspace = true } [dependencies] +git-next-core = { workspace = true } git-next-server = { workspace = true } # CLI parsing diff --git a/crates/cli/README.md b/crates/cli/README.md index 714ffb1..cdd5ccc 100644 --- a/crates/cli/README.md +++ b/crates/cli/README.md @@ -519,10 +519,11 @@ The following diagram shows the dependency between the crates that make up `git- ```mermaid stateDiagram-v2 + cli --> core + cli --> server file_watcher_actor --> config - file_watcher_actor --> actor_macros forge --> config forge --> git @@ -537,23 +538,24 @@ stateDiagram-v2 git --> config + repo_actor --> core repo_actor --> config repo_actor --> git repo_actor --> forge - repo_actor --> actor_macros server --> config server --> file_watcher_actor server --> server_actor + server_actor --> core server_actor --> config server_actor --> git server_actor --> forge server_actor --> repo_actor - server_actor --> actor_macros server_actor --> file_watcher_actor server_actor --> webhook_actor + webhook_actor --> core webhook_actor --> config webhook_actor --> repo_actor ``` diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml new file mode 100644 index 0000000..1328984 --- /dev/null +++ b/crates/core/Cargo.toml @@ -0,0 +1,30 @@ +[package] +name = "git-next-core" +version = { workspace = true } +edition = { workspace = true } +license = { workspace = true } +repository = { workspace = true } +description = "core for git-next, the trunk-based development manager" + +[dependencies] +# logging +console-subscriber = { workspace = true } +tracing = { workspace = true } +tracing-subscriber = { workspace = true } + +# fs/network +kxio = { workspace = true } + +# Actors +actix = { workspace = true } +actix-rt = { workspace = true } + +[dev-dependencies] +# Testing +assert2 = { workspace = true } + +[lints.clippy] +nursery = { level = "warn", priority = -1 } +# pedantic = "warn" +unwrap_used = "warn" +expect_used = "warn" diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs new file mode 100644 index 0000000..992f6dd --- /dev/null +++ b/crates/core/src/lib.rs @@ -0,0 +1 @@ +mod macros; diff --git a/crates/actor-macros/src/message.rs b/crates/core/src/macros/message.rs similarity index 100% rename from crates/actor-macros/src/message.rs rename to crates/core/src/macros/message.rs diff --git a/crates/core/src/macros/mod.rs b/crates/core/src/macros/mod.rs new file mode 100644 index 0000000..23efb2a --- /dev/null +++ b/crates/core/src/macros/mod.rs @@ -0,0 +1,2 @@ +mod message; +mod newtype; diff --git a/crates/core/src/macros/newtype.rs b/crates/core/src/macros/newtype.rs new file mode 100644 index 0000000..e69de29 diff --git a/crates/file-watcher-actor/Cargo.toml b/crates/file-watcher-actor/Cargo.toml index aa353b8..8be02f6 100644 --- a/crates/file-watcher-actor/Cargo.toml +++ b/crates/file-watcher-actor/Cargo.toml @@ -8,8 +8,6 @@ description = "Config file watcher for git-next, the trunk-based development man [dependencies] git-next-config = { workspace = true } -git-next-actor-macros = { workspace = true } -# git-next-repo-actor = { workspace = true } # logging tracing = { workspace = true } diff --git a/crates/repo-actor/Cargo.toml b/crates/repo-actor/Cargo.toml index 45fdba0..b342671 100644 --- a/crates/repo-actor/Cargo.toml +++ b/crates/repo-actor/Cargo.toml @@ -12,10 +12,10 @@ forgejo = [] github = [] [dependencies] +git-next-core = { workspace = true } git-next-config = { workspace = true } git-next-git = { workspace = true } git-next-forge = { workspace = true } -git-next-actor-macros = { workspace = true } # logging tracing = { workspace = true } diff --git a/crates/repo-actor/src/messages.rs b/crates/repo-actor/src/messages.rs index 65e3a8f..4fe760b 100644 --- a/crates/repo-actor/src/messages.rs +++ b/crates/repo-actor/src/messages.rs @@ -3,8 +3,8 @@ use config::newtype; use derive_more::Display; use git::UserNotification; -use git_next_actor_macros::message; use git_next_config as config; +use git_next_core::message; use git_next_git as git; message!(LoadConfigFromRepo: "Request to load the `git-next.toml` from the git repo."); diff --git a/crates/repo-actor/src/tests/mod.rs b/crates/repo-actor/src/tests/mod.rs index b92f3e1..6c66dd5 100644 --- a/crates/repo-actor/src/tests/mod.rs +++ b/crates/repo-actor/src/tests/mod.rs @@ -16,8 +16,8 @@ use git::{ repository::{factory::MockRepositoryFactory, open::MockOpenRepositoryLike, Direction}, Generation, MockForgeLike, RepoDetails, }; -use git_next_actor_macros::message; use git_next_config as config; +use git_next_core::message; use git_next_git as git; use mockall::predicate::eq; use std::{ diff --git a/crates/server-actor/Cargo.toml b/crates/server-actor/Cargo.toml index 4a247e5..91d2424 100644 --- a/crates/server-actor/Cargo.toml +++ b/crates/server-actor/Cargo.toml @@ -7,11 +7,11 @@ repository = { workspace = true } description = "Server actor for git-next, the trunk-based development manager" [dependencies] +git-next-core = { workspace = true } git-next-config = { workspace = true } git-next-git = { workspace = true } git-next-forge = { workspace = true } git-next-repo-actor = { workspace = true } -git-next-actor-macros = { workspace = true } git-next-file-watcher-actor = { workspace = true } git-next-webhook-actor = { workspace = true } diff --git a/crates/server-actor/src/lib.rs b/crates/server-actor/src/lib.rs index 2bca343..a26e838 100644 --- a/crates/server-actor/src/lib.rs +++ b/crates/server-actor/src/lib.rs @@ -24,7 +24,7 @@ use webhook::WebhookActor; pub use git_next_git::repository::{factory::real as repository_factory, RepositoryFactory}; -use crate::messages::ReceiveServerConfig; +use messages::ReceiveServerConfig; #[derive(Debug, derive_more::Display, derive_more::From)] pub enum Error { diff --git a/crates/server-actor/src/messages.rs b/crates/server-actor/src/messages.rs index adbf46e..4e321c3 100644 --- a/crates/server-actor/src/messages.rs +++ b/crates/server-actor/src/messages.rs @@ -1,7 +1,7 @@ //- use derive_more::Constructor; -use git_next_actor_macros::message; use git_next_config::server::{ServerConfig, ServerStorage}; +use git_next_core::message; use std::net::SocketAddr; // receive server config diff --git a/crates/webhook-actor/Cargo.toml b/crates/webhook-actor/Cargo.toml index 353e7fc..31c23b7 100644 --- a/crates/webhook-actor/Cargo.toml +++ b/crates/webhook-actor/Cargo.toml @@ -7,7 +7,7 @@ repository = { workspace = true } description = "webhook actor for git-next, the trunk-based development manager" [dependencies] -git-next-actor-macros = { workspace = true } +git-next-core = { workspace = true } git-next-config = { workspace = true } git-next-repo-actor = { workspace = true } diff --git a/crates/webhook-actor/src/messages.rs b/crates/webhook-actor/src/messages.rs index 97cf082..886414a 100644 --- a/crates/webhook-actor/src/messages.rs +++ b/crates/webhook-actor/src/messages.rs @@ -1,4 +1,4 @@ // -use git_next_actor_macros::message; +use git_next_core::message; message!(ShutdownWebhook: "Request to shutdown the Webhook actor");