From 05b3a4bc93cf6555857bfc68b5e85830a0da80dc Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Wed, 9 Jun 2021 17:16:52 +0200 Subject: Build test-macros in a build script --- crates/proc_macro_srv/src/tests/utils.rs | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) (limited to 'crates/proc_macro_srv/src/tests') diff --git a/crates/proc_macro_srv/src/tests/utils.rs b/crates/proc_macro_srv/src/tests/utils.rs index 2e950c113..2c093aa0a 100644 --- a/crates/proc_macro_srv/src/tests/utils.rs +++ b/crates/proc_macro_srv/src/tests/utils.rs @@ -7,35 +7,8 @@ use proc_macro_api::ListMacrosTask; use std::str::FromStr; pub mod fixtures { - use cargo_metadata::Message; - use std::path::PathBuf; - use std::process::Command; - - // Use current project metadata to get the proc-macro dylib path pub fn proc_macro_test_dylib_path() -> std::path::PathBuf { - let name = "proc_macro_test"; - let version = "0.0.0"; - let command = Command::new(toolchain::cargo()) - .args(&["check", "--tests", "--message-format", "json"]) - .output() - .unwrap() - .stdout; - - for message in Message::parse_stream(command.as_slice()) { - match message.unwrap() { - Message::CompilerArtifact(artifact) => { - if artifact.target.kind.contains(&"proc-macro".to_string()) { - let repr = format!("{} {}", name, version); - if artifact.package_id.repr.starts_with(&repr) { - return PathBuf::from(&artifact.filenames[0]); - } - } - } - _ => (), // Unknown message - } - } - - panic!("No proc-macro dylib for {} found!", name); + proc_macro_test::PROC_MACRO_TEST_LOCATION.into() } } -- cgit v1.2.3