Batch draft transcripts and reuse verified source versions

This commit is contained in:
gloamxun committed 2026-11-29 01:11:42 +08:00
1 parent 373204a8d8
commit c6b5c9ed56
4 files changed
+108 -47

No files matched your search

+30 -24
View File
@@ -33,7 +33,7 @@ pub use texrra_tex_core::resources::{WorldFailure, WorldObservation};
use texrra_tex_core::{
execution::{
Cancellation, ExecutionFailure, Executor, FormatImage, InputProfile, JobTime, Limits,
NativeSession, RevisionError, RevisionExecution, RevisionFailure, RevisionJob, SourceFile,
NativeSession, Profile, RevisionError, RevisionExecution, RevisionFailure, RevisionJob, SourceFile,
SourceProvider, State, WriteDestination,
},
pdf_unicode::XdvGlyphNames,
@@ -783,23 +783,6 @@ fn prepare_checked(
data: loaded.data,
};
check(cancellation)?;
let state = if matches!(request.entry, Entry::Initex) {
State::initex()
} else {
State::default()
}
.with_job_time(request.time)
.with_input_profile(request.input_profile);
let state = if request.target == Target::Shipouts && !dump {
state.with_pdf_output()
} else {
state
};
let state = if request.etex {
state.with_etex()
} else {
state
};
let translation = request.translation_file.as_ref().map(|name| {
if request.input_profile != InputProfile::TeX8Bit {
return Err("a TCX file requires the TeX 8-bit profile".to_owned());
@@ -809,6 +792,11 @@ fn prepare_checked(
.map_err(|e| format!("TCX {}: {e}", loaded.version.path.display()))
}).transpose()?;
let (executor, format_preparation) = if let Entry::Format(name) = &request.entry {
let profile = if request.etex {
Profile::EtexBootstrap
} else {
Profile::Bootstrap
};
let loaded =
world.read_shared(ResourceKind::Tex, &name.display().to_string(), &path)?;
check(cancellation)?;
@@ -864,7 +852,7 @@ fn prepare_checked(
let image = &cached.image;
let executor = if kernel == KernelPreparation::Resume {
image.validate_shared_job_inputs(
state.profile(),
profile,
request.input_profile,
&mut world,
read,
@@ -873,7 +861,7 @@ fn prepare_checked(
None
} else {
Some(image.fork_job_with_file_dates(
state.profile(),
profile,
request.input_profile,
request.time,
request.limits,
@@ -894,7 +882,7 @@ fn prepare_checked(
image.bind_inputs(&bindings);
let executor = if kernel == KernelPreparation::Resume {
image.validate_shared_job_inputs(
state.profile(),
profile,
request.input_profile,
&mut world,
read,
@@ -903,7 +891,7 @@ fn prepare_checked(
None
} else {
Some(image.new_job_with_file_dates(
state.profile(),
profile,
request.input_profile,
request.time,
request.limits,
@@ -916,8 +904,26 @@ fn prepare_checked(
}
}
} else {
let executor =
(kernel == KernelPreparation::Fresh).then(|| Executor::new(state, request.limits));
let executor = (kernel == KernelPreparation::Fresh).then(|| {
let state = if matches!(request.entry, Entry::Initex) {
State::initex()
} else {
State::default()
}
.with_job_time(request.time)
.with_input_profile(request.input_profile);
let state = if request.target == Target::Shipouts && !dump {
state.with_pdf_output()
} else {
state
};
let state = if request.etex {
state.with_etex()
} else {
state
};
Executor::new(state, request.limits)
});
(executor, None)
};
let executor = match (executor, translation) {