mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 14:18:04 +08:00
Exclude node registry functions from desktop frontend builds (#3584)
* Exclude node registry functions from desktop frontend builds This reduces compile times and file sizes * Use early return * Fix branch name in build-linux pipeline
This commit is contained in:
2
.github/workflows/build-linux-bundle.yml
vendored
2
.github/workflows/build-linux-bundle.yml
vendored
@@ -4,7 +4,7 @@ on:
|
||||
workflow_dispatch: {}
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -2481,6 +2481,7 @@ dependencies = [
|
||||
"js-sys",
|
||||
"log",
|
||||
"math-parser",
|
||||
"node-macro",
|
||||
"ron",
|
||||
"serde",
|
||||
"serde-wasm-bindgen",
|
||||
|
||||
@@ -14,7 +14,7 @@ license = "Apache-2.0"
|
||||
default = ["gpu", "shader-nodes"]
|
||||
gpu = ["editor/gpu"]
|
||||
shader-nodes = ["graphene-std/shader-nodes", "gpu"]
|
||||
native = []
|
||||
native = ["node-macro/disable-registration"]
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
@@ -39,6 +39,7 @@ wgpu = { workspace = true }
|
||||
web-sys = { workspace = true }
|
||||
ron = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
node-macro = { workspace = true }
|
||||
|
||||
[package.metadata.wasm-pack.profile.dev]
|
||||
wasm-opt = false
|
||||
|
||||
@@ -13,6 +13,9 @@ license = "Apache-2.0"
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
[features]
|
||||
disable-registration = []
|
||||
|
||||
[dependencies]
|
||||
# Workspace dependencies
|
||||
syn = { workspace = true }
|
||||
|
||||
@@ -678,8 +678,7 @@ fn generate_register_node_impl(parsed: &ParsedNodeFn, field_names: &[&Ident], st
|
||||
}
|
||||
let registry_name = format_ident!("__node_registry_{}_{}", NODE_ID.fetch_add(1, std::sync::atomic::Ordering::SeqCst), struct_name);
|
||||
|
||||
Ok(quote! {
|
||||
|
||||
let native = quote! {
|
||||
#[cfg_attr(not(target_family = "wasm"), ctor)]
|
||||
fn register_node() {
|
||||
let mut registry = NODE_REGISTRY.lock().unwrap();
|
||||
@@ -690,6 +689,14 @@ fn generate_register_node_impl(parsed: &ParsedNodeFn, field_names: &[&Ident], st
|
||||
]
|
||||
);
|
||||
}
|
||||
};
|
||||
if cfg!(feature = "disable-registration") {
|
||||
return Ok(native);
|
||||
}
|
||||
|
||||
Ok(quote! {
|
||||
#native
|
||||
|
||||
#[cfg(target_family = "wasm")]
|
||||
#[unsafe(no_mangle)]
|
||||
extern "C" fn #registry_name() {
|
||||
|
||||
Reference in New Issue
Block a user