Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrated to workspace #36

Merged
merged 6 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions Cargo.lock

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

22 changes: 7 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[package]
name = "profiler"
version = "0.1.0"
edition = "2021"
[workspace]
resolver = "2"
members = [
"crates/trace-data",
"crates/profiler",
]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
[workspace.dependencies]
prost = "0.12"
# Only necessary if using Protobuf well-known types:
prost-types = "0.12"
Expand All @@ -17,16 +18,7 @@ serde = { version = "1.0.195", features = ["derive"] }
serde_json = "1.0.111"
camino = { version = "1.1.4", features = ["serde1"] }
anyhow = "1.0"


[dev-dependencies]
assert_fs = "1.1.1"
project-root = "0.2.2"
snapbox = "0.4.16"

[build-dependencies]
prost-build = { version = "0.12" }

[[bin]]
name = "cairo-profiler"
path = "src/main.rs"
32 changes: 32 additions & 0 deletions crates/profiler/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[package]
name = "profiler"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
prost.workspace = true
prost-types.workspace = true
bytes.workspace = true
flate2.workspace = true
hex.workspace = true
clap.workspace = true
serde.workspace = true
serde_json.workspace = true
camino.workspace = true
anyhow.workspace = true
trace-data = { path="../trace-data" }


[dev-dependencies]
assert_fs.workspace = true
project-root.workspace = true
snapbox.workspace = true

[build-dependencies]
prost-build.workspace = true

[[bin]]
name = "cairo-profiler"
path = "src/main.rs"
File renamed without changes.
1 change: 0 additions & 1 deletion src/main.rs → crates/profiler/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use prost::Message;
use trace_data::CallTrace;

mod profile_builder;
mod trace_data;
mod trace_reader;

#[derive(Parser, Debug)]
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/trace_reader.rs → crates/profiler/src/trace_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use std::ops::Add;

use crate::profile_builder::perftools::profiles::ValueType;
use crate::profile_builder::{ProfilerContext, StringId};
use crate::trace_data::{ContractAddress, EntryPointSelector};
use trace_data::{ContractAddress, EntryPointSelector};

use crate::trace_data::{CallTrace, DeprecatedSyscallSelector, ExecutionResources};
use trace_data::{CallTrace, DeprecatedSyscallSelector, ExecutionResources};

#[derive(Clone, Hash, Eq, PartialEq)]
pub struct FunctionName(pub String);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 8 additions & 2 deletions tests/e2e.rs → crates/profiler/tests/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ fn simple_package() {
let project_root = project_root::get_project_root().unwrap();
let temp_dir = assert_fs::TempDir::new().unwrap();
temp_dir
.copy_from(project_root.join("tests/data/"), &["trace.json"])
.copy_from(
project_root.join("crates/profiler/tests/data/"),
&["trace.json"],
)
.unwrap();

SnapboxCommand::new(cargo_bin!("cairo-profiler"))
Expand All @@ -25,7 +28,10 @@ fn output_path() {
let project_root = project_root::get_project_root().unwrap();
let temp_dir = assert_fs::TempDir::new().unwrap();
temp_dir
.copy_from(project_root.join("tests/data/"), &["trace.json"])
.copy_from(
project_root.join("crates/profiler/tests/data/"),
&["trace.json"],
)
.unwrap();

SnapboxCommand::new(cargo_bin!("cairo-profiler"))
Expand Down
9 changes: 9 additions & 0 deletions crates/trace-data/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "trace-data"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
serde.workspace = true
File renamed without changes.
1 change: 0 additions & 1 deletion src/lib.rs

This file was deleted.

Loading