Skip to content

Commit a1f3599

Browse files
authored
fix: build for docs.rs (#11)
1 parent 3a31665 commit a1f3599

File tree

4 files changed

+6
-1274
lines changed

4 files changed

+6
-1274
lines changed

build.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
use std::process::Command;
1+
use std::{env, path::PathBuf, process::Command};
22

33
use prost_build::Config;
44

55
fn main() {
66
println!("cargo:rerun-if-changed=build.rs");
77

88
println!("cargo:rerun-if-changed=ext/sass/sass-embedded.proto");
9+
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
910
Config::new()
10-
.out_dir("src/protocol")
11+
.out_dir(&out_dir)
1112
.compile_protos(&["ext/sass/sass-embedded.proto"], &["."])
1213
.unwrap();
1314

14-
println!("cargo:rerun-if-changed=.rustfmt.toml");
15+
println!("cargo:rerun-if-changed=rustfmt.toml");
1516
Command::new("rustfmt")
16-
.arg("./src/protocol/sass.embedded_protocol.rs")
17+
.arg(out_dir.join("sass.embedded_protocol.rs"))
1718
.spawn()
1819
.unwrap();
1920
}
File renamed without changes.

src/protocol.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#[path = "./protocol/sass.embedded_protocol.rs"]
2-
mod sass_embedded_protocol;
3-
4-
pub use sass_embedded_protocol::*;
1+
include!(concat!(env!("OUT_DIR"), "/sass.embedded_protocol.rs"));

0 commit comments

Comments
 (0)