Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix pest_derive without std under a workspace in Windows #1034

Merged
merged 5 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions bootstrap/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ fn main() {
env!("CARGO_MANIFEST_DIR"),
"/../meta/src/grammar.pest"
));

// workaround for Windows
// TODO: use `normpath` or a different workaround on Windows?
let pest_ref = pest.to_string_lossy();
let normalized_path = pest_ref
.strip_prefix(r#"\\?\"#)
.unwrap_or_else(|| &pest_ref);
let pest = Path::new(&normalized_path);

// Path on which we should write generated grammar file.
// In case `not-bootstrap-in-src` is:
// * OFF -> in `grammar.rs` next to `grammar.pest`
Expand Down
2 changes: 1 addition & 1 deletion meta/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ once_cell = "1.8.0"

[build-dependencies]
sha2 = { version = "0.10", default-features = false }
cargo = { version = "0.72.2", optional = true }
cargo = { version = "0.81.0", optional = true }

[features]
default = []
Expand Down
7 changes: 3 additions & 4 deletions meta/build.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#[cfg(feature = "not-bootstrap-in-src")]
use cargo::{
core::{resolver::CliFeatures, Workspace},
ops,
ops::{CompileOptions, Packages},
ops::{self, CompileOptions, Packages},
util::command_prelude::CompileMode,
Config,
GlobalContext,
};
use sha2::{Digest, Sha256};
use std::env;
Expand Down Expand Up @@ -82,7 +81,7 @@ fn main() {

#[cfg(feature = "not-bootstrap-in-src")]
{
let config = Config::default().expect("cargo config");
let config = GlobalContext::default().expect("cargo config");
let workspace_manifest = manifest_dir
.join("../Cargo.toml")
.canonicalize()
Expand Down
Loading