Skip to content

Commit

Permalink
Fix dangling resolver artifact
Browse files Browse the repository at this point in the history
Reviewed By: gordyf

Differential Revision: D64219255

fbshipit-source-id: bb6fb60e0ff840f67b25a5fe56a459b185225ac0
  • Loading branch information
tyao1 authored and facebook-github-bot committed Oct 11, 2024
1 parent cc1c66f commit f166d6b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
26 changes: 23 additions & 3 deletions compiler/crates/relay-compiler/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use crate::build_project::BuildProjectFailure;
use crate::compiler_state::ArtifactMapKind;
use crate::compiler_state::CompilerState;
use crate::compiler_state::DocblockSources;
use crate::compiler_state::FullSources;
use crate::config::Config;
use crate::errors::Error;
use crate::errors::Result;
Expand Down Expand Up @@ -378,6 +379,9 @@ async fn build_projects<TPerfLogger: PerfLogger + 'static>(
get_removed_docblock_artifact_source_keys(compiler_state.docblocks.get(&project_name));

removed_artifact_sources.extend(removed_docblock_artifact_sources);
removed_artifact_sources.extend(get_removed_full_sources(
compiler_state.full_sources.get(&project_name),
));

let dirty_artifact_paths = compiler_state
.dirty_artifact_paths
Expand Down Expand Up @@ -480,9 +484,25 @@ fn get_removed_docblock_artifact_source_keys(
}
}
}
}

removed_docblocks
}

removed_docblocks
} else {
vec![]
/// Get the list of removed full sources.
fn get_removed_full_sources(full_sources: Option<&FullSources>) -> Vec<ArtifactSourceKey> {
let mut removed_full_sources: Vec<ArtifactSourceKey> = vec![];
if let Some(full_sources) = full_sources {
for (file, source) in full_sources.pending.iter() {
if source.is_empty() {
if let Some(text) = full_sources.processed.get(file) {
// For now, full sources are only used for ResolverHash
removed_full_sources.push(ArtifactSourceKey::ResolverHash(
ResolverSourceHash::new(text),
))
}
}
}
}
removed_full_sources
}
4 changes: 4 additions & 0 deletions compiler/crates/relay-compiler/src/compiler_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,10 @@ impl CompilerState {
.docblocks
.get(&project_name)
.map_or(false, |sources| !sources.pending.is_empty())
|| self
.full_sources
.get(&project_name)
.map_or(false, |sources| !sources.pending.is_empty())
}

pub fn has_processed_changes(&self) -> bool {
Expand Down

0 comments on commit f166d6b

Please sign in to comment.