Skip to content

Commit

Permalink
Merge pull request #316 from viperproject/improve-skip-deps
Browse files Browse the repository at this point in the history
Use CARGO_PRIMARY_PACKAGE to skip dependencies
  • Loading branch information
fpoli authored Dec 14, 2020
2 parents bb97608 + e5a4477 commit 7348843
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 48 deletions.
2 changes: 2 additions & 0 deletions prusti-tests/tests/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ fn run_verification_core_proof(group_name: &str, filter: &Option<String>) {
}

fn test_runner(_tests: &[&()]) {
env::set_var("PRUSTI_TESTS", "1");

// Spawn server process as child (so it stays around until main function terminates)
let server_address = ServerSideService::spawn_off_thread();
env::set_var("PRUSTI_SERVER_ADDRESS", server_address.to_string());
Expand Down
45 changes: 0 additions & 45 deletions prusti/src/arg_value.rs

This file was deleted.

7 changes: 4 additions & 3 deletions prusti/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ extern crate prusti_common;

mod callbacks;
mod verifier;
mod arg_value;

use log::debug;
use std::{env, panic, borrow::Cow, path::PathBuf};
Expand All @@ -40,7 +39,6 @@ use lazy_static::lazy_static;
use callbacks::PrustiCompilerCalls;
use rustc_middle::ty::TyCtxt;
use prusti_common::config;
use arg_value::arg_value;

/// Link to report Prusti bugs
const BUG_REPORT_URL: &str = "https://github.com/viperproject/prusti-dev/issues/new";
Expand Down Expand Up @@ -125,8 +123,11 @@ fn main() {

// If the environment asks us to actually be rustc, then do that.
// If cargo is compiling a dependency, then be rustc.
let is_prusti_test = env::var("PRUSTI_TESTS").is_ok();
let is_cargo_running = env::var("CARGO_PKG_NAME").is_ok();
let in_primary_package = env::var("CARGO_PRIMARY_PACKAGE").is_ok();
let prusti_be_rustc = config::be_rustc()
|| arg_value(&rustc_args, "--cap-lints", |val| val == "allow").is_some();
|| (!is_prusti_test && is_cargo_running && !in_primary_package);
if prusti_be_rustc {
rustc_driver::main();
}
Expand Down

0 comments on commit 7348843

Please sign in to comment.