Skip to content

Commit

Permalink
Reorganize cargo dependencies and upgrade most of them (#1815)
Browse files Browse the repository at this point in the history
* Reorganize cargo dependencies and upgrade most

* cargo update

* Attempt 2

* Polishing changes

* Comment out specta typescript flag-dependent code

* Fix test
  • Loading branch information
Keavon authored Jul 9, 2024
1 parent 97616e8 commit f7ada70
Show file tree
Hide file tree
Showing 30 changed files with 1,034 additions and 966 deletions.
1,353 changes: 678 additions & 675 deletions Cargo.lock

Large diffs are not rendered by default.

96 changes: 51 additions & 45 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,83 +22,89 @@ members = [
"libraries/raw-rs/tag-derive",
"website/other/bezier-rs-demos/wasm",
]
resolver = "2"
exclude = ["node-graph/gpu-compiler"]
resolver = "2"

[workspace.dependencies]
specta = { git = "https://github.com/oscartbeaumont/specta.git", features = [
"glam",
"typescript",
] }
rustc-hash = "1.1.0"
# wasm-bindgen upgrades may break various things so we pin the version
wasm-bindgen = "=0.2.91"
# Local dependencies
dyn-any = { path = "libraries/dyn-any", features = ["derive", "glam"] }
graphene-core = { path = "node-graph/gcore" }
graph-craft = { path = "node-graph/graph-craft", features = ["serde"] }
spirv-std = { git = "https://github.com/EmbarkStudios/rust-gpu.git" }
bezier-rs = { path = "libraries/bezier-rs", features = ["dyn-any"] }
node-macro = { path = "node-graph/node-macro" }

# Workspace dependencies
rustc-hash = "2.0"
bytemuck = { version = "1.13", features = ["derive"] }
async-trait = { version = "0.1" }
async-trait = "0.1"
serde = { version = "1.0", features = ["derive", "rc"] }
serde_json = "1.0"
reqwest = { version = "0.11", features = ["rustls", "rustls-tls", "json"] }
serde-wasm-bindgen = "0.6"
reqwest = { version = "0.12", features = ["blocking", "rustls-tls", "json"] }
futures = "0.3"
log = { version = "0.4" }
env_logger = "0.11"
log = "0.4"
bitflags = { version = "2.4", features = ["serde"] }
derivative = "2.2.0"
tempfile = "3"
derivative = "2.2"
tempfile = "3.6"
thiserror = "1.0"
anyhow = "1.0.66"
anyhow = "1.0"
proc-macro2 = "1"
syn = { version = "2.0", default-features = false, features = ["full", "derive"] }
quote = "1.0"
axum = "0.6"
chrono = "^0.4.23"
axum = "0.7"
chrono = "0.4"
ron = "0.8"
fastnoise-lite = "1.1.0"
fastnoise-lite = "1.1"
spirv-std = { git = "https://github.com/EmbarkStudios/rust-gpu.git" }
wgpu-types = "0.17"
wgpu = "0.19"
wasm-bindgen-futures = { version = "0.4.36" }
once_cell = "1.13" # Remove when `core::cell::LazyCell` (<https://doc.rust-lang.org/core/cell/struct.LazyCell.html>) is stabilized in Rust 1.80 and we bump our MSRV
wasm-bindgen = "=0.2.92" # wasm-bindgen upgrades may break various things so we pin the version
wasm-bindgen-futures = "0.4"
js-sys = "=0.3.69"
web-sys = "=0.3.69"
winit = "0.29"
url = "2.4.0"
url = "2.5"
tokio = { version = "1.29", features = ["fs", "io-std"] }
vello = { version = "0.1.0" }
resvg = { version = "0.39" }
rand = { version = "0.8.5", default-features = false }
rand_chacha = { version = "0.3.1" }
bezier-rs = { path = "libraries/bezier-rs", features = ["dyn-any"] }
kurbo = { git = "https://github.com/linebender/kurbo.git", features = [
"serde",
] }
glam = { version = "0.25", default-features = false, features = ["serde"] }
node-macro = { path = "node-graph/node-macro" }
base64 = { version = "0.21" }
image = { version = "0.24", default-features = false, features = ["png"] }
rustybuzz = { version = "0.10.0" }
num-derive = { version = "0.4" }
num-traits = { version = "0.2.15", default-features = false, features = [
"i128",
] }
js-sys = { version = "=0.3.67" }
web-sys = { version = "=0.3.67" }
vello = "0.1"
resvg = "0.39"
usvg = "0.39"
rand = { version = "0.8", default-features = false }
rand_chacha = "0.3"
glam = { version = "0.25", default-features = false, features = ["serde"] }
base64 = "0.22"
image = { version = "0.25", default-features = false, features = ["png"] }
rustybuzz = "0.17"
meval = "0.2"
spirv = "0.3"
fern = { version = "0.6", features = ["colored"] }
num_enum = "0.7"
num-derive = "0.4"
num-traits = { version = "0.2", default-features = false, features = ["i128"] }
specta = { git = "https://github.com/oscartbeaumont/specta.git", features = [
"glam",
# "typescript",
] }
syn = { version = "2.0", default-features = false, features = [
"full",
"derive",
] }
kurbo = { git = "https://github.com/linebender/kurbo.git", features = [
"serde",
] }

[profile.dev.package.graphite-editor]
opt-level = 1

# This is a mitigation for https://github.com/rustwasm/wasm-pack/issues/981
# Which is needed because the node_registry function is too large
[profile.dev.package.interpreted-executor]
opt-level = 1

[profile.dev.package.graphene-core]
opt-level = 1

[profile.dev.package.graphene-std]
opt-level = 1

[profile.dev.package.interpreted-executor]
opt-level = 1 # This is a mitigation for https://github.com/rustwasm/wasm-pack/issues/981 which is needed because the node_registry function is too large

[profile.dev.package.autoquant]
opt-level = 3

Expand Down
38 changes: 22 additions & 16 deletions editor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "graphite-editor"
publish = false
version = "0.0.0"
rust-version = "1.66.0"
rust-version = "1.70.0"
authors = ["Graphite Authors <contact@graphite.rs>"]
edition = "2021"
readme = "../README.md"
Expand All @@ -12,6 +12,7 @@ license = "Apache-2.0"

[features]
default = ["wasm"]
wasm = ["wasm-bindgen", "graphene-std/wasm", "wasm-bindgen-futures"]
gpu = [
"interpreted-executor/gpu",
"graphene-std/gpu",
Expand All @@ -23,34 +24,31 @@ quantization = [
"graphene-std/quantization",
"interpreted-executor/quantization",
]
wasm = ["wasm-bindgen", "graphene-std/wasm", "wasm-bindgen-futures"]

[dependencies]
js-sys = "0.3.67"
# Local dependencies
graphite-proc-macros = { path = "../proc-macros" }
graph-craft = { path = "../node-graph/graph-craft" }
interpreted-executor = { path = "../node-graph/interpreted-executor" }
graphene-core = { path = "../node-graph/gcore" }
graphene-std = { path = "../node-graph/gstd", features = ["serde"] }

# Workspace dependencies
js-sys = { workspace = true }
log = { workspace = true }
bitflags = { workspace = true }
thiserror = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
graphite-proc-macros = { path = "../proc-macros" }
bezier-rs = { workspace = true }
glam = { workspace = true, features = ["serde", "debug-glam-assert"] }
derivative = { workspace = true }
specta.workspace = true
image = { workspace = true, features = ["bmp", "png"] }
graph-craft = { path = "../node-graph/graph-craft" }
wgpu-executor = { path = "../node-graph/wgpu-executor", optional = true }
gpu-executor = { path = "../node-graph/gpu-executor", optional = true }
interpreted-executor = { path = "../node-graph/interpreted-executor" }
dyn-any = { workspace = true }
graphene-core = { path = "../node-graph/gcore" }
graphene-std = { path = "../node-graph/gstd", features = ["serde"] }
num_enum = "0.6.1"
num_enum = { workspace = true }
usvg = { workspace = true }
wasm-bindgen = { workspace = true, optional = true }
wasm-bindgen-futures = { workspace = true, optional = true }
# Remove when `core::cell::LazyCell` is stabilized (<https://doc.rust-lang.org/core/cell/struct.LazyCell.html>)
once_cell = "1.13.0"
once_cell = { workspace = true }
web-sys = { workspace = true, features = [
"Document",
"DomRect",
Expand All @@ -60,9 +58,17 @@ web-sys = { workspace = true, features = [
"TextMetrics",
] }

# Optional local dependencies
wgpu-executor = { path = "../node-graph/wgpu-executor", optional = true }
gpu-executor = { path = "../node-graph/gpu-executor", optional = true }

# Optional workspace dependencies
wasm-bindgen = { workspace = true, optional = true }
wasm-bindgen-futures = { workspace = true, optional = true }

[dev-dependencies]
env_logger = "0.10"
# Workspace dependencies
env_logger = { workspace = true }
futures = { workspace = true }
tokio = { workspace = true, features = ["rt", "macros"] }

Expand Down
36 changes: 19 additions & 17 deletions editor/src/generate_ts_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,31 @@
#[ignore]
#[test]
fn generate_ts_types() {
use crate::messages::prelude::FrontendMessage;
use specta::ts::{export_named_datatype, BigIntExportBehavior, ExportConfig};
use specta::{NamedType, TypeMap};
use std::fs::File;
use std::io::Write;
// TODO: Un-comment this out when we figure out how to reenable the "typescript` Specta feature flag

let config = ExportConfig::new().bigint(BigIntExportBehavior::Number);
// use crate::messages::prelude::FrontendMessage;
// use specta::ts::{export_named_datatype, BigIntExportBehavior, ExportConfig};
// use specta::{NamedType, TypeMap};
// use std::fs::File;
// use std::io::Write;

let mut type_map = TypeMap::default();
// let config = ExportConfig::new().bigint(BigIntExportBehavior::Number);

let datatype = FrontendMessage::definition_named_data_type(&mut type_map);
// let mut type_map = TypeMap::default();

let mut export = String::new();
// let datatype = FrontendMessage::definition_named_data_type(&mut type_map);

export += &export_named_datatype(&config, &datatype, &type_map).unwrap();
// let mut export = String::new();

type_map
.iter()
.map(|(_, v)| v)
.flat_map(|v| export_named_datatype(&config, v, &type_map))
.for_each(|e| export += &format!("\n\n{e}"));
// export += &export_named_datatype(&config, &datatype, &type_map).unwrap();

let mut file = File::create("../types.ts").unwrap();
// type_map
// .iter()
// .map(|(_, v)| v)
// .flat_map(|v| export_named_datatype(&config, v, &type_map))
// .for_each(|e| export += &format!("\n\n{e}"));

write!(file, "{export}").ok();
// let mut file = File::create("../types.ts").unwrap();

// write!(file, "{export}").ok();
}
46 changes: 25 additions & 21 deletions frontend/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,41 @@ license = "Apache-2.0"
repository = ""
default-run = "graphite-desktop"
edition = "2021"
rust-version = "1.66.0"
rust-version = "1.70.0"

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

[build-dependencies]
tauri-build = { version = "1.2", features = [] }
[features]
# by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
default = ["custom-protocol"]
# this feature is used for production builds where `devPath` points to the filesystem
# DO NOT remove this
custom-protocol = ["tauri/custom-protocol"]
gpu = ["graphite-editor/gpu"]
quantization = ["graphite-editor/quantization"]

[dependencies]
# Local dependencies
graphite-editor = { path = "../../editor" }

# Workspace dependencies
serde_json = { workspace = true }
serde = { workspace = true }
tauri = { version = "1.5", features = [
"api-all",
"devtools",
"linux-protocol-headers",
"wry",
] }
axum = { workspace = true }
graphite-editor = { path = "../../editor" }
chrono = { workspace = true }
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
ron = { workspace = true }
log = { workspace = true }
fern = { workspace = true }
futures = { workspace = true }

[features]
gpu = ["graphite-editor/gpu"]
quantization = ["graphite-editor/quantization"]
# by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
default = ["custom-protocol"]
# this feature is used for production builds where `devPath` points to the filesystem
# DO NOT remove this
custom-protocol = ["tauri/custom-protocol"]
# Required dependencies
tauri = { version = "1.5", features = [
"api-all",
"devtools",
"linux-protocol-headers",
"wry",
] }

[build-dependencies]
# Required dependencies
tauri-build = { version = "1.2", features = [] }
3 changes: 2 additions & 1 deletion frontend/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ async fn main() {

// run it with hyper on localhost:3000
tauri::async_runtime::spawn(async {
axum::Server::bind(&"0.0.0.0:3001".parse().unwrap()).serve(app.into_make_service()).await.unwrap();
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
axum::serve(listener, app).await.unwrap();
});

tauri::Builder::default()
Expand Down
Loading

0 comments on commit f7ada70

Please sign in to comment.