Skip to content

Commit 536deee

Browse files
committed
Fix compilation error with package managers
This commit will fix the compilation errors appearing when trying to build wiki-tui for a package manager. The underlying error is with the hard-coded path to the languages.json in the proc-macro, which gets interpreted in multiple ways depending on how wiki-tui is compiled (for example, `cargo publish` works, but building through nixpkgs doesn't). It fixes the issue by removing the path dependency completely and instead passing the entire json file as a string literal to the proc-macro Signed-off-by: Builditluc <git@builditluc.eu>
1 parent 48bb060 commit 536deee

File tree

7 files changed

+8109
-8112
lines changed

7 files changed

+8109
-8112
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ members = ["wiki-api", "wiki-api-macros"]
33

44
[package]
55
name = "wiki-tui"
6-
version = "0.9.0"
6+
version = "0.9.1"
77
authors = ["builditluc <37375448+Builditluc@users.noreply.github.com>"]
88
edition = "2018"
99
rust-version = "1.76.0"
@@ -42,4 +42,4 @@ bitflags = { version = "2.6.0", features = ["serde"] }
4242

4343
[dependencies.wiki-api]
4444
path = "wiki-api"
45-
version = "0.1.0"
45+
version = "0.1.1"

wiki-api-macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "wiki-api-macros"
3-
version = "0.1.0"
3+
version = "0.1.2"
44
authors = ["builditluc <37375448+Builditluc@users.noreply.github.com>"]
55
edition = "2018"
66
description = "Proc-macros for use within wiki-api"

wiki-api-macros/src/lib.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
use std::{
2-
collections::{BTreeMap, HashMap},
3-
fs::File,
4-
io::BufReader,
5-
};
1+
use std::collections::{BTreeMap, HashMap};
62

73
use proc_macro::TokenStream;
84
use proc_macro2::Span;
@@ -40,9 +36,7 @@ struct SiteMatrixWrapper {
4036
#[proc_macro]
4137
pub fn parse_languages(input: TokenStream) -> TokenStream {
4238
let input = parse_macro_input!(input as LitStr).value();
43-
let file = File::open(input).unwrap();
44-
let reader = BufReader::new(file);
45-
let sitematrix: SiteMatrixWrapper = serde_json::from_reader(reader).unwrap();
39+
let sitematrix: SiteMatrixWrapper = serde_json::from_str(&input).unwrap();
4640
let languages =
4741
sitematrix
4842
.site_matrix

wiki-api/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "wiki-api"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
authors = ["builditluc <37375448+Builditluc@users.noreply.github.com>"]
55
edition = "2018"
66
description = "Backend for wiki-tui"
@@ -30,4 +30,4 @@ urlencoding = "2.1.3"
3030

3131
[dependencies.wiki-api-macros]
3232
path = "../wiki-api-macros"
33-
version = "0.1.0"
33+
version = "0.1.2"

0 commit comments

Comments
 (0)