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: ignore proc-macro crates in rap #71

Merged
merged 3 commits into from
Nov 12, 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
1 change: 1 addition & 0 deletions rap/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion rap/src/bin/cargo-rap/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,12 @@ pub fn is_current_compile_crate() -> bool {

/// Returns true for crate types to be checked;
/// returns false for some special crate types that can't be handled by rap.
/// For example, skip build.rs which causes linking errors in rap.
/// For example, checking proc-macro crates or build.rs can cause linking errors in rap.
pub fn filter_crate_type() -> bool {
if let Some(s) = get_arg_flag_value("--crate-type") {
if s == "proc-macro" {
return false;
}
if s == "bin" && get_arg_flag_value("--crate-name") == Some("build_script_build") {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use rap::utils::log::rap_error_and_exit;
use std::{process::Command, time::Duration};
use wait_timeout::ChildExt;

pub fn run_cargo_check() {
pub fn run() {
let [rap_args, cargo_args] = crate::args::rap_and_cargo_args();
rap_debug!("rap_args={rap_args:?}\tcargo_args={cargo_args:?}");

Expand Down
5 changes: 2 additions & 3 deletions rap/src/bin/cargo-rap/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ mod help;
mod utils;
use crate::utils::*;

mod target;
use target::*;
mod cargo_check;

fn phase_cargo_rap() {
rap_info!("Start cargo-rap");
Expand All @@ -37,7 +36,7 @@ fn phase_cargo_rap() {
_ => {}
}

run_cargo_check();
cargo_check::run();
}

fn phase_rustc_wrapper() {
Expand Down