Skip to content

Commit

Permalink
Specify dependencies and metadata for entire workspace (#2565)
Browse files Browse the repository at this point in the history
* Specify dependencies and metadata for entire workspace (fixes #2474)

* building api_common shouldnt depend on diesel

* remove drone task

* try with quotes

* fix clippy

* more clippy
  • Loading branch information
Nutomic authored Nov 17, 2022
1 parent 63c237d commit df7809f
Show file tree
Hide file tree
Showing 20 changed files with 359 additions and 363 deletions.
5 changes: 5 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ steps:
- cargo workspaces exec cargo check --no-default-features
- cargo workspaces exec cargo check --all-features

- name: lemmy_api_common doesnt depend on diesel
image: rust:1.64-buster
commands:
- "! cargo tree -p lemmy_api_common --no-default-features -i diesel"

- name: cargo build
image: clux/muslrust:1.64.0
commands:
Expand Down
65 changes: 2 additions & 63 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 74 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
[package]
name = "lemmy_server"
[workspace.package]
version = "0.16.5"
edition = "2021"
description = "A link aggregator for the fediverse"
license = "AGPL-3.0"
homepage = "https://join-lemmy.org/"
documentation = "https://join-lemmy.org/docs/en/index.html"
rust-version = "1.57"

[package]
name = "lemmy_server"
version.workspace = true
edition.workspace = true
description.workspace = true
license.workspace = true
homepage.workspace = true
documentation.workspace = true

[lib]
doctest = false
Expand Down Expand Up @@ -40,15 +47,18 @@ members = [
"crates/routes"
]

[dependencies]
[workspace.dependencies]
lemmy_api = { version = "=0.16.5", path = "./crates/api" }
lemmy_api_crud = { version = "=0.16.5", path = "./crates/api_crud" }
lemmy_apub = { version = "=0.16.5", path = "./crates/apub" }
lemmy_utils = { version = "=0.16.5", path = "./crates/utils" }
lemmy_db_schema = { version = "=0.16.5", path = "./crates/db_schema" }
lemmy_api_common = { version = "=0.16.5", path = "crates/api_common" }
lemmy_api_common = { version = "=0.16.5", path = "./crates/api_common" }
lemmy_websocket = { version = "=0.16.5", path = "./crates/websocket" }
lemmy_routes = { version = "=0.16.5", path = "./crates/routes" }
lemmy_db_views = { version = "=0.16.5", path = "./crates/db_views" }
lemmy_db_views_actor = { version = "=0.16.5", path = "./crates/db_views_actor" }
lemmy_db_views_moderator = { version = "=0.16.5", path = "./crates/db_views_moderator" }
activitypub_federation = "0.3.2"
diesel = "2.0.2"
diesel_migrations = "2.0.0"
Expand All @@ -69,8 +79,64 @@ clokwerk = "0.3.5"
doku = { version = "0.20.0", features = ["url-2"] }
parking_lot = "0.12.1"
reqwest-retry = "0.1.5"
bcrypt = "0.13.0"
chrono = { version = "0.4.22", features = ["serde"], default-features = false }
serde_json = { version = "1.0.87", features = ["preserve_order"] }
base64 = "0.13.1"
uuid = { version = "1.2.1", features = ["serde", "v4"] }
async-trait = "0.1.58"
captcha = "0.0.9"
anyhow = "1.0.66"
diesel_ltree = "0.3.0"
typed-builder = "0.10.0"
serial_test = "0.9.0"
tokio = "1.21.2"
sha2 = "0.10.6"
regex = "1.6.0"
once_cell = "1.15.0"
diesel-derive-newtype = "2.0.0-rc.0"
strum = "0.24.1"
strum_macros = "0.24.3"
itertools = "0.10.5"
futures = "0.3.25"
http = "0.2.8"
actix-rt = { version = "2.7.0", default-features = false }
percent-encoding = "2.2.0"
rosetta-i18n = "0.1.2"
rand = "0.8.5"
opentelemetry = { version = "0.17.0", features = ["rt-tokio"] }
tracing-opentelemetry = { version = "0.17.2" }

[dependencies]
lemmy_api = { workspace = true }
lemmy_api_crud = { workspace = true }
lemmy_apub = { workspace = true }
lemmy_utils = { workspace = true }
lemmy_db_schema = { workspace = true }
lemmy_api_common = { workspace = true }
lemmy_websocket = { workspace = true }
lemmy_routes = { workspace = true }
activitypub_federation = { workspace = true }
diesel = { workspace = true }
diesel_migrations = { workspace = true }
diesel-async = { workspace = true }
serde = { workspace = true }
actix = { workspace = true }
actix-web = { workspace = true }
tracing = { workspace = true }
tracing-actix-web = { workspace = true }
tracing-error = { workspace = true }
tracing-log = { workspace = true }
tracing-subscriber = { workspace = true }
url = { workspace = true }
reqwest = { workspace = true }
reqwest-middleware = { workspace = true }
reqwest-tracing = { workspace = true }
clokwerk = { workspace = true }
doku = { workspace = true }
parking_lot = { workspace = true }
reqwest-retry = { workspace = true }
tracing-opentelemetry = { workspace = true, optional = true }
opentelemetry = { workspace = true, optional = true }
console-subscriber = { version = "0.1.8", optional = true }
opentelemetry = { version = "0.17.0", features = ["rt-tokio"], optional = true }
opentelemetry-otlp = { version = "0.10.0", optional = true }
tracing-opentelemetry = { version = "0.17.2", optional = true }
tokio = "1.21.2"
59 changes: 29 additions & 30 deletions crates/api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
[package]
name = "lemmy_api"
version = "0.16.5"
edition = "2021"
description = "A link aggregator for the fediverse"
license = "AGPL-3.0"
homepage = "https://join-lemmy.org/"
documentation = "https://join-lemmy.org/docs/en/index.html"
rust-version = "1.57"
version.workspace = true
edition.workspace = true
description.workspace = true
license.workspace = true
homepage.workspace = true
documentation.workspace = true

[lib]
name = "lemmy_api"
path = "src/lib.rs"
doctest = false

[dependencies]
lemmy_apub = { version = "=0.16.5", path = "../apub" }
lemmy_utils = { version = "=0.16.5", path = "../utils" }
lemmy_db_schema = { version = "=0.16.5", path = "../db_schema", features = ["full"] }
lemmy_db_views = { version = "=0.16.5", path = "../db_views", features = ["full"] }
lemmy_db_views_moderator = { version = "=0.16.5", path = "../db_views_moderator", features = ["full"] }
lemmy_db_views_actor = { version = "=0.16.5", path = "../db_views_actor", features = ["full"] }
lemmy_api_common = { version = "=0.16.5", path = "../api_common", features = ["full"] }
lemmy_websocket = { version = "=0.16.5", path = "../websocket" }
activitypub_federation = "0.3.2"
diesel = "2.0.2"
bcrypt = "0.13.0"
chrono = { version = "0.4.22", features = ["serde"], default-features = false }
serde_json = { version = "1.0.87", features = ["preserve_order"] }
serde = { version = "1.0.147", features = ["derive"] }
actix-web = { version = "4.2.1", default-features = false }
base64 = "0.13.1"
uuid = { version = "1.2.1", features = ["serde", "v4"] }
async-trait = "0.1.58"
captcha = "0.0.9"
anyhow = "1.0.66"
tracing = "0.1.37"
lemmy_apub = { workspace = true }
lemmy_utils = { workspace = true }
lemmy_db_schema = { workspace = true, features = ["full"] }
lemmy_db_views = { workspace = true, features = ["full"] }
lemmy_db_views_moderator = { workspace = true, features = ["full"] }
lemmy_db_views_actor = { workspace = true, features = ["full"] }
lemmy_api_common = { workspace = true, features = ["full"] }
lemmy_websocket = { workspace = true }
activitypub_federation = { workspace = true }
diesel = { workspace = true }
bcrypt = { workspace = true }
chrono = { workspace = true }
serde_json = { workspace = true }
serde = { workspace = true }
actix-web = { workspace = true }
base64 = { workspace = true }
uuid = { workspace = true }
async-trait = { workspace = true }
captcha = { workspace = true }
anyhow = { workspace = true }
tracing = { workspace = true }

[dev-dependencies]
serial_test = "0.9.0"
tokio = "1.21.2"
serial_test = { workspace = true }
tokio = { workspace = true }
49 changes: 24 additions & 25 deletions crates/api_common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
[package]
name = "lemmy_api_common"
version = "0.16.5"
edition = "2021"
description = "A link aggregator for the fediverse"
license = "AGPL-3.0"
homepage = "https://join-lemmy.org/"
documentation = "https://join-lemmy.org/docs/en/index.html"
rust-version = "1.57"
version.workspace = true
edition.workspace = true
description.workspace = true
license.workspace = true
homepage.workspace = true
documentation.workspace = true

[lib]
name = "lemmy_api_common"
Expand All @@ -19,24 +18,24 @@ full = ["diesel", "tracing", "rosetta-i18n", "chrono", "actix-web", "lemmy_utils
"percent-encoding", "encoding", "reqwest-middleware", "webpage"]

[dependencies]
lemmy_db_views = { version = "=0.16.5", path = "../db_views" }
lemmy_db_views_moderator = { version = "=0.16.5", path = "../db_views_moderator" }
lemmy_db_views_actor = { version = "=0.16.5", path = "../db_views_actor" }
lemmy_db_schema = { version = "=0.16.5", path = "../db_schema", default-features = false }
lemmy_utils = { version = "=0.16.5", path = "../utils", optional = true }
serde = { version = "1.0.147", features = ["derive"] }
url = "2.3.1"
actix-web = { version = "4.2.1", default-features = false, features = ["cookies"], optional = true }
chrono = { version = "0.4.22", features = ["serde"], optional = true }
diesel = { version = "2.0.2", optional = true }
tracing = { version = "0.1.36", optional = true }
rosetta-i18n = { version = "0.1.2", optional = true }
percent-encoding = { version = "2.2.0", optional = true }
encoding = { version = "0.2.33", optional = true }
reqwest-middleware = { version = "0.1.6", optional = true }
lemmy_db_views = { workspace = true }
lemmy_db_views_moderator = { workspace = true }
lemmy_db_views_actor = { workspace = true }
lemmy_db_schema = { workspace = true, default-features = false }
lemmy_utils = { workspace = true, optional = true }
serde = { workspace = true }
url = { workspace = true }
actix-web = { workspace = true, features = ["cookies"], optional = true }
chrono = { workspace = true, optional = true }
diesel = { workspace = true, optional = true }
tracing = { workspace = true, optional = true }
reqwest-middleware = { workspace = true, optional = true }
regex = { workspace = true }
rosetta-i18n = { workspace = true, optional = true }
percent-encoding = { workspace = true, optional = true }
webpage = { version = "1.4.0", default-features = false, features = ["serde"], optional = true }
regex = "1.6.0"
encoding = { version = "0.2.33", optional = true }

[dev-dependencies]
actix-rt = { version = "2.7.0", default-features = false }
reqwest = { version = "0.11.12", features = ["json"] }
actix-rt = { workspace = true }
reqwest = { workspace = true }
4 changes: 2 additions & 2 deletions crates/api_common/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ pub async fn build_federated_instances(
let blocked = Instance::blocklist(pool).await?;

// These can return empty vectors, so convert them to options
let allowed = (!allowed.is_empty()).then(|| allowed);
let blocked = (!blocked.is_empty()).then(|| blocked);
let allowed = (!allowed.is_empty()).then_some(allowed);
let blocked = (!blocked.is_empty()).then_some(blocked);

Ok(Some(FederatedInstances {
linked,
Expand Down
Loading

0 comments on commit df7809f

Please sign in to comment.