mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-05 21:37:15 +02:00
124 lines
4.4 KiB
Diff
124 lines
4.4 KiB
Diff
From dc5c374e2f3c5b3a8684fd1c35dba55936829618 Mon Sep 17 00:00:00 2001
|
|
From: Divy Srivastava <dj.srivastava23@gmail.com>
|
|
Date: Sun, 3 Mar 2024 13:22:00 +0530
|
|
Subject: [PATCH] feat(cli): cargo feature flag for webgpu
|
|
|
|
---
|
|
cli/Cargo.toml | 4 +++-
|
|
runtime/Cargo.toml | 7 +++++--
|
|
runtime/lib.rs | 1 +
|
|
runtime/snapshot.rs | 1 +
|
|
runtime/web_worker.rs | 1 +
|
|
runtime/worker.rs | 1 +
|
|
6 files changed, 12 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/cli/Cargo.toml b/cli/Cargo.toml
|
|
index 5656c77f85ad8..f39613c1f5857 100644
|
|
--- a/cli/Cargo.toml
|
|
+++ b/cli/Cargo.toml
|
|
@@ -36,7 +36,7 @@ harness = false
|
|
path = "./bench/lsp_bench_standalone.rs"
|
|
|
|
[features]
|
|
-default = ["upgrade", "__vendored_zlib_ng"]
|
|
+default = ["upgrade", "__vendored_zlib_ng", "webgpu"]
|
|
# A feature that enables the upgrade subcommand and the background check for
|
|
# available updates (of deno binary). This is typically disabled for (Linux)
|
|
# distribution packages.
|
|
@@ -46,6 +46,8 @@ upgrade = []
|
|
__runtime_js_sources = ["deno_runtime/__runtime_js_sources"]
|
|
# Vendor zlib as zlib-ng
|
|
__vendored_zlib_ng = ["flate2/zlib-ng-compat", "libz-sys/zlib-ng"]
|
|
+# Feature flags for large extensions.
|
|
+webgpu = ["deno_runtime/webgpu"]
|
|
|
|
[build-dependencies]
|
|
deno_runtime = { workspace = true, features = ["include_js_files_for_snapshotting", "only_snapshotted_js_sources"] }
|
|
diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml
|
|
index a7bedafe66a24..fe26635450d6d 100644
|
|
--- a/runtime/Cargo.toml
|
|
+++ b/runtime/Cargo.toml
|
|
@@ -10,6 +10,7 @@ repository.workspace = true
|
|
description = "Provides the deno runtime library"
|
|
|
|
[features]
|
|
+default = ["webgpu"]
|
|
# "fake" feature that allows to generate docs on docs.rs
|
|
docsrs = []
|
|
# A feature that allows excluding `./js/99_main.js` from the exported extension.
|
|
@@ -27,6 +28,8 @@ __runtime_js_sources = ["include_js_files_for_snapshotting"]
|
|
# conditionally exclude the runtime source transpilation logic, and add an
|
|
# assertion that a snapshot is provided.
|
|
only_snapshotted_js_sources = ["include_js_files_for_snapshotting"]
|
|
+# Feature flags for large extensions.
|
|
+webgpu = ["deno_webgpu"]
|
|
|
|
[lib]
|
|
name = "deno_runtime"
|
|
@@ -60,7 +63,7 @@ deno_kv.workspace = true
|
|
deno_tls.workspace = true
|
|
deno_url.workspace = true
|
|
deno_web.workspace = true
|
|
-deno_webgpu.workspace = true
|
|
+deno_webgpu = { workspace = true, optional = true }
|
|
deno_webidl.workspace = true
|
|
deno_websocket.workspace = true
|
|
deno_webstorage.workspace = true
|
|
@@ -94,7 +97,7 @@ deno_terminal.workspace = true
|
|
deno_tls.workspace = true
|
|
deno_url.workspace = true
|
|
deno_web.workspace = true
|
|
-deno_webgpu.workspace = true
|
|
+deno_webgpu = { workspace = true, optional = true }
|
|
deno_webidl.workspace = true
|
|
deno_websocket.workspace = true
|
|
deno_webstorage.workspace = true
|
|
diff --git a/runtime/lib.rs b/runtime/lib.rs
|
|
index b63fd41340b53..c80ab112b5fef 100644
|
|
--- a/runtime/lib.rs
|
|
+++ b/runtime/lib.rs
|
|
@@ -19,6 +19,7 @@ pub use deno_node;
|
|
pub use deno_tls;
|
|
pub use deno_url;
|
|
pub use deno_web;
|
|
+#[cfg(feature = "webgpu")]
|
|
pub use deno_webgpu;
|
|
pub use deno_webidl;
|
|
pub use deno_websocket;
|
|
diff --git a/runtime/snapshot.rs b/runtime/snapshot.rs
|
|
index e48af43ff7d1d..f94cfecb98b0a 100644
|
|
--- a/runtime/snapshot.rs
|
|
+++ b/runtime/snapshot.rs
|
|
@@ -212,6 +212,7 @@ pub fn create_runtime_snapshot(
|
|
Default::default(),
|
|
Default::default(),
|
|
),
|
|
+ #[cfg(feature = "webgpu")]
|
|
deno_webgpu::deno_webgpu::init_ops_and_esm(),
|
|
deno_canvas::deno_canvas::init_ops_and_esm(),
|
|
deno_fetch::deno_fetch::init_ops_and_esm::<Permissions>(Default::default()),
|
|
diff --git a/runtime/web_worker.rs b/runtime/web_worker.rs
|
|
index 97b855c5671cf..ff133cfedba99 100644
|
|
--- a/runtime/web_worker.rs
|
|
+++ b/runtime/web_worker.rs
|
|
@@ -409,6 +409,7 @@ impl WebWorker {
|
|
options.blob_store.clone(),
|
|
Some(main_module.clone()),
|
|
),
|
|
+ #[cfg(feature = "webgpu")]
|
|
deno_webgpu::deno_webgpu::init_ops_and_esm(),
|
|
deno_canvas::deno_canvas::init_ops_and_esm(),
|
|
deno_fetch::deno_fetch::init_ops_and_esm::<PermissionsContainer>(
|
|
diff --git a/runtime/worker.rs b/runtime/worker.rs
|
|
index d19e520c9b1a3..947582bbee73b 100644
|
|
--- a/runtime/worker.rs
|
|
+++ b/runtime/worker.rs
|
|
@@ -344,6 +344,7 @@ impl MainWorker {
|
|
options.blob_store.clone(),
|
|
options.bootstrap.location.clone(),
|
|
),
|
|
+ #[cfg(feature = "webgpu")]
|
|
deno_webgpu::deno_webgpu::init_ops_and_esm(),
|
|
deno_canvas::deno_canvas::init_ops_and_esm(),
|
|
deno_fetch::deno_fetch::init_ops_and_esm::<PermissionsContainer>(
|