Skip to content

Commit

Permalink
Auto merge of #16412 - lnicola:sync-from-rust, r=lnicola
Browse files Browse the repository at this point in the history
internal: Sync from downstream
  • Loading branch information
bors committed Jan 21, 2024
2 parents 47b0f46 + 5607714 commit d410d4a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions crates/proc-macro-srv/proc-macro-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,26 @@ fn main() {
panic!("proc-macro-test-impl failed to build");
}

// Old Package ID Spec
let repr = format!("{name} {version}");
// New Package Id Spec since rust-lang/cargo#13311
let pkgid = String::from_utf8(
Command::new(toolchain::cargo())
.current_dir(&staging_dir)
.args(["pkgid", name])
.output()
.unwrap()
.stdout,
)
.unwrap();
let pkgid = pkgid.trim();

let mut artifact_path = None;
for message in Message::parse_stream(output.stdout.as_slice()) {
if let Message::CompilerArtifact(artifact) = message.unwrap() {
if artifact.target.kind.contains(&"proc-macro".to_string()) {
let repr = format!("{name} {version}");
if artifact.package_id.repr.starts_with(&repr) {
if artifact.package_id.repr.starts_with(&repr) || artifact.package_id.repr == pkgid
{
artifact_path = Some(PathBuf::from(&artifact.filenames[0]));
}
}
Expand Down

0 comments on commit d410d4a

Please sign in to comment.