Skip to content

Commit

Permalink
refactor: restructuring as a monorepo for the rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
sminez committed Nov 26, 2024
1 parent 6e1fffa commit 828e8cd
Show file tree
Hide file tree
Showing 77 changed files with 2,356 additions and 158 deletions.
859 changes: 814 additions & 45 deletions Cargo.lock

Large diffs are not rendered by default.

61 changes: 3 additions & 58 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,59 +1,4 @@
[package]
name = "ratings"
description = "Ubuntu App Center ratings service"
license = "GPL-3.0-only"
authors = ["Canonical"]
version = "0.0.3"
edition = "2021"
[workspace]
resolver = "2"

[dependencies]
argon2 = "0.5.3"
axum = "0.6.20" # this *must* be pinned because 0.7.x relies on hyper 1.x causing a ton of type conversion issues
base64 = "0.22.0"
chrono = { version = "0.4.34", default-features = false, features = [
"std",
"clock",
"serde",
] }
dotenvy = "0.15"
envy = "0.4"
futures = "0.3"
http = "1.0"
http-body = "0.4.6"
hyper = { version = "0.14", features = ["full", "backports", "deprecated"] }
jsonwebtoken = "9.2"
log = { version = "0.4.21", features = ["serde"] }
once_cell = "1.19"
prost = "0.12"
prost-types = "0.12"
rand = "0.8"
reqwest = "0.12"
secrecy = { version = "0.8.0", features = ["serde"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.114"
sha2 = "0.10"
sqlx = { version = "0.8", features = [
"runtime-tokio-rustls",
"postgres",
"time",
] }
strum = { version = "0.26.2", features = ["derive"] }
thiserror = "1.0"
time = { version = "0.3", features = ["macros"] }
tokio = { version = "1.36", features = ["full"] }
tokio-postgres = "0.7"
tonic = "0.10"
tonic-reflection = "0.10"
tower = "0.4"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }

[build-dependencies]
git2 = { version = "0.18.2", default-features = false }
tonic-build = { version = "0.11", features = ["prost"] }

[dev-dependencies]
anyhow = "1.0.89"
lazy_static = "1.4.0"
regex = "1.10.3"
simple_test_case = "1.2.0"
members = [ "crates/*" ]
25 changes: 0 additions & 25 deletions TODO

This file was deleted.

60 changes: 60 additions & 0 deletions crates/ratings/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[package]
name = "ratings"
description = "Ubuntu App Center ratings service"
license = "GPL-3.0-only"
authors = ["Canonical"]
version = "0.0.3"
edition = "2021"

[dependencies]
argon2 = "0.5.3"
axum = "0.6.20" # this *must* be pinned because 0.7.x relies on hyper 1.x causing a ton of type conversion issues
base64 = "0.22.0"
chrono = { version = "0.4.34", default-features = false, features = [
"std",
"clock",
"serde",
] }
dotenvy = "0.15"
envy = "0.4"
futures = "0.3"
http = "1.0"
http-body = "0.4.6"
hyper = { version = "0.14", features = ["full", "backports", "deprecated"] }
jsonwebtoken = "9.2"
log = { version = "0.4.21", features = ["serde"] }
once_cell = "1.19"
prost = "0.12"
prost-types = "0.12"
rand = "0.8"
reqwest = "0.12"
secrecy = { version = "0.8.0", features = ["serde"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.114"
sha2 = "0.10"
snapd = { git = "https://github.com/ZoopOTheGoop/snapd-rs", branch = "framework" }
sqlx = { version = "0.8", features = [
"runtime-tokio-rustls",
"postgres",
"time",
] }
strum = { version = "0.26.2", features = ["derive"] }
thiserror = "1.0"
time = { version = "0.3", features = ["macros"] }
tokio = { version = "1.36", features = ["full"] }
tokio-postgres = "0.7"
tonic = "0.10"
tonic-reflection = "0.10"
tower = "0.4"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
[build-dependencies]
git2 = { version = "0.18.2", default-features = false }
tonic-build = { version = "0.11", features = ["prost"] }

[dev-dependencies]
cucumber = { version = "0.20.2", features = ["libtest", "tracing"] }
lazy_static = "1.4.0"
regex = "1.10.3"
serde_json = "1.0.114"

28 changes: 6 additions & 22 deletions build.rs → crates/ratings/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::path::Path;

fn init_proto() -> Result<(), Box<dyn std::error::Error>> {
// Define the path to the output directory within the `src` folder
let out_dir = Path::new("proto");
let out_dir = Path::new("src/proto");
std::fs::create_dir_all(out_dir)?;

let descriptor_set_path = format!(
Expand All @@ -12,10 +12,10 @@ fn init_proto() -> Result<(), Box<dyn std::error::Error>> {
);

let files = &[
"proto/ratings_features_app.proto",
"proto/ratings_features_chart.proto",
"proto/ratings_features_user.proto",
"proto/ratings_features_common.proto",
"../../proto/ratings_features_app.proto",
"../../proto/ratings_features_chart.proto",
"../../proto/ratings_features_user.proto",
"../../proto/ratings_features_common.proto",
];

tonic_build::configure()
Expand All @@ -31,27 +31,11 @@ fn init_proto() -> Result<(), Box<dyn std::error::Error>> {
"Category",
r#"#[strum(serialize_all = "kebab_case", ascii_case_insensitive)]"#,
)
.compile(files, &["proto"])?;
.compile(files, &["../../proto"])?;

Ok(())
}

// fn include_build_info() -> Result<(), Box<dyn std::error::Error>> {
// let repo = Repository::open(std::env::current_dir()?)?;
// let head = repo.head()?;
// let branch = head
// .name()
// .unwrap()
// .strip_prefix("refs/heads/")
// .unwrap_or("no-branch");
// println!("cargo:rustc-env=GIT_BRANCH={}", branch);
//
// let commit_sha = repo.head()?.target().unwrap();
// println!("cargo:rustc-env=GIT_HASH={}", commit_sha);
//
// Ok(())
// }

fn main() -> Result<(), Box<dyn std::error::Error>> {
init_proto()?;
// Running this in docker compose breaks the build and we only need it for
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 4 additions & 8 deletions src/features/pb.rs → crates/ratings/src/features/pb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,20 @@

pub mod app {
//! Contains protobufs relating to the app features
include!("../../proto/ratings.features.app.rs");
include!("../proto/ratings.features.app.rs");
}

pub mod common {
//! Contains common protobufs
include!("../../proto/ratings.features.common.rs");
include!("../proto/ratings.features.common.rs");
}

pub mod user {
//! Contains user protobufs
include!("../../proto/ratings.features.user.rs");
include!("../proto/ratings.features.user.rs");
}

pub mod chart {
//! Contains chart protobufs
include!("../../proto/ratings.features.chart.rs");
include!("../proto/ratings.features.chart.rs");
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 828e8cd

Please sign in to comment.