diff --git a/Cargo.lock b/Cargo.lock index 842653bf1..e26ca2d2c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -95,6 +95,7 @@ dependencies = [ "slog-async", "slog-envlogger", "slog-term", + "strum", "tempfile", "tokio", "unic-langid", @@ -2344,6 +2345,27 @@ dependencies = [ "quote", ] +[[package]] +name = "strum" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7318c509b5ba57f18533982607f24070a55d353e90d4cae30c467cdb2ad5ac5c" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8bc6b87a5112aeeab1f4a9f7ab634fe6cbefc4850006df31267f4cfb9e3149" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "subtle" version = "2.4.0" diff --git a/cargo/crates.bzl b/cargo/crates.bzl index 1546046d1..c628313a4 100644 --- a/cargo/crates.bzl +++ b/cargo/crates.bzl @@ -2371,6 +2371,26 @@ def raze_fetch_remote_crates(): build_file = Label("//cargo/remote:BUILD.string_cache_codegen-0.5.1.bazel"), ) + maybe( + http_archive, + name = "raze__strum__0_20_0", + url = "https://crates.io/api/v1/crates/strum/0.20.0/download", + type = "tar.gz", + sha256 = "7318c509b5ba57f18533982607f24070a55d353e90d4cae30c467cdb2ad5ac5c", + strip_prefix = "strum-0.20.0", + build_file = Label("//cargo/remote:BUILD.strum-0.20.0.bazel"), + ) + + maybe( + http_archive, + name = "raze__strum_macros__0_20_1", + url = "https://crates.io/api/v1/crates/strum_macros/0.20.1/download", + type = "tar.gz", + sha256 = "ee8bc6b87a5112aeeab1f4a9f7ab634fe6cbefc4850006df31267f4cfb9e3149", + strip_prefix = "strum_macros-0.20.1", + build_file = Label("//cargo/remote:BUILD.strum_macros-0.20.1.bazel"), + ) + maybe( http_archive, name = "raze__subtle__2_4_0", diff --git a/cargo/licenses.json b/cargo/licenses.json index 569b9955e..485bba7a4 100644 --- a/cargo/licenses.json +++ b/cargo/licenses.json @@ -2150,6 +2150,24 @@ "license_file": null, "description": "A codegen library for string-cache, developed as part of the Servo project." }, + { + "name": "strum", + "version": "0.20.0", + "authors": "Peter Glotfelty ", + "repository": "https://github.com/Peternator7/strum", + "license": "MIT", + "license_file": null, + "description": "Helpful macros for working with enums and strings" + }, + { + "name": "strum_macros", + "version": "0.20.1", + "authors": "Peter Glotfelty ", + "repository": "https://github.com/Peternator7/strum", + "license": "MIT", + "license_file": null, + "description": "Helpful macros for working with enums and strings" + }, { "name": "subtle", "version": "2.4.0", diff --git a/cargo/remote/BUILD.strum-0.20.0.bazel b/cargo/remote/BUILD.strum-0.20.0.bazel new file mode 100644 index 000000000..0409267e7 --- /dev/null +++ b/cargo/remote/BUILD.strum-0.20.0.bazel @@ -0,0 +1,58 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT" +]) + +# Generated Targets + +rust_library( + name = "strum", + srcs = glob(["**/*.rs"]), + crate_features = [ + "derive", + "strum_macros", + ], + crate_root = "src/lib.rs", + crate_type = "lib", + data = [], + edition = "2018", + proc_macro_deps = [ + "@raze__strum_macros__0_20_1//:strum_macros", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.20.0", + # buildifier: leave-alone + deps = [ + ], +) diff --git a/cargo/remote/BUILD.strum_macros-0.20.1.bazel b/cargo/remote/BUILD.strum_macros-0.20.1.bazel new file mode 100644 index 000000000..9c41b9a80 --- /dev/null +++ b/cargo/remote/BUILD.strum_macros-0.20.1.bazel @@ -0,0 +1,57 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT" +]) + +# Generated Targets + +rust_library( + name = "strum_macros", + srcs = glob(["**/*.rs"]), + crate_features = [ + ], + crate_root = "src/lib.rs", + crate_type = "proc-macro", + data = [], + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.20.1", + # buildifier: leave-alone + deps = [ + "@raze__heck__0_3_2//:heck", + "@raze__proc_macro2__1_0_24//:proc_macro2", + "@raze__quote__1_0_9//:quote", + "@raze__syn__1_0_62//:syn", + ], +) diff --git a/rslib/BUILD.bazel b/rslib/BUILD.bazel index c2919a83c..cfc878e27 100644 --- a/rslib/BUILD.bazel +++ b/rslib/BUILD.bazel @@ -66,9 +66,9 @@ rust_library( compile_data = _anki_compile_data, crate_features = _anki_features, proc_macro_deps = [ + "//rslib/cargo:async_trait", "//rslib/cargo:serde_derive", "//rslib/cargo:serde_repr", - "//rslib/cargo:async_trait", ], rustc_env = _anki_rustc_env, visibility = ["//visibility:public"], @@ -113,6 +113,7 @@ rust_library( "//rslib/cargo:slog_async", "//rslib/cargo:slog_envlogger", "//rslib/cargo:slog_term", + "//rslib/cargo:strum", "//rslib/cargo:tempfile", "//rslib/cargo:tokio", "//rslib/cargo:unic_langid", diff --git a/rslib/Cargo.toml b/rslib/Cargo.toml index d970a316c..cf73f3057 100644 --- a/rslib/Cargo.toml +++ b/rslib/Cargo.toml @@ -23,6 +23,9 @@ env_logger = "0.8.1" [dependencies] # pinned as any changes could invalidate sqlite indexes unicase = "=2.6.0" +# transitive dependency; 0.1.7 is currently broken on Windows (perhaps +# only in Bazel) +proc-macro-nested = "=0.1.6" askama = "0.10.1" async-compression = { version = "0.3.5", features = ["stream", "gzip"] } @@ -75,10 +78,7 @@ unicode-normalization = "0.1.13" utime = "0.3.1" zip = { version = "0.5.6", default-features = false, features = ["deflate", "time"] } async-trait = "0.1.42" - -# transitive dependency; 0.1.7 is currently broken on Windows (perhaps -# only in Bazel) -proc-macro-nested = "=0.1.6" ammonia = "3.1.0" pulldown-cmark = "0.8.0" fnv = "1.0.7" +strum = { version = "0.20.0", features = ["derive"] } diff --git a/rslib/cargo/BUILD.bazel b/rslib/cargo/BUILD.bazel index 778e0c3b5..4f3b61dd2 100644 --- a/rslib/cargo/BUILD.bazel +++ b/rslib/cargo/BUILD.bazel @@ -426,6 +426,15 @@ alias( ], ) +alias( + name = "strum", + actual = "@raze__strum__0_20_0//:strum", + tags = [ + "cargo-raze", + "manual", + ], +) + alias( name = "tempfile", actual = "@raze__tempfile__3_2_0//:tempfile",