From 0a7abc3dc0bd99d3de978c58254855d0e7b8929c Mon Sep 17 00:00:00 2001 From: Jinlei Li Date: Fri, 14 Oct 2022 12:06:18 +0800 Subject: [PATCH] Use cargo 1.64 workspace inheritance feature --- .github/workflows/ci.yml | 2 +- Cargo.toml | 56 ++++++++++++++++++++++++++++-- README.md | 2 +- dummy/Cargo.toml | 9 +++-- player/Cargo.toml | 30 ++++++++-------- run-wasm/Cargo.toml | 2 +- wgpu-core/Cargo.toml | 57 ++++++++++++++----------------- wgpu-hal/Cargo.toml | 56 ++++++++++++++---------------- wgpu-info/Cargo.toml | 16 ++++----- wgpu-types/Cargo.toml | 16 ++++----- wgpu/Cargo.toml | 74 ++++++++++++++++------------------------ 11 files changed, 170 insertions(+), 150 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1a1cb04a00b..c30ab238f40 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: env: RUST_BACKTRACE: 1 - RUST_VERSION: 1.62 + RUST_VERSION: 1.64 # We distinguish the following kinds of builds: # - local: build for the same target as we compile on, and do local tests diff --git a/Cargo.toml b/Cargo.toml index 7d3044ae3d9..8b23516a058 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,14 +8,66 @@ members = [ "wgpu-hal", "wgpu-info", "wgpu-types", - "run-wasm", + "run-wasm" ] exclude = [ "cts_runner", - "deno_webgpu", + "deno_webgpu" ] default-members = ["wgpu", "wgpu-hal", "wgpu-info"] +[workspace.package] +edition = "2021" +rust-version = "1.64" +keywords = ["graphics"] +license = "MIT OR Apache-2.0" +homepage = "https://wgpu.rs/" +repository = "https://github.com/gfx-rs/wgpu" +authors = ["wgpu developers"] + +[workspace.dependencies.wgc] +package = "wgpu-core" +path = "./wgpu-core" +version = "0.14" + +[workspace.dependencies.wgt] +package = "wgpu-types" +path = "./wgpu-types" +version = "0.14" + +[workspace.dependencies.hal] +package = "wgpu-hal" +path = "./wgpu-hal" +version = "0.14" + +[workspace.dependencies.naga] +git = "https://github.com/gfx-rs/naga" +rev = "c52d9102" +version = "0.10" + +[workspace.dependencies] +arrayvec = "0.7" +bitflags = "1" +egl = { package = "khronos-egl", version = "4.1" } +env_logger = "0.9" +fxhash = "0.2.1" +log = "0.4" +# parking_lot 0.12 switches from `winapi` to `windows`; permit either +parking_lot = ">=0.11,<0.13" +raw-window-handle = "0.5" +ron = "0.8" +smallvec = "1" +serde = "1" +thiserror = "1" +wgpu = { version = "0.14", path = "./wgpu" } +winit = "0.27.1" + +# wasm32 dependencies +js-sys = "0.3.60" +wasm-bindgen = "0.2.83" +wasm-bindgen-futures = "0.4.33" +web-sys = "0.3.60" + [patch."https://github.com/gfx-rs/naga"] #naga = { path = "../naga" } diff --git a/README.md b/README.md index 7fe11cb7d94..46dbd914b67 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ For an overview of all the components in the gfx-rs ecosystem, see [the big pict ### MSRV policy -Minimum Supported Rust Version is **1.62**. +Minimum Supported Rust Version is **1.64**. It is enforced on CI (in "/.github/workflows/ci.yml") with `RUST_VERSION` variable. This version can only be upgraded in breaking releases. diff --git a/dummy/Cargo.toml b/dummy/Cargo.toml index 796bde96f2d..aa50ca86652 100644 --- a/dummy/Cargo.toml +++ b/dummy/Cargo.toml @@ -2,15 +2,14 @@ name = "dummy" version = "0.1.0" authors = [ - "Dzmitry Malyshau ", + "Dzmitry Malyshau " ] -edition = "2021" -license = "MIT OR Apache-2.0" +edition.workspace = true +license.workspace = true publish = false [features] [dependencies.wgc] -path = "../wgpu-core" -package = "wgpu-core" +workspace = true features = ["serial-pass", "trace"] diff --git a/player/Cargo.toml b/player/Cargo.toml index 8cfbbcff833..21db33ef23d 100644 --- a/player/Cargo.toml +++ b/player/Cargo.toml @@ -2,34 +2,32 @@ name = "player" version = "0.1.0" authors = [ - "Dzmitry Malyshau ", + "Dzmitry Malyshau " ] -edition = "2021" +edition.workspace = true description = "WebGPU trace player" -homepage = "https://github.com/gfx-rs/wgpu" -repository = "https://github.com/gfx-rs/wgpu" -keywords = ["graphics"] -license = "MIT OR Apache-2.0" +homepage.workspace = true +repository.workspace = true +keywords.workspace = true +license.workspace = true publish = false [features] [dependencies] -env_logger = "0.9" -log = "0.4" -raw-window-handle = "0.5" -ron = "0.8" -winit = { version = "0.27", optional = true } +env_logger.workspace = true +log.workspace = true +raw-window-handle.workspace = true +ron.workspace = true +winit = { workspace = true, optional = true } [dependencies.wgt] -path = "../wgpu-types" -package = "wgpu-types" +workspace = true features = ["replay"] [dependencies.wgc] -path = "../wgpu-core" -package = "wgpu-core" +workspace = true features = ["replay", "raw-window-handle", "strict_asserts", "wgsl"] [dev-dependencies] -serde = "1" +serde.workspace = true diff --git a/run-wasm/Cargo.toml b/run-wasm/Cargo.toml index 3ac77b26d8a..67aa31dbd67 100644 --- a/run-wasm/Cargo.toml +++ b/run-wasm/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "run-wasm" version = "0.1.0" -edition = "2021" +edition.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/wgpu-core/Cargo.toml b/wgpu-core/Cargo.toml index 8dd0632121c..e8cb9f334fd 100644 --- a/wgpu-core/Cargo.toml +++ b/wgpu-core/Cargo.toml @@ -1,13 +1,13 @@ [package] name = "wgpu-core" version = "0.14.0" -authors = ["wgpu developers"] -edition = "2021" +authors.workspace = true +edition.workspace = true description = "WebGPU core logic on wgpu-hal" -homepage = "https://github.com/gfx-rs/wgpu" -repository = "https://github.com/gfx-rs/wgpu" -keywords = ["graphics"] -license = "MIT OR Apache-2.0" +homepage.workspace = true +repository.workspace = true +keywords.workspace = true +license.workspace = true [lib] @@ -29,55 +29,48 @@ wgsl = ["naga/wgsl-in"] vulkan-portability = ["hal/vulkan"] [dependencies] -arrayvec = "0.7" -bitflags = "1.0" +arrayvec.workspace = true +bitflags.workspace = true bit-vec = "0.6" codespan-reporting = "0.11" -fxhash = "0.2" -log = "0.4" -# parking_lot 0.12 switches from `winapi` to `windows`; permit either -parking_lot = ">=0.11,<0.13" +fxhash.workspace = true +log.workspace = true +parking_lot.workspace = true profiling = { version = "1", default-features = false } -raw-window-handle = { version = "0.5", optional = true } -ron = { version = "0.8", optional = true } -serde = { version = "1.0", features = ["serde_derive"], optional = true } -smallvec = "1" -thiserror = "1" +raw-window-handle = { workspace = true, optional = true } +ron = { workspace = true, optional = true } +serde = { workspace = true, features = ["serde_derive"], optional = true } +smallvec.workspace = true +thiserror.workspace = true [dependencies.naga] -git = "https://github.com/gfx-rs/naga" -rev = "c52d9102" -version = "0.10" +workspace = true features = ["clone", "span", "validate"] [dependencies.wgt] -path = "../wgpu-types" -package = "wgpu-types" -version = "0.14" +workspace = true [dependencies.hal] -path = "../wgpu-hal" -package = "wgpu-hal" -version = "0.14" +workspace = true [target.'cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))'.dependencies] -web-sys = { version = "0.3", features = ["HtmlCanvasElement", "OffscreenCanvas"] } +web-sys = { workspace = true, features = ["HtmlCanvasElement", "OffscreenCanvas"] } [target.'cfg(target_arch = "wasm32")'.dependencies] -hal = { path = "../wgpu-hal", package = "wgpu-hal", version = "0.14", features = ["gles"] } +hal = { workspace = true, features = ["gles"] } [target.'cfg(all(not(target_arch = "wasm32"), any(target_os = "ios", target_os = "macos")))'.dependencies] -hal = { path = "../wgpu-hal", package = "wgpu-hal", version = "0.14", features = ["metal"] } +hal = { workspace = true, features = ["metal"] } #Note: could also enable "vulkan" for Vulkan Portability [target.'cfg(all(not(target_arch = "wasm32"), unix, not(target_os = "ios"), not(target_os = "macos")))'.dependencies] -hal = { path = "../wgpu-hal", package = "wgpu-hal", version = "0.14", features = ["vulkan", "gles", "renderdoc"] } +hal = { workspace = true, features = ["vulkan", "gles", "renderdoc"] } [target.'cfg(all(not(target_arch = "wasm32"), windows))'.dependencies] -hal = { path = "../wgpu-hal", package = "wgpu-hal", version = "0.14", features = ["vulkan", "dx12", "dx11", "renderdoc"] } +hal = { workspace = true, features = ["vulkan", "dx12", "dx11", "renderdoc"] } [target.'cfg(target_os = "emscripten")'.dependencies] -hal = { path = "../wgpu-hal", package = "wgpu-hal", version = "0.14", features = ["emscripten"] } +hal = { workspace = true, features = ["emscripten"] } [build-dependencies] cfg_aliases = "0.1" diff --git a/wgpu-hal/Cargo.toml b/wgpu-hal/Cargo.toml index b68d30f13e3..30479b1b521 100644 --- a/wgpu-hal/Cargo.toml +++ b/wgpu-hal/Cargo.toml @@ -1,14 +1,14 @@ [package] name = "wgpu-hal" version = "0.14.0" -authors = ["wgpu developers"] -edition = "2021" +authors.workspace = true +edition.workspace = true description = "WebGPU hardware abstraction layer" -homepage = "https://github.com/gfx-rs/wgpu" -repository = "https://github.com/gfx-rs/wgpu" -keywords = ["graphics"] -license = "MIT OR Apache-2.0" -rust-version = "1.60" +homepage.workspace = true +repository.workspace = true +keywords.workspace = true +license.workspace = true +rust-version.workspace = true [lib] @@ -30,17 +30,16 @@ name = "raw-gles" required-features = ["gles"] [dependencies] -bitflags = "1.0" -# parking_lot 0.12 switches from `winapi` to `windows`; permit either -parking_lot = ">=0.11,<0.13" +bitflags.workspace = true +parking_lot.workspace = true profiling = { version = "1", default-features = false } -raw-window-handle = "0.5" -thiserror = "1" +raw-window-handle.workspace = true +thiserror.workspace = true # backends common -arrayvec = "0.7" -fxhash = "0.2.1" -log = "0.4" +arrayvec.workspace = true +fxhash.workspace = true +log.workspace = true renderdoc-sys = { version = "0.7.1", optional = true } # backend: Metal @@ -51,7 +50,7 @@ foreign-types = { version = "0.3", optional = true } ash = { version = "0.37", optional = true } gpu-alloc = { version = "0.5", optional = true } gpu-descriptor = { version = "0.2", optional = true } -smallvec = { version = "1", optional = true, features = ["union"] } +smallvec = { workspace = true, optional = true, features = ["union"] } # backend: Gles #glow = { version = "0.11.2", optional = true } @@ -63,17 +62,15 @@ bit-set = { version = "0.5", optional = true } range-alloc = { version = "0.1", optional = true } [dependencies.wgt] -package = "wgpu-types" -path = "../wgpu-types" -version = "0.14" +workspace = true [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -egl = { package = "khronos-egl", version = "4.1", features = ["dynamic"], optional = true } +egl = { workspace = true, features = ["dynamic"], optional = true } #Note: it's only unused on Apple platforms libloading = { version = "0.7", optional = true } [target.'cfg(target_os = "emscripten")'.dependencies] -egl = { package = "khronos-egl", version = "4.1", features = ["static", "no-pkg-config"] } +egl = { workspace = true, features = ["static", "no-pkg-config"] } #Note: it's unused by emscripten, but we keep it to have single code base in egl.rs libloading = { version = "0.7", optional = true } @@ -89,29 +86,26 @@ objc = "0.2.5" core-graphics-types = "0.1" [target.'cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))'.dependencies] -wasm-bindgen = { version = "0.2" } -web-sys = { version = "=0.3.60", features = ["Window", "HtmlCanvasElement", "WebGl2RenderingContext", "OffscreenCanvas"] } -js-sys = { version = "0.3" } +wasm-bindgen.workspace = true +web-sys = { workspace = true, features = ["Window", "HtmlCanvasElement", "WebGl2RenderingContext", "OffscreenCanvas"] } +js-sys.workspace = true [target.'cfg(target_os = "android")'.dependencies] android_system_properties = "0.1.1" [dependencies.naga] -git = "https://github.com/gfx-rs/naga" -rev = "c52d9102" -version = "0.10" +workspace = true features = ["clone"] # DEV dependencies [dev-dependencies.naga] -git = "https://github.com/gfx-rs/naga" -rev = "c52d9102" +workspace = true features = ["wgsl-in"] [dev-dependencies] -env_logger = "0.9" -winit = "0.27.1" # for "halmark" example +env_logger.workspace = true +winit.workspace = true # for "halmark" example [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] glutin = "0.29.1" # for "gles" example diff --git a/wgpu-info/Cargo.toml b/wgpu-info/Cargo.toml index 84650d1b7af..52cd94b6347 100644 --- a/wgpu-info/Cargo.toml +++ b/wgpu-info/Cargo.toml @@ -1,14 +1,14 @@ [package] name = "wgpu-info" version = "0.14.0" -authors = ["wgpu developers"] -edition = "2021" +authors.workspace = true +edition.workspace = true description = "Adapter information and per-adapter test program" -homepage = "https://github.com/gfx-rs/wgpu" -repository = "https://github.com/gfx-rs/wgpu" -keywords = ["graphics"] -license = "MIT OR Apache-2.0" +homepage.workspace = true +repository.workspace = true +keywords.workspace = true +license.workspace = true [dependencies] -env_logger = "0.9" -wgpu = { version = "0.14", path = "../wgpu" } +env_logger.workspace = true +wgpu.workspace = true diff --git a/wgpu-types/Cargo.toml b/wgpu-types/Cargo.toml index e9ae58b990b..dff4182462c 100644 --- a/wgpu-types/Cargo.toml +++ b/wgpu-types/Cargo.toml @@ -1,13 +1,13 @@ [package] name = "wgpu-types" version = "0.14.0" -authors = ["wgpu developers"] -edition = "2021" +authors.workspace = true +edition.workspace = true description = "WebGPU types" -homepage = "https://github.com/gfx-rs/wgpu" -repository = "https://github.com/gfx-rs/wgpu" -keywords = ["graphics"] -license = "MIT OR Apache-2.0" +homepage.workspace = true +repository.workspace = true +keywords.workspace = true +license.workspace = true [lib] @@ -16,8 +16,8 @@ trace = ["serde", "bitflags_serde_shim"] replay = ["serde", "bitflags_serde_shim"] [dependencies] -bitflags = "1.0" -serde = { version = "1.0", features = ["serde_derive"], optional = true } +bitflags.workspace = true +serde = { workspace = true, features = ["serde_derive"], optional = true } bitflags_serde_shim = { version = "0.2", optional = true } [dev-dependencies] diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index 2017ada1926..bbfccf95963 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -1,13 +1,13 @@ [package] name = "wgpu" version = "0.14.0" -authors = ["wgpu developers"] -edition = "2021" +authors.workspace = true +edition.workspace = true description = "Rusty WebGPU API wrapper" -homepage = "https://wgpu.rs/" -repository = "https://github.com/gfx-rs/wgpu/tree/v0.13" -keywords = ["graphics"] -license = "MIT OR Apache-2.0" +homepage.workspace = true +repository.workspace = true +keywords.workspace = true +license.workspace = true exclude = [ "etc/**/*", "examples/**/*.png", # Image comparison test @@ -88,80 +88,65 @@ emscripten = ["webgl"] vulkan-portability = ["wgc/vulkan-portability"] [target.'cfg(not(target_arch = "wasm32"))'.dependencies.wgc] -package = "wgpu-core" -path = "../wgpu-core" -version = "0.14" +workspace = true features = ["raw-window-handle"] [target.'cfg(target_arch = "wasm32")'.dependencies.wgc] -package = "wgpu-core" -path = "../wgpu-core" -version = "0.14" +workspace = true features = ["raw-window-handle"] optional = true [dependencies.wgt] -package = "wgpu-types" -path = "../wgpu-types" -version = "0.14" +workspace = true [target.'cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))'.dependencies.hal] -package = "wgpu-hal" -path = "../wgpu-hal" -version = "0.14" +workspace = true [dependencies] -arrayvec = "0.7" -log = "0.4" -# parking_lot 0.12 switches from `winapi` to `windows`; permit either -parking_lot = ">=0.11,<0.13" -raw-window-handle = "0.5" -serde = { version = "1", features = ["derive"], optional = true } -smallvec = "1" +arrayvec.workspace = true +log.workspace = true +parking_lot.workspace = true +raw-window-handle.workspace = true +serde = { workspace = true, features = ["derive"], optional = true } +smallvec.workspace = true static_assertions = "1.1.0" [dev-dependencies] -bitflags = "1" +bitflags.workspace = true bytemuck = { version = "1.4", features = ["derive"] } glam = "0.21.3" ddsfile = "0.5" futures-intrusive = "0.4" -log = "0.4" +log.workspace = true # Opt out of noise's "default-features" to avoid "image" feature as a dependency count optimization. # This will not be required in the next release since it has been removed from the default feature in https://github.com/Razaekel/noise-rs/commit/1af9e1522236b2c584fb9a02150c9c67a5e6bb04#diff-2e9d962a08321605940b5a657135052fbcef87b5e360662bb527c96d9a615542 noise = { version = "0.7", default-features = false } obj = "0.10" png = "0.17" nanorand = { version = "0.7", default-features = false, features = ["wyrand"] } -winit = "0.27.1" # for "halmark" example +winit.workspace = true # for "halmark" example [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] async-executor = "1.0" pollster = "0.2" -env_logger = "0.9" +env_logger.workspace = true [dependencies.naga] -git = "https://github.com/gfx-rs/naga" -rev = "c52d9102" -version = "0.10" +workspace = true features = ["clone"] optional = true # used to test all the example shaders [dev-dependencies.naga] -git = "https://github.com/gfx-rs/naga" -rev = "c52d9102" -version = "0.10" +workspace = true features = ["wgsl-in"] [target.'cfg(target_arch = "wasm32")'.dependencies.naga] -git = "https://github.com/gfx-rs/naga" -rev = "c52d9102" -version = "0.10" +workspace = true features = ["wgsl-out"] [target.'cfg(target_arch = "wasm32")'.dependencies] -web-sys = { version = "0.3.60", features = [ +web-sys = { workspace = true, features = [ "Document", "Navigator", "Node", @@ -290,17 +275,16 @@ web-sys = { version = "0.3.60", features = [ "WorkerGlobalScope", "WorkerNavigator" ] } -wasm-bindgen = "0.2.83" -js-sys = "0.3.60" -wasm-bindgen-futures = "0.4.33" -# parking_lot 0.12 switches from `winapi` to `windows`; permit either -parking_lot = ">=0.11,<0.13" +wasm-bindgen.workspace = true +js-sys.workspace = true +wasm-bindgen-futures.workspace = true +parking_lot.workspace = true [target.'cfg(target_arch = "wasm32")'.dev-dependencies] console_error_panic_hook = "0.1.7" console_log = "0.2" # We need these features in the framework examples -web-sys = { version = "0.3.60", features = [ +web-sys = { workspace = true, features = [ "Location", "Blob", "RequestInit",