Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Introduce bundle serve command. #1195

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Next Next commit
IoProvider: expose paths of cached files
This is used to implement the "bundle serve" command that benefits from
sharing path to cached files.
  • Loading branch information
let-def committed May 24, 2024
commit 9cd8325b67b7c5d2aafa28fc8d813aa10149ad57
4 changes: 4 additions & 0 deletions crates/bundles/src/cache.rs
Original file line number Diff line number Diff line change
@@ -658,6 +658,10 @@ impl<CB: CacheBackend> IoProvider for CachingBundle<CB> {
InputOrigin::Other,
))
}

fn input_path(&mut self, name: &str, status: &mut dyn StatusBackend) -> OpenResult<PathBuf> {
self.ensure_file_availability(name, status)
}
}

impl<CB: CacheBackend> Bundle for CachingBundle<CB> {
9 changes: 9 additions & 0 deletions crates/io_base/src/lib.rs
Original file line number Diff line number Diff line change
@@ -485,6 +485,15 @@ pub trait IoProvider: AsIoProviderMut {
}
}

/// Return the path of an input file if it happens to be stored on the file system.
///
/// A minimal implementation can always return [`OpenResult::NotAvailable`].
/// If a file is on the file system, it is preferred by the "bundle serve" command to return a
/// local path rather than dumping the contents.
fn input_path(&mut self, _name: &str, _status: &mut dyn StatusBackend) -> OpenResult<PathBuf> {
OpenResult::NotAvailable
}

/// Open the "primary" input file, which in the context of TeX is the main
/// input that it's given. When the build is being done using the
/// filesystem and the input is a file on the filesystem, this function