Skip to content
Closed
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
14 changes: 13 additions & 1 deletion compiler/crates/relay-compiler/src/artifact_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

use std::fmt;
use std::path::PathBuf;

use dashmap::DashMap;
Expand All @@ -20,11 +21,22 @@ use crate::build_project::Artifact;
use crate::build_project::ArtifactContent;

/// Record that contains path to the artifact, persisted_operation_id (when available)
#[derive(Serialize, Deserialize, Debug, Clone)]
#[derive(Serialize, Deserialize, Clone)]
pub struct ArtifactRecord {
pub path: PathBuf,
pub persisted_operation_id: Option<String>,
}

impl fmt::Debug for ArtifactRecord {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// Normalize path separators to forward slashes for cross-platform consistency
let normalized_path = self.path.to_string_lossy().replace('\\', "/");
f.debug_struct("ArtifactRecord")
.field("path", &normalized_path)
.field("persisted_operation_id", &self.persisted_operation_id)
.finish()
}
}
/// A map from DefinitionName to output artifacts records
#[derive(Default, Serialize, Deserialize, Debug, Clone)]
pub struct ArtifactMap(pub DashMap<ArtifactSourceKey, Vec<ArtifactRecord>>);
Expand Down
4 changes: 3 additions & 1 deletion compiler/crates/relay-compiler/src/compiler_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,9 @@ impl fmt::Debug for ProjectArtifactMap {
sorted_records.sort_by_key(|record| &record.path);

for record in sorted_records {
output.push_str(&format!(" Path: {}\n", record.path.display()));
// Normalize path separators to forward slashes for cross-platform consistency
let normalized_path = record.path.to_string_lossy().replace('\\', "/");
output.push_str(&format!(" Path: {}\n", normalized_path));
if let Some(persisted_id) = &record.persisted_operation_id {
output.push_str(&format!(" Persisted ID: {}\n", persisted_id));
}
Expand Down
Loading