Reject precompile generations changed in flight
This commit is contained in:
+23
-2
@@ -1727,15 +1727,36 @@ int precompile_unit_generation()
|
||||
if(total.assigned != files.size())
|
||||
worker_error = true;
|
||||
}
|
||||
auto final_files = compiler_scan_site_units(&background_context);
|
||||
bool source_generation_changed = final_files != files;
|
||||
if(!source_generation_changed)
|
||||
{
|
||||
for(auto& file_name : final_files)
|
||||
{
|
||||
bool source_missing = false;
|
||||
if(compiler_unit_needs_recompile(&background_context, file_name, &source_missing, false, true, true) || source_missing)
|
||||
{
|
||||
source_generation_changed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(source_generation_changed)
|
||||
{
|
||||
compiler_set_known_units(&background_context, final_files);
|
||||
compiler_mark_source_generation(&background_context);
|
||||
printf("(!) source generation changed during precompile; candidate generation rejected\n");
|
||||
}
|
||||
if(worker_error)
|
||||
printf("(!) precompile worker or result reporting failed; candidate generation rejected\n");
|
||||
bool candidate_rejected = worker_error || source_generation_changed;
|
||||
printf("Precompiled unit generation %s with %llu job%s: %zu units, %llu compiled, %llu failed, worker status %s in %.3f s\n",
|
||||
compiler_unit_bin_directory(&background_context).c_str(),
|
||||
(unsigned long long)jobs, jobs == 1 ? "" : "s", files.size(),
|
||||
(unsigned long long)total.compiled, (unsigned long long)total.failed,
|
||||
worker_error ? "failed" : "ok",
|
||||
candidate_rejected ? "failed" : "ok",
|
||||
time_precise() - started_at);
|
||||
return(total.failed == 0 && !worker_error ? 0 : 1);
|
||||
return(total.failed == 0 && !candidate_rejected ? 0 : 1);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
|
||||
Reference in New Issue
Block a user