on master help sign in
Remove embed_runtime feature

It's no longer practical to maintain. Closes #451

commit0fdb626c2cc5518b10a9bfbedc8b78cff3d360c9 authorBlaž Hrastnik <blaz@mxxn.io> dateFri 30 Jul 2021, 16:27 (5 years ago) parentf88d4c1
7 files changed+3−84
Cargo.lock−34 README.md−7 book/src/install.md+3−10 helix-core/Cargo.toml−2 helix-core/src/lib.rs−1 helix-core/src/syntax.rs−29 helix-term/Cargo.toml−1
Cargo.lock−34
@@ -317,7 +317,6 @@ dependencies = [
317317 "quickcheck",
318318 "regex",
319319 "ropey",
320− "rust-embed",
321320 "serde",
322321 "similar",
323322 "smallvec",
@@ -773,39 +772,6 @@ dependencies = [
773772 "smallvec",
774773]
775774
776−[[package]]
777−name = "rust-embed"
778−version = "5.9.0"
779−source = "registry+https://github.com/rust-lang/crates.io-index"
780−checksum = "2fe1fe6aac5d6bb9e1ffd81002340363272a7648234ec7bdfac5ee202cb65523"
781−dependencies = [
782− "rust-embed-impl",
783− "rust-embed-utils",
784− "walkdir",
785−]
786−
787−[[package]]
788−name = "rust-embed-impl"
789−version = "5.9.0"
790−source = "registry+https://github.com/rust-lang/crates.io-index"
791−checksum = "3ed91c41c42ef7bf687384439c312e75e0da9c149b0390889b94de3c7d9d9e66"
792−dependencies = [
793− "proc-macro2",
794− "quote",
795− "rust-embed-utils",
796− "syn",
797− "walkdir",
798−]
799−
800−[[package]]
801−name = "rust-embed-utils"
802−version = "5.1.0"
803−source = "registry+https://github.com/rust-lang/crates.io-index"
804−checksum = "2a512219132473ab0a77b52077059f1c47ce4af7fbdc94503e9862a34422876d"
805−dependencies = [
806− "walkdir",
807−]
808−
809775[[package]]
810776name = "ryu"
811777version = "1.0.5"
README.md−7
@@ -51,13 +51,6 @@ that sets the variable to the install dir.
5151> NOTE: running via cargo also doesn't require setting explicit `HELIX_RUNTIME` path, it will automatically
5252> detect the `runtime` directory in the project root.
5353
54−Alternatively, if you want to embed the `runtime/` directory into the Helix binary you can build
55−it with:
56−
57−```
58−cargo install --path helix-term --features "embed_runtime"
59−```
60−
6154[![Packaging status](https://repology.org/badge/vertical-allrepos/helix.svg)](https://repology.org/project/helix/versions)
6255
6356## MacOS
book/src/install.md+3−10
@@ -37,13 +37,6 @@ cargo install --path helix-term
3737
3838This will install the `hx` binary to `$HOME/.cargo/bin`.
3939
40−Now copy the `runtime/` directory somewhere. Helix will by default look for the
41−runtime inside the same folder as the executable, but that can be overriden via
42−the `HELIX_RUNTIME` environment variable.
43−
44−If you want to embed the `runtime/` directory into the Helix binary you can build
45−it with:
46−
47−```
48−cargo install --path helix-term --features "embed_runtime"
49−```
40+Helix also needs it's runtime files so make sure to copy/symlink the `runtime/` directory into the
41+config directory (for example `~/.config/helix/runtime` on Linux/macOS). This location can be overriden
42+via the `HELIX_RUNTIME` environment variable.
helix-core/Cargo.toml−2
@@ -11,7 +11,6 @@ homepage = "https://helix-editor.com"
1111include = ["src/**/*", "README.md"]
1212
1313[features]
14−embed_runtime = ["rust-embed"]
1514
1615[dependencies]
1716helix-syntax = { version = "0.3", path = "../helix-syntax" }
@@ -34,7 +33,6 @@ toml = "0.5"
3433similar = "1.3"
3534
3635etcetera = "0.3"
37−rust-embed = { version = "5.9.0", optional = true }
3836
3937[dev-dependencies]
4038quickcheck = { version = "1", default-features = false }
helix-core/src/lib.rs−1
@@ -58,7 +58,6 @@ pub fn find_root(root: Option<&str>) -> Option<std::path::PathBuf> {
5858 None
5959}
6060
61−#[cfg(not(embed_runtime))]
6261pub fn runtime_dir() -> std::path::PathBuf {
6362 if let Ok(dir) = std::env::var("HELIX_RUNTIME") {
6463 return dir.into();
helix-core/src/syntax.rs−29
@@ -84,7 +84,6 @@ pub struct IndentQuery {
8484 pub outdent: HashSet<String>,
8585}
8686
87−#[cfg(not(feature = "embed_runtime"))]
8887fn load_runtime_file(language: &str, filename: &str) -> Result<String, std::io::Error> {
8988 let path = crate::RUNTIME_DIR
9089 .join("queries")
@@ -93,34 +92,6 @@ fn load_runtime_file(language: &str, filename: &str) -> Result<String, std::io::
9392 std::fs::read_to_string(&path)
9493}
9594
96−#[cfg(feature = "embed_runtime")]
97−fn load_runtime_file(language: &str, filename: &str) -> Result<String, Box<dyn std::error::Error>> {
98− use std::path::PathBuf;
99−
100− #[derive(rust_embed::RustEmbed)]
101− #[folder = "../runtime/"]
102− struct Runtime;
103−
104− #[derive(Debug)]
105− struct EmbeddedFileNotFoundError {
106− path: PathBuf,
107− }
108− impl std::error::Error for EmbeddedFileNotFoundError {}
109− impl fmt::Display for EmbeddedFileNotFoundError {
110− fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
111− write!(f, "failed to load embedded file {}", self.path.display())
112− }
113− }
114−
115− let path = PathBuf::from("queries").join(language).join(filename);
116−
117− if let Some(query_bytes) = Runtime::get(&path.display().to_string()) {
118− String::from_utf8(query_bytes.to_vec()).map_err(|err| err.into())
119− } else {
120− Err(Box::new(EmbeddedFileNotFoundError { path }))
121− }
122−}
123−
12495fn read_query(language: &str, filename: &str) -> String {
12596 static INHERITS_REGEX: Lazy<Regex> =
12697 Lazy::new(|| Regex::new(r";+\s*inherits\s*:?\s*([a-z_,()]+)\s*").unwrap());
helix-term/Cargo.toml−1
@@ -15,7 +15,6 @@ build = true
1515app = true
1616
1717[features]
18−embed_runtime = ["helix-core/embed_runtime"]
1918
2019[[bin]]
2120name = "hx"